From f0aaf655533cf838cb3470de0be9936ef500815e Mon Sep 17 00:00:00 2001 From: Lion - dapplion <35266934+dapplion@users.noreply.github.com> Date: Mon, 1 Jun 2026 08:17:00 +0200 Subject: [PATCH] Use correct slot in custody request (#9380) Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com> --- .../network/src/sync/block_lookups/common.rs | 2 +- .../sync/block_lookups/single_block_lookup.rs | 6 +++-- .../network/src/sync/network_context.rs | 22 +++---------------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/beacon_node/network/src/sync/block_lookups/common.rs b/beacon_node/network/src/sync/block_lookups/common.rs index edd99345b4..bf11f0b658 100644 --- a/beacon_node/network/src/sync/block_lookups/common.rs +++ b/beacon_node/network/src/sync/block_lookups/common.rs @@ -172,7 +172,7 @@ impl RequestState for CustodyRequestState { _: usize, cx: &mut SyncNetworkContext, ) -> Result { - cx.custody_lookup_request(id, self.block_root, lookup_peers) + cx.custody_lookup_request(id, self.block_root, self.slot, lookup_peers) .map_err(LookupRequestError::SendFailedNetwork) } diff --git a/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs b/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs index d54480e8e5..536a8c5cb0 100644 --- a/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs +++ b/beacon_node/network/src/sync/block_lookups/single_block_lookup.rs @@ -239,7 +239,7 @@ impl SingleBlockLookup { ); } else if cx.chain.should_fetch_custody_columns(block_epoch) { self.component_requests = ComponentRequests::ActiveCustodyRequest( - CustodyRequestState::new(self.block_root), + CustodyRequestState::new(self.block_root, block.slot()), ); } else { self.component_requests = ComponentRequests::NotNeeded("outside da window"); @@ -397,13 +397,15 @@ impl BlobRequestState { pub struct CustodyRequestState { #[educe(Debug(ignore))] pub block_root: Hash256, + pub slot: Slot, pub state: SingleLookupRequestState>, } impl CustodyRequestState { - pub fn new(block_root: Hash256) -> Self { + pub fn new(block_root: Hash256, slot: Slot) -> Self { Self { block_root, + slot, state: SingleLookupRequestState::new(), } } diff --git a/beacon_node/network/src/sync/network_context.rs b/beacon_node/network/src/sync/network_context.rs index 9d5ac40c0a..3aaf4dbaa0 100644 --- a/beacon_node/network/src/sync/network_context.rs +++ b/beacon_node/network/src/sync/network_context.rs @@ -1174,34 +1174,18 @@ impl SyncNetworkContext { &mut self, lookup_id: SingleLookupId, block_root: Hash256, + block_slot: Slot, lookup_peers: Arc>>, ) -> Result { - let slot = self - .chain - .canonical_head - .fork_choice_read_lock() - .get_block(&block_root) - .map(|block| block.slot) - .or_else(|| self.chain.slot().ok()) - .ok_or_else(|| { - RpcRequestSendError::InternalError(format!( - "Unable to determine slot for block {block_root:?}" - )) - })?; - let custody_indexes_imported = self .chain - .cached_data_column_indexes(&block_root, slot) + .cached_data_column_indexes(&block_root, block_slot) .unwrap_or_default(); - let current_epoch = self.chain.epoch().map_err(|e| { - RpcRequestSendError::InternalError(format!("Unable to read slot clock {:?}", e)) - })?; - // Include only the blob indexes not yet imported (received through gossip) let mut custody_indexes_to_fetch = self .chain - .sampling_columns_for_epoch(current_epoch) + .sampling_columns_for_epoch(block_slot.epoch(T::EthSpec::slots_per_epoch())) .iter() .copied() .filter(|index| !custody_indexes_imported.contains(index))