Skip to content

feat(events): add chain_reorg and safe_target chain events#533

Draft
MegaRedHand wants to merge 1 commit into
mainfrom
feat/events-reorg-safe-target
Draft

feat(events): add chain_reorg and safe_target chain events#533
MegaRedHand wants to merge 1 commit into
mainfrom
feat/events-reorg-safe-target

Conversation

@MegaRedHand

@MegaRedHand MegaRedHand commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Continues the chain-event pub-sub series (#516 / #517 / #518, all merged). Adds the two cheap follow-up topics, both derived from the existing actor-layer snapshot diff.

Events added

Topic Payload Emitted when
chain_reorg { slot, depth, old_head_block, old_head_state, new_head_block, new_head_state } Fork choice switches to a head off the old head's chain (same recency gate as head)
safe_target { slot, block } The interval-3 fork-choice safe attestation target advances

Notes

  • chain_reorg reuses store::reorg_depth, widened to pub(crate) so the actor diff and block processing share one definition of "reorg". Recency-gated like head (HEAD_EVENT_RECENCY_SLOTS) and emitted just before it, matching beacon ordering; payload mirrors the beacon chain_reorg shape minus epoch/execution_optimistic.
  • safe_target is an ethlambda extension with no beacon analog; ungated since it coalesces to the latest value (the only one that matters).

Testing

cargo fmt, cargo clippy -p ethlambda-blockchain (clean), blockchain lib tests pass, including two new unit tests: chain_event_diff_emits_chain_reorg_before_head and chain_event_diff_emits_safe_target.


Independent PR, based off main. One of three sibling PRs continuing the series — alongside #534 (attestation/aggregate) and #535 (block_gossip), each independently based off main. They touch overlapping regions of events.rs / docs/rpc.md, so whichever two merge later will each need a small conflict rebase. Opened as draft.

Extend the /lean/v0/events stream with two cheap follow-up topics
derived from the actor-layer snapshot diff.

chain_reorg: fork choice switched to a head off the old head's chain.
Reuses store::reorg_depth (widened to pub(crate) so the actor diff and
block processing share one definition of "reorg"); recency-gated like
head and emitted just before it. Mirrors the beacon chain_reorg payload
minus epoch/execution_optimistic.

safe_target: the interval-3 fork-choice safe attestation target
advanced. Ungated since it coalesces to the latest value, the only one
that matters; an ethlambda extension with no beacon analog.
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.

1 participant