Skip to content

Commit

Permalink
primitive-traits: use alloy _DURATION constants (#11960)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Oct 23, 2024
1 parent b7167a9 commit 889a7e0
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 24 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 4 additions & 11 deletions crates/node/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"] }
3 changes: 2 additions & 1 deletion crates/node/core/src/args/payload_builder.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions crates/payload/basic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 2 additions & 2 deletions crates/payload/basic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
10 changes: 0 additions & 10 deletions crates/primitives-traits/src/constants/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit 889a7e0

Please sign in to comment.