feat(events): add chain_reorg and safe_target chain events#533
Draft
MegaRedHand wants to merge 1 commit into
Draft
feat(events): add chain_reorg and safe_target chain events#533MegaRedHand wants to merge 1 commit into
MegaRedHand wants to merge 1 commit into
Conversation
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.
This was referenced Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
chain_reorg{ slot, depth, old_head_block, old_head_state, new_head_block, new_head_state }head)safe_target{ slot, block }Notes
chain_reorgreusesstore::reorg_depth, widened topub(crate)so the actor diff and block processing share one definition of "reorg". Recency-gated likehead(HEAD_EVENT_RECENCY_SLOTS) and emitted just before it, matching beacon ordering; payload mirrors the beaconchain_reorgshape minusepoch/execution_optimistic.safe_targetis 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_headandchain_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 offmain. They touch overlapping regions ofevents.rs/docs/rpc.md, so whichever two merge later will each need a small conflict rebase. Opened as draft.