From 8e4687a521e617fbcb25fcedcd9e3c70a89c5f04 Mon Sep 17 00:00:00 2001 From: makemake Date: Tue, 30 Dec 2025 17:19:03 +0100 Subject: [PATCH 1/7] fix: assertion gas limit to block gas limit --- crates/cheatcodes/src/credible.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/cheatcodes/src/credible.rs b/crates/cheatcodes/src/credible.rs index 16d34873bad0a..7273dbd40da6d 100644 --- a/crates/cheatcodes/src/credible.rs +++ b/crates/cheatcodes/src/credible.rs @@ -144,8 +144,9 @@ pub fn execute_assertion( // Prepare assertion store - let config = - ExecutorConfig { spec_id: spec_id.into(), chain_id, assertion_gas_limit: TX_GAS_LIMIT_CAP }; + let block_gas_limit = block.gas_limit.try_into().unwrap_or(u64::MAX); + let assertion_gas_limit = ASSERTION_GAS_LIMIT.min(TX_GAS_LIMIT_CAP).min(block_gas_limit); + let config = ExecutorConfig { spec_id: spec_id.into(), chain_id, assertion_gas_limit }; let store = AssertionStore::new_ephemeral(); From dd0648002e146990f50ad1a967aaa15292fb9719 Mon Sep 17 00:00:00 2001 From: makemake Date: Tue, 30 Dec 2025 18:03:42 +0100 Subject: [PATCH 2/7] fix: surface overshooting the limit --- Cargo.lock | 32 +++++++++++++++---------------- crates/cheatcodes/src/credible.rs | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 15687e1dc6338..a6f270aa2ddce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2100,9 +2100,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.9.6" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fda37911905ea4d3141a01364bc5509a0f32ae3f3b22d6e330c0abfb62d247" +checksum = "a392db6c583ea4a912538afb86b7be7c5d8887d91604f50eb55c262ee1b4a5f5" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -3814,7 +3814,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4140,7 +4140,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5613,8 +5613,8 @@ dependencies = [ "libc", "log", "rustversion", - "windows-link 0.2.1", - "windows-result 0.4.1", + "windows-link 0.1.3", + "windows-result 0.3.4", ] [[package]] @@ -6021,7 +6021,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.1", + "socket2 0.5.10", "system-configuration", "tokio", "tower-service", @@ -6408,7 +6408,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -7193,7 +7193,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -8389,7 +8389,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.6.1", + "socket2 0.5.10", "thiserror 2.0.17", "tokio", "tracing", @@ -8426,9 +8426,9 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.6.1", + "socket2 0.5.10", "tracing", - "windows-sys 0.60.2", + "windows-sys 0.59.0", ] [[package]] @@ -9551,7 +9551,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -10866,7 +10866,7 @@ dependencies = [ "getrandom 0.3.4", "once_cell", "rustix 1.1.2", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -10911,7 +10911,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -12233,7 +12233,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] diff --git a/crates/cheatcodes/src/credible.rs b/crates/cheatcodes/src/credible.rs index 7273dbd40da6d..4369f9d1015fc 100644 --- a/crates/cheatcodes/src/credible.rs +++ b/crates/cheatcodes/src/credible.rs @@ -145,7 +145,7 @@ pub fn execute_assertion( // Prepare assertion store let block_gas_limit = block.gas_limit.try_into().unwrap_or(u64::MAX); - let assertion_gas_limit = ASSERTION_GAS_LIMIT.min(TX_GAS_LIMIT_CAP).min(block_gas_limit); + let assertion_gas_limit = TX_GAS_LIMIT_CAP.min(block_gas_limit); let config = ExecutorConfig { spec_id: spec_id.into(), chain_id, assertion_gas_limit }; let store = AssertionStore::new_ephemeral(); From 3247a49c18e92a6f0201a55d124e44bccd08851a Mon Sep 17 00:00:00 2001 From: makemake Date: Tue, 30 Dec 2025 18:20:03 +0100 Subject: [PATCH 3/7] fix: enforce `TX_GAS_LIMIT_CAP` for `tx_gas_limit` --- crates/cheatcodes/src/credible.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/cheatcodes/src/credible.rs b/crates/cheatcodes/src/credible.rs index 4369f9d1015fc..6aa3e50e3734a 100644 --- a/crates/cheatcodes/src/credible.rs +++ b/crates/cheatcodes/src/credible.rs @@ -169,9 +169,10 @@ pub fn execute_assertion( }); store.insert(assertion.adopter, assertion_state).expect("Failed to store assertions"); + let tx_gas_limit = block.gas_limit.try_into().unwrap_or(u64::MAX).min(TX_GAS_LIMIT_CAP); let tx_env = TxEnv { caller: tx_attributes.caller, - gas_limit: block.gas_limit.try_into().unwrap_or(u64::MAX), + gas_limit: tx_gas_limit, gas_price: block.basefee.into(), chain_id: Some(chain_id), value: tx_attributes.value, From a9c57e013de7dc0fad0f550bde5ed9df22d5f028 Mon Sep 17 00:00:00 2001 From: "Odysseas.eth" Date: Tue, 30 Dec 2025 19:31:54 +0200 Subject: [PATCH 4/7] fix: revert error message for assertion fn run --- crates/cheatcodes/src/credible.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/crates/cheatcodes/src/credible.rs b/crates/cheatcodes/src/credible.rs index 6aa3e50e3734a..130256f4ee840 100644 --- a/crates/cheatcodes/src/credible.rs +++ b/crates/cheatcodes/src/credible.rs @@ -225,12 +225,7 @@ pub fn execute_assertion( if let Some(expected) = &mut cheats.expected_revert { expected.max_depth = max(ecx.journaled_state.depth(), expected.max_depth); } - // Get a new inspector for logging - let mut inspector = executor.get_inspector(cheats); - inspector.console_log(&format!( - "Expected 1 assertion fn to be executed, but {total_assertions_ran} were executed." - )); - bail!("Assertion Fn number mismatch"); + bail!("Expected 1 assertion to be executed, but {total_assertions_ran} were executed."); } //Expect is safe because we validate above that 1 assertion was ran. From 254a0e2964838730ac6041294f1691b2da59d8df Mon Sep 17 00:00:00 2001 From: makemake Date: Wed, 31 Dec 2025 11:10:12 +0100 Subject: [PATCH 5/7] feat: disable block gas limit check --- Cargo.toml | 2 +- crates/cheatcodes/src/credible.rs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dbeac987c0358..c6bbbf4308852 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -298,7 +298,7 @@ alloy-evm = "0.25.2" alloy-op-evm = "0.25.2" # revm -revm = { version = "33.1.0", default-features = false } +revm = { version = "33.1.0", default-features = false, features = ["optional_block_gas_limit"] } revm-inspectors = { version = "0.33.2", features = ["serde"] } op-revm = { version = "14.1.0", default-features = false } diff --git a/crates/cheatcodes/src/credible.rs b/crates/cheatcodes/src/credible.rs index 130256f4ee840..ba9812402a092 100644 --- a/crates/cheatcodes/src/credible.rs +++ b/crates/cheatcodes/src/credible.rs @@ -143,9 +143,7 @@ pub fn execute_assertion( let db = ThreadSafeDb::new(*ecx.db_mut()); // Prepare assertion store - - let block_gas_limit = block.gas_limit.try_into().unwrap_or(u64::MAX); - let assertion_gas_limit = TX_GAS_LIMIT_CAP.min(block_gas_limit); + let assertion_gas_limit = TX_GAS_LIMIT_CAP; let config = ExecutorConfig { spec_id: spec_id.into(), chain_id, assertion_gas_limit }; let store = AssertionStore::new_ephemeral(); From a60ce64adb81a6240a00a3a44ae08d4a1be4f367 Mon Sep 17 00:00:00 2001 From: makemake Date: Wed, 31 Dec 2025 16:08:34 +0100 Subject: [PATCH 6/7] fix: ci --- Cargo.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6f270aa2ddce..15687e1dc6338 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2100,9 +2100,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.9.5" +version = "1.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a392db6c583ea4a912538afb86b7be7c5d8887d91604f50eb55c262ee1b4a5f5" +checksum = "65fda37911905ea4d3141a01364bc5509a0f32ae3f3b22d6e330c0abfb62d247" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -3814,7 +3814,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4140,7 +4140,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -5613,8 +5613,8 @@ dependencies = [ "libc", "log", "rustversion", - "windows-link 0.1.3", - "windows-result 0.3.4", + "windows-link 0.2.1", + "windows-result 0.4.1", ] [[package]] @@ -6021,7 +6021,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.5.10", + "socket2 0.6.1", "system-configuration", "tokio", "tower-service", @@ -6408,7 +6408,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -7193,7 +7193,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -8389,7 +8389,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2 0.5.10", + "socket2 0.6.1", "thiserror 2.0.17", "tokio", "tracing", @@ -8426,9 +8426,9 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.5.10", + "socket2 0.6.1", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -9551,7 +9551,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -10866,7 +10866,7 @@ dependencies = [ "getrandom 0.3.4", "once_cell", "rustix 1.1.2", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -10911,7 +10911,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -12233,7 +12233,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] From 1be27095c84c71e3f9f10aac143c0fe091eb6e7d Mon Sep 17 00:00:00 2001 From: makemake Date: Mon, 5 Jan 2026 13:20:13 +0100 Subject: [PATCH 7/7] feat: revert gas clamping --- Cargo.toml | 2 +- crates/cheatcodes/src/credible.rs | 8 ++++---- crates/cli/src/opts/global.rs | 5 +---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c6bbbf4308852..dbeac987c0358 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -298,7 +298,7 @@ alloy-evm = "0.25.2" alloy-op-evm = "0.25.2" # revm -revm = { version = "33.1.0", default-features = false, features = ["optional_block_gas_limit"] } +revm = { version = "33.1.0", default-features = false } revm-inspectors = { version = "0.33.2", features = ["serde"] } op-revm = { version = "14.1.0", default-features = false } diff --git a/crates/cheatcodes/src/credible.rs b/crates/cheatcodes/src/credible.rs index ba9812402a092..be929462fe839 100644 --- a/crates/cheatcodes/src/credible.rs +++ b/crates/cheatcodes/src/credible.rs @@ -143,8 +143,7 @@ pub fn execute_assertion( let db = ThreadSafeDb::new(*ecx.db_mut()); // Prepare assertion store - let assertion_gas_limit = TX_GAS_LIMIT_CAP; - let config = ExecutorConfig { spec_id: spec_id.into(), chain_id, assertion_gas_limit }; + let config = ExecutorConfig { spec_id, chain_id, assertion_gas_limit: TX_GAS_LIMIT_CAP }; let store = AssertionStore::new_ephemeral(); @@ -167,7 +166,8 @@ pub fn execute_assertion( }); store.insert(assertion.adopter, assertion_state).expect("Failed to store assertions"); - let tx_gas_limit = block.gas_limit.try_into().unwrap_or(u64::MAX).min(TX_GAS_LIMIT_CAP); + // transaction gas limit should respect new hardfork rules of max 16m gas + let tx_gas_limit = block.gas_limit.min(TX_GAS_LIMIT_CAP); let tx_env = TxEnv { caller: tx_attributes.caller, gas_limit: tx_gas_limit, @@ -239,7 +239,7 @@ pub fn execute_assertion( if !assertion_fn_result.console_logs.is_empty() { inspector.console_log("Assertion function logs: "); - for log in assertion_fn_result.console_logs.iter() { + for log in &assertion_fn_result.console_logs { inspector.console_log(log); } } diff --git a/crates/cli/src/opts/global.rs b/crates/cli/src/opts/global.rs index 7d24db8daf563..5cc478513724e 100644 --- a/crates/cli/src/opts/global.rs +++ b/crates/cli/src/opts/global.rs @@ -1,8 +1,5 @@ use clap::{ArgAction, Parser}; -use foundry_common::{ - shell::{ColorChoice, OutputFormat, OutputMode, Shell, Verbosity}, - version::{IS_NIGHTLY_VERSION, NIGHTLY_VERSION_WARNING_MESSAGE}, -}; +use foundry_common::shell::{ColorChoice, OutputFormat, OutputMode, Shell, Verbosity}; use serde::{Deserialize, Serialize}; /// Global arguments for the CLI.