fix(rpc): cap simulate_v1 default gas limit to RPC gas cap#21402
Merged
Conversation
When eth_simulateV1 transactions don't specify a gas limit, the default is calculated as remaining block gas divided among such transactions. Previously this could exceed the RPC gas cap (50M by default), causing transaction hash mismatches with geth. This fix caps the default gas limit to call_gas_limit(), matching geth's CallDefaults behavior and the spec allowance for client-specific limits. Amp-Thread-ID: https://ampcode.com/threads/T-019bf0aa-8b57-7338-a8ec-a932111b46fc Co-authored-by: Amp <amp@ampcode.com>
klkvr
approved these changes
Jan 26, 2026
rakita
pushed a commit
that referenced
this pull request
Jan 26, 2026
Co-authored-by: Amp <amp@ampcode.com>
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.
Summary
Fixes a transaction hash mismatch between reth and geth in
eth_simulateV1for transactions that don't specify a gas limit.Problem
When
eth_simulateV1transactions don't specify a gas limit, the default is calculated as:This could result in gas limits exceeding the RPC gas cap (50M by default). For example, with a block gas limit of 75.4M and one transaction without gas specified, it would get 75.4M gas.
Geth caps this value to
CallDefaults(the RPC gas cap), resulting in different transaction hashes.Solution
Cap the calculated default gas limit to
call_gas_limit(), matching geth's behavior.This aligns with the eth_simulateV1 spec which allows clients to set their own global gas limits.
Testing
ethSimulate-blockhash-simpleHive test failure