core/types: minimize this invalid intermediate state (#32241)

This commit is contained in:
maskpp 2025-07-22 15:03:48 +08:00 committed by GitHub
parent 36c87a220e
commit b2a0e08808
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -117,15 +117,16 @@ func (sc *BlobTxSidecar) ToV1() error {
return nil
}
if sc.Version == BlobSidecarVersion0 {
sc.Proofs = make([]kzg4844.Proof, 0, len(sc.Blobs)*kzg4844.CellProofsPerBlob)
proofs := make([]kzg4844.Proof, 0, len(sc.Blobs)*kzg4844.CellProofsPerBlob)
for _, blob := range sc.Blobs {
cellProofs, err := kzg4844.ComputeCellProofs(&blob)
if err != nil {
return err
}
sc.Proofs = append(sc.Proofs, cellProofs...)
proofs = append(proofs, cellProofs...)
}
sc.Version = BlobSidecarVersion1
sc.Proofs = proofs
}
return nil
}