Skip to content

fix(eth): tighten block range handling for filter APIs#13561

Merged
rvagg merged 3 commits intomasterfrom
rvagg/filter-limits
Mar 31, 2026
Merged

fix(eth): tighten block range handling for filter APIs#13561
rvagg merged 3 commits intomasterfrom
rvagg/filter-limits

Conversation

@rvagg
Copy link
Copy Markdown
Member

@rvagg 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

Copilot AI review requested due to automatic review settings March 27, 2026 08:14
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FilOz Mar 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ErrBlockRangeExceeded with JSON-RPC code -32005 and uses it for eth_getLogs/trace_filter range-limit violations.
  • Enforces MaxFilterHeightRange for trace_filter at the node layer and adds a gateway EthTraceFilterMaxBlockRange (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.

Comment thread gateway/proxy_eth_v1.go Outdated
Comment thread node/impl/eth/events.go
Comment thread api/api_errors.go
Comment thread gateway/eth_utils.go Outdated
Comment thread gateway/eth_utils.go Outdated
Comment thread gateway/proxy_v2.go Outdated
- 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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread gateway/proxy_eth_v1.go
Comment thread gateway/proxy_v2.go
Comment thread gateway/eth_utils.go
Comment thread node/impl/eth/events.go Outdated
@BigLep BigLep moved this from 📌 Triage to 🔎 Awaiting Review in FilOz Mar 27, 2026
@Kubuxu Kubuxu self-requested a review March 30, 2026 10:56
Comment thread gateway/eth_utils.go
@github-project-automation github-project-automation Bot moved this from 🔎 Awaiting Review to ✔️ Approved by reviewer in FilOz Mar 30, 2026
@rvagg rvagg enabled auto-merge (squash) March 31, 2026 04:52
@rvagg rvagg merged commit 60f3b0b into master Mar 31, 2026
98 checks passed
@rvagg rvagg deleted the rvagg/filter-limits branch March 31, 2026 05:33
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FilOz Mar 31, 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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

4 participants