Skip to content

feat(events): add block_gossip chain event#535

Draft
MegaRedHand wants to merge 2 commits into
mainfrom
feat/events-block-gossip
Draft

feat(events): add block_gossip chain event#535
MegaRedHand wants to merge 2 commits into
mainfrom
feat/events-block-gossip

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 beacon block_gossip analog.

Event added

Topic Payload Emitted when
block_gossip { slot, block } A block is seen on the network, before import

Notes

  • Emitted from the blockchain actor's NewBlock handler, not a second P2P-side publisher, so the actor stays the sole event publisher and the write flow stays one-directional (a core requirement of the series' design).
  • Fires for both gossip'd and by-root-fetched blocks, since both re-enter through NewBlock. Import may pend the block while its parent chain is fetched, so this precedes import.
  • Ungated like block (not recency-gated), so subscribers can watch sync progress. Low-rate (one per block), so the payload is built unconditionally behind emit's no-subscriber guard.

Testing

cargo fmt, cargo clippy -p ethlambda-blockchain -p ethlambda-rpc (clean), blockchain lib + rpc events tests pass.


Independent PR, based off main. One of three sibling PRs continuing the series — alongside #533 (chain_reorg/safe_target) and #534 (attestation/aggregate), 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.

@MegaRedHand
MegaRedHand force-pushed the feat/events-attestation-aggregate branch from 51184e6 to 5be589f Compare July 21, 2026 22:44
Add the block_gossip topic to the /lean/v0/events stream, the analog of
the beacon block_gossip event: a block seen on the network before import
(import may pend it while its parent chain is fetched).

Emitted from the blockchain actor's NewBlock handler rather than a
second P2P-side publisher, so the actor stays the sole event publisher
and the write flow stays one-directional. Fires for both gossip'd and
by-root-fetched blocks, since both re-enter through NewBlock. Ungated
like block (not recency-gated), so subscribers can watch sync progress.
Low-rate (one per block), so the payload is built unconditionally behind
emit's no-subscriber guard.
@MegaRedHand
MegaRedHand force-pushed the feat/events-block-gossip branch from e17223c to a492c00 Compare July 22, 2026 13:35
@MegaRedHand
MegaRedHand changed the base branch from feat/events-attestation-aggregate to main July 22, 2026 13:35
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