alloy_eips/
merge.rs

1//! Constants related to the beacon chain consensus.
2
3use core::time::Duration;
4
5/// An EPOCH is a series of 32 slots.
6pub const EPOCH_SLOTS: u64 = 32;
7
8/// The duration of a slot in seconds.
9///
10/// This is the time period of 12 seconds in which a randomly chosen validator has time to propose a
11/// block.
12pub const SLOT_DURATION_SECS: u64 = 12;
13
14/// An EPOCH is a series of 32 slots (~6.4min).
15pub const EPOCH_DURATION_SECS: u64 = EPOCH_SLOTS * SLOT_DURATION_SECS;
16
17/// The duration of a slot in seconds.
18///
19/// This is the time period of 12 seconds in which a randomly chosen validator has time to propose a
20/// block.
21pub const SLOT_DURATION: Duration = Duration::from_secs(SLOT_DURATION_SECS);
22
23/// An EPOCH is a series of 32 slots (~6.4min).
24pub const EPOCH_DURATION: Duration = Duration::from_secs(EPOCH_DURATION_SECS);
25
26/// The default block nonce in the beacon consensus
27pub const BEACON_NONCE: u64 = 0u64;
28
29/// Max seconds from current time allowed for blocks, before they're considered future blocks.
30///
31/// This is only used when checking whether or not the timestamp for pre-merge blocks is in the
32/// future.
33///
34/// See:
35/// <https://github.com/ethereum/go-ethereum/blob/a196f3e8a22b6ad22ced5c2e3baf32bc3ebd4ec9/consensus/ethash/consensus.go#L227-L229>
36pub const ALLOWED_FUTURE_BLOCK_TIME_SECONDS: u64 = 15;