Range sync: fetch data columns via custody-by-root (#9496)

- Generalize the custody-by-root request to accept a `Vec<Hash256>` of block roots so a whole batch is fetched in one request; `DataColumnsByRootRequestParams { block_roots, indices }` completes at `block_roots.len() * indices.len()`.
- `custody_lookup_request` takes `block_roots: &[Hash256]` + `block_epoch`; `cached_data_column_indexes` takes `block_epoch`.
- `block_sidecar_coupling.rs`: couple a batch's blocks with the columns returned by the single custody-by-root request; drop the per-column request map and retry/faulty-peer machinery.
- Remove the now-unused columns-by-range range-sync path and the serialize-downloads gate.


Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
This commit is contained in:
Lion - dapplion
2026-06-25 17:51:12 +02:00
committed by GitHub
parent 8c2a909061
commit 812913643b
18 changed files with 635 additions and 1416 deletions

View File

@@ -1203,13 +1203,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
pub fn cached_data_column_indexes(
&self,
block_root: &Hash256,
slot: Slot,
block_epoch: Epoch,
) -> Option<Vec<ColumnIndex>> {
if self
.spec
.fork_name_at_slot::<T::EthSpec>(slot)
.gloas_enabled()
{
if self.spec.fork_name_at_epoch(block_epoch).gloas_enabled() {
self.pending_payload_cache
.cached_data_column_indexes(block_root)
} else {
@@ -3494,7 +3490,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
return;
};
let imported_data_columns = self
.cached_data_column_indexes(block_root, slot)
.cached_data_column_indexes(block_root, slot.epoch(T::EthSpec::slots_per_epoch()))
.unwrap_or_default();
let new_data_columns =
data_columns_iter.filter(|b| !imported_data_columns.contains(b.index()));

View File

@@ -10,7 +10,7 @@ use mockall::automock;
use std::collections::HashSet;
use std::sync::Arc;
use task_executor::TaskExecutor;
use types::{ChainSpec, ColumnIndex, Hash256, Slot};
use types::{ChainSpec, ColumnIndex, EthSpec, Hash256, Slot};
/// An adapter to the `BeaconChain` functionalities to remove `BeaconChain` from direct dependency to enable testing fetch blobs logic.
pub(crate) struct FetchBlobsBeaconAdapter<T: BeaconChainTypes> {
@@ -92,7 +92,8 @@ impl<T: BeaconChainTypes> FetchBlobsBeaconAdapter<T> {
block_root: &Hash256,
slot: Slot,
) -> Option<Vec<u64>> {
self.chain.cached_data_column_indexes(block_root, slot)
self.chain
.cached_data_column_indexes(block_root, slot.epoch(T::EthSpec::slots_per_epoch()))
}
pub(crate) async fn process_engine_blobs(