From 9f40d91d513ac96ba4ab7758083b0fef57b640aa Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Mon, 15 Jul 2024 18:01:06 +0200 Subject: [PATCH] Revert "Add BeaconBlocksByRange v3" This reverts commit e3ce7fc5eae558da117b41ca7abbd6e03f4e420d. --- beacon_node/network/src/sync/block_lookups/mod.rs | 2 +- beacon_node/network/src/sync/range_sync/chain.rs | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/beacon_node/network/src/sync/block_lookups/mod.rs b/beacon_node/network/src/sync/block_lookups/mod.rs index 43bae1f960..0a44cf2fdf 100644 --- a/beacon_node/network/src/sync/block_lookups/mod.rs +++ b/beacon_node/network/src/sync/block_lookups/mod.rs @@ -53,7 +53,7 @@ mod tests; /// The maximum depth we will search for a parent block. In principle we should have sync'd any /// canonical chain to its head once the peer connects. A chain should not appear where it's depth /// is further back than the most recent head slot. -pub(crate) const PARENT_DEPTH_TOLERANCE: usize = SLOT_IMPORT_TOLERANCE + 1; +pub(crate) const PARENT_DEPTH_TOLERANCE: usize = SLOT_IMPORT_TOLERANCE * 2; const FAILED_CHAINS_CACHE_EXPIRY_SECONDS: u64 = 60; pub const SINGLE_BLOCK_LOOKUP_MAX_ATTEMPTS: u8 = 4; diff --git a/beacon_node/network/src/sync/range_sync/chain.rs b/beacon_node/network/src/sync/range_sync/chain.rs index 0e4058dddf..a735001fed 100644 --- a/beacon_node/network/src/sync/range_sync/chain.rs +++ b/beacon_node/network/src/sync/range_sync/chain.rs @@ -11,7 +11,6 @@ use rand::{seq::SliceRandom, Rng}; use slog::{crit, debug, o, warn}; use std::collections::{btree_map::Entry, BTreeMap, HashSet}; use std::hash::{Hash, Hasher}; -use std::time::Instant; use types::{Epoch, EthSpec, Hash256, Slot}; /// Blocks are downloaded in batches from peers. This constant specifies how many epochs worth of @@ -110,9 +109,6 @@ pub struct SyncingChain { pub enum ChainSyncingState { /// The chain is not being synced. Stopped, - /// The chain should not download any more batches, but should attempt to processing everything - /// that is already downloaded. - Stopping(Instant), /// The chain is undergoing syncing. Syncing, } @@ -870,11 +866,6 @@ impl SyncingChain { network: &mut SyncNetworkContext, batch_id: BatchId, ) -> ProcessingResult { - // If chain is stopping do not request any more batches. - if matches!(self.state, ChainSyncingState::Stopping) { - return Ok(KeepChain); - } - let Some(batch) = self.batches.get_mut(&batch_id) else { return Ok(KeepChain); }; @@ -981,7 +972,7 @@ impl SyncingChain { pub fn is_syncing(&self) -> bool { match self.state { ChainSyncingState::Syncing => true, - ChainSyncingState::Stopped | ChainSyncingState::Stopping { .. } => false, + ChainSyncingState::Stopped => false, } } @@ -1000,7 +991,6 @@ impl SyncingChain { /// Attempts to request the next required batches from the peer pool if the chain is syncing. It will exhaust the peer /// pool and left over batches until the batch buffer is reached or all peers are exhausted. fn request_batches(&mut self, network: &mut SyncNetworkContext) -> ProcessingResult { - // If chain is stopped or stopping do not request any more batches. if !matches!(self.state, ChainSyncingState::Syncing) { return Ok(KeepChain); }