Replace INTERVALS_PER_SLOT with explicit slot component times (#7944)

https://github.com/ethereum/consensus-specs/pull/4476


  


Co-Authored-By: Barnabas Busa <barnabas.busa@ethereum.org>

Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>

Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
Eitan Seri-Levi
2026-02-01 21:58:42 -08:00
committed by GitHub
parent cd8049a696
commit 3ecf964385
56 changed files with 579 additions and 184 deletions

View File

@@ -9,7 +9,6 @@ pub use crate::manual_slot_clock::ManualSlotClock;
pub use crate::system_time_slot_clock::SystemTimeSlotClock;
pub use metrics::scrape_for_metrics;
pub use types::Slot;
use types::consts::bellatrix::INTERVALS_PER_SLOT;
/// A clock that reports the current slot.
///
@@ -77,30 +76,6 @@ pub trait SlotClock: Send + Sync + Sized + Clone {
.or_else(|| Some(self.genesis_slot()))
}
/// Returns the delay between the start of the slot and when unaggregated attestations should be
/// produced.
fn unagg_attestation_production_delay(&self) -> Duration {
self.slot_duration() / INTERVALS_PER_SLOT as u32
}
/// Returns the delay between the start of the slot and when sync committee messages should be
/// produced.
fn sync_committee_message_production_delay(&self) -> Duration {
self.slot_duration() / INTERVALS_PER_SLOT as u32
}
/// Returns the delay between the start of the slot and when aggregated attestations should be
/// produced.
fn agg_attestation_production_delay(&self) -> Duration {
self.slot_duration() * 2 / INTERVALS_PER_SLOT as u32
}
/// Returns the delay between the start of the slot and when partially aggregated `SyncCommitteeContribution` should be
/// produced.
fn sync_committee_contribution_production_delay(&self) -> Duration {
self.slot_duration() * 2 / INTERVALS_PER_SLOT as u32
}
/// Returns the `Duration` since the start of the current `Slot` at seconds precision. Useful in determining whether to apply proposer boosts.
fn seconds_from_current_slot_start(&self) -> Option<Duration> {
self.now_duration()
@@ -134,13 +109,4 @@ pub trait SlotClock: Send + Sync + Sized + Clone {
slot_clock.set_current_time(freeze_at);
slot_clock
}
/// Returns the delay between the start of the slot and when a request for block components
/// missed over gossip in the current slot should be made via RPC.
///
/// Currently set equal to 1/2 of the `unagg_attestation_production_delay`, but this may be
/// changed in the future.
fn single_lookup_delay(&self) -> Duration {
self.unagg_attestation_production_delay() / 2
}
}