Repository navigation
fix(anvil): respect genesis number in RPC lookups - #17731
Merged
Merged
Conversation
With a non-zero genesis block (--number N), eth_feeHistory, eth_getTransactionBySenderAndNonce, anvil_rollback and anvil_reorg looked up blocks below genesis, which made plain cast send fail on a fresh node. Bound these lookups by the genesis number outside fork mode, and do the same for ots_getContractCreator and debug_executionWitness.
stevencartavia
requested review from
0xrusowsky,
DaniPopes,
figtracer,
grandizzy,
mablr and
mattsse
as code owners
October 22, 2026 02:59
mablr
previously approved these changes
Oct 22, 2026
Retain both the genesis fee-history regression and the Amsterdam state gas reservoir test added at the same location.
mablr
approved these changes
Oct 22, 2026
mablr
enabled auto-merge (squash)
October 22, 2026 09:27
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.
Fixes #17725.
When anvil starts with a non-zero genesis block (
--number N), several RPC methods still treated block 0 as the start of the chain and looked up blocks belowNthat don't exist. The most visible effect was that a plaincast sendfailed on a fresh node, becauseeth_feeHistoryerrored during fee estimation.eth_feeHistorynow limits its range to the blocks that exist, as it already does with genesis 0.eth_getTransactionBySenderAndNoncestarts its search at the block after genesis.anvil_rollbackandanvil_reorgnow reject a depth that would go below genesis with the usual invalid-params error, instead of a generic "Resource not found". Two neighboring spots get the same treatment:ots_getContractCreatorno longer scans heights below genesis, anddebug_executionWitnessreports the configured genesis as having no parent state. Fork mode is unchanged, since blocks before the fork are already served by the fork provider.