Skip to content

Commit 70f177a

Browse files
core/txpool/blobpool: fix getblobs error handling (#32538)
Another getBlobs PR on top of #32190 to avoid some minor regressions. - bring back more log messages from before - continue processing also on some internal errors - ensure v2 complies with spec even if there are internal errors --------- Signed-off-by: Csaba Kiraly <[email protected]> Co-authored-by: rjl493456442 <[email protected]>
1 parent e6884cc commit 70f177a

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

core/txpool/blobpool/blobpool.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,17 +1334,20 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash, version byte) ([]*kzg4844.Blo
13341334
}
13351335
data, err := p.store.Get(txID)
13361336
if err != nil {
1337-
return nil, nil, nil, err
1337+
log.Error("Tracked blob transaction missing from store", "id", txID, "err", err)
1338+
continue
13381339
}
13391340

13401341
// Decode the blob transaction
13411342
tx := new(types.Transaction)
13421343
if err := rlp.DecodeBytes(data, tx); err != nil {
1343-
return nil, nil, nil, err
1344+
log.Error("Blobs corrupted for traced transaction", "id", txID, "err", err)
1345+
continue
13441346
}
13451347
sidecar := tx.BlobTxSidecar()
13461348
if sidecar == nil {
1347-
return nil, nil, nil, fmt.Errorf("blob tx without sidecar %x", tx.Hash())
1349+
log.Error("Blob tx without sidecar", "hash", tx.Hash(), "id", txID)
1350+
continue
13481351
}
13491352
// Traverse the blobs in the transaction
13501353
for i, hash := range tx.BlobHashes() {

eth/catalyst/api.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -541,20 +541,23 @@ func (api *ConsensusAPI) GetBlobsV2(hashes []common.Hash) ([]*engine.BlobAndProo
541541
getBlobsV2RequestMiss.Inc(1)
542542
return nil, nil
543543
}
544-
getBlobsV2RequestHit.Inc(1)
545544

546545
blobs, _, proofs, err := api.eth.BlobTxPool().GetBlobs(hashes, types.BlobSidecarVersion1)
547546
if err != nil {
548547
return nil, engine.InvalidParams.With(err)
549548
}
550-
res := make([]*engine.BlobAndProofV2, len(hashes))
551-
for i := 0; i < len(blobs); i++ {
552-
// the blob is missing, return null as response. It should
553-
// be caught by `AvailableBlobs` though, perhaps data race
554-
// occurs between two calls.
555-
if blobs[i] == nil {
549+
550+
// To comply with API spec, check again that we really got all data needed
551+
for _, blob := range blobs {
552+
if blob == nil {
553+
getBlobsV2RequestMiss.Inc(1)
556554
return nil, nil
557555
}
556+
}
557+
getBlobsV2RequestHit.Inc(1)
558+
559+
res := make([]*engine.BlobAndProofV2, len(hashes))
560+
for i := 0; i < len(blobs); i++ {
558561
var cellProofs []hexutil.Bytes
559562
for _, proof := range proofs[i] {
560563
cellProofs = append(cellProofs, proof[:])

0 commit comments

Comments
 (0)