diff --git a/Cargo.lock b/Cargo.lock index f753c14ae807c..41b1a54a4adff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10766,3 +10766,8 @@ dependencies = [ "cc", "pkg-config", ] + +[[patch.unused]] +name = "foundry-compilers" +version = "0.16.2" +source = "git+https://github.com/foundry-rs/compilers.git?rev=898bcbb#898bcbb77c0fe67a538a539694ed6f48598a24c8" diff --git a/Cargo.toml b/Cargo.toml index 85c1b018440f0..88147742e8a89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -392,4 +392,5 @@ op-revm = { git = "https://github.com/bluealloy/revm.git", rev = "b5808253" } # revm-inspectors = { git = "https://github.com/paradigmxyz/revm-inspectors.git", rev = "a625c04" } ## foundry +foundry-compilers = { git = "https://github.com/foundry-rs/compilers.git", rev = "898bcbb" } # foundry-fork-db = { git = "https://github.com/foundry-rs/foundry-fork-db", rev = "811a61a" } diff --git a/crates/anvil/src/cmd.rs b/crates/anvil/src/cmd.rs index d4b91e14f20fd..108984a99c620 100644 --- a/crates/anvil/src/cmd.rs +++ b/crates/anvil/src/cmd.rs @@ -78,7 +78,7 @@ pub struct NodeArgs { /// The EVM hardfork to use. /// - /// Choose the hardfork by name, e.g. `cancun`, `shanghai`, `paris`, `london`, etc... + /// Choose the hardfork by name, e.g. `prague`, `cancun`, `shanghai`, `paris`, `london`, etc... /// [default: latest] #[arg(long)] pub hardfork: Option, diff --git a/crates/anvil/src/eth/backend/mem/mod.rs b/crates/anvil/src/eth/backend/mem/mod.rs index 911086700e721..0db21c134b440 100644 --- a/crates/anvil/src/eth/backend/mem/mod.rs +++ b/crates/anvil/src/eth/backend/mem/mod.rs @@ -780,11 +780,17 @@ impl Backend { /// Returns [`BlobParams`] corresponding to the current spec. pub fn blob_params(&self) -> BlobParams { - if self.env.read().evm_env.cfg_env.spec >= SpecId::PRAGUE { - BlobParams::prague() - } else { - BlobParams::cancun() + let spec_id = self.env.read().evm_env.cfg_env.spec; + + if spec_id >= SpecId::OSAKA { + return BlobParams::osaka(); } + + if spec_id >= SpecId::PRAGUE { + return BlobParams::prague(); + } + + BlobParams::cancun() } /// Returns an error if EIP1559 is not active (pre Berlin) diff --git a/crates/anvil/src/eth/fees.rs b/crates/anvil/src/eth/fees.rs index acec3a29201ac..630b2e6c23597 100644 --- a/crates/anvil/src/eth/fees.rs +++ b/crates/anvil/src/eth/fees.rs @@ -192,6 +192,8 @@ pub fn calculate_next_block_base_fee(gas_used: u64, gas_limit: u64, base_fee: u6 /// An async service that takes care of the `FeeHistory` cache pub struct FeeHistoryService { + /// Hardfork identifier + spec_id: SpecId, /// incoming notifications about new blocks new_blocks: NewBlockNotifications, /// contains all fee history related entries @@ -204,11 +206,18 @@ pub struct FeeHistoryService { impl FeeHistoryService { pub fn new( + spec_id: SpecId, new_blocks: NewBlockNotifications, cache: FeeHistoryCache, storage_info: StorageInfo, ) -> Self { - Self { new_blocks, cache, fee_history_limit: MAX_FEE_HISTORY_CACHE_SIZE, storage_info } + Self { + spec_id, + new_blocks, + cache, + fee_history_limit: MAX_FEE_HISTORY_CACHE_SIZE, + storage_info, + } } /// Returns the configured history limit @@ -245,7 +254,13 @@ impl FeeHistoryService { let base_fee = header.base_fee_per_gas.map(|g| g as u128).unwrap_or_default(); let excess_blob_gas = header.excess_blob_gas.map(|g| g as u128); let blob_gas_used = header.blob_gas_used.map(|g| g as u128); - let base_fee_per_blob_gas = header.blob_fee(BlobParams::cancun()); + + let base_fee_per_blob_gas = match self.spec_id { + SpecId::OSAKA => header.blob_fee(BlobParams::osaka()), + SpecId::PRAGUE => header.blob_fee(BlobParams::prague()), + _ => header.blob_fee(BlobParams::cancun()), + }; + let mut item = FeeHistoryCacheItem { base_fee, gas_used_ratio: 0f64, diff --git a/crates/anvil/src/hardfork.rs b/crates/anvil/src/hardfork.rs index 34fe97fa1de41..3b796a64a0c0b 100644 --- a/crates/anvil/src/hardfork.rs +++ b/crates/anvil/src/hardfork.rs @@ -75,8 +75,8 @@ impl EthereumHardfork { Self::GrayGlacier => 15050000, Self::Paris => 15537394, Self::Shanghai => 17034870, - Self::Cancun | Self::Latest => 19426587, - Self::Prague => 22431084, + Self::Cancun => 19426587, + Self::Prague | Self::Latest => 22431084, } } } @@ -131,8 +131,8 @@ impl From for SpecId { EthereumHardfork::GrayGlacier => Self::GRAY_GLACIER, EthereumHardfork::Paris => Self::MERGE, EthereumHardfork::Shanghai => Self::SHANGHAI, - EthereumHardfork::Cancun | EthereumHardfork::Latest => Self::CANCUN, - EthereumHardfork::Prague => Self::PRAGUE, + EthereumHardfork::Cancun => Self::CANCUN, + EthereumHardfork::Prague | EthereumHardfork::Latest => Self::PRAGUE, } } } diff --git a/crates/anvil/src/lib.rs b/crates/anvil/src/lib.rs index 77e072e0aa1f2..b6fb69ea8286f 100644 --- a/crates/anvil/src/lib.rs +++ b/crates/anvil/src/lib.rs @@ -198,6 +198,7 @@ pub async fn try_spawn(mut config: NodeConfig) -> Result<(EthApi, NodeHandle)> { let fee_history_cache = Arc::new(Mutex::new(Default::default())); let fee_history_service = FeeHistoryService::new( + backend.spec_id(), backend.new_block_notifications(), Arc::clone(&fee_history_cache), StorageInfo::new(Arc::clone(&backend)), diff --git a/crates/anvil/tests/it/anvil_api.rs b/crates/anvil/tests/it/anvil_api.rs index ce337714587b9..ecd57a0d17101 100644 --- a/crates/anvil/tests/it/anvil_api.rs +++ b/crates/anvil/tests/it/anvil_api.rs @@ -448,7 +448,7 @@ async fn can_get_node_info() { let block_number = provider.get_block_number().await.unwrap(); let block = provider.get_block(BlockId::from(block_number)).await.unwrap().unwrap(); - let hard_fork: &str = SpecId::CANCUN.into(); + let hard_fork: &str = SpecId::PRAGUE.into(); let expected_node_info = NodeInfo { current_block_number: 0_u64, diff --git a/crates/cast/src/cmd/run.rs b/crates/cast/src/cmd/run.rs index c586cf4c9ded4..04f52957ef668 100644 --- a/crates/cast/src/cmd/run.rs +++ b/crates/cast/src/cmd/run.rs @@ -165,7 +165,7 @@ impl RunArgs { if evm_version.is_none() { // if the block has the excess_blob_gas field, we assume it's a Cancun block if block.header.excess_blob_gas.is_some() { - evm_version = Some(EvmVersion::Cancun); + evm_version = Some(EvmVersion::Prague); } } apply_chain_and_block_specific_env_changes::(env.as_env_mut(), block); diff --git a/crates/config/README.md b/crates/config/README.md index be3055f5816f7..bd2b683f1bae4 100644 --- a/crates/config/README.md +++ b/crates/config/README.md @@ -79,7 +79,7 @@ allow_paths = [] # additional solc include paths include_paths = [] force = false -evm_version = 'shanghai' +evm_version = 'prague' gas_reports = ['*'] gas_reports_ignore = [] ## Sets the concrete solc version to use, this overrides the `auto_detect_solc` value diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index c70e980c66b6f..6cbeb91d95234 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -2309,7 +2309,7 @@ impl Default for Config { allow_paths: vec![], include_paths: vec![], force: false, - evm_version: EvmVersion::Cancun, + evm_version: EvmVersion::Prague, gas_reports: vec!["*".to_string()], gas_reports_ignore: vec![], gas_reports_include_tests: false, diff --git a/crates/forge/tests/cli/cmd.rs b/crates/forge/tests/cli/cmd.rs index 3f76a179a0994..95d0c2b8bc61b 100644 --- a/crates/forge/tests/cli/cmd.rs +++ b/crates/forge/tests/cli/cmd.rs @@ -3673,7 +3673,7 @@ forgetest_init!(can_inspect_standard_json, |prj, cmd| { ] } }, - "evmVersion": "cancun", + "evmVersion": "prague", "viaIR": false, "libraries": {} } diff --git a/crates/forge/tests/cli/config.rs b/crates/forge/tests/cli/config.rs index a9286661beac0..dfb40d3812e88 100644 --- a/crates/forge/tests/cli/config.rs +++ b/crates/forge/tests/cli/config.rs @@ -982,7 +982,7 @@ allow_paths = [] include_paths = [] skip = [] force = false -evm_version = "cancun" +evm_version = "prague" gas_reports = ["*"] gas_reports_ignore = [] gas_reports_include_tests = false @@ -1140,7 +1140,7 @@ exclude = [] "include_paths": [], "skip": [], "force": false, - "evm_version": "cancun", + "evm_version": "prague", "gas_reports": [ "*" ], @@ -1787,19 +1787,19 @@ contract Counter { let (via_ir, evm_version, enabled, runs) = artifact_settings("Counter.sol/Counter.json"); assert_eq!(None, via_ir); - assert_eq!("\"cancun\"", evm_version.unwrap().to_string()); + assert_eq!("\"prague\"", evm_version.unwrap().to_string()); assert_eq!("false", enabled.unwrap().to_string()); assert_eq!("200", runs.unwrap().to_string()); let (via_ir, evm_version, enabled, runs) = artifact_settings("v1/Counter.sol/Counter.json"); assert_eq!("true", via_ir.unwrap().to_string()); - assert_eq!("\"cancun\"", evm_version.unwrap().to_string()); + assert_eq!("\"prague\"", evm_version.unwrap().to_string()); assert_eq!("true", enabled.unwrap().to_string()); assert_eq!("44444444", runs.unwrap().to_string()); let (via_ir, evm_version, enabled, runs) = artifact_settings("v2/Counter.sol/Counter.json"); assert_eq!("true", via_ir.unwrap().to_string()); - assert_eq!("\"cancun\"", evm_version.unwrap().to_string()); + assert_eq!("\"prague\"", evm_version.unwrap().to_string()); assert_eq!("true", enabled.unwrap().to_string()); assert_eq!("111", runs.unwrap().to_string()); diff --git a/crates/forge/tests/cli/script.rs b/crates/forge/tests/cli/script.rs index f2b5dc1ca15ae..1e1ab73c9673f 100644 --- a/crates/forge/tests/cli/script.rs +++ b/crates/forge/tests/cli/script.rs @@ -2575,7 +2575,7 @@ Chain 31337 accessList [] chainId 31337 -gasLimit 228231 +gasLimit [..] gasPrice input [..] maxFeePerBlobGas diff --git a/crates/test-utils/src/util.rs b/crates/test-utils/src/util.rs index 3179503f28f90..a72c36df8b081 100644 --- a/crates/test-utils/src/util.rs +++ b/crates/test-utils/src/util.rs @@ -48,7 +48,7 @@ static TEMPLATE_LOCK: LazyLock = static NEXT_ID: AtomicUsize = AtomicUsize::new(0); /// The default Solc version used when compiling tests. -pub const SOLC_VERSION: &str = "0.8.27"; +pub const SOLC_VERSION: &str = "0.8.30"; /// Another Solc version used when compiling tests. ///