diff --git a/crates/chainspec/src/constants/mod.rs b/crates/chainspec/src/constants.rs similarity index 87% rename from crates/chainspec/src/constants/mod.rs rename to crates/chainspec/src/constants.rs index cde927189c8b..7026e76ff438 100644 --- a/crates/chainspec/src/constants/mod.rs +++ b/crates/chainspec/src/constants.rs @@ -7,6 +7,3 @@ pub(crate) const MAINNET_DEPOSIT_CONTRACT: DepositContract = DepositContract::ne 11052984, b256!("649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5"), ); - -#[cfg(feature = "optimism")] -pub(crate) mod optimism; diff --git a/crates/chainspec/src/constants/optimism.rs b/crates/chainspec/src/constants/optimism.rs deleted file mode 100644 index 1c32df6f37ed..000000000000 --- a/crates/chainspec/src/constants/optimism.rs +++ /dev/null @@ -1,46 +0,0 @@ -use alloy_eips::eip1559::BaseFeeParams; -use reth_primitives_traits::constants::{ - BASE_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, - OP_MAINNET_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON, - OP_MAINNET_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, - OP_MAINNET_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, - OP_SEPOLIA_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON, - OP_SEPOLIA_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, - OP_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, -}; - -/// Get the base fee parameters for Base Sepolia. -pub(crate) const BASE_SEPOLIA_BASE_FEE_PARAMS: BaseFeeParams = BaseFeeParams { - max_change_denominator: OP_SEPOLIA_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, - elasticity_multiplier: BASE_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, -}; - -/// Get the base fee parameters for Base Sepolia (post Canyon). -pub(crate) const BASE_SEPOLIA_CANYON_BASE_FEE_PARAMS: BaseFeeParams = BaseFeeParams { - max_change_denominator: OP_SEPOLIA_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON, - elasticity_multiplier: BASE_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, -}; - -/// Get the base fee parameters for Optimism Sepolia. -pub(crate) const OP_SEPOLIA_BASE_FEE_PARAMS: BaseFeeParams = BaseFeeParams { - max_change_denominator: OP_SEPOLIA_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, - elasticity_multiplier: OP_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, -}; - -/// Get the base fee parameters for Optimism Sepolia (post Canyon). -pub(crate) const OP_SEPOLIA_CANYON_BASE_FEE_PARAMS: BaseFeeParams = BaseFeeParams { - max_change_denominator: OP_SEPOLIA_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON, - elasticity_multiplier: OP_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, -}; - -/// Get the base fee parameters for Optimism Mainnet. -pub(crate) const OP_BASE_FEE_PARAMS: BaseFeeParams = BaseFeeParams { - max_change_denominator: OP_MAINNET_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, - elasticity_multiplier: OP_MAINNET_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, -}; - -/// Get the base fee parameters for Optimism Mainnet (post Canyon). -pub(crate) const OP_CANYON_BASE_FEE_PARAMS: BaseFeeParams = BaseFeeParams { - max_change_denominator: OP_MAINNET_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON, - elasticity_multiplier: OP_MAINNET_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, -}; diff --git a/crates/chainspec/src/spec.rs b/crates/chainspec/src/spec.rs index f557a3d8de31..2fd631fcd898 100644 --- a/crates/chainspec/src/spec.rs +++ b/crates/chainspec/src/spec.rs @@ -23,11 +23,6 @@ use reth_trie_common::root::state_root_ref_unhashed; #[cfg(feature = "std")] use std::sync::Arc; -#[cfg(feature = "optimism")] -use crate::constants::optimism::{ - BASE_SEPOLIA_BASE_FEE_PARAMS, BASE_SEPOLIA_CANYON_BASE_FEE_PARAMS, OP_BASE_FEE_PARAMS, - OP_CANYON_BASE_FEE_PARAMS, OP_SEPOLIA_BASE_FEE_PARAMS, OP_SEPOLIA_CANYON_BASE_FEE_PARAMS, -}; pub use alloy_eips::eip1559::BaseFeeParams; #[cfg(feature = "optimism")] use reth_ethereum_forks::OptimismHardfork; @@ -138,8 +133,8 @@ pub static OP_MAINNET: Lazy> = Lazy::new(|| { hardforks: OptimismHardfork::op_mainnet(), base_fee_params: BaseFeeParamsKind::Variable( vec![ - (EthereumHardfork::London.boxed(), OP_BASE_FEE_PARAMS), - (OptimismHardfork::Canyon.boxed(), OP_CANYON_BASE_FEE_PARAMS), + (EthereumHardfork::London.boxed(), BaseFeeParams::optimism()), + (OptimismHardfork::Canyon.boxed(), BaseFeeParams::optimism_canyon()), ] .into(), ), @@ -163,8 +158,8 @@ pub static OP_SEPOLIA: Lazy> = Lazy::new(|| { hardforks: OptimismHardfork::op_sepolia(), base_fee_params: BaseFeeParamsKind::Variable( vec![ - (EthereumHardfork::London.boxed(), OP_SEPOLIA_BASE_FEE_PARAMS), - (OptimismHardfork::Canyon.boxed(), OP_SEPOLIA_CANYON_BASE_FEE_PARAMS), + (EthereumHardfork::London.boxed(), BaseFeeParams::optimism_sepolia()), + (OptimismHardfork::Canyon.boxed(), BaseFeeParams::optimism_sepolia_canyon()), ] .into(), ), @@ -188,8 +183,8 @@ pub static BASE_SEPOLIA: Lazy> = Lazy::new(|| { hardforks: OptimismHardfork::base_sepolia(), base_fee_params: BaseFeeParamsKind::Variable( vec![ - (EthereumHardfork::London.boxed(), BASE_SEPOLIA_BASE_FEE_PARAMS), - (OptimismHardfork::Canyon.boxed(), BASE_SEPOLIA_CANYON_BASE_FEE_PARAMS), + (EthereumHardfork::London.boxed(), BaseFeeParams::base_sepolia()), + (OptimismHardfork::Canyon.boxed(), BaseFeeParams::base_sepolia_canyon()), ] .into(), ), @@ -213,8 +208,8 @@ pub static BASE_MAINNET: Lazy> = Lazy::new(|| { hardforks: OptimismHardfork::base_mainnet(), base_fee_params: BaseFeeParamsKind::Variable( vec![ - (EthereumHardfork::London.boxed(), OP_BASE_FEE_PARAMS), - (OptimismHardfork::Canyon.boxed(), OP_CANYON_BASE_FEE_PARAMS), + (EthereumHardfork::London.boxed(), BaseFeeParams::optimism()), + (OptimismHardfork::Canyon.boxed(), BaseFeeParams::optimism()), ] .into(), ),