From a6da87066b7681cf75691f9f4b4eacd8655082ac Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 1 Feb 2022 01:04:22 +0000 Subject: [PATCH] Add strict penalties const bool (#2976) ## Issue Addressed NA ## Proposed Changes Adds `STRICT_LATE_MESSAGE_PENALTIES: bool` which allows for toggling penalties for late sync/attn messages. `STRICT_LATE_MESSAGE_PENALTIES` is set to `false`, since we're seeing a lot of late messages on the network which are causing peer drops. We can toggle the bool during testing to try and figure out what/who is the cause of these late messages. In effect, this PR *relaxes* peer downscoring for late attns and sync committee messages. ## Additional Info - ~~Blocked on #2974~~ --- .../network/src/beacon_processor/worker/gossip_methods.rs | 8 ++++++-- 1 file changed, 6 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 132bed1b7..d6549db9f 100644 --- a/beacon_node/network/src/beacon_processor/worker/gossip_methods.rs +++ b/beacon_node/network/src/beacon_processor/worker/gossip_methods.rs @@ -30,6 +30,10 @@ use super::{ }; use crate::beacon_processor::DuplicateCache; +/// Set to `true` to introduce stricter penalties for peers who send some types of late consensus +/// messages. +const STRICT_LATE_MESSAGE_PENALTIES: bool = false; + /// An attestation that has been validated by the `BeaconChain`. /// /// Since this struct implements `beacon_chain::VerifiedAttestation`, it would be a logic error to @@ -1311,7 +1315,7 @@ impl Worker { // Only penalize the peer if it would have been invalid at the moment we received // it. - if hindsight_verification.is_err() { + if STRICT_LATE_MESSAGE_PENALTIES && hindsight_verification.is_err() { self.gossip_penalize_peer( peer_id, PeerAction::LowToleranceError, @@ -1832,7 +1836,7 @@ impl Worker { }; // Penalize the peer if the message was more than one slot late - if excessively_late && invalid_in_hindsight() { + if STRICT_LATE_MESSAGE_PENALTIES && excessively_late && invalid_in_hindsight() { self.gossip_penalize_peer( peer_id, PeerAction::HighToleranceError,