mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
fix CellProofsAt method
This commit is contained in:
parent
355228b011
commit
d39594a7d7
1 changed files with 11 additions and 9 deletions
|
|
@ -22,11 +22,11 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/crypto/kzg4844"
|
"github.com/ethereum/go-ethereum/crypto/kzg4844"
|
||||||
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/holiman/uint256"
|
"github.com/holiman/uint256"
|
||||||
|
|
@ -76,14 +76,15 @@ func (sc *BlobTxSidecar) BlobHashes() []common.Hash {
|
||||||
|
|
||||||
// CellProofsAt returns the cell proofs for blob with index idx.
|
// CellProofsAt returns the cell proofs for blob with index idx.
|
||||||
func (sc *BlobTxSidecar) CellProofsAt(idx int) []kzg4844.Proof {
|
func (sc *BlobTxSidecar) CellProofsAt(idx int) []kzg4844.Proof {
|
||||||
var cellProofs []kzg4844.Proof
|
if len(sc.Proofs) == len(sc.Blobs)*kzg4844.CellProofsPerBlob {
|
||||||
for i := range kzg4844.CellProofsPerBlob {
|
index := idx * kzg4844.CellProofsPerBlob
|
||||||
index := idx*kzg4844.CellProofsPerBlob + i
|
return sc.Proofs[index : index+kzg4844.CellProofsPerBlob]
|
||||||
if index > len(sc.Proofs) {
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
proof := sc.Proofs[index]
|
|
||||||
cellProofs = append(cellProofs, proof)
|
cellProofs, err := kzg4844.ComputeCellProofs(&sc.Blobs[idx])
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Failed to compute cell proofs for blob", "index", idx, "error", err)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return cellProofs
|
return cellProofs
|
||||||
}
|
}
|
||||||
|
|
@ -217,6 +218,7 @@ func (tx *BlobTx) copy() TxData {
|
||||||
}
|
}
|
||||||
if tx.Sidecar != nil {
|
if tx.Sidecar != nil {
|
||||||
cpy.Sidecar = &BlobTxSidecar{
|
cpy.Sidecar = &BlobTxSidecar{
|
||||||
|
Version: tx.Sidecar.Version,
|
||||||
Blobs: slices.Clone(tx.Sidecar.Blobs),
|
Blobs: slices.Clone(tx.Sidecar.Blobs),
|
||||||
Commitments: slices.Clone(tx.Sidecar.Commitments),
|
Commitments: slices.Clone(tx.Sidecar.Commitments),
|
||||||
Proofs: slices.Clone(tx.Sidecar.Proofs),
|
Proofs: slices.Clone(tx.Sidecar.Proofs),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue