From e2c0650d16d6d6de5c92f71cf4b1adf6f8d50027 Mon Sep 17 00:00:00 2001 From: Divma Date: Sun, 31 Oct 2021 22:30:19 +0000 Subject: [PATCH] Relax late sync committee penalty (#2752) ## Issue Addressed Getting too many peers kicked due to slightly late sync committee messages as tested on.. under-performant hardware. ## Proposed Changes Only penalize if the message is more than one slot late. Still ignore the message- Co-authored-by: Divma <26765164+divagant-martian@users.noreply.github.com> --- .../beacon_processor/worker/gossip_methods.rs | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/beacon_node/network/src/beacon_processor/worker/gossip_methods.rs b/beacon_node/network/src/beacon_processor/worker/gossip_methods.rs index fe6cb573a7..2e5ee5160b 100644 --- a/beacon_node/network/src/beacon_processor/worker/gossip_methods.rs +++ b/beacon_node/network/src/beacon_processor/worker/gossip_methods.rs @@ -1610,9 +1610,9 @@ impl Worker { metrics::register_sync_committee_error(&error); match &error { - SyncCommitteeError::FutureSlot { .. } | SyncCommitteeError::PastSlot { .. } => { + SyncCommitteeError::FutureSlot { .. } => { /* - * These errors can be triggered by a mismatch between our slot and the peer. + * This error can be triggered by a mismatch between our slot and the peer. * * * The peer has published an invalid consensus message, _only_ if we trust our own clock. @@ -1631,6 +1631,31 @@ impl Worker { // Do not propagate these messages. self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Ignore); } + SyncCommitteeError::PastSlot { + message_slot, + earliest_permissible_slot, + } => { + /* + * This error can be triggered by a mismatch between our slot and the peer. + * + * + * The peer has published an invalid consensus message, _only_ if we trust our own clock. + */ + trace!( + self.log, + "Sync committee message is not within the last MAXIMUM_GOSSIP_CLOCK_DISPARITY slots"; + "peer_id" => %peer_id, + "type" => ?message_type, + ); + + // We tolerate messages that were just one slot late. + if *message_slot + 1 < *earliest_permissible_slot { + self.gossip_penalize_peer(peer_id, PeerAction::HighToleranceError); + } + + // Do not propagate these messages. + self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Ignore); + } SyncCommitteeError::EmptyAggregationBitfield => { /* * The aggregate had no signatures and is therefore worthless.