Skip to content

feat: send ChainEvent::Reorg from node on host revert#95

Merged
prestwich merged 1 commit intodevelopfrom
prestwich/eng-1968
Mar 9, 2026
Merged

feat: send ChainEvent::Reorg from node on host revert#95
prestwich merged 1 commit intodevelopfrom
prestwich/eng-1968

Conversation

@prestwich
Copy link
Member

Summary

  • Make on_host_revert() async and use drain_above() from signet-storage to read rollup block headers and receipts before unwinding storage
  • Add notify_reorg() helper that constructs a ReorgNotification with removed block hashes and logs, and broadcasts it via ChainNotifier::send_reorg()
  • Patch signet-storage to james/eng-1978 branch which adds the drain_above method

Closes ENG-1968. Depends on init4tech/storage james/eng-1978 (ENG-1978).

Key design decisions

  • Rollup data, not host data: The ExEx reverted chain contains host blocks. Rollup block hashes/logs are read from storage via drain_above() before the unwind destroys them.
  • Ownership over cloning: notify_reorg takes Vec<DrainedBlock> by value and moves RpcLog.inner out rather than cloning.
  • Cold lag is safe: If cold storage hasn't indexed a block yet, no RPC subscriber has seen its logs, so empty receipts are correct.

Test plan

  • cargo clippy -p signet-node --all-features --all-targets — clean
  • cargo +nightly fmt — clean
  • cargo t -p signet-node — pass
  • Integration test with actual reorg scenario (manual)

🤖 Generated with Claude Code

@prestwich prestwich requested a review from a team as a code owner March 9, 2026 17:32
Wire up reorg notifications in on_host_revert() so the RPC layer
receives removed rollup block hashes and logs before storage is
unwound. Uses the new drain_above() method from signet-storage
which reads headers from hot storage and receipts from cold storage
before performing the unwind.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prestwich prestwich force-pushed the prestwich/eng-1968 branch from e2d26ba to 88f629e Compare March 9, 2026 17:36
Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

lgtm, the biggest change is on the actual deps, this looks fine

@prestwich prestwich merged commit 51ce47f into develop Mar 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants