Skip to content

feat(rpc): emit gloas events and head_v2 on /eth/v1/events - #748

Open
MegaRedHand wants to merge 15 commits into
mainfrom
feat/beacon-gloas-events
Open

MegaRedHand wants to merge 15 commits into
mainfrom
feat/beacon-gloas-events

Conversation

@MegaRedHand

Copy link
Copy Markdown
Collaborator

Summary

GET /eth/v1/events accepted every gloas topic but emitted none of them, so contributoor (ethPandaOps) had nothing to show for our nodes on Sepolia. This emits:

Topic Emitted when
head_v2 next to every head (pre-gloas with payload_status: "full"), and again for the same block on an empty -> full payload status change
block unchanged, plus builder_index and block_hash for gloas blocks (absent before)
execution_payload, execution_payload_available the chain actor imports an envelope
execution_payload_gossip an envelope passes gossip validation, or POST /eth/v1/beacon/execution_payload_envelopes accepts it
execution_payload_bid, proposer_preferences, payload_attestation_message passes gossip validation, or the matching POST accepts it

head is deprecated by the specification in favour of head_v2 and is still emitted. docs/rpc.md has the new rows, drops the stale "this build stops at fulu" sentence, and documents the execution_payload_available timing.

Design notes

  • Publisher. Bids, preferences and payload attestation messages are validated in ethlambda-p2p and never reach the chain actor, and p2p does not depend on ethlambda-blockchain (which owns EventBus). So ethlambda-network-api gets a GossipEventSink trait and a GossipEvent enum, EventBus implements the trait, and main.rs passes Some(Arc::new(events.clone())) into P2P::spawn (new last parameter). The p2p side is one function, publish_gossip_event, called from Validated::forward on Accept only, behind has_subscribers(). The API handlers already run next to the bus, so they emit directly through a small emit_accepted helper; the bus is an Option<Extension<EventBus>> there so routers built without one (the handlers' own tests) still serve.
  • Envelope gossip: sink, not BlockAnnouncement. Accepted gossip envelopes do reach the actor, but new_execution_payload_envelope carries no accepted-versus-queued flag, and gossip also forwards Queued envelopes through it. Following the block_gossip pattern would have meant a new parameter on that trait method and every implementor and test double. The sink already exists for the other three, takes Accept only, and touches one function.
  • execution_payload_available. Emitted right after execution_payload, from the same import. The actor imports an envelope only once the payload is verified and every sampled column is stored, which is what the event reports, so there is no later moment to wait for.
  • head_v2 dependent roots. current_epoch_dependent_root is the root at start_slot(epoch - 1) - 1 and next_epoch_dependent_root the root at start_slot(epoch) - 1, genesis root on underflow. These are head's previous_duty_dependent_root and current_duty_dependent_root renamed, so they come from the same NewChain::dependent_root.
  • payload_status. full for every pre-gloas head. From gloas on it follows Store::head_payload_status, with empty when none is recorded yet. The re-emission is driven by the EventView (the head and its recorded status as last reported), so it fires once per empty -> full transition and nothing else repeats (full -> empty is optional in the specification and left out). Both head_v2 emissions keep the 32-slot recency gate head has.
  • version on head_v2 is the head state's fork; the bid, message and preferences wrappers are always gloas.
  • block fields are Options with skip_serializing_if, so a pre-gloas block's JSON is byte-identical to before.
  • A head move now puts two beacon events on the shared ring instead of one. The existing head tests read through drain, which leaves head_v2 out; the new ones use drain_all.

Test plan

  • cargo fmt --all
  • cargo clippy -p ethlambda-network-api -p ethlambda-blockchain -p ethlambda-p2p -p ethlambda-rpc -p ethlambda --all-targets --profile release-fast -- -D warnings
  • cargo test -p ethlambda-blockchain --profile release-fast --lib -- events: JSON shape of every new payload against the specification examples (field names, quoting, version wrapper), the sink-to-topic mapping, the payload_status label.
  • cargo test -p ethlambda-blockchain --profile release-fast --lib -- head_v2 imported_envelope block_event_carries ... and the existing beacon event tests: head_v2 dependent roots across epochs 0 to 2 including underflow, the pre-gloas full, the empty -> full re-emission (and that full -> empty and a repeat do not re-emit), publish_envelope_imported, and the block event's bid fields.
  • cargo test -p ethlambda-rpc --profile release-fast --lib -- beacon::: an accepted bid and accepted preferences are announced once in their wrapper, a refused or already-pooled bid is not.
  • cargo test -p ethlambda-blockchain --profile release-fast --features beacon-spec-tests --lib -- beacon_envelope against the v1.7.0-beta.2 fixtures: 47 passed, including an_imported_envelope_emits_execution_payload_then_available, which drives the actor's real envelope import.
  • Not covered by a test: the p2p publish_gossip_event function, and the payload attestation and envelope POST handlers' emission (same helper as the bid and preferences handlers).

ethPandaOps' contributoor subscribes to head_v2 and the gloas topics, and
ethlambda accepted every one of them without ever sending any, so the lab's
gloas views stayed empty for our nodes on Sepolia.

head_v2 goes out next to every head (pre-gloas with payload_status "full")
and again for the same block when its payload status goes from empty to
full. The block event gains builder_index and block_hash for gloas blocks.
The chain actor publishes execution_payload and execution_payload_available
on envelope import. Bids, proposer preferences, payload attestation messages
and accepted envelopes are validated in ethlambda-p2p and never reach the
actor, and p2p does not depend on the crate owning the event bus, so p2p
reports them through a GossipEventSink trait in ethlambda-network-api that
EventBus implements. The API handlers that accept the same objects publish
on the bus they already hold.
MegaRedHand added a commit that referenced this pull request Nov 2, 2026
ethPandaOps' contributoor subscribes to head_v2 and the gloas topics, and
ethlambda accepted every one of them without ever sending any, so the lab's
gloas views stayed empty for our nodes on Sepolia.

head_v2 goes out next to every head (pre-gloas with payload_status "full")
and again for the same block when its payload status goes from empty to
full. The block event gains builder_index and block_hash for gloas blocks.
The chain actor publishes execution_payload and execution_payload_available
on envelope import. Bids, proposer preferences, payload attestation messages
and accepted envelopes are validated in ethlambda-p2p and never reach the
actor, and p2p does not depend on the crate owning the event bus, so p2p
reports them through a GossipEventSink trait in ethlambda-network-api that
EventBus implements. The API handlers that accept the same objects publish
on the bus they already hold.

Cherry-picked from feat/beacon-gloas-events at 8274123.

Adapted onto #747: the p2p crate imports both `GossipEventSink` and the peer table types.
MegaRedHand added a commit that referenced this pull request Nov 2, 2026
…ash (#749)

contributoor subscribes to the Beacon API `fast_confirmation` event, which
this node accepted but never emitted for lack of a Fast Confirmation Rule.
`forkchoiceUpdated` had the same gap: the spec's `get_safe_execution_block_hash`
is built on the rule, so the safe block was a stand-in (the justified
checkpoint's payload).

Implement the rule from consensus-specs `master` at f993cf2 (not the pinned
beta.2, which ships no FCR fixtures and lacks the gloas empty-slot discount,
precise committee weight, the restart-resilient root and the
`support_discount <= maximum_support` assertion), one Rust function per spec
function in `beacon::fast_confirmation`. The beacon actor runs it once per
slot at the tick, after the head recompute and before `forkchoiceUpdated`, and
skips it (resetting its variables) while the head is more than 32 slots behind
the clock. Each run publishes a `fast_confirmation` event and its confirmed
block becomes the engine's safe hash, which removes the documented
spec deviation.

The spec's helpers walk the registry or the committees per block, which is
tens of passes per slot at mainnet size, so a run flattens each balance source
once, folds every block's attestation score from the latest messages in one
pass and sums cached per-slot committee weights; only epoch-crossing and
empty-slot ranges deduplicate validators. Tests check those sums against the
spec's set-based definitions and `get_attestation_score`.

Cherry-picked from feat/beacon-fast-confirmation at 5247749.

Adapted onto #748: its gloas `ChainEvent` variants sit beside `BeaconFastConfirmation`, and `docs/rpc.md` lists both PRs' events, with `fast_confirmation` dropped from the never-emitted list.
MegaRedHand added a commit that referenced this pull request Nov 2, 2026
feat(rpc): emit single_attestation for gossip-accepted subnet attestations

ethPandaOps' contributoor subscribes to single_attestation and never to
attestation, and ethlambda accepted that topic without ever sending it, so
the lab showed no attestation data for our nodes.

Subnet attestations are validated in ethlambda-p2p and never reach the chain
actor, so p2p reports an accepted one through the GossipEventSink that #748
added, and the event bus maps it to a ChainEvent on Topic::SingleAttestation.
It is the highest-rate event the node has (every attestation on its backbone
subnets), so the attestation is cloned only when a client is subscribed, and
the payload is boxed to keep the broadcast ring sized for the smaller
variants. The payload is the existing electra SingleAttestation container, so
its JSON form is the specification's.

Second commit: feat(rpc): emit single_attestation for API-submitted attestations

This is the specification's "(from P2P or API)" half of single_attestation:
POST /eth/v2/beacon/pool/attestations now reports each attestation that
passed validation and was handed to the network actor, the way the other
API handlers report what a validator client or builder submits.

It is a separate commit because emitting our own validators' attestations,
with near-zero propagation time, can link validator indices to this node,
which is why contributoor makes the topic opt-in. Dropping this commit leaves
the gossip-accepted events alone; docs/spec_deviations.md would then need a
line saying API submissions are not reported.

Cherry-picked from feat/beacon-single-attestation-event at 6a62106.
Adapted onto #749: events.rs keeps both the BeaconFastConfirmation and SingleAttestation variants and topic arms.
MegaRedHand added a commit that referenced this pull request Nov 5, 2026
…rs (#773)

The chain actor waited for every engine_newPayload inside the import,
so the head moved only after EL + state transition and the actor sat
idle for the EL round trip, handling nothing else. Gloas envelopes did
the same.

A pre-gloas block that is an optimistic candidate now imports as
optimistic as soon as its consensus checks pass, and a gloas envelope
applies with its payload NOT_VALIDATED. The newPayload question goes out
first, from a tokio task that reports back with a NewPayloadAnswered
message, and the answer is applied then as optimistic-sync.md applies a
verdict. Optimism already gates attestation data, so validators still
attest only to validated payloads.

- Payloads are sent parent-before-child, at most 4 in flight, and
  forkchoiceUpdated names the newest payload on the head's chain whose
  request is not queued or in flight (walking the waiting payloads'
  parent hashes), sent again when the head's own answer arrives, so a
  catch-up still feeds the EL a head.
- At most 128 payloads wait for an answer; past that the import is held
  until answers free room, so catch-up cannot run unboundedly ahead.
- No answer after the retry ladder keeps the block optimistic and asks
  again each slot. optimistic-sync.md says such a block MUST NOT be
  applied; it already is, so this is documented as a deviation.
- An envelope answered INVALID with a null latestValidHash (how Engine
  API V2+ reports a block hash mismatch) is taken back out and only that
  copy refused, matching Lighthouse and Prysm. Blocks built on a FULL
  payload wait for its answer, so nothing is built on an envelope that
  gets taken back out.
- A VALID answer for the current head sends `head` again without the
  optimistic flag, for validator clients that react to head events.

Non-candidate blocks (merge transition) and servers without a mailbox
(offline replay, the import benchmark) still wait for the answer inline.

On nightly, that inline wait is #755's: the request goes out from a task
and the block's state transition runs meanwhile, so the inline path keeps
its overlap, speculation metrics and EngineAnswer telemetry rows, and
#773's own inline helper (ask_payload_inline) is dropped. The engine
section of an import that asks without waiting is a recorded zero. An
applied envelope still publishes #748's execution_payload and
execution_payload_available events, now before its answer. Answers that arrive later write no el_sent/el_verdict
telemetry rows (#765): those come only from an import that waited.

Cherry-picked from perf/async-new-payload at 33d1969 (f23010e,
33d1969).

Claude-Session: https://claude.ai/code/session_011vghNmndKPkZinHRkVTwVB
emit_accepted was inserted between decode_list's doc comment and its
signature, so its doc opened with decode_list's description and decode_list
had none. Two comments also still said the chain actor is the bus's only
publisher, which stopped being true once p2p and the submission endpoints
emit accepted objects.
@MegaRedHand
MegaRedHand marked this pull request as ready for review November 17, 2026 18:52
@github-actions

Copy link
Copy Markdown

🤖 Claude Code Review

Review

Overall this is a careful, well-tested PR. The sink trait in ethlambda-network-api is a clean way to avoid a p2p → blockchain dependency, and the spec-example tests are good. A few issues, mostly edge cases and wasted work.

Correctness

  1. A None → Full transition never re-emits head_v2 (events.rs, publish_beacon_changes, the new else if).

    • payload_status_label reports an unrecorded gloas head (None) as "empty".
    • The repeat condition only fires on previous.payload_status == Some(PayloadStatus::Empty).
    • So when a head move publishes before fork choice has recorded a status, subscribers see "empty". When the status later becomes Full, they never get the second event the spec requires.
    • Fix: make the condition match the label semantics, e.g. previous.payload_status != Some(PayloadStatus::Full) && self.view.payload_status == Some(PayloadStatus::Full), gated on the head being gloas.
    • Add a test alongside a_head_whose_payload_arrives_gets_head_v2_again that starts from None.
  2. head_v2_event reads the status from the store, not from the head it describes (events.rs, head_v2_event).

    • It calls store.head_payload_status() rather than taking the status for new_chain.root.
    • This is correct today only because both callers pass the current head.
    • Passing self.view.payload_status, or a lookup keyed by new_chain.root, would make the function self-consistent with the view the diff was computed from.
  3. The envelope's slot comes from different sources on the two paths.

    • Gossip (verdict.rs, publish_gossip_event) uses envelope.message.payload.slot_number.
    • The API path (gloas_proposal.rs, post_envelope_emitting) uses block_slot.
    • These are equal only if gossip validation enforces payload.slot_number == block.slot before Accept. Please confirm it does. Otherwise, use the block's slot on both paths for consistency with execution_payload, which uses the block slot.
  4. Only one import site is hooked (beacon_envelope.rs ~L577).

    • publish_envelope_imported is called at a single place.
    • Please confirm every import path funnels through this function, including held envelopes released once columns arrive, and req/resp-fetched envelopes. Otherwise execution_payload will be silently missing for some imports.
  5. Possible double execution_payload_gossip / execution_payload_bid.

    • The API handlers emit after p2p.publish_*.
    • If any p2p publish path re-runs the object through Validated::forward (e.g. a local-loopback validation for the builder market), the event goes out twice.
    • The bid test uses a p2p stub, so it can't catch this. Worth a quick check.

Performance

  1. Clones happen eagerly despite the lazy closure. emit_accepted is documented as building the payload only behind the subscriber check, but every caller clones first:

    • bids.rs: let for_event = bid.clone();
    • proposer_preferences.rs: let for_event = signed.clone();
    • ptc.rs: let for_event = message.clone();

    The bid includes blob_kzg_commitments. Check events.is_some_and(|e| e.has_subscribers()) before cloning, e.g. let for_event = wants_event.then(|| bid.clone());. The envelope path already avoids this because it copies only scalars.

  2. publish_beacon_payload_arrived loads the full head state without a subscriber gate (events.rs).

    • It calls store.get_state(&head), a full BeaconState load, on every empty→full transition, roughly once per slot under gloas.
    • Add if !events.has_subscribers() { return; } up front, as publish_envelope_imported does.
    • Check that publish_beacon_head_change is gated the same way now that it builds a second event.

Minor / style

  1. Inconsistent gating in publish_gossip_event (verdict.rs).

    • The Envelope arm skips sink.has_subscribers() while the other arms check it.
    • This is harmless since it copies scalars only, but a single if !sink.has_subscribers() { return; } at the top would be simpler and uniform.
  2. Unreachable branch in serialize_quoted_option. The None => serializer.serialize_none() arm cannot run because of skip_serializing_if. That is fine, but a short comment or unreachable! would make the intent explicit. The current doc comment half-says this already.

  3. Import order in ptc.rs. use crate::beacon::emit_accepted; sits above the external crate imports. Move it into the existing crate:: block to match the other modules.

  4. Wording in lib.rs. The comment "Two words, taken before the match moves the block" is a bit cryptic. Something like "Captured before signed_block is moved below" is clearer.

Tests

Tests are thorough: spec examples, ordering, the empty→full repeat, and no repeat for full→empty. The missing case is Item 1 (None → Full).


Automated review by Claude · claude-opus-5-5 · custom prompt

@github-actions

Copy link
Copy Markdown

🤖 Codex Code Review

  • [P2] Optimistic Gloas payloads are reported as validated — events.rs:834. Envelope import accepts EL SYNCING/ACCEPTED responses and records them in block_payload_statuses, but is_beacon_optimistic() only checks the separate optimistic_roots map. Consequently, execution_payload.execution_optimistic is false even when execution validation is pending. Derive this flag from the Gloas payload verdict and add coverage for an envelope imported on SYNCING.

Tests could not run because the Rust toolchain attempted to write to the read-only rustup directory.


Automated review by OpenAI Codex · gpt-6.1-sol · custom prompt

@github-actions

Copy link
Copy Markdown

🤖 Gemini Code Review

Overall this PR is clean, well-structured, and thoroughly tested. The GossipEventSink abstraction in ethlambda-network-api keeps the crate dependency graph one-directional while wiring P2P and RPC acceptance events into the SSE stream.

A few minor issues and improvements found:

  1. Use envelope.message.slot instead of envelope.message.payload.slot_number in gossip event emission (crates/net/p2p/src/beacon/verdict.rs:422-427)

    Validated::Envelope(envelope) => GossipEvent::ExecutionPayloadGossip {
        slot: envelope.message.payload.slot_number,

    Gossip validation for execution_payload checks envelope.message.slot == block.slot, whereas payload.slot_number is an internal EL payload field that is only verified once the EL checks block_hash during payload import. Using envelope.message.slot here avoids emitting an unverified slot value and stays consistent with gloas_proposal.rs:1189 and beacon_envelope.rs:580.

    Also, checking if !sink.has_subscribers() { return; } once at the start of publish_gossip_event (verdict.rs:418) would let you drop the per-arm if sink.has_subscribers() guards and skip emitting ExecutionPayloadGossip when nobody is subscribed.

  2. Unconditional clones before emit_accepted defeat its lazy closure (crates/net/rpc/src/beacon/bids.rs:145, proposer_preferences.rs:141, ptc.rs:438)
    emit_accepted (crates/net/rpc/src/beacon/mod.rs:161-173) takes an FnOnce closure documented to avoid cloning when there are no subscribers, but the callers clone eagerly before moving the value into p2p.publish_*:

    let for_event = bid.clone();
    match p2p.publish_execution_payload_bid(bid) {
        Ok(()) => {
            emit_accepted(events.as_deref(), || {
                GossipEvent::ExecutionPayloadBid(Box::new(for_event))
            });

    To actually skip the clone (especially for SignedExecutionPayloadBid which carries blob_kzg_commitments) when nobody is listening, consider only cloning when events.as_deref().is_some_and(EventBus::has_subscribers).

  3. Duplicate dependent_root lookups on head change (crates/blockchain/src/events.rs:1169-1189)
    publish_beacon_head_change binds current_dependent and previous_dependent locally, and then head_v2_event (events.rs:1256-1257) calls new_chain.dependent_root(epoch.checked_sub(1)) and new_chain.dependent_root(Some(epoch)) a second time. Passing them (or computing them once) would avoid the redundant work.


Automated review by Gemini · gemini-4-argon · custom prompt

@github-actions

Copy link
Copy Markdown

🤖 Grok Code Review

The event wiring is careful overall: gossip emits only on Accept, large gloas objects are boxed, pre-gloas block fields are omitted rather than null, and the spec JSON examples are actually tested. A few correctness gaps are worth fixing before this is treated as validator-facing.

  1. head_v2 dependent roots look shifted one epoch early. In head_v2_event (crates/blockchain/src/events.rs, around the new BeaconHeadV2Event construction) current_epoch_dependent_root is dependent_root(epoch - 1) and next_epoch_dependent_root is dependent_root(epoch). That is the old previous_duty_dependent_root and current_duty_dependent_root, not the roots those names usually mean (start_slot(epoch) - 1 and start_slot(epoch + 1) - 1). The spec example test cannot catch this: both roots are the same hash. A validator client that treats current_epoch_dependent_root as the current duty root will sign against the wrong root. Please check the spec field prose, not the example, and add a fixture where the two roots differ (the epoch-1 / epoch-2 case in head_v2_dependent_roots_follow_the_epoch_and_underflow_to_genesis is the right place).

  2. The second head_v2 is dropped when status was never recorded as Empty. payload_status_label maps gloas None to "empty", but the transition in publish_beacon_changes only fires for Some(Empty) → Some(Full). If a head is announced while fork choice has not recorded a status, subscribers see empty and never get the follow-up when it becomes Full, unless some intermediate publish_beacon_changes happens to observe Empty. Widen the else if so a same-head transition to Full from anything other than Full repeats head_v2, and pass that status into head_v2_event instead of re-reading store.head_payload_status() with no root. That getter is a single head-global value; if it still describes the previous head at emit time, a reorg is labeled with the wrong payload_status.

  3. Gossip and API disagree on the envelope slot. publish_gossip_event in crates/net/p2p/src/beacon/verdict.rs sets execution_payload_gossip.slot from envelope.message.payload.slot_number. The POST path in crates/net/rpc/src/beacon/gloas_proposal.rs uses beacon block_slot. If slot_number is the execution block number, gossip subscribers get a wrong slot. Use the beacon slot on both paths (the envelope message slot / beacon_block_root's slot), and test it with a payload whose block number differs from the beacon slot.

  4. execution_optimistic on import may be stale. publish_envelope_imported (crates/blockchain/src/beacon_envelope.rs, just after verified.push_back) calls store.is_beacon_optimistic(block_root) at the moment the envelope is marked verified. If optimistic mode is cleared only later in that function, the event still says true after a payload that should have cleared it. Emit after that update, or the test in an_imported_envelope_emits_execution_payload_then_available will not catch it (the fixture is already non-optimistic).

  5. API handlers defeat the subscriber guard. emit_accepted is documented to build the payload only when someone is listening, but post_bid, post_proposer_preferences, and post_pool_payload_attestations clone the bid / preferences / message before that check (and before publish succeeds). Clone inside the closure. Also confirm publish_* does not re-enter Validated::forward: that path now emits on Accept, and the handlers emit again, so a local publish that is validated in-process would double-fire execution_payload_bid, proposer_preferences, payload_attestation_message, and execution_payload_gossip.

ptc.rs puts use crate::beacon::emit_accepted above the axum imports; rustfmt will want that moved down. Not functional.


Automated review by Grok (xAI) · grok-4.7 · custom prompt

@github-actions

Copy link
Copy Markdown

🤖 Kimi Code Review

Found three issues:

  1. head_v2 can miss the empty-to-full update — crates/blockchain/src/events.rs:767
    The repeat-event condition only recognizes Some(PayloadStatus::Empty) → Some(PayloadStatus::Full). However, EventView::payload_status explicitly allows None, and payload_status_label advertises None as "empty" for a gloas head. If the initial head event is emitted with None and the next observed status is Full, subscribers never receive the second head_v2 showing "full". Treat a previously advertised empty status—including None on gloas—as eligible for this transition, and add a None → Full regression test.

  2. Payload arrival can load a full beacon state with no subscribers — crates/blockchain/src/events.rs, publish_beacon_payload_arrived around line 1190
    This common gloas path performs block_slot_and_state_root and store.get_state(&head) before emitting, without the has_subscribers() guard used by publish_envelope_imported. On nodes with no event consumers, every head payload arrival can therefore incur an unnecessary state lookup/deserialization in the chain actor. Return early before any store access when nobody is subscribed.

  3. The accepted-event clones are not actually subscriber-gated — crates/net/rpc/src/beacon/bids.rs:145, proposer_preferences.rs:141, and ptc.rs:438
    emit_accepted defers only the closure; bid.clone(), signed.clone(), and message.clone() have already executed unconditionally. This contradicts the helper’s documentation and is most costly for bids carrying KZG commitments. Prepare the cloned event value only when a bus with subscribers exists, before passing the original object to p2p.

Otherwise, the publisher plumbing is clean, gossip events are correctly restricted to Accept, and the serialization and ordering tests are thorough.


Automated review by Kimi (Moonshot AI) · kimi-k3.1-pro · custom prompt

@github-actions

Copy link
Copy Markdown

🤖 DeepSeek Code Review

⚠️ Review failed: DeepSeek returned an empty content field (finish_reason=length, reasoning_content present=yes). Raise max_tokens or lower reasoning_effort ('none' disables thinking).


Automated review by DeepSeek

@MegaRedHand
MegaRedHand added this pull request to stack #842 November 19, 2026 20:40
…mistic

`execution_payload` read `execution_optimistic` from the store's
optimistic set, which only pre-gloas blocks enter: a gloas block carries
no payload of its own, so its import asks the execution client nothing
and its root is never added. An envelope the execution client answered
`SYNCING` or `ACCEPTED` was therefore reported as validated.

The flag now comes from the verdict the envelope was imported on, which
`apply_or_hold_envelope` already holds: anything short of `VALID` is
optimistic, the rule the Beacon API's envelope responses follow.
…stens

`emit_accepted` builds its event behind the subscriber check, but the
bid, preferences and payload attestation handlers cloned the object
before calling it, since the object itself moves into the publish. Every
submission paid the copy, a bid's KZG commitments included, on a node
nobody subscribes to.

`copy_if_listened` makes that copy under the same check, before the
publish. The envelope handler keeps its event: it copies four scalars.
Also moves `ptc.rs`'s `emit_accepted` import into its `crate::` block.
`head_v2_event` re-read `Store::head_payload_status` for its label while
`publish_beacon_changes` decided to emit from the `EventView`'s copy of
that status. Both read the same row for the same head, but the label now
takes the view's value, so the two cannot be read apart.

Also says where a `None` status can come from: only the view taken at
startup, since `get_head` records the status with its root before it
moves the head row. A head move therefore never announces an unrecorded
status, and the empty-to-full repeat has no `None` case to catch. And
rewords the comment on the `block` event's bid, captured before the
block moves.
@MegaRedHand

Copy link
Copy Markdown
Collaborator Author

Round one (the automated review of a7565b3). Fixed in c949d98, f2bd6d5 and a709342. make fmt and make lint pass. Tests were not run locally; CI runs them.

Fixed

  • execution_payload reported a SYNCING payload as validated (Codex P2; Grok, item 4):
    • The flag came from is_beacon_optimistic, i.e. the store's optimistic set. A gloas block carries no payload of its own, so its import asks the execution client nothing and its root never enters that set: the flag was always false.
    • publish_envelope_imported now takes the verdict the envelope was imported on, and anything short of VALID is optimistic. That is the rule the Beacon API's envelope responses already follow.
    • an_envelope_imported_on_syncing_or_accepted_is_optimistic (no fixtures needed) covers it. So does the mock-engine a_syncing_verdict_applies_the_envelope_as_not_validated, which now reads the event the actor's real import publishes.
    • The execution_payload row in docs/rpc.md says so. c949d98
  • Eager clones before emit_accepted (Claude, item 6; Gemini, item 2; Grok, item 5; Kimi, item 3): the bid, preferences and payload attestation handlers now copy the object with copy_if_listened before the publish. The copy is made only when the node has a bus and someone listens. The envelope handler copies four scalars and is unchanged. f2bd6d5
  • ptc.rs import order (Claude, item 10; Grok): emit_accepted moved into the crate:: block. f2bd6d5
  • head_v2_event read the status from the store (Claude, item 2): the label now takes the status the EventView holds, the value the diff that decided to emit read. The two always agreed, since head_payload_status answers only for the current head root, but now they cannot be read apart. a709342
  • "Two words, taken before the match moves the block" (Claude, item 11): reworded. a709342

Follow-up

  • The other beacon events' execution_optimistic under gloas: checking Codex's point showed that head, head_v2, block and finalized_checkpoint read the same optimistic set. Under gloas they are therefore always false, where the Beacon API responses walk to the payload the block builds on. That is pre-existing on main for every topic but head_v2, and the fix moves shared/optimistic.rs out of ethlambda-rpc: Beacon events report execution_optimistic: false for every gloas head and block #844.

Not changed

  • None -> Full never repeats head_v2 (Claude, item 1; Grok, item 2; Kimi, item 1): no head move announces None.
    • get_head, the only runtime writer of the beacon head, records the status with its root before it moves the head row (fork_choice.rs:2607-2613).
    • So a view taken after a head move always holds Empty or Full. None exists only in the view taken at actor start, before any head_v2 went out, so there is no announced empty to correct.
    • Widening the condition would instead send a spurious head_v2 for an unmoved pre-gloas head after every restart.
    • The comments that suggested the case ("a head move whose status is still pending") now say this.
  • A reorg labelled with the previous head's status (Grok, item 2): head_payload_status never returns another root's status (store.rs:2919-2937).
  • The envelope slot (Claude, item 3; Gemini, item 1; Grok, item 3): gossip rejects an envelope whose block slot differs from payload.slot_number before Accept (gossip/envelope.rs:142-145), so both paths report the block's slot. slot_number is the EIP-7843 slot, not a block number, and the gloas envelope has no message.slot field.
  • One import site (Claude, item 4): apply_or_hold_envelope is the only caller of accept_execution_payload_envelope. Every arrival (gossip, req/resp, the POST, the checkpoint source) enters through receive_envelope, and every held envelope is redriven through it by settle_envelopes.
  • Double emission on local publish (Claude, item 5; Grok, item 5): the publish paths go straight to swarm_handle.publish, and gossipsub never delivers a node its own message, so Validated::forward never sees them.
  • Head state loaded with no subscriber (Claude, item 7; Kimi, item 2): publish_beacon_changes returns before either head path when nobody listens (advance_view, events.rs:785-788).
  • One subscriber check at the top of publish_gossip_event (Claude, item 8; Gemini, item 1): the envelope arm copies four scalars, and the stacked feat(rpc): emit single_attestation on /eth/v1/events #757 adds an arm in the per-arm shape.
  • Dependent roots shifted an epoch (Grok, item 1): the specification's head_v2 text defines current_epoch_dependent_root at compute_start_slot_at_epoch(epoch - 1) - 1 and next_epoch_dependent_root at compute_start_slot_at_epoch(epoch) - 1, as implemented. The epoch-2 case of head_v2_dependent_roots_follow_the_epoch_and_underflow_to_genesis asserts two distinct roots.
  • serialize_none arm (Claude, item 9): a null is the right fallback if skip_serializing_if is ever dropped, where unreachable! would panic the stream.
  • Duplicate dependent-root lookups (Gemini, item 3): two vector reads on a loaded state. head_v2_event stays self-contained because the payload-arrival path, which has no head event, uses it too.

DeepSeek's review failed (empty content at finish_reason=length).

@MegaRedHand

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions

Copy link
Copy Markdown

🤖 Claude Code Review

Review of PR 748: gloas Beacon API events (head_v2, execution_payload*, bids, preferences, PTC messages)

Overall the PR is well structured. The GossipEventSink trait in ethlambda-network-api cleanly avoids a p2p → blockchain dependency, and the serialization tests match the spec examples. A few points are worth addressing.

Correctness

  1. execution_optimistic disagrees between execution_payload and head_v2 (events.rs, publish_beacon_payload_arrived)

    • publish_envelope_imported notes that gloas roots never enter the store's optimistic set, so it derives optimism from the EL verdict.
    • publish_beacon_payload_arrived and publish_beacon_head_change still use store.is_beacon_optimistic(head).
    • Effect: after an envelope imports on SYNCING/ACCEPTED, a subscriber sees execution_payload{execution_optimistic: true} immediately followed by head_v2{payload_status: "full", execution_optimistic: false} for the same block.
    • The same holds for any gloas head whose payload was imported optimistically.
    • Either track the envelope verdict per root, or document this as a known gap.
  2. Possible duplicate events for API-submitted objects (bids.rs, proposer_preferences.rs, ptc.rs, gloas_proposal.rs)

    • Each handler emits on a successful p2p.publish_*.
    • If the p2p actor routes self-published objects back through Validated::forward with Outcome::Accept, publish_gossip_event fires a second time. Candidates are envelopes (if the local publish path re-enters validation for import) and payload attestations (if the pool path goes through forward).
    • Bids look safe, because record_bid makes gossip re-delivery AlreadySeen. The other three deserve a confirming test like an_accepted_bid_is_announced_once_in_its_version_wrapper.
  3. Inconsistent envelope slot source.

    • p2p uses envelope.message.payload.slot_number (verdict.rs, publish_gossip_event).
    • The API path uses the looked-up block_slot.
    • publish_envelope_imported uses the block's slot.
    • Gossip validation presumably enforces equality, so this is harmless. Still, using one source (the block's slot, or payload.slot_number everywhere) would avoid surprises.

Performance

  1. Full state load on every payload arrival with no subscriber check (events.rs, publish_beacon_payload_arrived)

    • On gloas, the Empty → Full transition happens roughly every slot.
    • Each time, store.get_state(&head) deserializes a full BeaconState just to read two block roots for the dependent-root fields, even when nobody is subscribed.
    • Add if !events.has_subscribers() { return; } before the slot lookup and the state load.
    • If publish_beacon_head_change isn't already gated the same way, that applies there too.
  2. ChainEvent variant size.

    • PayloadAttestationMessage(Versioned<gloas::PayloadAttestationMessage>) is unboxed and holds a 96-byte BLS signature plus data.
    • BeaconHeadV2 is about 170 bytes.
    • Check size_of::<ChainEvent>() didn't grow, since every subscriber clones it through the broadcast channel. Boxing the PTC message would be consistent with the bid and preferences variants.

Rust / readability

  1. Shadowed method name in impl GossipEventSink for EventBus (events.rs)

    • EventBus::emit(self, event) resolves to the inherent emit(ChainEvent) because inherent methods win, so it is correct.
    • However, two emits with different argument types on the same type is easy to misread.
    • A comment, or renaming the inherent method, would help. emit_accepted already disambiguates explicitly with GossipEventSink::emit.
  2. Double subscriber check in the handlers. copy_if_listened checks has_subscribers(), then emit_accepted re-checks it. That is harmless but redundant. A single helper such as emit_accepted_owned(events, Option<T>, impl FnOnce(T) -> GossipEvent) would read cleaner than the repeated if let Some(x) = for_event { emit_accepted(...) } pattern in three handlers.

  3. serialize_quoted_option. The None => serialize_none() branch is unreachable given skip_serializing_if, which is fine. A debug_assert!/unreachable! comment is optional.

Tests

The coverage is good: spec-example round trips, ordering of execution_payload → available, the Empty → Full repeat, no repeat on Full → Empty, and None treated as empty. One gap is a test that a head_v2 re-emission is suppressed when the head is outside HEAD_EVENT_RECENCY_SLOTS, which is the recency path in publish_beacon_payload_arrived.


Automated review by Claude · claude-opus-5-5 · custom prompt

@github-actions

Copy link
Copy Markdown

🤖 Codex Code Review

  • [P1] head_v2 incorrectly reports Gloas heads as execution-validated — events.rs:1249. store.is_beacon_optimistic(head) only checks the pre-Gloas optimistic set. A Gloas head building on a payload with a SYNCING verdict therefore emits execution_optimistic: false, contradicting the REST API and potentially misleading validator clients. Move the Gloas-aware logic from shared/optimistic.rs::block_is_optimistic into a shared layer and use it for both head_v2 emission paths. Add coverage for a head building on an optimistic FULL parent.

Review based on static inspection; tests were not run.


Automated review by OpenAI Codex · gpt-6.1-sol · custom prompt

@github-actions

Copy link
Copy Markdown

🤖 Gemini Code Review

Great PR! The GossipEventSink abstraction in ethlambda-network-api cleanly keeps ethlambda-p2p decoupled from ethlambda-blockchain, and the spec test coverage for the new Gloas SSE events and head_v2 transitions is very thorough.

One minor suggestion in crates/net/p2p/src/beacon/verdict.rs:

  1. Use envelope.message.slot and check has_subscribers() upfront (crates/net/p2p/src/beacon/verdict.rs:417-440):
    In publish_gossip_event, ExecutionPayloadGossip reads envelope.message.payload.slot_number instead of envelope.message.slot. Gossip validation validates the envelope's consensus envelope.message.slot against the block slot and clock (matching what gloas_proposal.rs and beacon_envelope.rs emit), whereas payload.slot_number is only validated by the EL on import.
    Also, checking sink.has_subscribers() once at the top of publish_gossip_event avoids repeating the guard on each match arm and avoids constructing/emitting ExecutionPayloadGossip when nobody is listening:
    fn publish_gossip_event(server: &P2PServer, object: &Validated) {
        let Some(sink) = server
            .gossip_events
            .as_ref()
            .filter(|sink| sink.has_subscribers())
        else {
            return;
        };
        let event = match object {
            Validated::Envelope(envelope) => GossipEvent::ExecutionPayloadGossip {
                slot: envelope.message.slot,
                builder_index: envelope.message.builder_index,
                block_hash: envelope.message.payload.block_hash,
                block_root: envelope.message.beacon_block_root,
            },
            Validated::ExecutionPayloadBid { bid, .. } => {
                GossipEvent::ExecutionPayloadBid(bid.clone())
            }
            Validated::ProposerPreferences(preferences) => {
                GossipEvent::ProposerPreferences(preferences.clone())
            }
            Validated::PayloadAttestation(message) => {
                GossipEvent::PayloadAttestationMessage(message.clone())
            }
            _ => return,
        };
        sink.emit(event);
    }

Automated review by Gemini · gemini-4-argon · custom prompt

@github-actions

Copy link
Copy Markdown

🤖 DeepSeek Code Review

The PR is generally well-structured and keeps the event bus best-effort, but I found one protocol-level correctness issue and a performance concern.

  1. head_v2 dependent roots are off by one epoch (critical for API consumers).
    In crates/blockchain/src/events.rs, head_v2_event computes:

    current_epoch_dependent_root: new_chain.dependent_root(epoch.checked_sub(1)),
    next_epoch_dependent_root: new_chain.dependent_root(Some(epoch)),

    This emits the roots for the previous and current epochs, not current and next. The head event correctly uses epoch.checked_sub(1) for previous_duty_dependent_root and Some(epoch) for current_duty_dependent_root; head_v2 should instead use Some(epoch) for current_epoch_dependent_root and something equivalent to epoch.checked_add(1) for next_epoch_dependent_root.

    This matters because /eth/v1/events?topics=head_v2 consumers use those roots to compute proposer duties for the current and next epochs. The current implementation sends the previous epoch’s root under the current-epoch field, so a client built against the Beacon API spec will compute duties for the wrong epoch.

    The test head_v2_dependent_roots_follow_the_epoch_and_underflow_to_genesis and the BeaconHeadV2Event doc currently encode the same off-by-one expectation, so they should be updated along with the fix.

  2. Shared bounded event channel may now be overwhelmed by gossip traffic.
    EventBus still uses the single bounded broadcast channel (CHAIN_EVENT_CHANNEL_CAPACITY), but p2p now emits potentially frequent execution_payload_bid, payload_attestation_message, and proposer_preferences events onto it. A slow /eth/v1/events subscriber can be lagged by this gossip traffic and then miss consensus-critical events like head, head_v2, or finalized_checkpoint.

    This is a performance/liveness concern rather than a memory-safety bug, but for an event stream that already documents best-effort delivery, it may be worth using a larger capacity or a separate channel for the accepted/gossip topics to reduce starvation of the chain-actor events.

In publish_gossip_event in crates/net/p2p/src/beacon/verdict.rs, the Validated::Envelope arm also emits without a sink.has_subscribers() guard, unlike the bid/preferences arms. It is cheap for EventBus, but adding the guard would be consistent with the other arms and avoids unnecessary send attempts when nobody is listening.


Automated review by DeepSeek · deepseek-v4-pro · custom prompt

@github-actions

Copy link
Copy Markdown

🤖 Grok Code Review

The event wiring is careful (subscriber-gated clones, head then head_v2, spec JSON tests, optional gloas block fields). A few event-semantics bugs will mislead validator clients.

  1. execution_payload_available is emitted for non-VALID imports. publish_envelope_imported always emits it immediately after execution_payload, and execution_optimistic is verdict != PayloadStatusEnum::Valid. The new unit test expects that pair for SYNCING and ACCEPTED. The comments say import means the payload is verified and sampled columns are stored, but those verdicts are exactly “not verified.” Subscribers can treat an optimistic envelope as available. Gate execution_payload_available on PayloadStatusEnum::Valid (and on the column check), or stop importing SYNCING/ACCEPTED before that event.

  2. Gloas head_v2.execution_optimistic cannot go true. publish_beacon_payload_arrived (and the head-move path) uses store.is_beacon_optimistic(head). The new comments say a gloas root never enters that set, while an envelope imported on SYNCING/ACCEPTED is optimistic. After that import, execution_payload says optimistic and the follow-up head_v2 says not. Track the envelope verdict on the head (or equivalent) and use it for both.

  3. Confirm the empty-to-full head_v2 is actually reached from import. The repeat is only in publish_beacon_changes when head_payload_status goes Empty to Full (events.rs around the new else if). The envelope path in beacon_envelope.rs (~577) only calls publish_envelope_imported. The actor test never asserts a second head_v2. If import does not update the head node’s payload status and then recompute, the spec’s second head_v2 never fires. Also, a startup view of None rather than Some(Empty) will miss the first empty-to-full transition.

  4. Gossip and API disagree on execution_payload_gossip.slot. publish_gossip_event uses envelope.message.payload.slot_number; post_envelope_emitting uses block_slot (the beacon block). Import uses the store’s block slot and beacon_block_root. One canonical beacon slot should feed all three, after validation has required they match.

  5. Avoid double SSE on the API path. Handlers emit after publish_* returns Ok, and Validated::forward also emits on Accept. The bid test only covers a mock that does not re-enter verdict. If local publish or gossip loopback hits publish_gossip_event, bids, preferences, payload attestations, and envelopes are announced twice.


Automated review by Grok (xAI) · grok-4.7 · custom prompt

@github-actions

Copy link
Copy Markdown

🤖 Kimi Code Review

  1. head_v2 can report the wrong optimistic state for gloas payloads — crates/blockchain/src/events.rs, especially publish_beacon_payload_arrived around lines 1242–1250. It sets execution_optimistic from store.is_beacon_optimistic(head), but publish_envelope_imported explicitly documents that gloas roots never enter that optimistic set. Consequently, an envelope imported with SYNCING or ACCEPTED can produce:

    • execution_payload.execution_optimistic = true
    • the subsequent empty→full head_v2.execution_optimistic = false

    The head-change path has the same underlying limitation when announcing an already-full gloas head. Persist or otherwise propagate the envelope’s validation verdict and use it when constructing head_v2. A regression test covering an optimistic envelope followed by the payload-arrived head_v2 would catch this.

Otherwise, the change looks solid: the sink avoids a p2p→blockchain dependency cycle, expensive clones are generally subscriber-gated, event emission remains non-blocking, and the serialization/ordering tests provide good coverage.


Automated review by Kimi (Moonshot AI) · kimi-k3.1-pro · custom prompt

Both head_v2 emissions skip a head more than HEAD_EVENT_RECENCY_SLOTS behind the wall clock, as head does. The publish_beacon_changes doc said only head is gated, and the stale-heads note in docs/rpc.md said such a head sends no head; both now name head_v2, the second one included.
The second head_v2, sent when a head's payload arrives, had no test for its recency gate: a_stale_heads_payload_arrival_is_gated_but_the_view_still_moves is that test. a_stale_head_is_gated_but_the_view_still_moves read through drain, which leaves head_v2 out, so the head move's head_v2 gate was untested too; it now reads drain_all.
@MegaRedHand

Copy link
Copy Markdown
Collaborator Author

Round two (the automated review of a709342). Fixed in 3221137 and dcbb125. make fmt and make lint pass. Tests were not run locally; CI runs them.

Fixed

  • Claude (tests): the recency gate on head_v2 was untested, and two docs said only head is gated.
    • Both head_v2 emissions skip a head more than HEAD_EVENT_RECENCY_SLOTS behind the wall clock. Neither gate had a test.
    • The new a_stale_heads_payload_arrival_is_gated_but_the_view_still_moves covers the second head_v2, sent when the payload arrives. a_stale_head_is_gated_but_the_view_still_moves covered the head move, but read through drain, which leaves head_v2 out; it now reads drain_all. dcbb125
    • The publish_beacon_changes doc said "Only head is gated", and the stale-heads note in docs/rpc.md said such a head "sends no head". Both now name head_v2, including the second one. 3221137

Not changed

  • Claude 1, Codex P1, Grok 2, Kimi 1: gloas head_v2 is never execution_optimistic. Tracked in Beacon events report execution_optimistic: false for every gloas head and block #844, from round one.
  • Claude 2, Grok 5: double events for objects submitted through the API. Settled in round one. Neither publish path enters Validated::forward. The envelope goes to the actor directly, and the payload attestation is published directly and marked in the seen cache, so a peer's echo is AlreadySeen.
  • Claude 3, Grok 4: the envelope's slot source. Settled in round one.
  • Claude 4: the state load on payload arrival. Settled in round one: advance_view returns before either head path when nobody listens.
  • Claude 5: ChainEvent's size. Not measured. The unboxed head_v2 payload is about the size of a PTC message, so boxing the message alone would not shrink the enum. A size_of::<ChainEvent>() assertion would measure it.
  • Claude 6 and 7: the two emits and the second subscriber check. Style. The call resolves as intended, and the second check is one atomic read.
  • Claude 8: the serialize_none arm. Settled in round one.
  • Gemini 1, DeepSeek 3: envelope.message.slot and one subscriber check at the top. Settled in round one. The gloas envelope has no slot field.
  • DeepSeek 1: dependent roots off by one epoch. Settled in round one. The Beacon API's head_v2 text puts current_epoch_dependent_root at compute_start_slot_at_epoch(epoch - 1) - 1, as implemented.
  • DeepSeek 2: gossip topics on the shared ring. Tracked in Event bus: build high-rate topics only for clients that subscribed to them #845: per-topic interest, or a ring of their own for the high-rate topics. Its text names the attestation topics; payload_attestation_message is the same case.
  • Grok 1: execution_payload_available on a SYNCING import. The event says the payload and blobs "are available and ready for payload attestation". A PTC vote reads whether the envelope was seen in time (payload_present) and is_data_available (blob_data_available), not the execution client's verdict. execution_payload's execution_optimistic carries that verdict.
  • Grok 3: whether import reaches the second head_v2. It does. An imported envelope's root goes onto envelopes.verified, the settle loop then recomputes the head, and recompute_beacon_head ends in publish_beacon_changes, whose empty-to-full step is tested. Startup None is settled in round one.

Gemini found nothing new.

@MegaRedHand

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions

Copy link
Copy Markdown

AI security review: 1 finding(s) to check

Reviewed by Opus, GPT, Kimi, GLM. A judge model checked every one of the findings against the code.
DeepSeek (stopped) did not finish; Opus, GPT, Kimi, GLM reviewed the whole PR. Comment /review continue to retry, with a new budget; reviewers that finished are reused.
Malicious-code check (tests, build and install scripts, hooks, editor tasks, dependency sources): nothing found.

# Finding Severity Status Found by Where
M1 Gloas head events report optimistic payload chains as validated (also M2) medium Bug Opus, GPT, Kimi, GLM (4/4) crates/blockchain/src/events.rs:1162
Details

M1. Gloas head events report optimistic payload chains as validated (medium, logic)

  • Trigger: A peer or proposer supplies a gloas envelope whose execution-client verdict is SYNCING or ACCEPTED, a child block builds on that FULL payload, and the child becomes head (or its own payload later arrives and triggers the second head_v2 emission).
  • Mechanism: For gloas, Store::is_beacon_optimistic consults optimistic_roots, which only pre-gloas blocks enter. The repository's optimistic-flag rule instead requires walking to the latest FULL payload the block builds on and checking beacon_block_payload_status; crates/net/rpc/src/shared/optimistic.rs implements that rule. The event code bypasses it and passes the always-false pre-gloas result into head, the newly added head_v2, and chain_reorg. The same wrong value is also used at line 1249 for the empty-to-full head_v2 re-emission.
  • Impact: Validator clients or other SSE consumers can treat a chain resting on an unvalidated execution payload as execution-validated and act on it, defeating the purpose of execution_optimistic in head_v2. The underlying head behavior existed before; this PR adds head_v2 and extends the incorrect result to it.
  • Judge: Confirmed for the newly added head_v2 emissions: they report false when a Gloas head builds on an unvalidated FULL ancestor. Gloas verdicts are recorded separately from optimistic_roots, and SYNCING forkchoiceUpdated responses leave them unvalidated. The legacy head and chain_reorg behavior exists on base, but the head_v2 defect is newly introduced.
Duplicates folded into another finding: 2
# Same as Finding Found by Where
M2 M1 Use Gloas-aware execution optimism for head_v2 Opus, GPT, Kimi crates/blockchain/src/events.rs:1249
M4 M3 Apply envelope gossip checks before announcing acceptance GPT crates/net/rpc/src/beacon/gloas_proposal.rs:1232
Pre-existing (real, but already on the base branch): 1
# Finding Category Severity (reported → judged) Found by Where Judge's reason
M3 Envelope POST accepts bid-inconsistent envelopes and emits them as gossip events logic medium GPT, GLM (2/4) crates/net/rpc/src/beacon/gloas_proposal.rs:1156 The validation gap is real: a correctly signed, bid-inconsistent envelope can receive 200 and be published before the chain actor rejects it. Slot and execution-requests mismatches are explicitly gossip-rejectable; the other cited mismatches fail full consensus verification. Base comparison confirms the incomplete POST checks and unchecked publication already existed; this PR's event only exposes
Housekeeping (not security): 4

Stale docs, missing tests, leftovers and inconsistencies, from a separate cheap model. Not checked by the judge.

Kind Item Where Fix
stale-docs Comment says blockchain actor is the sole publisher bin/ethlambda/src/main.rs:510 Change "sole publisher" to "main publisher" or describe the additional publishers, matching the updated events.rs module doc.
missing-test p2p publish_gossip_event is untested crates/net/p2p/src/beacon/verdict.rs:417 Add a test that wires a real EventBus into a P2PServer and checks that an accepted envelope/bid/preferences/message produces the expected GossipEvent topics.
missing-test Envelope POST handler event emission is untested crates/net/rpc/src/beacon/gloas_proposal.rs:1232 Add a test that provides an EventBus and subscribes to verify the ExecutionPayloadGossip event is emitted on success.
missing-test Payload attestation POST handler event emission is untested crates/net/rpc/src/beacon/ptc.rs:437 Add a test that provides an EventBus and subscribes to verify the PayloadAttestationMessage event is emitted on success.

Cost of this review: ~$4.66 of a $30 budget (estimated from token counts).

This branch has not been deployed

No deployments
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