fix(anvil): return error for eth_getLogs with unknown blockHash instead of empty#14371
Merged
mattsse merged 1 commit intofoundry-rs:masterfrom Apr 20, 2026
Merged
Conversation
Match Geth's behavior by returning a JSON-RPC error (-32000 "unknown block") when eth_getLogs is called with a blockHash that doesn't resolve to a known block, instead of silently returning an empty array. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
stevencartavia
approved these changes
Apr 17, 2026
mablr
approved these changes
Apr 17, 2026
mattsse
approved these changes
Apr 20, 2026
Contributor
Author
|
Thank you all for the fast response 🚀 |
spalladino
added a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Apr 21, 2026
When rolling back local L1 to L2 messages, we query each message against L1 by fetching its log. Since #22154 (v5) this was done via blockHash. However, querying logs by blockhash throws an RPC error if the block no longer exists, which is likely if the local message was removed due to an L1 reorg. We never hit this during testing because of foundry-rs/foundry#14371. To fix this, we know query by an L1 block number range. This also allows to still find the locall message on L1 even if it was moved by a few blocks due to a small reorg. Additionally, this PR adds a fast-path in `rollbackL1ToL2Messages` that matches the local rolling hash against the current remote state, so we don't query by event when we don't need to.
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.
Return a JSON-RPC error (-32000 "unknown block") when eth_getLogs is called with a blockHash that doesn't resolve to a known block, instead of silently returning an empty array. This aligns with how geth and other clients behave:
See also paradigmxyz/reth#7371
Code written with Claude.