mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
upgrade go kzg library to canonical one, adding new functions for eip-7594
This commit is contained in:
parent
4cdd7c8631
commit
5181cb5cfc
8 changed files with 4344 additions and 84 deletions
|
|
@ -21,6 +21,7 @@ import (
|
|||
"fmt"
|
||||
"math/big"
|
||||
|
||||
goethkzg "github.com/crate-crypto/go-eth-kzg"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
|
|
@ -29,6 +30,7 @@ import (
|
|||
"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/forks"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -153,7 +155,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
|||
return fmt.Errorf("too many blobs in transaction: have %d, permitted %d", len(hashes), maxBlobs)
|
||||
}
|
||||
// Ensure commitments, proofs and hashes are valid
|
||||
if err := validateBlobSidecar(hashes, sidecar); err != nil {
|
||||
if err := validateBlobSidecar(opts.Config, head.Time, hashes, sidecar); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
@ -165,23 +167,54 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
|||
return nil
|
||||
}
|
||||
|
||||
func validateBlobSidecar(hashes []common.Hash, sidecar *types.BlobTxSidecar) error {
|
||||
func validateBlobSidecar(cfg *params.ChainConfig, time uint64, hashes []common.Hash, sidecar *types.BlobTxSidecar) error {
|
||||
if len(sidecar.Blobs) != len(hashes) {
|
||||
return fmt.Errorf("invalid number of %d blobs compared to %d blob hashes", len(sidecar.Blobs), len(hashes))
|
||||
}
|
||||
if len(sidecar.Proofs) != len(hashes) {
|
||||
return fmt.Errorf("invalid number of %d blob proofs compared to %d blob hashes", len(sidecar.Proofs), len(hashes))
|
||||
}
|
||||
if err := sidecar.ValidateBlobCommitmentHashes(hashes); err != nil {
|
||||
return err
|
||||
}
|
||||
// Blob commitments match with the hashes in the transaction, verify the
|
||||
// blobs themselves via KZG
|
||||
for i := range sidecar.Blobs {
|
||||
if err := kzg4844.VerifyBlobProof(&sidecar.Blobs[i], sidecar.Commitments[i], sidecar.Proofs[i]); err != nil {
|
||||
return fmt.Errorf("invalid blob %d: %v", i, err)
|
||||
|
||||
fork := cfg.LatestFork(time)
|
||||
if fork >= forks.Osaka {
|
||||
if len(sidecar.Blobs)*goethkzg.CellsPerExtBlob != len(sidecar.Proofs) {
|
||||
return fmt.Errorf("invalid number of %d cell proofs compared to %d blobs", len(sidecar.Proofs), len(sidecar.Blobs))
|
||||
}
|
||||
|
||||
// Prepare cells and cell indices for each blob
|
||||
totalCells := len(sidecar.Blobs) * goethkzg.CellsPerExtBlob
|
||||
cells := make([]kzg4844.Cell, totalCells)
|
||||
cellIndices := make([]uint64, totalCells)
|
||||
for i := range sidecar.Blobs {
|
||||
// Compute cells for the currentblob
|
||||
blobCells, err := kzg4844.ComputeCells(&sidecar.Blobs[i])
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to compute cells for blob %d: %v", i, err)
|
||||
}
|
||||
|
||||
cells = append(cells, blobCells...)
|
||||
for j := uint64(0); j < goethkzg.CellsPerExtBlob; j++ {
|
||||
cellIndices = append(cellIndices, j)
|
||||
}
|
||||
}
|
||||
|
||||
if err := kzg4844.VerifyCellKZGProofBatch(sidecar.Commitments, cellIndices, cells, sidecar.Proofs); err != nil {
|
||||
return fmt.Errorf("failed to verify cell proofs: %v", err)
|
||||
}
|
||||
} else { // older folks
|
||||
if len(sidecar.Proofs) != len(hashes) {
|
||||
return fmt.Errorf("invalid number of %d blob proofs compared to %d blob hashes", len(sidecar.Proofs), len(hashes))
|
||||
}
|
||||
|
||||
// Blob commitments match with the hashes in the transaction, verify the
|
||||
// blobs themselves via KZG
|
||||
for i := range sidecar.Blobs {
|
||||
if err := kzg4844.VerifyBlobProof(&sidecar.Blobs[i], sidecar.Commitments[i], sidecar.Proofs[i]); err != nil {
|
||||
return fmt.Errorf("invalid blob %d: %v", i, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import (
|
|||
"reflect"
|
||||
"sync/atomic"
|
||||
|
||||
goethkzg "github.com/crate-crypto/go-eth-kzg"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
)
|
||||
|
||||
|
|
@ -39,6 +40,8 @@ var (
|
|||
// Blob represents a 4844 data blob.
|
||||
type Blob [131072]byte
|
||||
|
||||
type Cell [goethkzg.BytesPerCell]byte
|
||||
|
||||
// UnmarshalJSON parses a blob in hex syntax.
|
||||
func (b *Blob) UnmarshalJSON(input []byte) error {
|
||||
return hexutil.UnmarshalFixedJSON(blobT, input, b[:])
|
||||
|
|
@ -149,6 +152,22 @@ func VerifyBlobProof(blob *Blob, commitment Commitment, proof Proof) error {
|
|||
return gokzgVerifyBlobProof(blob, commitment, proof)
|
||||
}
|
||||
|
||||
// VerifyCellKZGProofBatch verifies a batch of KZG proofs for a set of cells.
|
||||
func VerifyCellKZGProofBatch(commitments []Commitment, cellIndicies []uint64, cells []Cell, proofs []Proof) error {
|
||||
if useCKZG.Load() {
|
||||
return ckzgVerifyCellKZGProofBatch(commitments, cellIndicies, cells, proofs)
|
||||
}
|
||||
return gokzgVerifyCellKZGProofBatch(commitments, cellIndicies, cells, proofs)
|
||||
}
|
||||
|
||||
// ComputeCells computes the cells for a given blob.
|
||||
func ComputeCells(blob *Blob) ([]Cell, error) {
|
||||
if useCKZG.Load() {
|
||||
return ckzgComputeCells(blob)
|
||||
}
|
||||
return gokzgComputeCells(blob)
|
||||
}
|
||||
|
||||
// CalcBlobHashV1 calculates the 'versioned blob hash' of a commitment.
|
||||
// The given hasher must be a sha256 hash instance, otherwise the result will be invalid!
|
||||
func CalcBlobHashV1(hasher hash.Hash, commit *Commitment) (vh [32]byte) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//go:build ckzg && !nacl && !js && !wasip1 && cgo && !gofuzz
|
||||
//xgo:build ckzg && !nacl && !js && !wasip1 && cgo && !gofuzz
|
||||
|
||||
package kzg4844
|
||||
|
||||
|
|
@ -23,8 +23,8 @@ import (
|
|||
"errors"
|
||||
"sync"
|
||||
|
||||
gokzg4844 "github.com/crate-crypto/go-kzg-4844"
|
||||
ckzg4844 "github.com/ethereum/c-kzg-4844/bindings/go"
|
||||
goethkzg "github.com/crate-crypto/go-eth-kzg"
|
||||
ckzg4844 "github.com/ethereum/c-kzg-4844/v2/bindings/go"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
)
|
||||
|
||||
|
|
@ -40,22 +40,34 @@ func ckzgInit() {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
params := new(gokzg4844.JSONTrustedSetup)
|
||||
params := new(goethkzg.JSONTrustedSetup)
|
||||
if err = json.Unmarshal(config, params); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err = gokzg4844.CheckTrustedSetupIsWellFormed(params); err != nil {
|
||||
if err = goethkzg.CheckTrustedSetupIsWellFormed(params); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
g1s := make([]byte, len(params.SetupG1Lagrange)*(len(params.SetupG1Lagrange[0])-2)/2)
|
||||
g1MonomialBytes := make([]byte, len(params.SetupG1Monomial)*(len(params.SetupG1Monomial[0])-2)/2)
|
||||
for i, g1 := range ¶ms.SetupG1Monomial {
|
||||
copy(g1MonomialBytes[i*(len(g1)-2)/2:], hexutil.MustDecode(g1))
|
||||
}
|
||||
g1LagrangeBytes := make([]byte, len(params.SetupG1Lagrange)*(len(params.SetupG1Lagrange[0])-2)/2)
|
||||
for i, g1 := range params.SetupG1Lagrange {
|
||||
copy(g1s[i*(len(g1)-2)/2:], hexutil.MustDecode(g1))
|
||||
copy(g1LagrangeBytes[i*(len(g1)-2)/2:], hexutil.MustDecode(g1))
|
||||
}
|
||||
g2s := make([]byte, len(params.SetupG2)*(len(params.SetupG2[0])-2)/2)
|
||||
g2MonomialBytes := make([]byte, len(params.SetupG2)*(len(params.SetupG2[0])-2)/2)
|
||||
for i, g2 := range params.SetupG2 {
|
||||
copy(g2s[i*(len(g2)-2)/2:], hexutil.MustDecode(g2))
|
||||
copy(g2MonomialBytes[i*(len(g2)-2)/2:], hexutil.MustDecode(g2))
|
||||
}
|
||||
if err = ckzg4844.LoadTrustedSetup(g1s, g2s); err != nil {
|
||||
|
||||
// c-kzg-4844 uses a global context/setup file, so it needs to be 8 for both the EL and CL (currently CL sets it at 8)
|
||||
//
|
||||
// the parameter is mainly for optimization purposes. Heuristically 8 has been shown to be the best tradeoff
|
||||
// It essentially stores something like 2^8 * len(g1_monomial) points
|
||||
// So the higher the number, the more memory it uses
|
||||
// You can set it to 0 to store nothing and it uses a different codepath, but its slow
|
||||
precompute := uint(8)
|
||||
if err = ckzg4844.LoadTrustedSetup(g1MonomialBytes, g1LagrangeBytes, g2MonomialBytes, precompute); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
|
@ -125,3 +137,47 @@ func ckzgVerifyBlobProof(blob *Blob, commitment Commitment, proof Proof) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// VerifyCellKZGProofBatch verifies a batch of KZG proofs for a set of cells.
|
||||
func ckzgVerifyCellKZGProofBatch(commitments []Commitment, cellIndicies []uint64, cells []Cell, proofs []Proof) error {
|
||||
ckzgIniter.Do(ckzgInit)
|
||||
|
||||
comts := make([]ckzg4844.Bytes48, len(commitments))
|
||||
for i, commitment := range commitments {
|
||||
comts[i] = (ckzg4844.Bytes48)(commitment)
|
||||
}
|
||||
|
||||
cellInputs := make([]ckzg4844.Cell, len(cells))
|
||||
for i := range cells {
|
||||
cellInputs[i] = (ckzg4844.Cell)(cells[i])
|
||||
}
|
||||
|
||||
proofsInput := make([]ckzg4844.Bytes48, len(proofs))
|
||||
for i, proof := range proofs {
|
||||
proofsInput[i] = (ckzg4844.Bytes48)(proof)
|
||||
}
|
||||
|
||||
valid, err := ckzg4844.VerifyCellKZGProofBatch(comts, cellIndicies, cellInputs, proofsInput)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !valid {
|
||||
return errors.New("invalid proof")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ckzgComputeCells(blob *Blob) ([]Cell, error) {
|
||||
ckzgIniter.Do(ckzgInit)
|
||||
|
||||
result, err := ckzg4844.ComputeCells((*ckzg4844.Blob)(blob))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cells := make([]Cell, len(result))
|
||||
for i, cell := range result {
|
||||
cells[i] = (Cell)(cell)
|
||||
}
|
||||
return cells, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
// Copyright 2023 The go-ethereum Authors
|
||||
!ckzg || nacl || js || wasip1 || !cgo || gofuzz
|
||||
|
||||
package p // Copyright 2023 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
|
|
@ -14,49 +16,57 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//go:build !ckzg || nacl || js || wasip1 || !cgo || gofuzz
|
||||
// package kzg4844
|
||||
|
||||
package kzg4844
|
||||
// import "sync"
|
||||
|
||||
import "sync"
|
||||
// // ckzgAvailable signals whether the library was compiled into Geth.
|
||||
// const ckzgAvailable = false
|
||||
|
||||
// ckzgAvailable signals whether the library was compiled into Geth.
|
||||
const ckzgAvailable = false
|
||||
// // ckzgIniter ensures that we initialize the KZG library once before using it.
|
||||
// var ckzgIniter sync.Once
|
||||
|
||||
// ckzgIniter ensures that we initialize the KZG library once before using it.
|
||||
var ckzgIniter sync.Once
|
||||
// // ckzgInit initializes the KZG library with the provided trusted setup.
|
||||
// func ckzgInit() {
|
||||
// panic("unsupported platform")
|
||||
// }
|
||||
|
||||
// ckzgInit initializes the KZG library with the provided trusted setup.
|
||||
func ckzgInit() {
|
||||
panic("unsupported platform")
|
||||
}
|
||||
// // ckzgBlobToCommitment creates a small commitment out of a data blob.
|
||||
// func ckzgBlobToCommitment(blob *Blob) (Commitment, error) {
|
||||
// panic("unsupported platform")
|
||||
// }
|
||||
|
||||
// ckzgBlobToCommitment creates a small commitment out of a data blob.
|
||||
func ckzgBlobToCommitment(blob *Blob) (Commitment, error) {
|
||||
panic("unsupported platform")
|
||||
}
|
||||
// // ckzgComputeProof computes the KZG proof at the given point for the polynomial
|
||||
// // represented by the blob.
|
||||
// func ckzgComputeProof(blob *Blob, point Point) (Proof, Claim, error) {
|
||||
// panic("unsupported platform")
|
||||
// }
|
||||
|
||||
// ckzgComputeProof computes the KZG proof at the given point for the polynomial
|
||||
// represented by the blob.
|
||||
func ckzgComputeProof(blob *Blob, point Point) (Proof, Claim, error) {
|
||||
panic("unsupported platform")
|
||||
}
|
||||
// // ckzgVerifyProof verifies the KZG proof that the polynomial represented by the blob
|
||||
// // evaluated at the given point is the claimed value.
|
||||
// func ckzgVerifyProof(commitment Commitment, point Point, claim Claim, proof Proof) error {
|
||||
// panic("unsupported platform")
|
||||
// }
|
||||
|
||||
// ckzgVerifyProof verifies the KZG proof that the polynomial represented by the blob
|
||||
// evaluated at the given point is the claimed value.
|
||||
func ckzgVerifyProof(commitment Commitment, point Point, claim Claim, proof Proof) error {
|
||||
panic("unsupported platform")
|
||||
}
|
||||
// // ckzgComputeBlobProof returns the KZG proof that is used to verify the blob against
|
||||
// // the commitment.
|
||||
// //
|
||||
// // This method does not verify that the commitment is correct with respect to blob.
|
||||
// func ckzgComputeBlobProof(blob *Blob, commitment Commitment) (Proof, error) {
|
||||
// panic("unsupported platform")
|
||||
// }
|
||||
|
||||
// ckzgComputeBlobProof returns the KZG proof that is used to verify the blob against
|
||||
// the commitment.
|
||||
//
|
||||
// This method does not verify that the commitment is correct with respect to blob.
|
||||
func ckzgComputeBlobProof(blob *Blob, commitment Commitment) (Proof, error) {
|
||||
panic("unsupported platform")
|
||||
}
|
||||
// // ckzgVerifyBlobProof verifies that the blob data corresponds to the provided commitment.
|
||||
// func ckzgVerifyBlobProof(blob *Blob, commitment Commitment, proof Proof) error {
|
||||
// panic("unsupported platform")
|
||||
// }
|
||||
|
||||
// ckzgVerifyBlobProof verifies that the blob data corresponds to the provided commitment.
|
||||
func ckzgVerifyBlobProof(blob *Blob, commitment Commitment, proof Proof) error {
|
||||
panic("unsupported platform")
|
||||
}
|
||||
// // ckzgVerifyCellKZGProofBatch verifies a batch of KZG proofs for a set of cells.
|
||||
// func ckzgVerifyCellKZGProofBatch(commitments []Commitment, cellIndicies []uint64, cells []Cell, proofs []Proof) error {
|
||||
// panic("unsupported platform")
|
||||
// }
|
||||
|
||||
// // ckzgComputeCells computes the cells for a given blob.
|
||||
// func ckzgComputeCells(blob *Blob) ([]Cell, error) {
|
||||
// panic("unsupported platform")
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ import (
|
|||
"encoding/json"
|
||||
"sync"
|
||||
|
||||
gokzg4844 "github.com/crate-crypto/go-kzg-4844"
|
||||
goethkzg "github.com/crate-crypto/go-eth-kzg"
|
||||
)
|
||||
|
||||
// context is the crypto primitive pre-seeded with the trusted setup parameters.
|
||||
var context *gokzg4844.Context
|
||||
var context *goethkzg.Context
|
||||
|
||||
// gokzgIniter ensures that we initialize the KZG library once before using it.
|
||||
var gokzgIniter sync.Once
|
||||
|
|
@ -35,11 +35,11 @@ func gokzgInit() {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
params := new(gokzg4844.JSONTrustedSetup)
|
||||
params := new(goethkzg.JSONTrustedSetup)
|
||||
if err = json.Unmarshal(config, params); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
context, err = gokzg4844.NewContext4096(params)
|
||||
context, err = goethkzg.NewContext4096(params)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ func gokzgInit() {
|
|||
func gokzgBlobToCommitment(blob *Blob) (Commitment, error) {
|
||||
gokzgIniter.Do(gokzgInit)
|
||||
|
||||
commitment, err := context.BlobToKZGCommitment((*gokzg4844.Blob)(blob), 0)
|
||||
commitment, err := context.BlobToKZGCommitment((*goethkzg.Blob)(blob), 0)
|
||||
if err != nil {
|
||||
return Commitment{}, err
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ func gokzgBlobToCommitment(blob *Blob) (Commitment, error) {
|
|||
func gokzgComputeProof(blob *Blob, point Point) (Proof, Claim, error) {
|
||||
gokzgIniter.Do(gokzgInit)
|
||||
|
||||
proof, claim, err := context.ComputeKZGProof((*gokzg4844.Blob)(blob), (gokzg4844.Scalar)(point), 0)
|
||||
proof, claim, err := context.ComputeKZGProof((*goethkzg.Blob)(blob), (goethkzg.Scalar)(point), 0)
|
||||
if err != nil {
|
||||
return Proof{}, Claim{}, err
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ func gokzgComputeProof(blob *Blob, point Point) (Proof, Claim, error) {
|
|||
func gokzgVerifyProof(commitment Commitment, point Point, claim Claim, proof Proof) error {
|
||||
gokzgIniter.Do(gokzgInit)
|
||||
|
||||
return context.VerifyKZGProof((gokzg4844.KZGCommitment)(commitment), (gokzg4844.Scalar)(point), (gokzg4844.Scalar)(claim), (gokzg4844.KZGProof)(proof))
|
||||
return context.VerifyKZGProof((goethkzg.KZGCommitment)(commitment), (goethkzg.Scalar)(point), (goethkzg.Scalar)(claim), (goethkzg.KZGProof)(proof))
|
||||
}
|
||||
|
||||
// gokzgComputeBlobProof returns the KZG proof that is used to verify the blob against
|
||||
|
|
@ -83,7 +83,7 @@ func gokzgVerifyProof(commitment Commitment, point Point, claim Claim, proof Pro
|
|||
func gokzgComputeBlobProof(blob *Blob, commitment Commitment) (Proof, error) {
|
||||
gokzgIniter.Do(gokzgInit)
|
||||
|
||||
proof, err := context.ComputeBlobKZGProof((*gokzg4844.Blob)(blob), (gokzg4844.KZGCommitment)(commitment), 0)
|
||||
proof, err := context.ComputeBlobKZGProof((*goethkzg.Blob)(blob), (goethkzg.KZGCommitment)(commitment), 0)
|
||||
if err != nil {
|
||||
return Proof{}, err
|
||||
}
|
||||
|
|
@ -94,5 +94,44 @@ func gokzgComputeBlobProof(blob *Blob, commitment Commitment) (Proof, error) {
|
|||
func gokzgVerifyBlobProof(blob *Blob, commitment Commitment, proof Proof) error {
|
||||
gokzgIniter.Do(gokzgInit)
|
||||
|
||||
return context.VerifyBlobKZGProof((*gokzg4844.Blob)(blob), (gokzg4844.KZGCommitment)(commitment), (gokzg4844.KZGProof)(proof))
|
||||
return context.VerifyBlobKZGProof((*goethkzg.Blob)(blob), (goethkzg.KZGCommitment)(commitment), (goethkzg.KZGProof)(proof))
|
||||
}
|
||||
|
||||
// gokzgVerifyCellKZGProofBatch verifies a batch of KZG proofs for a set of cells.
|
||||
func gokzgVerifyCellKZGProofBatch(commitments []Commitment, cellIndicies []uint64, cells []Cell, proofs []Proof) error {
|
||||
gokzgIniter.Do(gokzgInit)
|
||||
|
||||
comts := make([]goethkzg.KZGCommitment, len(commitments))
|
||||
for i, commitment := range commitments {
|
||||
comts[i] = (goethkzg.KZGCommitment)(commitment)
|
||||
}
|
||||
|
||||
cellInputs := make([]*goethkzg.Cell, len(cells))
|
||||
for i := range cells {
|
||||
cellInputs[i] = (*goethkzg.Cell)(&cells[i])
|
||||
}
|
||||
|
||||
proofsInput := make([]goethkzg.KZGProof, len(proofs))
|
||||
for i, proof := range proofs {
|
||||
proofsInput[i] = (goethkzg.KZGProof)(proof)
|
||||
}
|
||||
|
||||
return context.VerifyCellKZGProofBatch(comts, cellIndicies, cellInputs, proofsInput)
|
||||
}
|
||||
|
||||
// gokzgComputeCells computes the cells for a given blob.
|
||||
func gokzgComputeCells(blob *Blob) ([]Cell, error) {
|
||||
gokzgIniter.Do(gokzgInit)
|
||||
|
||||
results, err := context.ComputeCells((*goethkzg.Blob)(blob), 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cells := make([]Cell, len(results))
|
||||
for i, result := range results {
|
||||
cells[i] = (Cell)(*result)
|
||||
}
|
||||
|
||||
return cells, nil
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
13
go.mod
13
go.mod
|
|
@ -13,7 +13,8 @@ require (
|
|||
github.com/cespare/cp v0.1.0
|
||||
github.com/cloudflare/cloudflare-go v0.114.0
|
||||
github.com/cockroachdb/pebble v1.1.2
|
||||
github.com/consensys/gnark-crypto v0.14.0
|
||||
github.com/consensys/gnark-crypto v0.16.0
|
||||
github.com/crate-crypto/go-eth-kzg v1.3.0
|
||||
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a
|
||||
github.com/crate-crypto/go-kzg-4844 v1.1.0
|
||||
github.com/davecgh/go-spew v1.1.1
|
||||
|
|
@ -21,7 +22,7 @@ require (
|
|||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1
|
||||
github.com/donovanhide/eventsource v0.0.0-20210830082556-c59027999da0
|
||||
github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3
|
||||
github.com/ethereum/c-kzg-4844 v1.0.0
|
||||
github.com/ethereum/c-kzg-4844/v2 v2.0.2-0.20250310171505-d800f8f15155
|
||||
github.com/ethereum/go-verkle v0.2.2
|
||||
github.com/fatih/color v1.16.0
|
||||
github.com/ferranbt/fastssz v0.1.2
|
||||
|
|
@ -65,8 +66,8 @@ require (
|
|||
go.uber.org/automaxprocs v1.5.2
|
||||
go.uber.org/goleak v1.3.0
|
||||
golang.org/x/crypto v0.32.0
|
||||
golang.org/x/sync v0.10.0
|
||||
golang.org/x/sys v0.29.0
|
||||
golang.org/x/sync v0.12.0
|
||||
golang.org/x/sys v0.31.0
|
||||
golang.org/x/text v0.21.0
|
||||
golang.org/x/time v0.9.0
|
||||
golang.org/x/tools v0.29.0
|
||||
|
|
@ -90,14 +91,14 @@ require (
|
|||
github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 // indirect
|
||||
github.com/aws/smithy-go v1.15.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.17.0 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.22.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/cockroachdb/errors v1.11.3 // indirect
|
||||
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
|
||||
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
|
||||
github.com/cockroachdb/redact v1.1.5 // indirect
|
||||
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
|
||||
github.com/consensys/bavard v0.1.22 // indirect
|
||||
github.com/consensys/bavard v0.1.30 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
|
||||
github.com/deepmap/oapi-codegen v1.6.0 // indirect
|
||||
github.com/dlclark/regexp2 v1.7.0 // indirect
|
||||
|
|
|
|||
28
go.sum
28
go.sum
|
|
@ -90,8 +90,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
|
|||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bits-and-blooms/bitset v1.17.0 h1:1X2TS7aHz1ELcC0yU1y2stUs/0ig5oMU6STFZGrhvHI=
|
||||
github.com/bits-and-blooms/bitset v1.17.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
|
||||
github.com/bits-and-blooms/bitset v1.22.0 h1:Tquv9S8+SGaS3EhyA+up3FXzmkhxPGjQQCkcs2uw7w4=
|
||||
github.com/bits-and-blooms/bitset v1.22.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
|
||||
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
|
||||
|
|
@ -124,12 +124,16 @@ github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwP
|
|||
github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
|
||||
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo=
|
||||
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
|
||||
github.com/consensys/bavard v0.1.22 h1:Uw2CGvbXSZWhqK59X0VG/zOjpTFuOMcPLStrp1ihI0A=
|
||||
github.com/consensys/bavard v0.1.22/go.mod h1:k/zVjHHC4B+PQy1Pg7fgvG3ALicQw540Crag8qx+dZs=
|
||||
github.com/consensys/gnark-crypto v0.14.0 h1:DDBdl4HaBtdQsq/wfMwJvZNE80sHidrK3Nfrefatm0E=
|
||||
github.com/consensys/gnark-crypto v0.14.0/go.mod h1:CU4UijNPsHawiVGNxe9co07FkzCeWHHrb1li/n1XoU0=
|
||||
github.com/consensys/bavard v0.1.30 h1:wwAj9lSnMLFXjEclKwyhf7Oslg8EoaFz9u1QGgt0bsk=
|
||||
github.com/consensys/bavard v0.1.30/go.mod h1:k/zVjHHC4B+PQy1Pg7fgvG3ALicQw540Crag8qx+dZs=
|
||||
github.com/consensys/gnark-crypto v0.16.0 h1:8Dl4eYmUWK9WmlP1Bj6je688gBRJCJbT8Mw4KoTAawo=
|
||||
github.com/consensys/gnark-crypto v0.16.0/go.mod h1:Ke3j06ndtPTVvo++PhGNgvm+lgpLvzbcE2MqljY7diU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/crate-crypto/go-eth-kzg v1.2.0 h1:f11Nm75wVcU/rT3coCTRpm1EorYCl6JIJZ3+3X1ls40=
|
||||
github.com/crate-crypto/go-eth-kzg v1.2.0/go.mod h1:pImFLw+HgU2p2UnVLqlVC9eNDNz1RCqpzUiCA1zEcT8=
|
||||
github.com/crate-crypto/go-eth-kzg v1.3.0 h1:05GrhASN9kDAidaFJOda6A4BEvgvuXbazXg/0E3OOdI=
|
||||
github.com/crate-crypto/go-eth-kzg v1.3.0/go.mod h1:J9/u5sWfznSObptgfa92Jq8rTswn6ahQWEuiLHOjCUI=
|
||||
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg=
|
||||
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwzHBvIzm2RfVCGNEBZgRyjwK40bVoun3ZnGOCafNM=
|
||||
github.com/crate-crypto/go-kzg-4844 v1.1.0 h1:EN/u9k2TF6OWSHrCCDBBU6GLNMq88OspHHlMnHfoyU4=
|
||||
|
|
@ -164,8 +168,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
|
|||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
|
||||
github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
|
||||
github.com/ethereum/c-kzg-4844/v2 v2.0.2-0.20250310171505-d800f8f15155 h1:nO+gHFSssFg71bxDJOXQZCjT6lINSy3pQcmRoomnek0=
|
||||
github.com/ethereum/c-kzg-4844/v2 v2.0.2-0.20250310171505-d800f8f15155/go.mod h1:xekiQpYbUjETEoLBT/i3IKtDBXQDvjytxGuxuox1RnA=
|
||||
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
|
||||
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
|
||||
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
|
||||
|
|
@ -640,8 +644,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
|
||||
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
|
@ -705,8 +709,8 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
|
|
|
|||
Loading…
Reference in a new issue