Implement eth/v1/beacon/light_client/updates - #11202
Conversation
7d850f8 to
ac21194
Compare
|
claude review: Review summary The PR is in good shape. It correctly implements the spec wire format, and the approach to fork-aware schema selection (single ConditionalSchemaGetter covering all forks ≥ ALTAIR) is correct — though subtle. Two things worth noting as positive changes that aren't immediately obvious:
One actionable bug (finding 1): In ChainDataProvider.getBestLightClientUpdates, getGenesisStateData() is called before checking whether the update list is empty. This throws ChainDataUnavailableException for empty-range requests when genesis data |
Fixed. |
PR Description
This PR implements
eth/v1/beacon/light_client/updates, which returned501until now. The PR:ChainDataProvidercountatMAX_REQUEST_LIGHT_CLIENT_UPDATESLightClientUpdateWithContext, which pairs each update with the fork digest at its attested header slotresponse_chunk_len | context | payloadchunks, as the spec expectsLightClientUpdateResponseand its schema, which did not match the wire formatTAG_EXPERIMENTALtag and drops the501,503and204responses, to matchGetLightClientBootstrapFixed Issue(s)
Resolves a part of #4230
Documentation
doc-change-requiredlabel to this PR if updates are required.Changelog
Note
Medium Risk
New production REST surface serves consensus light-client data with fork-specific encoding; incorrect SSZ or fork digest would break light clients, though behavior is covered by unit/metadata tests.
Overview
Implements
GET /eth/v1/beacon/light_client/updates, which previously always returned 501. The handler now readsstart_periodandcount, capscountatMAX_REQUEST_LIGHT_CLIENT_UPDATES(128), and returns the best updates fromChainDataProvider.getBestLightClientUpdates.Each update is wrapped in
LightClientUpdateWithContext(fork digest at the attested header slot + theLightClientUpdate). JSON responses use milestone-aware typing (versionfrom attested slot); SSZ (application/octet-stream) emits repeated chunks ofresponse_chunk_len | context | payload. OpenAPI drops the Experimental tag and 501, and documents aoneOfof fork-specificLightClientUpdateschemas (new Capella/Deneb/Electra/Gloas fixture schemas).Removes
LightClientUpdateResponseand its Altair schema wiring in favor of the spec wire format. Tests cover happy path, count capping, empty range, JSON/SSZ metadata, and handler wiring viaDataProvider/ChainDataProvider.Reviewed by Cursor Bugbot for commit 7a9df83. Bugbot is set up for automated code reviews on this repo. Configure here.