Skip to content

eth_subscribe logs: emit reorg-removed (removed: true) logs in subscription #7096

@akaladarshi

Description

@akaladarshi

Summary

Forest's eth_subscribe("logs") subscription does not emit reorg-removed logs. On a chain reorg, geth, reth, and Lotus all re-emit the logs of reverted tipsets/blocks with removed: true so subscribers can roll back state. Forest currently drops reverted tipsets entirely and only emits logs for applied tipsets.

The root cause is that Forest has no reverted-event tracking. EthEventHandler::collect_events recomputes events from tipset state on every query and hardcodes reverted: false. CollectedEvent.reverted is therefore always false, and EthLog.removed (src/rpc/methods/eth.rs, removed: event.reverted) is consequently always false.

How Lotus does it (reference design)

Lotus maintains reverted as a first-class property, two converging paths both feeding CollectedEvent.RevertedEthLog.Removed (Removed: ev.Reverted, node/impl/eth/events.go):

  • Persisted index (ChainIndexer / SQLite).
  • Live subscription push. An in-memory eventFilter registered as a head-change observer builds CollectedEvent{ Reverted: revert } from whether the head-change was an apply (false) or revert (true)

Completion Criteria

  • eth_subscribe("logs") re-emits the logs of reverted tipsets with removed: true on reorg (reverts emitted before applies).
  • Test coverage for the reorg removed-log path.

Metadata

Metadata

Assignees

Labels

Type: TaskDiscrete task to implement

Type

No type
No fields configured for issues without a type.

Projects

Status

New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions