Skip to content

Commit b9fff0d

Browse files
committed
Handle blocks without blobs.
1 parent 0238130 commit b9fff0d

4 files changed

Lines changed: 30 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
1.37.1:
2+
- handle missing blobs for block info
3+
- fix `--epoch` flag for epoch summary
4+
15
1.37.0:
26
- support Electra
37
- add `--compounding` flag when creating validator deposit data

cmd/block/info/output.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ func outputDenebBlockText(ctx context.Context,
607607
}
608608
res.WriteString(tmp)
609609

610-
tmp, err = outputBlobInfo(ctx, data.verbose, blobs)
610+
tmp, err = outputBlobInfo(ctx, data.verbose, signedBlock.Message.Body.BlobKZGCommitments, blobs)
611611
if err != nil {
612612
return "", err
613613
}
@@ -717,7 +717,7 @@ func outputElectraBlockText(ctx context.Context,
717717
}
718718
res.WriteString(tmp)
719719

720-
tmp, err = outputBlobInfo(ctx, data.verbose, blobs)
720+
tmp, err = outputBlobInfo(ctx, data.verbose, signedBlock.Message.Body.BlobKZGCommitments, blobs)
721721
if err != nil {
722722
return "", err
723723
}
@@ -1160,20 +1160,24 @@ func outputElectraBlockExecutionRequests(_ context.Context,
11601160

11611161
func outputBlobInfo(_ context.Context,
11621162
verbose bool,
1163+
commitments []deneb.KZGCommitment,
11631164
blobs []*deneb.BlobSidecar,
11641165
) (
11651166
string,
11661167
error,
11671168
) {
11681169
res := strings.Builder{}
11691170

1170-
res.WriteString(fmt.Sprintf("Blobs: %d\n", len(blobs)))
1171-
1172-
if verbose {
1173-
for i, blob := range blobs {
1174-
res.WriteString(fmt.Sprintf("%3d:\n", i))
1175-
res.WriteString(fmt.Sprintf(" KZG proof: %s\n", blob.KZGProof.String()))
1176-
res.WriteString(fmt.Sprintf(" KZG commitment: %s\n", blob.KZGCommitment.String()))
1171+
if len(blobs) == 0 && len(commitments) > 0 {
1172+
res.WriteString(fmt.Sprintf("Blobs: %d (but no blobs obtained from the beacon node)\n", len(commitments)))
1173+
} else {
1174+
res.WriteString(fmt.Sprintf("Blobs: %d\n", len(blobs)))
1175+
if verbose {
1176+
for i, blob := range blobs {
1177+
res.WriteString(fmt.Sprintf("%3d:\n", i))
1178+
res.WriteString(fmt.Sprintf(" KZG proof: %s\n", blob.KZGProof.String()))
1179+
res.WriteString(fmt.Sprintf(" KZG commitment: %s\n", blob.KZGCommitment.String()))
1180+
}
11771181
}
11781182
}
11791183

cmd/block/info/process.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,13 @@ func processDenebBlock(ctx context.Context,
168168
Block: data.blockID,
169169
})
170170
if err != nil {
171-
return errors.Wrap(err, "failed to obtain blob sidecars")
171+
var apiErr *api.Error
172+
if errors.As(err, &apiErr) && apiErr.StatusCode != http.StatusNotFound {
173+
return errors.Wrap(err, "failed to obtain blob sidecars")
174+
}
175+
} else {
176+
blobSidecars = blobSidecarsResponse.Data
172177
}
173-
blobSidecars = blobSidecarsResponse.Data
174178
}
175179
if err := outputDenebBlock(ctx, data.jsonOutput, data.sszOutput, block.Deneb, blobSidecars); err != nil {
176180
return errors.Wrap(err, "failed to output block")
@@ -193,9 +197,13 @@ func processElectraBlock(ctx context.Context,
193197
Block: data.blockID,
194198
})
195199
if err != nil {
196-
return errors.Wrap(err, "failed to obtain blob sidecars")
200+
var apiErr *api.Error
201+
if errors.As(err, &apiErr) && apiErr.StatusCode != http.StatusNotFound {
202+
return errors.Wrap(err, "failed to obtain blob sidecars")
203+
}
204+
} else {
205+
blobSidecars = blobSidecarsResponse.Data
197206
}
198-
blobSidecars = blobSidecarsResponse.Data
199207
}
200208
if err := outputElectraBlock(ctx, data.jsonOutput, data.sszOutput, block.Electra, blobSidecars); err != nil {
201209
return errors.Wrap(err, "failed to output block")

cmd/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
// ReleaseVersion is the release version of the codebase.
2626
// Usually overridden by tag names when building binaries.
27-
var ReleaseVersion = "local build (latest release 1.37.0)"
27+
var ReleaseVersion = "local build (latest release 1.37.1)"
2828

2929
// versionCmd represents the version command.
3030
var versionCmd = &cobra.Command{

0 commit comments

Comments
 (0)