From 92e7e288e749da6cf23a4596efd76e309af42ee2 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Fri, 25 Feb 2022 17:15:39 +0100 Subject: [PATCH] Ignore seen aggregates (#3439) https://github.com/ethereum/consensus-specs/pull/2225 removed an ignore rule that would filter out duplicate aggregates from gossip publishing - however, this causes increased bandwidth and CPU usage as discussed in https://github.com/ethereum/consensus-specs/issues/2183 - the intent is to revert the removal and reinstate the rule. This PR implements ignore filtering which cuts down on CPU usage (fewer aggregates to validate) and bandwidth usage (less fanout of duplicates) - as #2225 points out, this may lead to a small increase in IHAVE messages. --- .../attestation_pool.nim | 32 +++++++++++++++---- .../gossip_processing/gossip_validation.nim | 24 ++++++++++++-- tests/test_attestation_pool.nim | 4 +++ 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/beacon_chain/consensus_object_pools/attestation_pool.nim b/beacon_chain/consensus_object_pools/attestation_pool.nim index 6a995da4d..711ae9279 100644 --- a/beacon_chain/consensus_object_pools/attestation_pool.nim +++ b/beacon_chain/consensus_object_pools/attestation_pool.nim @@ -280,6 +280,12 @@ func updateAggregates(entry: var AttestationEntry) = inc j inc i +func covers(entry: AttestationEntry, bits: CommitteeValidatorsBits): bool = + for i in 0..