From 60b83b945d382a0db5446883a87f5bc791574247 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 d1d2fac91bd9..9a48531e158a 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 goerli + #[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 818e3de227d3..66ae8ea71d24 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;