Skip to content

Commit a4fcf60

Browse files
authored
Increase attestation cache sizes (#5135)
* increase observed attesters and aggregates cache sizes * fix comment
1 parent 64efdaf commit a4fcf60

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

beacon_node/beacon_chain/src/observed_aggregates.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl<T: EthSpec> Consts for Attestation<T> {
4343

4444
/// We need to keep attestations for each slot of the current epoch.
4545
fn max_slot_capacity() -> usize {
46-
T::slots_per_epoch() as usize
46+
2 * T::slots_per_epoch() as usize
4747
}
4848

4949
/// As a DoS protection measure, the maximum number of distinct `Attestations` or

beacon_node/beacon_chain/src/observed_attesters.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@ use types::{Epoch, EthSpec, Hash256, Slot, Unsigned};
2424

2525
/// The maximum capacity of the `AutoPruningEpochContainer`.
2626
///
27-
/// Fits the next, current and previous epochs. We require the next epoch due to the
28-
/// `MAXIMUM_GOSSIP_CLOCK_DISPARITY`. We require the previous epoch since the specification
29-
/// declares:
27+
/// If the current epoch is N, this fits epoch N + 1, N, N - 1, and N - 2. We require the next epoch due
28+
/// to the `MAXIMUM_GOSSIP_CLOCK_DISPARITY`. We require the N - 2 epoch since the specification declares:
3029
///
3130
/// ```ignore
32-
/// aggregate.data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE
33-
/// >= current_slot >= aggregate.data.slot
31+
/// the epoch of `aggregate.data.slot` is either the current or previous epoch
3432
/// ```
3533
///
36-
/// This means that during the current epoch we will always accept an attestation
37-
/// from at least one slot in the previous epoch.
38-
pub const MAX_CACHED_EPOCHS: u64 = 3;
34+
/// This means that during the current epoch we will always accept an attestation from
35+
/// at least one slot in the epoch prior to the previous epoch.
36+
pub const MAX_CACHED_EPOCHS: u64 = 4;
3937

4038
pub type ObservedAttesters<E> = AutoPruningEpochContainer<EpochBitfield, E>;
4139
pub type ObservedSyncContributors<E> =

0 commit comments

Comments
 (0)