Skip to content

Serve block_gossip events for gossip publication requests - #248

Merged
Bronek merged 2 commits into
mainfrom
bronek/sse_block_gossip_v2
Sep 14, 2026
Merged

Bronek merged 2 commits into
mainfrom
bronek/sse_block_gossip_v2

Conversation

@Bronek

@Bronek Bronek commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Add block_gossip to /eth/v1/events. The promise is: these events correspond to what we publish on gossip. An event reports silver's publication request, not successful delivery to a peer.

This deliberately narrows the Beacon API's validation event. Upstream covers blocks received through P2P or API after gossip validation, without requiring publication. Silver additionally requires a relay request, so validated RPC imports and disk replay produce no block_gossip event.

A request precedes payload notification, state transition, and import; a later import failure does not retract it. The existing block topic remains tied to Applied receipts. Repeated requests are not deduplicated, and late subscribers receive no replay. The two queues establish no shared ordering; subscribing to both topics can reach the existing send cap sooner.

event: block_gossip
data: {"slot":"<decimal>","block":"0x<64 lowercase hex>"}

This PR targets main; bronek/sse_data_column_sidecar_v2 follows. Neither PR depends on PR #231 or its head topics.

  • Carry block metadata on gossip relay requests: attach slot and root at both existing relay sites. Producer and Controller tests cover selection, import receipts, routing, and IWANT service.
  • Serve block_gossip events over SSE: add the topic, renderer, and boundary consumer outside the engine capacity gate. Socket tests cover isolation, repeats, late subscribers, and engine saturation.

The ADR-0004 amendment records the publication contract and deliberate divergence. P2P conformance gaps remain tracked separately.

Message sizes and ring capacities are unchanged.

Coverage limits: no Gloas fixture exercises the full AwaitParentPayload retry with its envelope. The proposer-lookahead test bypasses signatures. Relay tests require ef_tests, enabled by just nextest.

@Bronek
Bronek added this pull request to stack #250 September 11, 2026 15:22
@Bronek
Bronek force-pushed the bronek/sse_block_gossip_v2 branch from ec947ff to 79dbcfc Compare September 11, 2026 15:54
msg_hash: MessageId,
recv_ts: Nanos,
protobuf: TCacheRead,
block: Option<GossipBlock>,

@vladimir-ea vladimir-ea Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

don't like this! we should not have some extra data relating to one message type on a general message like this.

I realise I advocated using this event but I thought you actually wanted to send the block and not the block root and slot.

I think the stream should use the BeaconStateEvent::PersistBlock as its trigger

@vladimir-ea vladimir-ea Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this also has the upside of not requiring any beacon state tile changes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

based on the discussion Friday and the fact that there are multiple streams on the 'gossip' trigger, lets keep it simple and continue to use the SendGossip event but lets include the ssz TCacheRead in the event, not values needed for 1 or 2 beacon apis - and just recalculate the block root in the api tile. If that turns out to be problematic we can think again.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 0833481 ( #249 )

Attach GossipBlock { slot, block_root } to existing SendGossip requests
at both block relay sites. RPC retains its empty callback, and other
topics carry no block record.

This prepares SSE publication without a new block stage or second
spine notification. Relay selection, import receipts, and networking
behaviour remain unchanged.

Eight block_relay tests cover metadata in both sync modes, RPC and
replay silence, staging, missing-parent retry, rejected imports, bad
signatures, and disabled relay. They require ef_tests, enabled by
just nextest. Fixture slots come from the decoded blocks.

Existing producer tests check absent metadata for nine non-block
topic families. The proposer-lookahead test checks eligibility in
both sync modes while bypassing signature verification.

A Controller test injects opaque payloads through the spine and
enters loop_body. With metadata absent and present, forwarding
preserves bytes and recipient selection, and IWANT service works.
The peer-manager test retains sender and IDONTWANT exclusions.

Fixture limits: gossip tests reuse SSZ handles as unread protobuf
handles. DA completion enters its handler without running the
columns tile. No fixture covers the full Gloas AwaitParentPayload
retry; the relay-disabled test checks its handler flag directly.

Validation, all exit zero:
- just fmt-check
- just clippy
- just nextest
- git diff --check

1,357 tests passed; 5 skipped.

Assisted-by: Codex:gpt-6-astra
Publish block_gossip from block metadata on existing SendGossip requests.
The boundary consumes PeerEvent outside the engine capacity gate.
It selects the metadata without reading the gossip payload.

This deliberately narrows the Beacon API's validation contract.
RPC imports remain silent because they do not request gossip publication.
A publication request does not guarantee delivery to peers.

Keep block tied to Applied receipts. Repeated publication requests
produce repeated events, and late subscribers receive no event replay.
The two spine queues establish no shared ordering.

Wire event: block_gossip
Data: {"slot":"<decimal>","block":"0x<64 lowercase hex>"}

Amend ADR-0004 with the publication contract and its exclusions.
Subscribers to both topics can reach the existing send cap sooner.
Message layouts and the peer_events ring are unchanged.

Extend topic parsing coverage with standalone and mixed subscriptions.
Check the renderer's required fields as parsed JSON.

Socket tests enter through the boundary's loop_body with spine inputs.
One scenario checks separate and mixed subscriptions, repeated requests,
and isolation from unrelated publications and block imports.
Trailing events keep unwanted publications within the events read.
The existing block test retains its receipt-stage coverage.

A late subscriber connects after an earlier subscriber receives an event.
Another test serves gossip notifications with unanswered FCU requests
occupying engine capacity. Startup requests receive responses.
Opaque payload bytes avoid coupling these fixtures to block serialization.

The test client decodes HTTP and SSE before checking event names and
required JSON fields. It permits additional fields and does not require
an ordering between the two topics.

A temporary renderer with reordered keys, extra whitespace, and an
additional nested field passed all 1,361 tests.

Two fault controls each failed one test, with just nextest exiting 100:
- Publishing Applied imports on both topics failed block_subscriptions_select_imports_and_preserve_repeated_relay_requests.
- Gating the peer-event consumer on engine capacity failed a_gossip_event_is_served_while_the_engine_pool_is_saturated.

All controls were restored. Final validation, each exiting zero:
- just fmt-check
- just clippy
- just nextest: 1,361 passed, 5 skipped
- git diff --check

Assisted-by: Codex:gpt-6-astra
@Bronek
Bronek force-pushed the bronek/sse_block_gossip_v2 branch from 79dbcfc to 7194762 Compare September 11, 2026 17:02
@Bronek
Bronek merged commit a8f089c into main Sep 14, 2026
2 of 3 checks passed
@Bronek
Bronek deleted the bronek/sse_block_gossip_v2 branch September 14, 2026 12:34
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