Increase attestation cache sizes (#5135)

* increase observed attesters and aggregates cache sizes

* fix comment
This commit is contained in:
realbigsean 2024-01-29 19:32:57 -05:00 committed by GitHub
parent 64efdaf39a
commit a4fcf60bcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 9 deletions

View File

@ -43,7 +43,7 @@ impl<T: EthSpec> Consts for Attestation<T> {
/// We need to keep attestations for each slot of the current epoch. /// We need to keep attestations for each slot of the current epoch.
fn max_slot_capacity() -> usize { fn max_slot_capacity() -> usize {
T::slots_per_epoch() as usize 2 * T::slots_per_epoch() as usize
} }
/// As a DoS protection measure, the maximum number of distinct `Attestations` or /// As a DoS protection measure, the maximum number of distinct `Attestations` or

View File

@ -24,18 +24,16 @@ use types::{Epoch, EthSpec, Hash256, Slot, Unsigned};
/// The maximum capacity of the `AutoPruningEpochContainer`. /// The maximum capacity of the `AutoPruningEpochContainer`.
/// ///
/// Fits the next, current and previous epochs. We require the next epoch due to the /// If the current epoch is N, this fits epoch N + 1, N, N - 1, and N - 2. We require the next epoch due
/// `MAXIMUM_GOSSIP_CLOCK_DISPARITY`. We require the previous epoch since the specification /// to the `MAXIMUM_GOSSIP_CLOCK_DISPARITY`. We require the N - 2 epoch since the specification declares:
/// declares:
/// ///
/// ```ignore /// ```ignore
/// aggregate.data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE /// the epoch of `aggregate.data.slot` is either the current or previous epoch
/// >= current_slot >= aggregate.data.slot
/// ``` /// ```
/// ///
/// This means that during the current epoch we will always accept an attestation /// This means that during the current epoch we will always accept an attestation from
/// from at least one slot in the previous epoch. /// at least one slot in the epoch prior to the previous epoch.
pub const MAX_CACHED_EPOCHS: u64 = 3; pub const MAX_CACHED_EPOCHS: u64 = 4;
pub type ObservedAttesters<E> = AutoPruningEpochContainer<EpochBitfield, E>; pub type ObservedAttesters<E> = AutoPruningEpochContainer<EpochBitfield, E>;
pub type ObservedSyncContributors<E> = pub type ObservedSyncContributors<E> =