Enforce EIP-7825 per-tx gas cap on settlement#4371
Open
0xDevNinja wants to merge 1 commit intocowprotocol:mainfrom
Open
Enforce EIP-7825 per-tx gas cap on settlement#43710xDevNinja wants to merge 1 commit intocowprotocol:mainfrom
0xDevNinja wants to merge 1 commit intocowprotocol:mainfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
recheck |
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/solveand 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
Gas::new, cap the per-settlement maximum atmin(block_limit / 2, EIP-7825)so over-sized solutions fail fast through the existingGasLimitExceedederror.Gas::EIP_7825_TX_GAS_CAPso callers and tests share the constant.2 * EIP-7825keep the tighter half-block behaviour.How to test
All three new tests pass; existing driver tests are unchanged.
Fixes #4368