rpc: return -32602 when eth_getLogs exceeds block range limit#20424
Merged
lupin012 merged 3 commits intoApr 12, 2026
Merged
Conversation
lupin012
reviewed
Apr 10, 2026
5de8700 to
c81ddcf
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Updates eth_getLogs so exceeding the configured block range limit is treated as an invalid-params error (-32602) rather than a generic server error (-32000), aligning error semantics with other parameter-validation paths and other clients.
Changes:
- Return
rpc.InvalidParamsErrorfromgetLogsV3when(end-begin) > rangeLimit. - Update
TestGetLogs_RangeLimitExceededto assert the exact RPC error code and message.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
rpc/jsonrpc/eth_receipts.go |
Switches block range limit violation to InvalidParamsError while preserving the existing error message. |
rpc/jsonrpc/erigon_receipts_test.go |
Strengthens the range-limit test to validate RPC error type/code/message precisely. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c81ddcf to
e39d996
Compare
lupin012
approved these changes
Apr 12, 2026
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.
This PR updates
eth_getLogsso that when the requested block range is larger than the configured range limit, Erigon returns-32602(invalid params) instead of-32000(server error). This makes the behavior consistent with the other parameter validation errors already used in the sameeth_getLogsflow and aligns Erigon with other clients such as Reth.The change is implemented in
getLogsV3by returning an RPC invalid-params error for the block range limit check, while keeping the existing error message format unchanged. The related test was also updated to verify the exact RPC behavior, including that the returned error code is-32602and that the message remainsquery block range exceeds server limit, narrow your filter: 5.