eth/catalyst: enforce all blobs or nil on getBlobsV2

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2025-09-03 12:28:16 +02:00
parent 497b96f5b7
commit ac2a6b2218
No known key found for this signature in database
GPG key ID: 0FE274EE8C95166E

View file

@ -541,12 +541,21 @@ func (api *ConsensusAPI) GetBlobsV2(hashes []common.Hash) ([]*engine.BlobAndProo
getBlobsV2RequestMiss.Inc(1) getBlobsV2RequestMiss.Inc(1)
return nil, nil return nil, nil
} }
getBlobsV2RequestHit.Inc(1)
blobs, _, proofs, err := api.eth.BlobTxPool().GetBlobs(hashes, types.BlobSidecarVersion1) blobs, _, proofs, err := api.eth.BlobTxPool().GetBlobs(hashes, types.BlobSidecarVersion1)
if err != nil { if err != nil {
return nil, engine.InvalidParams.With(err) return nil, engine.InvalidParams.With(err)
} }
// To comply with API spec, check again that we really got all data needed
for _, blob := range blobs {
if blob == nil {
getBlobsV2RequestMiss.Inc(1)
return nil, nil
}
}
getBlobsV2RequestHit.Inc(1)
res := make([]*engine.BlobAndProofV2, len(hashes)) res := make([]*engine.BlobAndProofV2, len(hashes))
for i := 0; i < len(blobs); i++ { for i := 0; i < len(blobs); i++ {
// the blob is missing, return null as response. It should // the blob is missing, return null as response. It should