Handle blocks without blobs.

This commit is contained in:
Jim McDonald
2025-02-25 12:54:58 +00:00
parent 0238130895
commit b9fff0dbde
4 changed files with 30 additions and 14 deletions

View File

@@ -1,3 +1,7 @@
1.37.1:
- handle missing blobs for block info
- fix `--epoch` flag for epoch summary
1.37.0:
- support Electra
- add `--compounding` flag when creating validator deposit data

View File

@@ -607,7 +607,7 @@ func outputDenebBlockText(ctx context.Context,
}
res.WriteString(tmp)
tmp, err = outputBlobInfo(ctx, data.verbose, blobs)
tmp, err = outputBlobInfo(ctx, data.verbose, signedBlock.Message.Body.BlobKZGCommitments, blobs)
if err != nil {
return "", err
}
@@ -717,7 +717,7 @@ func outputElectraBlockText(ctx context.Context,
}
res.WriteString(tmp)
tmp, err = outputBlobInfo(ctx, data.verbose, blobs)
tmp, err = outputBlobInfo(ctx, data.verbose, signedBlock.Message.Body.BlobKZGCommitments, blobs)
if err != nil {
return "", err
}
@@ -1160,6 +1160,7 @@ func outputElectraBlockExecutionRequests(_ context.Context,
func outputBlobInfo(_ context.Context,
verbose bool,
commitments []deneb.KZGCommitment,
blobs []*deneb.BlobSidecar,
) (
string,
@@ -1167,13 +1168,16 @@ func outputBlobInfo(_ context.Context,
) {
res := strings.Builder{}
res.WriteString(fmt.Sprintf("Blobs: %d\n", len(blobs)))
if verbose {
for i, blob := range blobs {
res.WriteString(fmt.Sprintf("%3d:\n", i))
res.WriteString(fmt.Sprintf(" KZG proof: %s\n", blob.KZGProof.String()))
res.WriteString(fmt.Sprintf(" KZG commitment: %s\n", blob.KZGCommitment.String()))
if len(blobs) == 0 && len(commitments) > 0 {
res.WriteString(fmt.Sprintf("Blobs: %d (but no blobs obtained from the beacon node)\n", len(commitments)))
} else {
res.WriteString(fmt.Sprintf("Blobs: %d\n", len(blobs)))
if verbose {
for i, blob := range blobs {
res.WriteString(fmt.Sprintf("%3d:\n", i))
res.WriteString(fmt.Sprintf(" KZG proof: %s\n", blob.KZGProof.String()))
res.WriteString(fmt.Sprintf(" KZG commitment: %s\n", blob.KZGCommitment.String()))
}
}
}

View File

@@ -168,9 +168,13 @@ func processDenebBlock(ctx context.Context,
Block: data.blockID,
})
if err != nil {
return errors.Wrap(err, "failed to obtain blob sidecars")
var apiErr *api.Error
if errors.As(err, &apiErr) && apiErr.StatusCode != http.StatusNotFound {
return errors.Wrap(err, "failed to obtain blob sidecars")
}
} else {
blobSidecars = blobSidecarsResponse.Data
}
blobSidecars = blobSidecarsResponse.Data
}
if err := outputDenebBlock(ctx, data.jsonOutput, data.sszOutput, block.Deneb, blobSidecars); err != nil {
return errors.Wrap(err, "failed to output block")
@@ -193,9 +197,13 @@ func processElectraBlock(ctx context.Context,
Block: data.blockID,
})
if err != nil {
return errors.Wrap(err, "failed to obtain blob sidecars")
var apiErr *api.Error
if errors.As(err, &apiErr) && apiErr.StatusCode != http.StatusNotFound {
return errors.Wrap(err, "failed to obtain blob sidecars")
}
} else {
blobSidecars = blobSidecarsResponse.Data
}
blobSidecars = blobSidecarsResponse.Data
}
if err := outputElectraBlock(ctx, data.jsonOutput, data.sszOutput, block.Electra, blobSidecars); err != nil {
return errors.Wrap(err, "failed to output block")

View File

@@ -24,7 +24,7 @@ import (
// ReleaseVersion is the release version of the codebase.
// Usually overridden by tag names when building binaries.
var ReleaseVersion = "local build (latest release 1.37.0)"
var ReleaseVersion = "local build (latest release 1.37.1)"
// versionCmd represents the version command.
var versionCmd = &cobra.Command{