Skip to content

Enforce EIP-7825 per-tx gas cap on settlement#4371

Open
0xDevNinja wants to merge 1 commit intocowprotocol:mainfrom
0xDevNinja:fix/eip-7825-driver-gas-cap
Open

Enforce EIP-7825 per-tx gas cap on settlement#4371
0xDevNinja wants to merge 1 commit intocowprotocol:mainfrom
0xDevNinja:fix/eip-7825-driver-gas-cap

Conversation

@0xDevNinja
Copy link
Copy Markdown

Description

The driver caps a settlement's gas estimate at half the block gas limit (e.g. 60M on a 120M block). Fusaka introduced the EIP-7825 per-transaction gas cap of 2^24 - 1 = 16,777,215; any tx exceeding this is rejected by the mempool. Without this check a solution above the cap can still be returned by /solve and forwarded to /settle, where it could never be mined. The cap is already enforced on the quote-verification path (#4261) but was never ported to settlement submission.

Changes

  • In Gas::new, cap the per-settlement maximum at min(block_limit / 2, EIP-7825) so over-sized solutions fail fast through the existing GasLimitExceeded error.
  • Expose the cap as Gas::EIP_7825_TX_GAS_CAP so callers and tests share the constant.
  • Chains with a block gas limit below 2 * EIP-7825 keep the tighter half-block behaviour.
  • Add unit tests for the new cap, the boundary case at the cap, and the small-block-limit path.

How to test

cargo nextest run -p driver settlement::tests

All three new tests pass; existing driver tests are unchanged.

Fixes #4368

@0xDevNinja 0xDevNinja requested a review from a team as a code owner April 30, 2026 14:02
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@0xDevNinja
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@0xDevNinja
Copy link
Copy Markdown
Author

recheck

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements the EIP-7825 per-transaction gas cap (2^24 - 1) within the settlement domain. The Gas::new function now caps the maximum gas by taking the minimum of half the block limit and this new constant, preventing the creation of solutions that would be rejected by the mempool. Unit tests have been added to verify the cap's behavior in both large and small block limit scenarios. I have no feedback to provide.

github-actions Bot added a commit that referenced this pull request Apr 30, 2026
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.

bug: Driver doesn't enforce the EIP-7825 per-transaction gas cap

1 participant