mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-25 21:17:17 +00:00
Fix penalties in sync methods (#3384)
## Issue Addressed N/A ## Proposed Changes Uses the `penalize_peer` function added in #3350 in sync methods as well. The existing code in sync methods missed the `ExecutionPayloadError::UnverifiedNonOptimisticCandidate` case.
This commit is contained in:
parent
034260bd99
commit
b3ce8d0de9
@ -7,10 +7,10 @@ use crate::beacon_processor::DuplicateCache;
|
|||||||
use crate::metrics;
|
use crate::metrics;
|
||||||
use crate::sync::manager::{BlockProcessType, SyncMessage};
|
use crate::sync::manager::{BlockProcessType, SyncMessage};
|
||||||
use crate::sync::{BatchProcessResult, ChainId};
|
use crate::sync::{BatchProcessResult, ChainId};
|
||||||
|
use beacon_chain::CountUnrealized;
|
||||||
use beacon_chain::{
|
use beacon_chain::{
|
||||||
BeaconChainError, BeaconChainTypes, BlockError, ChainSegmentResult, HistoricalBlockError,
|
BeaconChainError, BeaconChainTypes, BlockError, ChainSegmentResult, HistoricalBlockError,
|
||||||
};
|
};
|
||||||
use beacon_chain::{CountUnrealized, ExecutionPayloadError};
|
|
||||||
use lighthouse_network::PeerAction;
|
use lighthouse_network::PeerAction;
|
||||||
use slog::{debug, error, info, warn};
|
use slog::{debug, error, info, warn};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -467,24 +467,22 @@ impl<T: BeaconChainTypes> Worker<T> {
|
|||||||
mode: FailureMode::ConsensusLayer,
|
mode: FailureMode::ConsensusLayer,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
BlockError::ExecutionPayloadError(e) => match &e {
|
ref err @ BlockError::ExecutionPayloadError(ref epe) => {
|
||||||
ExecutionPayloadError::NoExecutionConnection { .. }
|
if !epe.penalize_peer() {
|
||||||
| ExecutionPayloadError::RequestFailed { .. } => {
|
|
||||||
// These errors indicate an issue with the EL and not the `ChainSegment`.
|
// These errors indicate an issue with the EL and not the `ChainSegment`.
|
||||||
// Pause the syncing while the EL recovers
|
// Pause the syncing while the EL recovers
|
||||||
debug!(self.log,
|
debug!(self.log,
|
||||||
"Execution layer verification failed";
|
"Execution layer verification failed";
|
||||||
"outcome" => "pausing sync",
|
"outcome" => "pausing sync",
|
||||||
"err" => ?e
|
"err" => ?err
|
||||||
);
|
);
|
||||||
Err(ChainSegmentFailed {
|
Err(ChainSegmentFailed {
|
||||||
message: format!("Execution layer offline. Reason: {:?}", e),
|
message: format!("Execution layer offline. Reason: {:?}", err),
|
||||||
// Do not penalize peers for internal errors.
|
// Do not penalize peers for internal errors.
|
||||||
peer_action: None,
|
peer_action: None,
|
||||||
mode: FailureMode::ExecutionLayer { pause_sync: true },
|
mode: FailureMode::ExecutionLayer { pause_sync: true },
|
||||||
})
|
})
|
||||||
}
|
} else {
|
||||||
err => {
|
|
||||||
debug!(self.log,
|
debug!(self.log,
|
||||||
"Invalid execution payload";
|
"Invalid execution payload";
|
||||||
"error" => ?err
|
"error" => ?err
|
||||||
@ -498,7 +496,7 @@ impl<T: BeaconChainTypes> Worker<T> {
|
|||||||
mode: FailureMode::ExecutionLayer { pause_sync: false },
|
mode: FailureMode::ExecutionLayer { pause_sync: false },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
other => {
|
other => {
|
||||||
debug!(
|
debug!(
|
||||||
self.log, "Invalid block received";
|
self.log, "Invalid block received";
|
||||||
|
Loading…
Reference in New Issue
Block a user