Skip to content

Commit

Permalink
Remove duplicate should_fetch_blobs check in sync lookup (#6318)
Browse files Browse the repository at this point in the history
* Remove duplicate should_fetch_blobs check in sync lookup
  • Loading branch information
dapplion authored Aug 30, 2024
1 parent 52f3b1f commit 100f33a
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions beacon_node/network/src/sync/network_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use rand::thread_rng;
use requests::ActiveDataColumnsByRootRequest;
pub use requests::LookupVerifyError;
use slog::{debug, error, warn};
use slot_clock::SlotClock;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::sync::Arc;
Expand Down Expand Up @@ -595,21 +594,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
block_root: Hash256,
downloaded_block: Option<Arc<SignedBeaconBlock<T::EthSpec>>>,
) -> Result<LookupRequestResult, RpcRequestSendError> {
// Check if we are into deneb, and before peerdas
if !self
.chain
.data_availability_checker
.blobs_required_for_epoch(
// TODO(das): use the block's slot
self.chain
.slot_clock
.now_or_genesis()
.ok_or(RpcRequestSendError::SlotClockError)?
.epoch(T::EthSpec::slots_per_epoch()),
)
{
return Ok(LookupRequestResult::NoRequestNeeded);
}
let Some(block) = downloaded_block.or_else(|| {
// If the block is already being processed or fully validated, retrieve how many blobs
// it expects. Consider any stage of the block. If the block root has been validated, we
Expand Down Expand Up @@ -637,7 +621,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
let expected_blobs = block.num_expected_blobs();
let block_epoch = block.slot().epoch(T::EthSpec::slots_per_epoch());

// Check if we are into peerdas
// Check if we are in deneb, before peerdas and inside da window
if !self.chain.should_fetch_blobs(block_epoch) {
return Ok(LookupRequestResult::NoRequestNeeded);
}
Expand Down Expand Up @@ -750,7 +734,7 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
let expected_blobs = block.num_expected_blobs();
let block_epoch = block.slot().epoch(T::EthSpec::slots_per_epoch());

// Check if we are into peerdas
// Check if we are into peerdas and inside da window
if !self.chain.should_fetch_custody_columns(block_epoch) {
return Ok(LookupRequestResult::NoRequestNeeded);
}
Expand Down

0 comments on commit 100f33a

Please sign in to comment.