feat: parse the head_v2 SSE event (gloas) - #41
Conversation
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
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.
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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:107— package does not compile: leftoverv.Version = builderJSON.Versionis 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
There was a problem hiding this comment.
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
Adds
HeadEventV2plus topic registration and dispatch for the beacon-APIhead_v2eventstream topic (gloas). The event uses the versioned{"version","data"}envelope, handled viaunmarshalVersionedEventDatalike the other gloas topics, with the bare shape accepted as a fallback. Consumers subscribe withHeadV2Handleror receive*apiv1.HeadEventV2through the generic handler.https://claude.ai/code/session_019cbhUv62kwFTKQD5aM8FGC