Skip to content

feat: parse the head_v2 SSE event (gloas) - #41

Merged
pk910 merged 7 commits into
masterfrom
feat/head-v2-sse
Aug 27, 2026
Merged

feat: parse the head_v2 SSE event (gloas)#41
pk910 merged 7 commits into
masterfrom
feat/head-v2-sse

Conversation

@samcm

@samcm samcm commented Jul 12, 2026

Copy link
Copy Markdown
Member

Adds HeadEventV2 plus topic registration and dispatch for the beacon-API head_v2 eventstream topic (gloas). The event uses the versioned {"version","data"} envelope, handled via unmarshalVersionedEventData like the other gloas topics, with the bare shape accepted as a fallback. Consumers subscribe with HeadV2Handler or receive *apiv1.HeadEventV2 through the generic handler.

https://claude.ai/code/session_019cbhUv62kwFTKQD5aM8FGC

Adds HeadEventV2 and dispatch for the head_v2 beacon-API topic: the
gloas-aware head event that drops previous_duty_dependent_root, renames
current_duty_dependent_root to current_epoch_dependent_root, and adds
next_epoch_dependent_root, payload_status and execution_optimistic. The
payload arrives in the {"version","data"} envelope, so the handler uses
unmarshalVersionedEventData (bare objects accepted as fallback, matching
the other gloas topics).

Claude-Session: https://claude.ai/code/session_019cbhUv62kwFTKQD5aM8FGC
The head_v2 event type made every decodeFixedBytes call site pass a
32-byte length, tripping unparam on the untouched helper. The parameter
stays — it exists for future non-root fields.

Claude-Session: https://claude.ai/code/session_019cbhUv62kwFTKQD5aM8FGC
@samcm
samcm marked this pull request as ready for review July 12, 2026 08:34
samcm added 2 commits July 18, 2026 00:14
Beacon API JSON encodes integers as strings; lighthouse returns
"version": "1" and unmarshaling into a bare uint8 fails, breaking
every gloas BeaconState fetch (xatu-cannon's beaconValidators deriver
errors with 'cannot unmarshal string into Go struct field
builderJSON.version'). MarshalYAML also dropped the field entirely.
…y and ptc_window (#43)

execution_payload_availability is a bitvector, hex-encoded on the wire like
justification_bits; it was marshalled as a per-byte decimal array and
unmarshalled through encoding/json's base64 path for byte slices, so every
gloas BeaconState fetch failed. ptc_window is served by lighthouse as bare
JSON numbers rather than the quoted-integer convention; accept both forms.

@redpandabot redpandabot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Adds the gloas head_v2 SSE topic end-to-end (eventsopts handler, SupportedEventTopics, Event.UnmarshalJSON dispatch, checkEventSpecificHandler, handleEvent and handleHeadV2Event), parsing the versioned {version,data} envelope with the bare-shape fallback exactly like the other gloas topics, plus three bundled gloas BeaconState/Builder JSON coding fixes and tests. I traced every changed file in full: the head_v2 wiring is consistent across all layers, HeadEventV2's JSON round-trips exactly, and the wire-format fixes align with real node output (lighthouse bare numbers, hex bitvectors, quoted integers) and the repo's existing conventions. No blockers found.


Reviewed 10 changed file(s) @ 8411fb11 — no blocking issues found.
"I have not failed. I've just found 10,000 ways that won't work." — Edison

Signed-off-by: pk910 <github@pk910.de>

@redpandabot redpandabot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Adds HeadEventV2 support for the beacon-API head_v2 SSE topic (marshal/unmarshal, registered topic, handler plumbing) plus gloas BeaconState wire-format fixes (hex-encoded execution_payload_availability, tolerant ptc_window parsing) and quoted builder version strings. The head_v2 wiring matches the other gloas topics, but the builder.go change leaves an assignment that is now a string->uint8 type error, so the spec/gloas package (and everything importing it) fails to build.

Issues

  • 🔴 spec/gloas/builder.go:107package does not compile: leftover v.Version = builderJSON.Version is a string->uint8 assignment — see the thread on that line

Reviewed @ 28fe488e
"I have not failed. I've just found 10,000 ways that won't work." — Edison

Comment thread spec/gloas/builder.go

@redpandabot redpandabot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Adds Beacon-API head_v2 SSE support (gloas/EIP-7732): new HeadEventV2 type, topic registration, HeadV2Handler option, and dispatch via the versioned-envelope unmarshalVersionedEventData with a bare-shape fallback. Also fixes the gloas JSON wire encoding: execution_payload_availability as a hex bitvector string, ptc_window accepting bare JSON numbers, and builder.version as a quoted Uint8 per the beacon-APIs spec. I verified the type fields, envelope, and topic against the live ethereum/beacon-APIs eventstream/primitive specs and traced the full dispatch path; the change is complete and consistent with existing patterns, with well-matched tests. No issues found.


Reviewed 10 changed file(s) @ 690bfece — no blocking issues found.
"I have not failed. I've just found 10,000 ways that won't work." — Edison

@pk910
pk910 enabled auto-merge August 27, 2026 15:16
@pk910
pk910 disabled auto-merge August 27, 2026 15:17
@pk910
pk910 merged commit 15ed59a into master Aug 27, 2026
3 checks passed
@pk910
pk910 deleted the feat/head-v2-sse branch August 27, 2026 15:17
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.

3 participants