fix(eth): tighten block range handling for filter APIs#13561
Merged
Conversation
Member
rvagg
commented
Mar 27, 2026
- Adds ErrBlockRangeExceeded with -32005 "limit exceeded" error code matching standard Ethereum JSON-RPC error code and message
- Enforces MaxFilterHeightRange on EthTraceFilter (node-level)
- Adds configurable EthTraceFilterMaxBlockRange (default 100) to the gateway, enforced via checkEthTraceFilterBlockRange
- Converts EthGetLogs parseBlockRange errors to ErrBlockRangeExceeded for consistency with Ethereum ecosystem error conventions
- Adds --eth-trace-filter-max-block-range CLI flag to lotus-gateway
- Integration tests covering node and gateway limits for both v1 and v2
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens Ethereum JSON-RPC filter block-range handling across node and gateway, standardizing on an Ethereum-compatible -32005 limit-exceeded error for oversize ranges and adding gateway-specific enforcement for trace_filter.
Changes:
- Introduces
api.ErrBlockRangeExceededwith JSON-RPC code-32005and uses it foreth_getLogs/trace_filterrange-limit violations. - Enforces
MaxFilterHeightRangefortrace_filterat the node layer and adds a gatewayEthTraceFilterMaxBlockRange(default 100) with CLI flag support. - Adds/updates integration and unit tests plus config/docs/changelog updates for the new behavior.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| node/modules/eth.go | Wires EventsConfig.MaxFilterHeightRange into EthTrace API construction. |
| node/impl/eth/trace.go | Adds node-level trace_filter block-range enforcement via ErrBlockRangeExceeded. |
| node/impl/eth/events.go | Propagates ErrBlockRangeExceeded unwrapped; converts parseBlockRange limit errors to structured RPC error. |
| node/impl/eth/events_test.go | Updates tests to assert the new error type/message behavior for block-range parsing. |
| node/config/types.go | Updates config comment to include trace_filter applicability. |
| node/config/doc_gen.go | Updates generated config docs accordingly. |
| node/builder_chain.go | Passes Events config into trace API module wiring. |
| gateway/node.go | Adds gateway-level config/default for EthTraceFilterMaxBlockRange and option wiring. |
| gateway/eth_utils.go | Adds gateway-side block-tag resolution + range check helper for trace_filter. |
| gateway/proxy_eth_v1.go | Adds gateway-side trace_filter range enforcement hook (v1). |
| gateway/proxy_v2.go | Adds gateway-side trace_filter range enforcement hook (v2). |
| cmd/lotus-gateway/main.go | Adds --eth-trace-filter-max-block-range flag and wires it into gateway options. |
| itests/gateway_test.go | Adds integration coverage for node + gateway limits and raw JSON-RPC error code validation. |
| documentation/en/default-lotus-config.toml | Documents that MaxFilterHeightRange applies to logs and trace_filter limits. |
| api/api_errors.go | Adds ELimitExceeded/ErrBlockRangeExceeded JSON-RPC codec registration. |
| CHANGELOG.md | Records the behavior change for users/operators. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Adds ErrBlockRangeExceeded with -32005 "limit exceeded" error code matching standard Ethereum JSON-RPC error code and message - Enforces MaxFilterHeightRange on EthTraceFilter (node-level) - Adds configurable EthTraceFilterMaxBlockRange (default 100) to the gateway, enforced via checkEthTraceFilterBlockRange - Converts EthGetLogs parseBlockRange errors to ErrBlockRangeExceeded for consistency with Ethereum ecosystem error conventions - Adds --eth-trace-filter-max-block-range CLI flag to lotus-gateway - Integration tests covering node and gateway limits for both v1 and v2
a5f90f8 to
34a274a
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Kubuxu
reviewed
Mar 30, 2026
Kubuxu
approved these changes
Mar 30, 2026
rjan90
pushed a commit
that referenced
this pull request
Mar 31, 2026
- Adds ErrBlockRangeExceeded with -32005 "limit exceeded" error code matching standard Ethereum JSON-RPC error code and message - Enforces MaxFilterHeightRange on EthTraceFilter (node-level) - Adds configurable EthTraceFilterMaxBlockRange (default 100) to the gateway, enforced via checkEthTraceFilterBlockRange - Converts EthGetLogs parseBlockRange errors to ErrBlockRangeExceeded for consistency with Ethereum ecosystem error conventions - Adds --eth-trace-filter-max-block-range CLI flag to lotus-gateway - Integration tests covering node and gateway limits for both v1 and v2
8 tasks
rjan90
pushed a commit
that referenced
this pull request
Mar 31, 2026
- Adds ErrBlockRangeExceeded with -32005 "limit exceeded" error code matching standard Ethereum JSON-RPC error code and message - Enforces MaxFilterHeightRange on EthTraceFilter (node-level) - Adds configurable EthTraceFilterMaxBlockRange (default 100) to the gateway, enforced via checkEthTraceFilterBlockRange - Converts EthGetLogs parseBlockRange errors to ErrBlockRangeExceeded for consistency with Ethereum ecosystem error conventions - Adds --eth-trace-filter-max-block-range CLI flag to lotus-gateway - Integration tests covering node and gateway limits for both v1 and v2
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.