Skip to content

Conversation

@niran
Copy link
Contributor

@niran niran commented Oct 16, 2025

Implements support for the new /eth/v1/beacon/blobs/{block_id} endpoint
as an automatic fallback from the deprecated blob_sidecars endpoint when
it fails.

Key changes:

  • Archiver: Prefer blob_sidecars endpoint, fall back to blobs endpoint
    on failure and compute KZG commitments/proofs from blob data
  • API: Add /eth/v1/beacon/blobs/{id} endpoint with versioned_hashes
    filtering support using kzg4844.CalcBlobHashV1
  • Test data: Generate valid BLS12-381 field elements by reducing random
    data modulo the field modulus to ensure KZG operations succeed
  • Test helpers: Consolidate blob generation into NewBlobSidecars with
    proper header support for consistent test comparisons

Even when the blobs endpoint is used, the archiver stores complete blob
sidecars with derived KZG commitments and proofs, maintaining backward
compatibility with existing storage format.

NOTE: This code relies on attestantio/go-eth2-client#273, which has not yet
been merged. An unreleased branch is used for this dependency for now.

niran added 2 commits October 15, 2025 16:32
Implements support for the new /eth/v1/beacon/blobs/{block_id} endpoint
with automatic fallback to the legacy blob_sidecars endpoint.

Key changes:
- Archiver: Prefer blobs endpoint, compute KZG commitments/proofs from
  blob data, fall back to blob_sidecars on failure
- API: Add /eth/v1/beacon/blobs/{id} endpoint with versioned_hashes
  filtering support using kzg4844.CalcBlobHashV1
- Test data: Generate valid BLS12-381 field elements by reducing random
  data modulo the field modulus to ensure KZG operations succeed
- Test helpers: Consolidate blob generation into NewBlobSidecars with
  proper header support for consistent test comparisons

All tests now use the blobs endpoint (except one that explicitly tests
the fallback behavior). The archiver stores complete blob sidecars with
derived KZG commitments and proofs, maintaining backward compatibility
with existing storage format.

Technical notes:
- Each 32-byte chunk in blob data must be < BLS12-381 field modulus
- KZG commitments/proofs are computed using gokzg4844 library
- Versioned hashes use ethereum/go-ethereum's kzg4844.CalcBlobHashV1
- Test data includes valid headers to match reconstructed sidecars
@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Oct 16, 2025

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@niran niran requested a review from meyer9 October 16, 2025 03:33
niran added 2 commits October 15, 2025 23:29
Switch to prioritizing /eth/v1/beacon/blob_sidecars over /eth/v1/beacon/blobs
since the sidecars endpoint provides KZG commitments and proofs directly,
avoiding unnecessary computation.
The go-kzg-4844 package is now directly used in the codebase after
migrating to the beacon blobs endpoint, so it should be listed as a
direct dependency rather than an indirect one.
meyer9
meyer9 previously approved these changes Oct 16, 2025
Copy link

@meyer9 meyer9 left a comment

Choose a reason for hiding this comment

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

LG!

Replaced custom field modulus constant with gokzg4844.BlsModulus, which
is the canonical BLS12-381 scalar field modulus from our existing
dependency. This fixes an incorrect modulus value and provides a single
source of truth for the BLS_MODULUS constant as specified in EIP-4844.

The go-kzg-4844 library already exports this value as BlsModulus, so
there's no need to duplicate it.
@cb-heimdall cb-heimdall dismissed meyer9’s stale review October 16, 2025 20:43

Approved review 3346878513 from meyer9 is now dismissed due to new commit. Re-request for approval.

@niran niran requested a review from meyer9 October 16, 2025 20:44
@cb-heimdall
Copy link
Collaborator

Review Error for meyer9 @ 2025-10-16 20:47:07 UTC
User failed mfa authentication, see go/mfa-help

@niran niran merged commit feee622 into master Oct 16, 2025
7 checks passed
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.

4 participants