mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-02 12:13:46 +00:00
Instrument tracing spans for block processing and import (#7816)
#7815 - removes all existing spans, so some span fields that appear in logs like `service_name` may be lost. - instruments a few key code paths in the beacon node, starting from **root spans** named below: * Gossip block and blobs * `process_gossip_data_column_sidecar` * `process_gossip_blob` * `process_gossip_block` * Rpc block and blobs * `process_rpc_block` * `process_rpc_blobs` * `process_rpc_custody_columns` * Rpc blocks (range and backfill) * `process_chain_segment` * `PendingComponents` lifecycle * `pending_components` To test locally: * Run Grafana and Tempo with https://github.com/sigp/lighthouse-metrics/pull/57 * Run Lighthouse BN with `--telemetry-collector-url http://localhost:4317` Some captured traces can be found here: https://hackmd.io/@jimmygchen/r1sLOxPPeg Removing the old spans seem to have reduced the memory usage quite a lot - i think we were using them on long running tasks and too excessively: <img width="910" height="495" alt="image" src="https://github.com/user-attachments/assets/5208bbe4-53b2-4ead-bc71-0b782c788669" />
This commit is contained in:
@@ -27,7 +27,7 @@ use std::collections::{
|
||||
HashSet,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use tracing::{debug, error, info, instrument, warn};
|
||||
use tracing::{debug, error, info, warn};
|
||||
use types::{Epoch, EthSpec};
|
||||
|
||||
/// Blocks are downloaded in batches from peers. This constant specifies how many epochs worth of
|
||||
@@ -147,10 +147,6 @@ pub struct BackFillSync<T: BeaconChainTypes> {
|
||||
}
|
||||
|
||||
impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
#[instrument(parent = None,
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn new(
|
||||
beacon_chain: Arc<BeaconChain<T>>,
|
||||
network_globals: Arc<NetworkGlobals<T::EthSpec>>,
|
||||
@@ -191,11 +187,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
}
|
||||
|
||||
/// Pauses the backfill sync if it's currently syncing.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn pause(&mut self) {
|
||||
if let BackFillState::Syncing = self.state() {
|
||||
debug!(processed_epochs = %self.validated_batches, to_be_processed = %self.current_start,"Backfill sync paused");
|
||||
@@ -207,11 +198,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
///
|
||||
/// If resuming is successful, reports back the current syncing metrics.
|
||||
#[must_use = "A failure here indicates the backfill sync has failed and the global sync state should be updated"]
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn start(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -287,11 +273,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
/// A fully synced peer has joined us.
|
||||
/// If we are in a failed state, update a local variable to indicate we are able to restart
|
||||
/// the failed sync on the next attempt.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn fully_synced_peer_joined(&mut self) {
|
||||
if matches!(self.state(), BackFillState::Failed) {
|
||||
self.restart_failed_sync = true;
|
||||
@@ -300,11 +281,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
|
||||
/// A peer has disconnected.
|
||||
/// If the peer has active batches, those are considered failed and re-requested.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
#[must_use = "A failure here indicates the backfill sync has failed and the global sync state should be updated"]
|
||||
pub fn peer_disconnected(&mut self, peer_id: &PeerId) -> Result<(), BackFillError> {
|
||||
if matches!(self.state(), BackFillState::Failed) {
|
||||
@@ -319,11 +295,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
/// An RPC error has occurred.
|
||||
///
|
||||
/// If the batch exists it is re-requested.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
#[must_use = "A failure here indicates the backfill sync has failed and the global sync state should be updated"]
|
||||
pub fn inject_error(
|
||||
&mut self,
|
||||
@@ -361,11 +332,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
/// If this returns an error, the backfill sync has failed and will be restarted once new peers
|
||||
/// join the system.
|
||||
/// The sync manager should update the global sync state on failure.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
#[must_use = "A failure here indicates the backfill sync has failed and the global sync state should be updated"]
|
||||
pub fn on_block_response(
|
||||
&mut self,
|
||||
@@ -417,11 +383,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
/// The syncing process has failed.
|
||||
///
|
||||
/// This resets past variables, to allow for a fresh start when resuming.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn fail_sync(&mut self, error: BackFillError) -> Result<(), BackFillError> {
|
||||
// Some errors shouldn't fail the chain.
|
||||
if matches!(error, BackFillError::Paused) {
|
||||
@@ -453,11 +414,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
|
||||
/// Processes the batch with the given id.
|
||||
/// The batch must exist and be ready for processing
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn process_batch(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -516,11 +472,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
/// The block processor has completed processing a batch. This function handles the result
|
||||
/// of the batch processor.
|
||||
/// If an error is returned the BackFill sync has failed.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
#[must_use = "A failure here indicates the backfill sync has failed and the global sync state should be updated"]
|
||||
pub fn on_batch_process_result(
|
||||
&mut self,
|
||||
@@ -673,11 +624,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
}
|
||||
|
||||
/// Processes the next ready batch.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn process_completed_batches(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -741,11 +687,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
///
|
||||
/// If a previous batch has been validated and it had been re-processed, penalize the original
|
||||
/// peer.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn advance_chain(&mut self, network: &mut SyncNetworkContext<T>, validating_epoch: Epoch) {
|
||||
// make sure this epoch produces an advancement
|
||||
if validating_epoch >= self.current_start {
|
||||
@@ -837,11 +778,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
/// These events occur when a peer has successfully responded with blocks, but the blocks we
|
||||
/// have received are incorrect or invalid. This indicates the peer has not performed as
|
||||
/// intended and can result in downvoting a peer.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn handle_invalid_batch(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -893,11 +829,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
}
|
||||
|
||||
/// Requests the batch assigned to the given id from a given peer.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn send_batch(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -969,11 +900,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
|
||||
/// When resuming a chain, this function searches for batches that need to be re-downloaded and
|
||||
/// transitions their state to redownload the batch.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn resume_batches(&mut self, network: &mut SyncNetworkContext<T>) -> Result<(), BackFillError> {
|
||||
let batch_ids_to_retry = self
|
||||
.batches
|
||||
@@ -998,11 +924,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
|
||||
/// 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.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn request_batches(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -1027,11 +948,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
|
||||
/// Creates the next required batch from the chain. If there are no more batches required,
|
||||
/// `false` is returned.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn include_next_batch(&mut self, network: &mut SyncNetworkContext<T>) -> Option<BatchId> {
|
||||
// don't request batches beyond genesis;
|
||||
if self.last_batch_downloaded {
|
||||
@@ -1093,11 +1009,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
///
|
||||
/// This errors if the beacon chain indicates that backfill sync has already completed or is
|
||||
/// not required.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn reset_start_epoch(&mut self) -> Result<(), ResetEpochError> {
|
||||
let anchor_info = self.beacon_chain.store.get_anchor_info();
|
||||
if anchor_info.block_backfill_complete(self.beacon_chain.genesis_backfill_slot) {
|
||||
@@ -1111,11 +1022,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
}
|
||||
|
||||
/// Checks with the beacon chain if backfill sync has completed.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn check_completed(&mut self) -> bool {
|
||||
if self.would_complete(self.current_start) {
|
||||
// Check that the beacon chain agrees
|
||||
@@ -1131,11 +1037,6 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
}
|
||||
|
||||
/// Checks if backfill would complete by syncing to `start_epoch`.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn would_complete(&self, start_epoch: Epoch) -> bool {
|
||||
start_epoch
|
||||
<= self
|
||||
@@ -1145,20 +1046,10 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
|
||||
}
|
||||
|
||||
/// Updates the global network state indicating the current state of a backfill sync.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn set_state(&self, state: BackFillState) {
|
||||
*self.network_globals.backfill_state.write() = state;
|
||||
}
|
||||
|
||||
#[instrument(parent = None,
|
||||
fields(service = "backfill_sync"),
|
||||
name = "backfill_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn state(&self) -> BackFillState {
|
||||
self.network_globals.backfill_state.read().clone()
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ use std::collections::hash_map::Entry;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use store::Hash256;
|
||||
use tracing::{debug, error, instrument, warn};
|
||||
use tracing::{debug, error, warn};
|
||||
use types::{BlobSidecar, DataColumnSidecar, EthSpec, SignedBeaconBlock};
|
||||
|
||||
pub mod common;
|
||||
@@ -127,7 +127,6 @@ use lighthouse_network::service::api_types::Id;
|
||||
pub(crate) type BlockLookupSummary = (Id, Hash256, Option<Hash256>, Vec<PeerId>);
|
||||
|
||||
impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
#[instrument(parent = None, fields(service = "lookup_sync"), name = "lookup_sync")]
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
failed_chains: LRUTimeCache::new(Duration::from_secs(
|
||||
@@ -138,31 +137,16 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub(crate) fn insert_failed_chain(&mut self, block_root: Hash256) {
|
||||
self.failed_chains.insert(block_root);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub(crate) fn get_failed_chains(&mut self) -> Vec<Hash256> {
|
||||
self.failed_chains.keys().cloned().collect()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub(crate) fn active_single_lookups(&self) -> Vec<BlockLookupSummary> {
|
||||
self.single_block_lookups
|
||||
.iter()
|
||||
@@ -171,11 +155,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
}
|
||||
|
||||
/// Returns a vec of all parent lookup chains by tip, in descending slot order (tip first)
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub(crate) fn active_parent_lookups(&self) -> Vec<NodeChain> {
|
||||
compute_parent_chains(
|
||||
&self
|
||||
@@ -192,11 +171,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
/// If a parent lookup exists or is triggered, a current lookup will be created.
|
||||
///
|
||||
/// Returns true if the lookup is created or already exists
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
#[must_use = "only reference the new lookup if returns true"]
|
||||
pub fn search_child_and_parent(
|
||||
&mut self,
|
||||
@@ -230,11 +204,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
/// Seach a block whose parent root is unknown.
|
||||
///
|
||||
/// Returns true if the lookup is created or already exists
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
#[must_use = "only reference the new lookup if returns true"]
|
||||
pub fn search_unknown_block(
|
||||
&mut self,
|
||||
@@ -251,11 +220,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
/// - `block_root_to_search` is a failed chain
|
||||
///
|
||||
/// Returns true if the lookup is created or already exists
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
#[must_use = "only reference the new lookup if returns true"]
|
||||
pub fn search_parent_of_child(
|
||||
&mut self,
|
||||
@@ -358,11 +322,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
/// Searches for a single block hash. If the blocks parent is unknown, a chain of blocks is
|
||||
/// constructed.
|
||||
/// Returns true if the lookup is created or already exists
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
#[must_use = "only reference the new lookup if returns true"]
|
||||
fn new_current_lookup(
|
||||
&mut self,
|
||||
@@ -466,11 +425,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
/* Lookup responses */
|
||||
|
||||
/// Process a block or blob response received from a single lookup request.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn on_download_response<R: RequestState<T>>(
|
||||
&mut self,
|
||||
id: SingleLookupReqId,
|
||||
@@ -556,11 +510,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
|
||||
/* Error responses */
|
||||
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn peer_disconnected(&mut self, peer_id: &PeerId) {
|
||||
for (_, lookup) in self.single_block_lookups.iter_mut() {
|
||||
lookup.remove_peer(peer_id);
|
||||
@@ -569,11 +518,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
|
||||
/* Processing responses */
|
||||
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn on_processing_result(
|
||||
&mut self,
|
||||
process_type: BlockProcessType,
|
||||
@@ -594,11 +538,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
self.on_lookup_result(process_type.id(), lookup_result, "processing_result", cx);
|
||||
}
|
||||
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn on_processing_result_inner<R: RequestState<T>>(
|
||||
&mut self,
|
||||
lookup_id: SingleLookupId,
|
||||
@@ -788,11 +727,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn on_external_processing_result(
|
||||
&mut self,
|
||||
block_root: Hash256,
|
||||
@@ -818,11 +752,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
}
|
||||
|
||||
/// Makes progress on the immediate children of `block_root`
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn continue_child_lookups(&mut self, block_root: Hash256, cx: &mut SyncNetworkContext<T>) {
|
||||
let mut lookup_results = vec![]; // < need to buffer lookup results to not re-borrow &mut self
|
||||
|
||||
@@ -848,11 +777,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
/// Drops `dropped_id` lookup and all its children recursively. Lookups awaiting a parent need
|
||||
/// the parent to make progress to resolve, therefore we must drop them if the parent is
|
||||
/// dropped.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn drop_lookup_and_children(&mut self, dropped_id: SingleLookupId) {
|
||||
if let Some(dropped_lookup) = self.single_block_lookups.remove(&dropped_id) {
|
||||
debug!(
|
||||
@@ -877,11 +801,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
|
||||
/// Common handler a lookup request error, drop it and update metrics
|
||||
/// Returns true if the lookup is created or already exists
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn on_lookup_result(
|
||||
&mut self,
|
||||
id: SingleLookupId,
|
||||
@@ -919,22 +838,12 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
/* Helper functions */
|
||||
|
||||
/// Drops all the single block requests and returns how many requests were dropped.
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn drop_single_block_requests(&mut self) -> usize {
|
||||
let requests_to_drop = self.single_block_lookups.len();
|
||||
self.single_block_lookups.clear();
|
||||
requests_to_drop
|
||||
}
|
||||
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn update_metrics(&self) {
|
||||
metrics::set_gauge(
|
||||
&metrics::SYNC_SINGLE_BLOCK_LOOKUPS,
|
||||
@@ -943,11 +852,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
}
|
||||
|
||||
/// Perform some prune operations on lookups on some interval
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn prune_lookups(&mut self) {
|
||||
self.drop_lookups_without_peers();
|
||||
self.drop_stuck_lookups();
|
||||
@@ -971,11 +875,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
///
|
||||
/// Instead there's no negative for keeping lookups with no peers around for some time. If we
|
||||
/// regularly prune them, it should not be a memory concern (TODO: maybe yes!).
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn drop_lookups_without_peers(&mut self) {
|
||||
for (lookup_id, block_root) in self
|
||||
.single_block_lookups
|
||||
@@ -1013,11 +912,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
///
|
||||
/// - One single clear warn level log per stuck incident
|
||||
/// - If the original bug is sporadic, it reduces the time a node is stuck from forever to 15 min
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn drop_stuck_lookups(&mut self) {
|
||||
// While loop to find and drop all disjoint trees of potentially stuck lookups.
|
||||
while let Some(stuck_lookup) = self.single_block_lookups.values().find(|lookup| {
|
||||
@@ -1055,11 +949,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
}
|
||||
|
||||
/// Recursively find the oldest ancestor lookup of another lookup
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn find_oldest_ancestor_lookup<'a>(
|
||||
&'a self,
|
||||
lookup: &'a SingleBlockLookup<T>,
|
||||
@@ -1084,11 +973,6 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
/// Adds peers to a lookup and its ancestors recursively.
|
||||
/// Note: Takes a `lookup_id` as argument to allow recursion on mutable lookups, without having
|
||||
/// to duplicate the code to add peers to a lookup
|
||||
#[instrument(parent = None,
|
||||
fields(service = "lookup_sync"),
|
||||
name = "lookup_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn add_peers_to_lookup_and_ancestors(
|
||||
&mut self,
|
||||
lookup_id: SingleLookupId,
|
||||
|
||||
@@ -68,7 +68,7 @@ use std::ops::Sub;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tokio::sync::mpsc;
|
||||
use tracing::{debug, error, info, info_span, trace, Instrument};
|
||||
use tracing::{debug, error, info, trace};
|
||||
use types::{
|
||||
BlobSidecar, DataColumnSidecar, EthSpec, ForkContext, Hash256, SignedBeaconBlock, Slot,
|
||||
};
|
||||
@@ -263,14 +263,7 @@ pub fn spawn<T: BeaconChainTypes>(
|
||||
|
||||
// spawn the sync manager thread
|
||||
debug!("Sync Manager started");
|
||||
executor.spawn(
|
||||
async move {
|
||||
Box::pin(sync_manager.main())
|
||||
.instrument(info_span!("", service = "sync"))
|
||||
.await
|
||||
},
|
||||
"sync",
|
||||
);
|
||||
executor.spawn(async move { Box::pin(sync_manager.main()).await }, "sync");
|
||||
}
|
||||
|
||||
impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
|
||||
@@ -45,7 +45,7 @@ use std::time::Duration;
|
||||
#[cfg(test)]
|
||||
use task_executor::TaskExecutor;
|
||||
use tokio::sync::mpsc;
|
||||
use tracing::{debug, error, span, warn, Level};
|
||||
use tracing::{debug, error, warn};
|
||||
use types::blob_sidecar::FixedBlobSidecarList;
|
||||
use types::{
|
||||
BlobSidecar, ColumnIndex, DataColumnSidecar, DataColumnSidecarList, EthSpec, ForkContext,
|
||||
@@ -267,12 +267,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
chain: Arc<BeaconChain<T>>,
|
||||
fork_context: Arc<ForkContext>,
|
||||
) -> Self {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
SyncNetworkContext {
|
||||
network_send,
|
||||
execution_engine_state: EngineState::Online, // always assume `Online` at the start
|
||||
@@ -374,13 +368,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
}
|
||||
|
||||
pub fn status_peers<C: ToStatusMessage>(&self, chain: &C, peers: impl Iterator<Item = PeerId>) {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
let status_message = chain.status_message();
|
||||
for peer_id in peers {
|
||||
debug!(
|
||||
@@ -776,13 +763,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
return Ok(LookupRequestResult::Pending("no peers"));
|
||||
};
|
||||
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
match self.chain.get_block_process_status(&block_root) {
|
||||
// Unknown block, continue request to download
|
||||
BlockProcessStatus::Unknown => {}
|
||||
@@ -882,13 +862,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
return Ok(LookupRequestResult::Pending("no peers"));
|
||||
};
|
||||
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
let imported_blob_indexes = self
|
||||
.chain
|
||||
.data_availability_checker
|
||||
@@ -953,13 +926,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
request: DataColumnsByRootSingleBlockRequest,
|
||||
expect_max_responses: bool,
|
||||
) -> Result<LookupRequestResult<DataColumnsByRootRequestId>, &'static str> {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
let id = DataColumnsByRootRequestId {
|
||||
id: self.next_id(),
|
||||
requester,
|
||||
@@ -1004,13 +970,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
block_root: Hash256,
|
||||
lookup_peers: Arc<RwLock<HashSet<PeerId>>>,
|
||||
) -> Result<LookupRequestResult, RpcRequestSendError> {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
let custody_indexes_imported = self
|
||||
.chain
|
||||
.data_availability_checker
|
||||
@@ -1212,26 +1171,12 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
}
|
||||
|
||||
pub fn update_execution_engine_state(&mut self, engine_state: EngineState) {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
debug!(past_state = ?self.execution_engine_state, new_state = ?engine_state, "Sync's view on execution engine state updated");
|
||||
self.execution_engine_state = engine_state;
|
||||
}
|
||||
|
||||
/// Terminates the connection with the peer and bans them.
|
||||
pub fn goodbye_peer(&mut self, peer_id: PeerId, reason: GoodbyeReason) {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
self.network_send
|
||||
.send(NetworkMessage::GoodbyePeer {
|
||||
peer_id,
|
||||
@@ -1245,13 +1190,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
|
||||
/// Reports to the scoring algorithm the behaviour of a peer.
|
||||
pub fn report_peer(&self, peer_id: PeerId, action: PeerAction, msg: &'static str) {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
debug!(%peer_id, %action, %msg, "Sync reporting peer");
|
||||
self.network_send
|
||||
.send(NetworkMessage::ReportPeer {
|
||||
@@ -1267,13 +1205,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
|
||||
/// Subscribes to core topics.
|
||||
pub fn subscribe_core_topics(&self) {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
self.network_send
|
||||
.send(NetworkMessage::SubscribeCoreTopics)
|
||||
.unwrap_or_else(|e| {
|
||||
@@ -1283,13 +1214,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
|
||||
/// Sends an arbitrary network message.
|
||||
fn send_network_msg(&self, msg: NetworkMessage<T::EthSpec>) -> Result<(), &'static str> {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
self.network_send.send(msg).map_err(|_| {
|
||||
debug!("Could not send message to the network service");
|
||||
"Network channel send Failed"
|
||||
@@ -1514,13 +1438,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
peer_id: PeerId,
|
||||
resp: RpcResponseResult<Vec<Arc<DataColumnSidecar<T::EthSpec>>>>,
|
||||
) -> Option<CustodyByRootResult<T::EthSpec>> {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
// Note: need to remove the request to borrow self again below. Otherwise we can't
|
||||
// do nested requests
|
||||
let Some(mut request) = self.custody_by_root_requests.remove(&id.requester) else {
|
||||
@@ -1540,13 +1457,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
request: ActiveCustodyRequest<T>,
|
||||
result: CustodyRequestResult<T::EthSpec>,
|
||||
) -> Option<CustodyByRootResult<T::EthSpec>> {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
let result = result
|
||||
.map_err(RpcResponseError::CustodyRequestError)
|
||||
.transpose();
|
||||
@@ -1574,13 +1484,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
block: Arc<SignedBeaconBlock<T::EthSpec>>,
|
||||
seen_timestamp: Duration,
|
||||
) -> Result<(), SendErrorProcessor> {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
let beacon_processor = self
|
||||
.beacon_processor_if_enabled()
|
||||
.ok_or(SendErrorProcessor::ProcessorNotAvailable)?;
|
||||
@@ -1613,13 +1516,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
blobs: FixedBlobSidecarList<T::EthSpec>,
|
||||
seen_timestamp: Duration,
|
||||
) -> Result<(), SendErrorProcessor> {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
let beacon_processor = self
|
||||
.beacon_processor_if_enabled()
|
||||
.ok_or(SendErrorProcessor::ProcessorNotAvailable)?;
|
||||
@@ -1651,13 +1547,6 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
seen_timestamp: Duration,
|
||||
process_type: BlockProcessType,
|
||||
) -> Result<(), SendErrorProcessor> {
|
||||
let span = span!(
|
||||
Level::INFO,
|
||||
"SyncNetworkContext",
|
||||
service = "network_context"
|
||||
);
|
||||
let _enter = span.enter();
|
||||
|
||||
let beacon_processor = self
|
||||
.beacon_processor_if_enabled()
|
||||
.ok_or(SendErrorProcessor::ProcessorNotAvailable)?;
|
||||
|
||||
@@ -12,7 +12,7 @@ use lighthouse_network::{PeerAction, PeerId};
|
||||
use logging::crit;
|
||||
use std::collections::{btree_map::Entry, BTreeMap, HashSet};
|
||||
use strum::IntoStaticStr;
|
||||
use tracing::{debug, instrument, warn};
|
||||
use tracing::{debug, warn};
|
||||
use types::{ColumnIndex, Epoch, EthSpec, Hash256, Slot};
|
||||
|
||||
/// Blocks are downloaded in batches from peers. This constant specifies how many epochs worth of
|
||||
@@ -205,7 +205,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
|
||||
/// A block has been received for a batch on this chain.
|
||||
/// If the block correctly completes the batch it will be processed if possible.
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
pub fn on_block_response(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -252,7 +251,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
|
||||
/// Processes the batch with the given id.
|
||||
/// The batch must exist and be ready for processing
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
fn process_batch(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -300,7 +298,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
}
|
||||
|
||||
/// Processes the next ready batch, prioritizing optimistic batches over the processing target.
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
fn process_completed_batches(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -410,7 +407,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
|
||||
/// The block processor has completed processing a batch. This function handles the result
|
||||
/// of the batch processor.
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
pub fn on_batch_process_result(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -565,7 +561,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
fn reject_optimistic_batch(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -600,7 +595,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
/// If a previous batch has been validated and it had been re-processed, penalize the original
|
||||
/// peer.
|
||||
#[allow(clippy::modulo_one)]
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
fn advance_chain(&mut self, network: &mut SyncNetworkContext<T>, validating_epoch: Epoch) {
|
||||
// make sure this epoch produces an advancement
|
||||
if validating_epoch <= self.start_epoch {
|
||||
@@ -704,7 +698,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
/// These events occur when a peer has successfully responded with blocks, but the blocks we
|
||||
/// have received are incorrect or invalid. This indicates the peer has not performed as
|
||||
/// intended and can result in downvoting a peer.
|
||||
#[instrument(parent = None, fields(service = self.id, network), skip_all)]
|
||||
fn handle_invalid_batch(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -764,7 +757,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
/// This chain has been requested to start syncing.
|
||||
///
|
||||
/// This could be new chain, or an old chain that is being resumed.
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
pub fn start_syncing(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -803,7 +795,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
/// Add a peer to the chain.
|
||||
///
|
||||
/// If the chain is active, this starts requesting batches from this peer.
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
pub fn add_peer(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -816,7 +807,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
/// An RPC error has occurred.
|
||||
///
|
||||
/// If the batch exists it is re-requested.
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
pub fn inject_error(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -900,7 +890,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
}
|
||||
|
||||
/// Requests the batch assigned to the given id from a given peer.
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
pub fn send_batch(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -979,7 +968,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
}
|
||||
|
||||
/// Retries partial column requests within the batch by creating new requests for the failed columns.
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
pub fn retry_partial_batch(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -1032,7 +1020,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
|
||||
/// Kickstarts the chain by sending for processing batches that are ready and requesting more
|
||||
/// batches if needed.
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
pub fn resume(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -1045,7 +1032,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
|
||||
/// 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.
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
fn request_batches(&mut self, network: &mut SyncNetworkContext<T>) -> ProcessingResult {
|
||||
if !matches!(self.state, ChainSyncingState::Syncing) {
|
||||
return Ok(KeepChain);
|
||||
@@ -1114,7 +1100,6 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
|
||||
|
||||
/// Creates the next required batch from the chain. If there are no more batches required,
|
||||
/// `false` is returned.
|
||||
#[instrument(parent = None, fields(chain = self.id , service = "range_sync"), skip_all)]
|
||||
fn include_next_batch(&mut self, network: &mut SyncNetworkContext<T>) -> Option<BatchId> {
|
||||
// don't request batches beyond the target head slot
|
||||
if self
|
||||
|
||||
@@ -55,7 +55,7 @@ use logging::crit;
|
||||
use lru_cache::LRUTimeCache;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use tracing::{debug, instrument, trace, warn};
|
||||
use tracing::{debug, trace, warn};
|
||||
use types::{Epoch, EthSpec, Hash256};
|
||||
|
||||
/// For how long we store failed finalized chains to prevent retries.
|
||||
@@ -81,11 +81,6 @@ impl<T: BeaconChainTypes> RangeSync<T>
|
||||
where
|
||||
T: BeaconChainTypes,
|
||||
{
|
||||
#[instrument(parent = None,
|
||||
fields(component = "range_sync"),
|
||||
name = "range_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn new(beacon_chain: Arc<BeaconChain<T>>) -> Self {
|
||||
RangeSync {
|
||||
beacon_chain: beacon_chain.clone(),
|
||||
@@ -102,11 +97,6 @@ where
|
||||
self.failed_chains.keys().copied().collect()
|
||||
}
|
||||
|
||||
#[instrument(parent = None,
|
||||
fields(component = "range_sync"),
|
||||
name = "range_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn state(&self) -> SyncChainStatus {
|
||||
self.chains.state()
|
||||
}
|
||||
@@ -116,11 +106,6 @@ where
|
||||
/// may need to be synced as a result. A new peer, may increase the peer pool of a finalized
|
||||
/// chain, this may result in a different finalized chain from syncing as finalized chains are
|
||||
/// prioritised by peer-pool size.
|
||||
#[instrument(parent = None,
|
||||
fields(component = "range_sync"),
|
||||
name = "range_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn add_peer(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -215,11 +200,6 @@ where
|
||||
///
|
||||
/// This function finds the chain that made this request. Once found, processes the result.
|
||||
/// This request could complete a chain or simply add to its progress.
|
||||
#[instrument(parent = None,
|
||||
fields(component = "range_sync"),
|
||||
name = "range_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn blocks_by_range_response(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -250,11 +230,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(parent = None,
|
||||
fields(component = "range_sync"),
|
||||
name = "range_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn handle_block_process_result(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -287,11 +262,6 @@ where
|
||||
|
||||
/// A peer has disconnected. This removes the peer from any ongoing chains and mappings. A
|
||||
/// disconnected peer could remove a chain
|
||||
#[instrument(parent = None,
|
||||
fields(component = "range_sync"),
|
||||
name = "range_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn peer_disconnect(&mut self, network: &mut SyncNetworkContext<T>, peer_id: &PeerId) {
|
||||
// if the peer is in the awaiting head mapping, remove it
|
||||
self.awaiting_head_peers.remove(peer_id);
|
||||
@@ -304,11 +274,6 @@ where
|
||||
/// which pool the peer is in. The chain may also have a batch or batches awaiting
|
||||
/// for this peer. If so we mark the batch as failed. The batch may then hit it's maximum
|
||||
/// retries. In this case, we need to remove the chain.
|
||||
#[instrument(parent = None,
|
||||
fields(component = "range_sync"),
|
||||
name = "range_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn remove_peer(&mut self, network: &mut SyncNetworkContext<T>, peer_id: &PeerId) {
|
||||
for (removed_chain, sync_type, remove_reason) in
|
||||
self.chains.call_all(|chain| chain.remove_peer(peer_id))
|
||||
@@ -327,11 +292,6 @@ where
|
||||
///
|
||||
/// Check to see if the request corresponds to a pending batch. If so, re-request it if possible, if there have
|
||||
/// been too many failed attempts for the batch, remove the chain.
|
||||
#[instrument(parent = None,
|
||||
fields(component = "range_sync"),
|
||||
name = "range_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn inject_error(
|
||||
&mut self,
|
||||
network: &mut SyncNetworkContext<T>,
|
||||
@@ -362,11 +322,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(parent = None,
|
||||
fields(component = "range_sync"),
|
||||
name = "range_sync",
|
||||
skip_all
|
||||
)]
|
||||
fn on_chain_removed(
|
||||
&mut self,
|
||||
chain: SyncingChain<T>,
|
||||
@@ -415,11 +370,6 @@ where
|
||||
}
|
||||
|
||||
/// Kickstarts sync.
|
||||
#[instrument(parent = None,
|
||||
fields(component = "range_sync"),
|
||||
name = "range_sync",
|
||||
skip_all
|
||||
)]
|
||||
pub fn resume(&mut self, network: &mut SyncNetworkContext<T>) {
|
||||
for (removed_chain, sync_type, remove_reason) in
|
||||
self.chains.call_all(|chain| chain.resume(network))
|
||||
|
||||
Reference in New Issue
Block a user