primitive-traits: use alloy _DURATION constants (#11960)

This commit is contained in:
Thomas Coratger
2024-10-23 16:31:22 +02:00
committed by GitHub
parent b7167a9ddc
commit 889a7e0b98
6 changed files with 11 additions and 24 deletions

2
Cargo.lock generated
View File

@ -6370,6 +6370,7 @@ name = "reth-basic-payload-builder"
version = "1.1.0"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-primitives",
"alloy-rlp",
"futures-core",
@ -7911,6 +7912,7 @@ name = "reth-node-core"
version = "1.1.0"
dependencies = [
"alloy-consensus",
"alloy-eips",
"alloy-primitives",
"alloy-rpc-types-engine",
"clap",

View File

@ -40,6 +40,7 @@ reth-stages-types.workspace = true
alloy-primitives.workspace = true
alloy-rpc-types-engine = { workspace = true, features = ["jwt"] }
alloy-consensus.workspace = true
alloy-eips.workspace = true
# misc
eyre.workspace = true
@ -76,18 +77,10 @@ proptest.workspace = true
tokio.workspace = true
[features]
optimism = [
"reth-primitives/optimism",
"reth-db/optimism"
]
optimism = ["reth-primitives/optimism", "reth-db/optimism"]
# Features for vergen to generate correct env vars
jemalloc = [
"reth-cli-util/jemalloc"
]
asm-keccak = [
"reth-primitives/asm-keccak",
"alloy-primitives/asm-keccak"
]
jemalloc = ["reth-cli-util/jemalloc"]
asm-keccak = ["reth-primitives/asm-keccak", "alloy-primitives/asm-keccak"]
[build-dependencies]
vergen = { version = "8.0.0", features = ["build", "cargo", "git", "gitcl"] }

View File

@ -1,11 +1,12 @@
use crate::{cli::config::PayloadBuilderConfig, version::default_extradata};
use alloy_consensus::constants::MAXIMUM_EXTRA_DATA_SIZE;
use alloy_eips::merge::SLOT_DURATION;
use clap::{
builder::{RangedU64ValueParser, TypedValueParser},
Arg, Args, Command,
};
use reth_cli_util::{parse_duration_from_secs, parse_duration_from_secs_or_ms};
use reth_primitives::constants::{ETHEREUM_BLOCK_GAS_LIMIT, SLOT_DURATION};
use reth_primitives::constants::ETHEREUM_BLOCK_GAS_LIMIT;
use std::{borrow::Cow, ffi::OsStr, time::Duration};
/// Parameters for configuring the Payload Builder

View File

@ -27,6 +27,7 @@ alloy-rlp.workspace = true
alloy-primitives.workspace = true
revm.workspace = true
alloy-consensus.workspace = true
alloy-eips.workspace = true
# async
tokio = { workspace = true, features = ["sync", "time"] }

View File

@ -10,6 +10,7 @@
use crate::metrics::PayloadBuilderMetrics;
use alloy_consensus::constants::EMPTY_WITHDRAWALS;
use alloy_eips::merge::SLOT_DURATION;
use alloy_primitives::{Bytes, B256, U256};
use futures_core::ready;
use futures_util::FutureExt;
@ -22,8 +23,7 @@ use reth_payload_primitives::{
BuiltPayload, PayloadBuilderAttributes, PayloadBuilderError, PayloadKind,
};
use reth_primitives::{
constants::{RETH_CLIENT_VERSION, SLOT_DURATION},
proofs, BlockNumberOrTag, SealedBlock, Withdrawals,
constants::RETH_CLIENT_VERSION, proofs, BlockNumberOrTag, SealedBlock, Withdrawals,
};
use reth_provider::{
BlockReaderIdExt, BlockSource, CanonStateNotification, ProviderError, StateProviderFactory,

View File

@ -1,7 +1,6 @@
//! Ethereum protocol-related constants
use alloy_primitives::{address, b256, Address, B256, U256};
use core::time::Duration;
/// Gas units, for example [`GIGAGAS`].
pub mod gas_units;
@ -13,15 +12,6 @@ pub const RETH_CLIENT_VERSION: &str = concat!("reth/v", env!("CARGO_PKG_VERSION"
/// An EPOCH is a series of 32 slots.
pub const EPOCH_SLOTS: u64 = 32;
/// 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 * EPOCH_SLOTS);
/// The default block nonce in the beacon consensus
pub const BEACON_NONCE: u64 = 0u64;