foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Rolling fork to specific transaction fails with validation error: priority fee is greater than max fee

Open nuntax opened this issue 6 months ago • 4 comments

Component

Forge

Have you ensured that all of these are up to date?

  • [x] Foundry
  • [x] Foundryup

What version of Foundry are you on?

forge Version: 1.2.2-nightly Commit SHA: b42d5121ba3f03099b1d649ab71f2100a212d3f3 Build Timestamp: 2025-06-03T06:02:38.785261834Z (1748930558) Build Profile: maxperf

What version of Foundryup are you on?

foundryup: 1.1.0

What command(s) is the bug in?

forge test

Operating System

Linux

Describe the bug

Rolling an arbitrum fork to a specific transaction fails with the following error: vm.rollFork: backend: failed committing transaction; transaction validation error: priority fee is greater than max fee This only happens with one specific transaction. Further than that arbitrum doesn't support eip1559 style fees, neither is the transaction itself a eip1559 transaction. (arbitrum supports them for compatibility reasons, just ignores the priority fee parameter). Minimal example to reproduce:

//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;
import {Test} from "forge-std/Test.sol";


contract IssueTest is Test {
        uint256 arbFork;

    function setUp() public {
        string memory rpcUrl = vm.envString("ARB_RPC_URL");
        arbFork = vm.createSelectFork(
            rpcUrl
        );
    }
    function testIssue() public {
        bytes32 txHash = 0x2e43e9ececcbb9cd08ce061edc3b4d39ca2b0ba480034e5f4650ba0065bf6b62;
        vm.rollFork(txHash);
        assertTrue(true, "This is a placeholder test that always passes.");
    }
}```
Specify the ARB_RPC_URL and run with ```forge test --mt testIssue```

nuntax avatar Jun 03 '25 08:06 nuntax

Forgot to mention that I tested this on nightly and stable

nuntax avatar Jun 03 '25 08:06 nuntax

replaying tx with cast results in

Error: Failed to execute transaction: 0xf7ca20b00441b6277b0ed25ae3f8520be299cfdcdc6cd1420babc31643a4922e in block 22614117

Context:
- Error #0: EVM error
- Error #1: transaction validation error: priority fee is greater than max fee

likely same reason as in #7514

grandizzy avatar Jun 03 '25 08:06 grandizzy

I don't know if this is helpful in anyway but i did some testing myself and the issue in this case seems to be that arbitrum doesn't enforce any restrictions on the eip1559 fees. its possible to set the max priority fee above the max fee which causes the error i encountered while testing. Heres a test tx: 0xb5e8b1cd23b8c07dd422b90002cb237afd4140e5d931a419ffbbb966bb31832e as expected cast run 0xb5e8b1cd23b8c07dd422b90002cb237afd4140e5d931a419ffbbb966bb31832e --rpc-url $RPC fails with Error: EVM error; transaction validation error: priority fee is greater than max fee

nuntax avatar Jun 03 '25 19:06 nuntax

this is directly enforced by the eip, there is currently no setting to disable this, but this seems useful, opening an issue for this on revm

mattsse avatar Jun 05 '25 19:06 mattsse

I've just encountered a similar error: a forge test where I use vm.rollFork to a specific transaction hash would fail with

[FAIL: vm.rollFork: backend: failed committing transaction; transaction validation error: gas floor (1631900) exceeds the gas limit (665360)] setUp() (gas: 0)

with cast, there's a workaround:

$ cast run -r $(rpc eth) 0x7e6d00c48b4e8513f6bd84388442326b960161d130576075fa4da99dfafd9e77
Executing previous transactions from the block.
Error: EVM error; transaction validation error: gas floor (1631900) exceeds the gas limit (665360)

But with --evm-version shanghai, the cast command works

[FAIL: vm.rollFork: backend: failed committing transaction; transaction validation error: gas floor (1631900) exceeds the gas limit (665360)] setUp() (gas: 0)

and this, no matter the evm version used. I tried evm_version = "shanghai" in foundry.toml, I tried running with --evm-version shanghai and I tried the inline configuration comment

/// forge-config: default.evm_version = "shanghai"

Nothing worked

Mouradif avatar Nov 03 '25 23:11 Mouradif

@Mouradif you need to set the proper execution evm, use vm.setEvmVersion with latest nightly build / upcoming 1.5

grandizzy avatar Nov 03 '25 23:11 grandizzy