Skip to content

miner, core, core/txpool: implement EIP 7825 - Transaction Gas Limit Cap #31824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 8, 2025

Conversation

jwasinger
Copy link
Contributor

@jwasinger jwasinger commented May 14, 2025

Implements EIP-7825

@MariusVanDerWijden MariusVanDerWijden self-assigned this May 21, 2025
@fjl fjl added the osaka label May 29, 2025
@fjl fjl mentioned this pull request May 29, 2025
19 tasks
@jwasinger jwasinger marked this pull request as ready for review June 5, 2025 06:32
@jwasinger
Copy link
Contributor Author

jwasinger commented Jun 5, 2025

IMO the one thing missing here is test coverage. I'm thinking that some the test coverage will end up in hive tests, and STEEL can probably be responsible for implementing these.

But as this PR is written now, there are edge-cases which probably need to be tested as unit tests: see my comment in miner/worker.go around the non-deterministic order of txpool-reset vs block-construction and how this creates an edge-case on fork boundary.

rjl493456442
rjl493456442 previously approved these changes Jun 12, 2025
Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

SGTM

@lightclient lightclient self-requested a review as a code owner June 23, 2025 18:00
rjl493456442
rjl493456442 previously approved these changes Jul 8, 2025
CallValueTransferGas uint64 = 9000 // Paid for CALL when the value transfer is non-zero.
CallNewAccountGas uint64 = 25000 // Paid for CALL when the destination address didn't exist prior.
TxGas uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions.
MaxTxGas uint64 = 30_000_000 // eip-7825 maximum transaction gas limit
Copy link
Contributor

Choose a reason for hiding this comment

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

This constant should not be in the middle of the list here, but have its own paragraph.

@MariusVanDerWijden MariusVanDerWijden merged commit 1cbcebc into ethereum:master Jul 8, 2025
4 of 5 checks passed
@MariusVanDerWijden MariusVanDerWijden added this to the 1.16.2 milestone Jul 8, 2025
rjl493456442 added a commit that referenced this pull request Aug 5, 2025
This PR makes 2 changes to how
[EIP-7825](#31824) behaves.

When `eth_estimateGas` or `eth_createAccessList` is called without any
gas limit in the payload, geth will choose the block's gas limit or the
`RPCGasCap`, which can be larger than the `maxTxGas`.

When this happens for `estimateGas`, the gas estimation just errors out
and ends, when it should continue doing binary search to find the lowest
possible gas limit.

This PR will: 
- Add a check to see if `hi` is larger than `maxTxGas` and cap it to
`maxTxGas` if it's larger. And add a special case handling for gas
estimation execute when it errs with `ErrGasLimitTooHigh`

---------

Co-authored-by: Gary Rong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants