Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions beacon_node/network/src/sync/backfill_sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

use crate::network_beacon_processor::ChainSegmentProcessId;
use crate::sync::manager::BatchProcessResult;
use crate::sync::network_context::RangeRequestId;
use crate::sync::network_context::SyncNetworkContext;
use crate::sync::network_context::{RangeRequestId, RpcResponseError, SyncNetworkContext};
use crate::sync::range_sync::{
BatchConfig, BatchId, BatchInfo, BatchOperationOutcome, BatchProcessingResult, BatchState,
};
Expand Down Expand Up @@ -375,6 +374,7 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
batch_id: BatchId,
peer_id: &PeerId,
request_id: Id,
err: RpcResponseError,
) -> Result<(), BackFillError> {
if let Some(batch) = self.batches.get_mut(&batch_id) {
// A batch could be retried without the peer failing the request (disconnecting/
Expand All @@ -385,7 +385,7 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
if !batch.is_expecting_block(&request_id) {
return Ok(());
}
debug!(batch_epoch = %batch_id, error = "rpc_error", "Batch failed");
debug!(batch_epoch = %batch_id, error = ?err, "Batch download failed");
if let Some(active_requests) = self.active_requests.get_mut(peer_id) {
active_requests.remove(&batch_id);
}
Expand Down
22 changes: 14 additions & 8 deletions beacon_node/network/src/sync/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,24 +1288,30 @@ impl<T: BeaconChainTypes> SyncManager<T> {
}
}
}
Err(_) => match range_request_id.requester {
Err(e) => match range_request_id.requester {
RangeRequestId::RangeSync { chain_id, batch_id } => {
self.range_sync.inject_error(
&mut self.network,
peer_id,
batch_id,
chain_id,
range_request_id.id,
e,
);
self.update_sync_state();
}
RangeRequestId::BackfillSync { batch_id } => match self
.backfill_sync
.inject_error(&mut self.network, batch_id, &peer_id, range_request_id.id)
{
Ok(_) => {}
Err(_) => self.update_sync_state(),
},
RangeRequestId::BackfillSync { batch_id } => {
match self.backfill_sync.inject_error(
&mut self.network,
batch_id,
&peer_id,
range_request_id.id,
e,
) {
Ok(_) => {}
Err(_) => self.update_sync_state(),
}
}
},
}
}
Expand Down
6 changes: 4 additions & 2 deletions beacon_node/network/src/sync/range_sync/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use super::batch::{BatchInfo, BatchProcessingResult, BatchState};
use super::RangeSyncType;
use crate::metrics;
use crate::network_beacon_processor::ChainSegmentProcessId;
use crate::sync::network_context::RangeRequestId;
use crate::sync::network_context::{RangeRequestId, RpcResponseError};
use crate::sync::{network_context::SyncNetworkContext, BatchOperationOutcome, BatchProcessResult};
use beacon_chain::block_verification_types::RpcBlock;
use beacon_chain::BeaconChainTypes;
Expand Down Expand Up @@ -879,6 +879,7 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
batch_id: BatchId,
peer_id: &PeerId,
request_id: Id,
err: RpcResponseError,
) -> ProcessingResult {
let batch_state = self.visualize_batch_state();
if let Some(batch) = self.batches.get_mut(&batch_id) {
Expand All @@ -901,9 +902,10 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
debug!(
batch_epoch = %batch_id,
batch_state = ?batch.state(),
error = ?err,
%peer_id,
%request_id,
"Batch failed. RPC Error"
"Batch download error"
);
if let Some(active_requests) = self.peers.get_mut(peer_id) {
active_requests.remove(&batch_id);
Expand Down
5 changes: 3 additions & 2 deletions beacon_node/network/src/sync/range_sync/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use super::chain_collection::{ChainCollection, SyncChainStatus};
use super::sync_type::RangeSyncType;
use crate::metrics;
use crate::status::ToStatusMessage;
use crate::sync::network_context::SyncNetworkContext;
use crate::sync::network_context::{RpcResponseError, SyncNetworkContext};
use crate::sync::BatchProcessResult;
use beacon_chain::block_verification_types::RpcBlock;
use beacon_chain::{BeaconChain, BeaconChainTypes};
Expand Down Expand Up @@ -348,10 +348,11 @@ where
batch_id: BatchId,
chain_id: ChainId,
request_id: Id,
err: RpcResponseError,
) {
// check that this request is pending
match self.chains.call_by_id(chain_id, |chain| {
chain.inject_error(network, batch_id, &peer_id, request_id)
chain.inject_error(network, batch_id, &peer_id, request_id, err)
}) {
Ok((removed_chain, sync_type)) => {
if let Some((removed_chain, remove_reason)) = removed_chain {
Expand Down