Repository navigation
Description
A test that lowers the hardfork with an inline evm_version (e.g. "Osaka") can fail before executing any bytecode, if the runner's global hardfork is Amsterdam and a transaction gas cap is configured without a gas limit at or below it:
EVM error: transaction validation error: transaction gas limit (4294967295) is greater than the cap (16777216)
The runner derives the transaction gas limit and the EIP-7825 cap once, from the global hardfork. At Amsterdam they are TX_MAX_TOTAL_GAS_LIMIT (2^32 − 1) and 2^24, respectively (crates/edr_napi_core/src/solidity/config.rs, crates/foundry/evm/core/src/fork/init.rs). The inline override only changes the spec (set_cfg_spec_id), which disables EIP-8037. revm then applies the EIP-7825 cap check, and tx.gas exceeds the cap.
All of the following must hold:
- the global hardfork is Amsterdam;
- the test has an inline pre-Amsterdam
evm_version; - the transaction gas cap is enabled (Hardhat:
transactionGasCapis set); gasLimit/blockGasLimitis unset or above the cap.
Hardhat disables the cap unless transactionGasCap is set, so its default config is not affected. None of the HH3 benchmark scenarios meets these conditions.
Reproduction
crates/edr_solidity_tests/tests/testdata/default/spec/EvmVersionBelowAmsterdam.t.sol:
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;
import "ds-test/test.sol";
contract EvmVersionAmsterdamTest is DSTest {
function testCall() public {
assertEq(uint256(1) + 1, 2);
}
}
/// forge-config: default.evm_version = "Osaka"
contract EvmVersionOsakaTest is DSTest {
function testCall() public {
assertEq(uint256(1) + 1, 2);
}
}crates/edr_solidity_tests/tests/it/spec.rs:
/// A test that lowers the hardfork below Amsterdam with an inline
/// `evm_version` must run like it does without the override.
#[tokio::test(flavor = "multi_thread")]
async fn test_function_override_evm_version_below_amsterdam() {
let test_data =
L1ForgeTestData::new(ForgeTestProfile::Default, edr_chain_l1::Hardfork::Amsterdam)
.expect("linking ok");
let filter = SolidityTestFilter::new(".*", ".*", ".*spec/EvmVersionBelowAmsterdam.t.sol");
let runner = test_data.runner().await;
let results = runner.test_collect(filter).await.suite_results;
assert_multiple(
&results,
BTreeMap::from([
(
"default/spec/EvmVersionBelowAmsterdam.t.sol:EvmVersionAmsterdamTest",
vec![("testCall()", true, None, None, None)],
),
(
"default/spec/EvmVersionBelowAmsterdam.t.sol:EvmVersionOsakaTest",
vec![("testCall()", true, None, None, None)],
),
]),
);
}cargo test -p edr_solidity_tests --test it spec::test_function_override_evm_version_below_amsterdam
EvmVersionAmsterdamTest passes and EvmVersionOsakaTest::testCall() fails with the error above.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsInbox
Activity
yash251 commentedon Nov 18, 2026
I'd be happy to work on this if you haven't started it yet. As I understand it, the transaction gas limit and the EIP-7825 cap are both derived once from the global hardfork, so an inline pre-Amsterdam
evm_versionchanges the spec but keeps the Amsterdam gas limit. My plan would be to recompute both when the inline override changes the spec, and use your repro as the regression test. Would that direction work for you?anaPerezGhiglia commentedon Nov 26, 2026
Hey @yash251. We haven't started on this yet, so feel free to take it. Your proposed direction sounds good. One thing to keep in mind: only the derived defaults should be recomputed for the overridden spec, so an explicitly configured
gasLimitorblockGasLimitshould still be respected.