Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

fix the base fee params for base mainnet #91

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions crates/primitives/src/chain/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Arc<ChainSpec>> = Lazy::new(|| {
ChainSpec {
Expand Down Expand Up @@ -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 }
}
}

Expand Down Expand Up @@ -312,7 +310,7 @@ pub static BASE_GOERLI: Lazy<Arc<ChainSpec>> = 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()
Expand All @@ -326,7 +324,7 @@ pub static BASE_MAINNET: Lazy<Arc<ChainSpec>> = 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"
))),
Expand Down
6 changes: 0 additions & 6 deletions crates/primitives/src/constants/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading