mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-30 19:34:37 +00:00
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:
@@ -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()));
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user