mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-21 15:29:27 +00:00
core/txpool/blobpool: fix getblobs error handling (#32538)
Another getBlobs PR on top of https://github.com/ethereum/go-ethereum/pull/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 <csaba.kiraly@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
This commit is contained in:
parent
e6884ccccf
commit
70f177a527
2 changed files with 16 additions and 10 deletions
|
|
@ -1334,17 +1334,20 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash, version byte) ([]*kzg4844.Blo
|
||||||
}
|
}
|
||||||
data, err := p.store.Get(txID)
|
data, err := p.store.Get(txID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
log.Error("Tracked blob transaction missing from store", "id", txID, "err", err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode the blob transaction
|
// Decode the blob transaction
|
||||||
tx := new(types.Transaction)
|
tx := new(types.Transaction)
|
||||||
if err := rlp.DecodeBytes(data, tx); err != nil {
|
if err := rlp.DecodeBytes(data, tx); err != nil {
|
||||||
return nil, nil, nil, err
|
log.Error("Blobs corrupted for traced transaction", "id", txID, "err", err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
sidecar := tx.BlobTxSidecar()
|
sidecar := tx.BlobTxSidecar()
|
||||||
if sidecar == nil {
|
if sidecar == nil {
|
||||||
return nil, nil, nil, fmt.Errorf("blob tx without sidecar %x", tx.Hash())
|
log.Error("Blob tx without sidecar", "hash", tx.Hash(), "id", txID)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
// Traverse the blobs in the transaction
|
// Traverse the blobs in the transaction
|
||||||
for i, hash := range tx.BlobHashes() {
|
for i, hash := range tx.BlobHashes() {
|
||||||
|
|
|
||||||
|
|
@ -541,20 +541,23 @@ 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)
|
||||||
}
|
}
|
||||||
res := make([]*engine.BlobAndProofV2, len(hashes))
|
|
||||||
for i := 0; i < len(blobs); i++ {
|
// To comply with API spec, check again that we really got all data needed
|
||||||
// the blob is missing, return null as response. It should
|
for _, blob := range blobs {
|
||||||
// be caught by `AvailableBlobs` though, perhaps data race
|
if blob == nil {
|
||||||
// occurs between two calls.
|
getBlobsV2RequestMiss.Inc(1)
|
||||||
if blobs[i] == nil {
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
getBlobsV2RequestHit.Inc(1)
|
||||||
|
|
||||||
|
res := make([]*engine.BlobAndProofV2, len(hashes))
|
||||||
|
for i := 0; i < len(blobs); i++ {
|
||||||
var cellProofs []hexutil.Bytes
|
var cellProofs []hexutil.Bytes
|
||||||
for _, proof := range proofs[i] {
|
for _, proof := range proofs[i] {
|
||||||
cellProofs = append(cellProofs, proof[:])
|
cellProofs = append(cellProofs, proof[:])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue