mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-19 12:56:12 +00:00
Fix Gossip Penalties During Optimistic Sync Window (#3350)
## Issue Addressed * #3344 ## Proposed Changes There are a number of cases during block processing where we might get an `ExecutionPayloadError` but we shouldn't penalize peers. We were forgetting to enumerate all of the non-penalizing errors in every single match statement where we are making that decision. I created a function to make it explicit when we should and should not penalize peers and I used that function in all places where this logic is needed. This way we won't make the same mistake if we add another variant of `ExecutionPayloadError` in the future.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::time::Duration;
|
||||
|
||||
use beacon_chain::{BeaconChainTypes, BlockError, ExecutionPayloadError};
|
||||
use beacon_chain::{BeaconChainTypes, BlockError};
|
||||
use fnv::FnvHashMap;
|
||||
use lighthouse_network::{PeerAction, PeerId};
|
||||
use lru_cache::LRUTimeCache;
|
||||
@@ -435,17 +435,12 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
BlockError::ParentUnknown(block) => {
|
||||
self.search_parent(block, peer_id, cx);
|
||||
}
|
||||
e @ BlockError::ExecutionPayloadError(ExecutionPayloadError::RequestFailed(
|
||||
_,
|
||||
))
|
||||
| e @ BlockError::ExecutionPayloadError(
|
||||
ExecutionPayloadError::NoExecutionConnection,
|
||||
) => {
|
||||
ref e @ BlockError::ExecutionPayloadError(ref epe) if !epe.penalize_peer() => {
|
||||
// These errors indicate that the execution layer is offline
|
||||
// and failed to validate the execution payload. Do not downscore peer.
|
||||
debug!(
|
||||
self.log,
|
||||
"Single block lookup failed. Execution layer is offline";
|
||||
"Single block lookup failed. Execution layer is offline / unsynced / misconfigured";
|
||||
"root" => %root,
|
||||
"error" => ?e
|
||||
);
|
||||
@@ -549,12 +544,9 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
BlockProcessResult::Err(
|
||||
e @ BlockError::ExecutionPayloadError(ExecutionPayloadError::RequestFailed(_)),
|
||||
)
|
||||
| BlockProcessResult::Err(
|
||||
e @ BlockError::ExecutionPayloadError(ExecutionPayloadError::NoExecutionConnection),
|
||||
) => {
|
||||
ref e @ BlockProcessResult::Err(BlockError::ExecutionPayloadError(ref epe))
|
||||
if !epe.penalize_peer() =>
|
||||
{
|
||||
// These errors indicate that the execution layer is offline
|
||||
// and failed to validate the execution payload. Do not downscore peer.
|
||||
debug!(
|
||||
|
||||
Reference in New Issue
Block a user