From 5bab9b866ee8e959e511466cda0647319b94a1d9 Mon Sep 17 00:00:00 2001 From: Pawan Dhananjay Date: Tue, 3 Oct 2023 23:59:35 +0000 Subject: [PATCH] Don't downscore peers on duplicate blocks (#4791) ## Issue Addressed N/A ## Proposed Changes We were currently downscoring a peer for sending us a block that we already have in fork choice. This is unnecessary as we get duplicates in lighthouse only when 1. We published the block, so the block is already in fork choice 2. We imported the same block over rpc In both scenarios, the peer who sent us the block over gossip is not at fault. This isn't exploitable as valid duplicates will get dropped by the gossipsub duplicate filter --- .../src/network_beacon_processor/gossip_methods.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/beacon_node/network/src/network_beacon_processor/gossip_methods.rs b/beacon_node/network/src/network_beacon_processor/gossip_methods.rs index ac7479db01..323c612075 100644 --- a/beacon_node/network/src/network_beacon_processor/gossip_methods.rs +++ b/beacon_node/network/src/network_beacon_processor/gossip_methods.rs @@ -763,9 +763,17 @@ impl NetworkBeaconProcessor { self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Ignore); return None; } + Err(BlockError::BlockIsAlreadyKnown) => { + debug!( + self.log, + "Gossip block is already known"; + "block_root" => %block_root, + ); + self.propagate_validation_result(message_id, peer_id, MessageAcceptance::Ignore); + return None; + } Err(e @ BlockError::FutureSlot { .. }) | Err(e @ BlockError::WouldRevertFinalizedSlot { .. }) - | Err(e @ BlockError::BlockIsAlreadyKnown) | Err(e @ BlockError::NotFinalizedDescendant { .. }) => { debug!(self.log, "Could not verify block for gossip. Ignoring the block"; "error" => %e);