From 485d986fcff3ca98720f829cb47f5fc22a0a2455 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Wed, 15 Jul 2026 22:32:01 +0800 Subject: [PATCH 1/2] feat(cli): honor --gas-limit for path/custom bytecode fixtures Wire the existing CLI flag into fixture_from_bytecode so ad-hoc runs no longer hardcode i64::MAX for block and tx gas limits. --- crates/revmc-cli/src/benches.rs | 12 +++++++++--- crates/revmc-cli/src/cmd/run.rs | 9 +++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/crates/revmc-cli/src/benches.rs b/crates/revmc-cli/src/benches.rs index 002a756a3..7973b8d24 100644 --- a/crates/revmc-cli/src/benches.rs +++ b/crates/revmc-cli/src/benches.rs @@ -20,8 +20,14 @@ impl Bench { } } -pub fn fixture_from_bytecode(name: &'static str, bytecode: Vec, spec_id: SpecId) -> Bench { +pub fn fixture_from_bytecode( + name: &'static str, + bytecode: Vec, + spec_id: SpecId, + gas_limit: u64, +) -> Bench { let bytecode = revmc::primitives::hex::encode(bytecode); + let gas_limit = format!("0x{gas_limit:x}"); Bench { name, fixture_json: Some(Cow::Owned(format!( @@ -30,7 +36,7 @@ pub fn fixture_from_bytecode(name: &'static str, bytecode: Vec, spec_id: Spe "env": {{ "currentBaseFee": "0x0", "currentCoinbase": "0x0000000000000000000000000000000000000000", - "currentGasLimit": "0x7fffffffffffffff", + "currentGasLimit": "0x{gas_limit:x}", "currentNumber": "0x1", "currentTimestamp": "0x1" }}, @@ -51,7 +57,7 @@ pub fn fixture_from_bytecode(name: &'static str, bytecode: Vec, spec_id: Spe "transaction": [ {{ "data": "0x", - "gasLimit": "0x7fffffffffffffff", + "gasLimit": "{gas_limit}", "gasPrice": "0x0", "nonce": "0x0", "sender": "0x1111111111111111111111111111111111111111", diff --git a/crates/revmc-cli/src/cmd/run.rs b/crates/revmc-cli/src/cmd/run.rs index 6f4e9d2e0..a3be03980 100644 --- a/crates/revmc-cli/src/cmd/run.rs +++ b/crates/revmc-cli/src/cmd/run.rs @@ -136,7 +136,12 @@ impl RunArgs { .to_string(); (stem, path.to_path_buf()) }; - fixture_from_bytecode(name.leak(), read_code_path(&bytecode_path)?, spec_id) + fixture_from_bytecode( + name.leak(), + read_code_path(&bytecode_path)?, + spec_id, + self.gas_limit, + ) } else { let bytecode = read_code_string(bench_name.trim().as_bytes(), None).map_err(|e| { eyre!( @@ -144,7 +149,7 @@ impl RunArgs { or valid EVM hex/asm: {e}" ) })?; - fixture_from_bytecode("custom", bytecode, spec_id) + fixture_from_bytecode("custom", bytecode, spec_id, self.gas_limit) }; let name = bench_entry.name; From 6c05ff2c3c0af6e79a1de6dcc19e432c6477024f Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Wed, 15 Jul 2026 22:32:14 +0800 Subject: [PATCH 2/2] fix(cli): format currentGasLimit from prebuilt gas_limit string gas_limit is already hex-prefixed; using :x on the String would not compile. --- crates/revmc-cli/src/benches.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/revmc-cli/src/benches.rs b/crates/revmc-cli/src/benches.rs index 7973b8d24..d94f1cd07 100644 --- a/crates/revmc-cli/src/benches.rs +++ b/crates/revmc-cli/src/benches.rs @@ -36,7 +36,7 @@ pub fn fixture_from_bytecode( "env": {{ "currentBaseFee": "0x0", "currentCoinbase": "0x0000000000000000000000000000000000000000", - "currentGasLimit": "0x{gas_limit:x}", + "currentGasLimit": "{gas_limit}", "currentNumber": "0x1", "currentTimestamp": "0x1" }},