Skip to content

Investigate: eth_getFilterLogs stateful behavior — Lotus parity or spec deviation? #7193

Description

@coderabbitai

Background

During review of PR #7172 (#7172), a question was raised about the behavior of eth_getFilterLogs vs eth_getFilterChanges.

Standard Ethereum spec defines:

  • eth_getFilterChanges — incremental/polling; returns only logs since the last poll (stateful).
  • eth_getFilterLogs — returns all logs matching the filter at the time of the call, regardless of previous polls (idempotent/non-stateful).

Lotus behavior (observed in node/impl/eth/events.go):
Both EthGetFilterLogs and EthGetFilterChanges call fc.TakeCollectedEvents(ctx), which drains the filter's accumulated event list. This makes both methods stateful and incremental — a deliberate (or accidental?) deviation from the standard Ethereum spec.

Forest's current behavior (after PR #7172):
Forest mirrors Lotus by using a shared poll_event_filter helper for both methods, making both stateful/incremental.

Question

Is the Lotus behavior intentional (i.e., Filecoin/Lotus defines its own semantics for eth_getFilterLogs) or is it a bug in Lotus?

Concretely, consider this sequence:

1. eth_getFilterChanges  → returns [log A, log B], poll state updated
2. eth_getFilterLogs     → returns [] (A and B already consumed!) ← is this correct?

According to the Ethereum spec, step 2 should return [log A, log B], but both Lotus and Forest currently return [].

Action Items

  • Verify with the Lotus team / spec whether this is intentional behavior or a bug.
  • If it is a bug in Lotus, decide whether Forest should deviate from Lotus and implement the spec-compliant behavior for eth_getFilterLogs.
  • Update Forest accordingly and document the chosen behavior.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions