mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 22:34:45 +00:00
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:
@@ -58,6 +58,8 @@ GLOAS_FORK_EPOCH: 18446744073709551615
|
||||
# ---------------------------------------------------------------
|
||||
# 5 seconds
|
||||
SECONDS_PER_SLOT: 5
|
||||
# 5 seconds
|
||||
SLOT_DURATION_MS: 5000
|
||||
# 6 (estimate from xDai mainnet)
|
||||
SECONDS_PER_ETH1_BLOCK: 6
|
||||
# 2**8 (= 256) epochs ~5.7 hours
|
||||
@@ -66,6 +68,18 @@ MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
|
||||
SHARD_COMMITTEE_PERIOD: 256
|
||||
# 2**10 (= 1024) ~1.4 hour
|
||||
ETH1_FOLLOW_DISTANCE: 1024
|
||||
# 1667 basis points, ~17% of SLOT_DURATION_MS
|
||||
PROPOSER_REORG_CUTOFF_BPS: 1667
|
||||
# 3333 basis points, ~33% of SLOT_DURATION_MS
|
||||
ATTESTATION_DUE_BPS: 3333
|
||||
# 6667 basis points, ~67% of SLOT_DURATION_MS
|
||||
AGGREGATE_DUE_BPS: 6667
|
||||
|
||||
# Altair
|
||||
# 3333 basis points, ~33% of SLOT_DURATION_MS
|
||||
SYNC_MESSAGE_DUE_BPS: 3333
|
||||
# 6667 basis points, ~67% of SLOT_DURATION_MS
|
||||
CONTRIBUTION_DUE_BPS: 6667
|
||||
|
||||
# Validator cycle
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
@@ -55,6 +55,8 @@ GLOAS_FORK_EPOCH: 18446744073709551615
|
||||
# ---------------------------------------------------------------
|
||||
# 5 seconds
|
||||
SECONDS_PER_SLOT: 5
|
||||
# 5 seconds
|
||||
SLOT_DURATION_MS: 5000
|
||||
# 6 (estimate from Gnosis Chain)
|
||||
SECONDS_PER_ETH1_BLOCK: 6
|
||||
# 2**8 (= 256) epochs ~8 hours
|
||||
@@ -63,6 +65,18 @@ MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
|
||||
SHARD_COMMITTEE_PERIOD: 256
|
||||
# 2**10 (= 1024) ~1.4 hour
|
||||
ETH1_FOLLOW_DISTANCE: 1024
|
||||
# 1667 basis points, ~17% of SLOT_DURATION_MS
|
||||
PROPOSER_REORG_CUTOFF_BPS: 1667
|
||||
# 3333 basis points, ~33% of SLOT_DURATION_MS
|
||||
ATTESTATION_DUE_BPS: 3333
|
||||
# 6667 basis points, ~67% of SLOT_DURATION_MS
|
||||
AGGREGATE_DUE_BPS: 6667
|
||||
|
||||
# Altair
|
||||
# 3333 basis points, ~33% of SLOT_DURATION_MS
|
||||
SYNC_MESSAGE_DUE_BPS: 3333
|
||||
# 6667 basis points, ~67% of SLOT_DURATION_MS
|
||||
CONTRIBUTION_DUE_BPS: 6667
|
||||
|
||||
# Validator cycle
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user