From a72aa1c88779d14d7f8b6c63a6afa0b007b4391a Mon Sep 17 00:00:00 2001 From: Roberto Bayardo Date: Sat, 26 Aug 2023 15:41:20 -0700 Subject: [PATCH] fix the base fee params for base mainnet --- crates/primitives/src/chain/spec.rs | 20 +++++++++----------- crates/primitives/src/constants/mod.rs | 6 ------ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/crates/primitives/src/chain/spec.rs b/crates/primitives/src/chain/spec.rs index d1d2fac91bd9c..6721729a08b11 100644 --- a/crates/primitives/src/chain/spec.rs +++ b/crates/primitives/src/chain/spec.rs @@ -18,11 +18,6 @@ use std::{ sync::Arc, }; -#[cfg(feature = "optimism")] -use crate::constants::{ - OP_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, OP_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, -}; - /// The Ethereum mainnet spec pub static MAINNET: Lazy> = Lazy::new(|| { ChainSpec { @@ -228,13 +223,16 @@ impl BaseFeeParams { } } + /// Get the base fee parameters for optimism mainnet + #[cfg(feature = "optimism")] + pub const fn optimism_goerli() -> BaseFeeParams { + BaseFeeParams { max_change_denominator: 50, elasticity_multiplier: 10 } + } + /// Get the base fee parameters for optimism mainnet #[cfg(feature = "optimism")] pub const fn optimism() -> BaseFeeParams { - BaseFeeParams { - max_change_denominator: OP_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, - elasticity_multiplier: OP_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, - } + BaseFeeParams { max_change_denominator: 50, elasticity_multiplier: 6 } } } @@ -312,7 +310,7 @@ pub static BASE_GOERLI: Lazy> = Lazy::new(|| { (Hardfork::Bedrock, ForkCondition::Block(0)), (Hardfork::Regolith, ForkCondition::Timestamp(1683219600)), ]), - base_fee_params: BaseFeeParams::optimism(), + base_fee_params: BaseFeeParams::optimism_goerli(), prune_batch_sizes: PruneBatchSizes::testnet(), optimism: true, ..Default::default() @@ -326,7 +324,7 @@ pub static BASE_MAINNET: Lazy> = Lazy::new(|| { ChainSpec { chain: Chain::base_mainnet(), genesis: serde_json::from_str(include_str!("../../res/genesis/base.json")) - .expect("Can't deserialize Base Goerli genesis json"), + .expect("Can't deserialize Base genesis json"), genesis_hash: Some(H256(hex!( "f712aa9241cc24369b143cf6dce85f0902a9731e70d66818a3a5845b296c73dd" ))), diff --git a/crates/primitives/src/constants/mod.rs b/crates/primitives/src/constants/mod.rs index 818e3de227d3c..66ae8ea71d24c 100644 --- a/crates/primitives/src/constants/mod.rs +++ b/crates/primitives/src/constants/mod.rs @@ -60,12 +60,6 @@ pub const EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR: u64 = 8; /// Elasticity multiplier as defined in [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) pub const EIP1559_DEFAULT_ELASTICITY_MULTIPLIER: u64 = 2; -/// Base fee max change denominator for Optimism. -pub const OP_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR: u64 = 50; - -/// Elasticity multiplier for Optimism. -pub const OP_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER: u64 = 10; - /// Multiplier for converting gwei to wei. pub const GWEI_TO_WEI: u64 = 1_000_000_000;