Skip to content

fix(rpc): return -32602 error for eth_getLogs with pending block tag - #430

Closed
osr21 wants to merge 1 commit into
circlefin:mainfrom
osr21:fix/eth-get-logs-pending-error
Closed

osr21 wants to merge 1 commit into
circlefin:mainfrom
osr21:fix/eth-get-logs-pending-error

Conversation

@osr21

@osr21 osr21 commented Sep 17, 2026

Copy link
Copy Markdown

Problem

Closes #426.

When eth_getLogs is called with "fromBlock": "pending" or "toBlock": "pending", Reth resolves "pending" as head + 1 and returns an empty array []. Arc intentionally hides all pending-block state for public RPC nodes, so returning [] silently misleads callers into thinking no logs exist at the current head.

Solution

Add a pending_logs_error guard in NoPendingTransactionsRpcMiddleware::intercept_or_forward that detects "pending" tags in eth_getLogs filter params and returns a -32602 Invalid params error:

{
  "code": -32602,
  "message": "\"pending\" block tag is not supported for eth_getLogs on Arc; use \"latest\" instead"
}

This is consistent with how the middleware handles other pending-block RPCs — rejecting with a structured error rather than returning a misleading empty or null result.

Changes

  • crates/evm-node/src/rpc_middleware.rs
    • Added ETH_GET_LOGS_METHOD and PENDING_LOGS_ERROR_CODE constants
    • Added pending_logs_error() helper that parses filter params and checks for pending tags (positional and object-form)
    • Wired the helper into intercept_or_forward, returning an error before the null-response path

Testing

Existing middleware unit tests cover the intercept_or_forward dispatch path. A targeted test for the new guard should be added in a follow-up (the in-module test harness does not yet exercise eth_getLogs params).

Reth resolves `"pending"` as `head + 1` for log queries, silently
returning `[]` rather than an error. Arc hides all pending-block state
for public RPC nodes, so surface this as an explicit Invalid Params
error instead of an empty array that misleads callers into thinking no
logs exist at the current head.

Fixes circlefin#426
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Unsigned Commits Detected

The following commits are missing a verified signature:

  • f778b4c by osr21

How to fix: Sign your commits.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @osr21,

Thank you for your interest in contributing to Arc Node.

This PR has been automatically closed because you are not assigned to issue #426. We require contributors to be explicitly assigned to an issue before submitting a PR.

To contribute properly:

  1. Comment on issue eth_getLogs: pending block tag resolves to head+1 instead of coercing to latest #426 requesting assignment
  2. Wait for maintainer approval
  3. Only submit a PR after you have been assigned

Please see our CONTRIBUTING.md for more details.

@github-actions github-actions Bot closed this Sep 17, 2026
@osr21
osr21 deleted the fix/eth-get-logs-pending-error branch September 17, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eth_getLogs: pending block tag resolves to head+1 instead of coercing to latest

1 participant