Skip to content

feat(contracts): enforce EIP-7825 gas cap in NUT bundle validation#20205

Open
lumoswiz wants to merge 4 commits intoethereum-optimism:developfrom
defi-wonderland:feat/contracts-nut-bundle-gas-cap
Open

feat(contracts): enforce EIP-7825 gas cap in NUT bundle validation#20205
lumoswiz wants to merge 4 commits intoethereum-optimism:developfrom
defi-wonderland:feat/contracts-nut-bundle-gas-cap

Conversation

@lumoswiz
Copy link
Copy Markdown

@lumoswiz lumoswiz commented Apr 21, 2026

Description

Adds a per-transaction gas limit cap check to GenerateNUTBundle.assertValidOutput so any NUT bundle transaction whose gasLimit exceeds the EIP-7825 Osaka cap (2**24 = 16_777_216) is rejected at bundle-generation time rather than at execution.

assertValidOutput was promoted from internal to public so that tests can invoke it directly against a mutated bundle.

Tests

Full negative-path coverage for every branch in assertValidOutput was added to test/scripts/GenerateNUTBundle.t.sol. Each test follows the same pattern:

  • Invoke script.run() to produce a valid bundle
  • Mutate a single field (or the array length)
  • Assert that script.assertValidOutput reverts with the expected error message

The count-mismatch test uses assembly to rewrite the in-memory array length rather than rebuilding the array. Shrink-only because growing would blow up the ABI encoding on the external call to assertValidOutput.

Additional context

Issue #20109 calls for two checks: the EIP-7825 upper cap and an op-geth gas floor check. This PR currently implements the upper cap only. I'm opening as a draft and plan to land the floor check in the same PR once I've synced with @0xniha on the intended approach to implementing the op-geth gas floor.

Resolved by #20075

Metadata

Closes #20109

@0xOneTony
Copy link
Copy Markdown
Contributor

/ci authorize 0885ccf

Comment thread packages/contracts-bedrock/scripts/upgrade/GenerateNUTBundle.s.sol
Comment thread packages/contracts-bedrock/test/scripts/GenerateNUTBundle.t.sol
@lumoswiz lumoswiz marked this pull request as ready for review April 22, 2026 15:32
@lumoswiz lumoswiz requested review from a team and skeletor-spaceman April 22, 2026 15:32
@0xOneTony
Copy link
Copy Markdown
Contributor

/ci authorize 51ae847

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[L2CM] Ensure all bundle tx fit within Osaka gas limit and op-geth gas floor

5 participants