diff --git a/crates/payload/basic/src/lib.rs b/crates/payload/basic/src/lib.rs index 5583d00a0..2feacb6c8 100644 --- a/crates/payload/basic/src/lib.rs +++ b/crates/payload/basic/src/lib.rs @@ -17,8 +17,8 @@ use reth_payload_builder::{ PayloadJobGenerator, }; use reth_primitives::{ - bloom::logs_bloom, bytes::Bytes, proofs, Block, ChainSpec, Hardfork, Head, Header, - IntoRecoveredTransaction, Receipt, SealedBlock, EMPTY_OMMER_ROOT, U256, + bloom::logs_bloom, bytes::Bytes, constants::SLOT_DURATION, proofs, Block, ChainSpec, Hardfork, + Head, Header, IntoRecoveredTransaction, Receipt, SealedBlock, EMPTY_OMMER_ROOT, U256, }; use reth_provider::{BlockProvider, EvmEnvProvider, PostState, StateProviderFactory}; use reth_revm::{ @@ -227,7 +227,7 @@ impl Default for BasicPayloadJobGeneratorConfig { Self { interval: Duration::from_secs(1), // 12s slot time - deadline: Duration::from_secs(12), + deadline: SLOT_DURATION, max_payload_tasks: 3, } } diff --git a/crates/primitives/src/constants.rs b/crates/primitives/src/constants.rs index 65d015f42..36547aba2 100644 --- a/crates/primitives/src/constants.rs +++ b/crates/primitives/src/constants.rs @@ -2,10 +2,20 @@ use crate::{H256, U256}; use hex_literal::hex; +use std::time::Duration; /// The first four bytes of the call data for a function call specifies the function to be called. pub const SELECTOR_LEN: usize = 4; +/// The duration of a slot in seconds. +/// +/// This is the time period of 12 seconds in which a randomly chosen validator has time to propose a +/// block. +pub const SLOT_DURATION: Duration = Duration::from_secs(12); + +/// An EPOCH is a series of 32 slots (~6.4min). +pub const EPOCH_DURATION: Duration = Duration::from_secs(12 * 32); + /// The minimal value the basefee can decrease to. /// /// The `BASE_FEE_MAX_CHANGE_DENOMINATOR` is `8`, or 12.5%.