diff --git a/core/types/data_blob.go b/core/types/data_blob.go index 8860e81d181a1..23f0afaa88205 100644 --- a/core/types/data_blob.go +++ b/core/types/data_blob.go @@ -10,7 +10,6 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto/kzg" "github.com/ethereum/go-ethereum/params" - "github.com/protolambda/go-kzg/bls" "github.com/protolambda/ztyp/codec" "github.com/protolambda/ztyp/tree" ) @@ -120,6 +119,16 @@ func (p *BLSFieldElement) UnmarshalText(text []byte) error { // Blob data type Blob [params.FieldElementsPerBlob]BLSFieldElement +// kzg.Blob interface +func (blob Blob) Len() int { + return len(blob) +} + +// kzg.Blob interface +func (blob Blob) At(i int) kzg.FieldElement { + return kzg.FieldElement(blob[i]) +} + func (blob *Blob) Deserialize(dr *codec.DecodingReader) error { if blob == nil { return errors.New("cannot decode ssz into nil Blob") @@ -156,17 +165,6 @@ func (blob *Blob) HashTreeRoot(hFn tree.HashFn) tree.Root { }, params.FieldElementsPerBlob) } -// Convert a blob to kzg.Blob -func (blob *Blob) ToKZGBlob() (kzg.Blob, bool) { - frs := make([]bls.Fr, len(blob)) - for i, elem := range blob { - if !bls.FrFrom32(&frs[i], elem) { - return []bls.Fr{}, false - } - } - return kzg.Blob(frs), true -} - func (blob *Blob) MarshalText() ([]byte, error) { out := make([]byte, 2+params.FieldElementsPerBlob*32*2) copy(out[:2], "0x") @@ -209,13 +207,13 @@ func (blob *Blob) UnmarshalText(text []byte) error { type BlobKzgs []KZGCommitment -func (li BlobKzgs) toKZGCommitmentSequence() []kzg.KZGCommitment { - l := len(li) - kzgs := make([]kzg.KZGCommitment, l) - for i := 0; i < l; i++ { - kzgs[i] = kzg.KZGCommitment(li[i]) - } - return kzgs +// kzg.KZGCommitmentSequence interface +func (bk BlobKzgs) Len() int { + return len(bk) +} + +func (bk BlobKzgs) At(i int) kzg.KZGCommitment { + return kzg.KZGCommitment(bk[i]) } func (li *BlobKzgs) Deserialize(dr *codec.DecodingReader) error { @@ -254,17 +252,14 @@ func (li BlobKzgs) copy() BlobKzgs { type Blobs []Blob -// Extract the crypto material underlying these blobs -func (blobs Blobs) toKZGBlobSequence() ([][]bls.Fr, bool) { - out := make([][]bls.Fr, len(blobs)) - for i, b := range blobs { - blob, ok := b.ToKZGBlob() - if !ok { - return nil, false - } - out[i] = blob - } - return out, true +// kzg.BlobSequence interface +func (blobs Blobs) Len() int { + return len(blobs) +} + +// kzg.BlobSequence interface +func (blobs Blobs) At(i int) kzg.Blob { + return blobs[i] } func (a *Blobs) Deserialize(dr *codec.DecodingReader) error { @@ -310,11 +305,10 @@ func (blobs Blobs) ComputeCommitmentsAndAggregatedProof() (commitments []KZGComm commitments = make([]KZGCommitment, len(blobs)) versionedHashes = make([]common.Hash, len(blobs)) for i, blob := range blobs { - frs, ok := blob.ToKZGBlob() + c, ok := kzg.BlobToKZGCommitment(blob) if !ok { - return nil, nil, KZGProof{}, errors.New("invalid blob for commitment") + return nil, nil, KZGProof{}, errors.New("could not convert blob to commitment") } - c := kzg.BlobToKZGCommitment(frs) commitments[i] = KZGCommitment(c) versionedHashes[i] = common.Hash(kzg.KZGToVersionedHash(c)) } @@ -323,11 +317,7 @@ func (blobs Blobs) ComputeCommitmentsAndAggregatedProof() (commitments []KZGComm if len(blobs) != 0 { // TODO: Execution layer shouldn't be responsible for computing the proof, it should // be done in the CL. - polys, ok := blobs.toKZGBlobSequence() - if !ok { - return nil, nil, KZGProof{}, err - } - proof, err := kzg.ComputeAggregateKZGProof(polys) + proof, err := kzg.ComputeAggregateKZGProof(blobs) if err != nil { return nil, nil, KZGProof{}, err } @@ -358,27 +348,6 @@ func (b *BlobsAndCommitments) FixedLength() uint64 { return 0 } -type PolynomialAndCommitment struct { - b Blob - c KZGCommitment -} - -func (p *PolynomialAndCommitment) HashTreeRoot(hFn tree.HashFn) tree.Root { - return hFn.HashTreeRoot(&p.b, &p.c) -} - -func (p *PolynomialAndCommitment) Serialize(w *codec.EncodingWriter) error { - return w.Container(&p.b, &p.c) -} - -func (p *PolynomialAndCommitment) ByteLength() uint64 { - return codec.ContainerLength(&p.b, &p.c) -} - -func (p *PolynomialAndCommitment) FixedLength() uint64 { - return 0 -} - type BlobTxWrapper struct { Tx SignedBlobTx BlobKzgs BlobKzgs @@ -443,12 +412,7 @@ func (b *BlobTxWrapData) verifyBlobs(inner TxData) error { if err := b.verifyVersionedHash(inner); err != nil { return err } - polys, ok := b.Blobs.toKZGBlobSequence() - if !ok { - return errors.New("could not convert blobs to blob sequence") - } - kzgs := b.BlobKzgs.toKZGCommitmentSequence() - ok, err := kzg.VerifyAggregateKZGProof(polys, kzgs, kzg.KZGProof(b.KzgAggregatedProof)) + ok, err := kzg.VerifyAggregateKZGProof(b.Blobs, b.BlobKzgs, kzg.KZGProof(b.KzgAggregatedProof)) if err != nil { return fmt.Errorf("error during proof verification: %v", err) } diff --git a/crypto/kzg/kzg_bytes.go b/crypto/kzg/kzg_bytes.go new file mode 100644 index 0000000000000..af20c5d5a235b --- /dev/null +++ b/crypto/kzg/kzg_bytes.go @@ -0,0 +1,147 @@ +package kzg + +import ( + "errors" + "fmt" + + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/params" + "github.com/protolambda/go-kzg/bls" +) + +// The custom types from EIP-4844 consensus spec: +// https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#custom-types +type FieldElement [32]byte +type KZGCommitment [48]byte +type KZGProof [48]byte +type VersionedHash [32]byte + +type BlobSequence interface { + Len() int + At(int) Blob +} + +type Blob interface { + Len() int + At(int) FieldElement +} + +type KZGCommitmentSequence interface { + Len() int + At(int) KZGCommitment +} + +// PointEvaluationPrecompile implements point_evaluation_precompile from EIP-4844 +func PointEvaluationPrecompile(input []byte) ([]byte, error) { + if len(input) != 192 { + return nil, errors.New("invalid input length") + } + + // versioned hash: first 32 bytes + var versionedHash [32]byte + copy(versionedHash[:], input[:32]) + + var x, y [32]byte + // Evaluation point: next 32 bytes + copy(x[:], input[32:64]) + // Expected output: next 32 bytes + copy(y[:], input[64:96]) + + // successfully converting x and y to bls.Fr confirms they are < MODULUS per the spec + var xFr, yFr bls.Fr + ok := bls.FrFrom32(&xFr, x) + if !ok { + return nil, errors.New("invalid evaluation point") + } + ok = bls.FrFrom32(&yFr, y) + if !ok { + return nil, errors.New("invalid expected output") + } + + // input kzg point: next 48 bytes + var dataKZG [48]byte + copy(dataKZG[:], input[96:144]) + if KZGToVersionedHash(KZGCommitment(dataKZG)) != VersionedHash(versionedHash) { + return nil, errors.New("mismatched versioned hash") + } + + // Quotient kzg: next 48 bytes + var quotientKZG [48]byte + copy(quotientKZG[:], input[144:192]) + + ok, err := VerifyKZGProof(KZGCommitment(dataKZG), &xFr, &yFr, KZGProof(quotientKZG)) + if err != nil { + return nil, fmt.Errorf("verify_kzg_proof error: %v", err) + } + if !ok { + return nil, errors.New("failed to verify kzg proof") + } + return []byte{}, nil +} + +// KZGToVersionedHash implements kzg_to_versioned_hash from EIP-4844 +func KZGToVersionedHash(kzg KZGCommitment) VersionedHash { + h := crypto.Keccak256Hash(kzg[:]) + h[0] = params.BlobCommitmentVersionKZG + return VersionedHash([32]byte(h)) +} + +// BlobToKZGCommitment implements blob_to_kzg_commitment from the EIP-4844 consensus spec: +// https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#blob_to_kzg_commitment +func BlobToKZGCommitment(blob Blob) (KZGCommitment, bool) { + poly, ok := BlobToPolynomial(blob) + if !ok { + return KZGCommitment{}, false + } + return PolynomialToKZGCommitment(poly), true +} + +// VerifyAggregateKZGProof implements verify_aggregate_kzg_proof from the EIP-4844 consensus spec: +// https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#verify_aggregate_kzg_proof +func VerifyAggregateKZGProof(blobs BlobSequence, expectedKZGCommitments KZGCommitmentSequence, kzgAggregatedProof KZGProof) (bool, error) { + polynomials, ok := BlobsToPolynomials(blobs) + if !ok { + return false, errors.New("could not convert blobs to polynomials") + } + aggregatedPoly, aggregatedPolyCommitment, evaluationChallenge, err := + ComputeAggregatedPolyAndCommitment(polynomials, expectedKZGCommitments) + if err != nil { + return false, err + } + y := EvaluatePolynomialInEvaluationForm(aggregatedPoly, evaluationChallenge) + return VerifyKZGProof(aggregatedPolyCommitment, evaluationChallenge, y, kzgAggregatedProof) +} + +// ComputeAggregateKZGProof implements compute_aggregate_kzg_proof from the EIP-4844 consensus spec: +// https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#compute_aggregate_kzg_proof +func ComputeAggregateKZGProof(blobs BlobSequence) (KZGProof, error) { + polynomials, ok := BlobsToPolynomials(blobs) + if !ok { + return KZGProof{}, errors.New("could not convert blobs to polynomials") + } + return ComputeAggregateKZGProofFromPolynomials(polynomials) +} + +func BlobToPolynomial(b Blob) (Polynomial, bool) { + l := b.Len() + frs := make(Polynomial, l) + for i := 0; i < l; i++ { + if !bls.FrFrom32(&frs[i], b.At(i)) { + return []bls.Fr{}, false + } + } + return frs, true +} + +func BlobsToPolynomials(blobs BlobSequence) ([][]bls.Fr, bool) { + l := blobs.Len() + out := make(Polynomials, l) + for i := 0; i < l; i++ { + blob, ok := BlobToPolynomial(blobs.At(i)) + if !ok { + return nil, false + } + out[i] = blob + } + return out, true +} diff --git a/crypto/kzg/kzg_new.go b/crypto/kzg/kzg_new.go index 047b9459202ca..a869306325acc 100644 --- a/crypto/kzg/kzg_new.go +++ b/crypto/kzg/kzg_new.go @@ -9,7 +9,6 @@ import ( "github.com/protolambda/go-kzg/bls" "github.com/protolambda/ztyp/codec" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/params" ) @@ -17,16 +16,17 @@ const ( FIAT_SHAMIR_PROTOCOL_DOMAIN = "FSBLOBVERIFY_V1_" ) -// The custom types from EIP-4844 consensus spec: -// https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#custom-types -// We deviate from the spec slightly in that we use: -// bls.Fr for BLSFieldElement -// bls.G1Point for G1Point -// bls.G2Point for G2Point -type Blob []bls.Fr -type KZGCommitment [48]byte -type KZGProof [48]byte -type VersionedHash [32]byte +type Polynomial []bls.Fr +type Polynomials [][]bls.Fr +type CommitmentSequenceImpl []KZGCommitment + +func (s CommitmentSequenceImpl) At(i int) KZGCommitment { + return s[i] +} + +func (s CommitmentSequenceImpl) Len() int { + return len(s) +} // VerifyKZGProof implements verify_kzg_proof from the EIP-4844 consensus spec: // https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#verify_kzg_proof @@ -56,9 +56,9 @@ func VerifyKZGProofFromPoints(polynomialKZG *bls.G1Point, z *bls.Fr, y *bls.Fr, return bls.PairingsVerify(&pMinusY, &bls.GenG2, kzgProof, &xMinusZ) } -// VerifyAggregateKZGProof implements verify_aggregate_kzg_proof from the EIP-4844 consensus spec: -// https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#verify_aggregate_kzg_proof -func VerifyAggregateKZGProof(blobs [][]bls.Fr, expectedKZGCommitments []KZGCommitment, kzgAggregatedProof KZGProof) (bool, error) { +// VerifyAggregateKZGProof implements verify_aggregate_kzg_proof from the EIP-4844 consensus spec, +// only operating on blobs that have already been converted into polynomials. +func VerifyAggregateKZGProofFromPolynomials(blobs Polynomials, expectedKZGCommitments KZGCommitmentSequence, kzgAggregatedProof KZGProof) (bool, error) { aggregatedPoly, aggregatedPolyCommitment, evaluationChallenge, err := ComputeAggregatedPolyAndCommitment(blobs, expectedKZGCommitments) if err != nil { @@ -68,61 +68,6 @@ func VerifyAggregateKZGProof(blobs [][]bls.Fr, expectedKZGCommitments []KZGCommi return VerifyKZGProof(aggregatedPolyCommitment, evaluationChallenge, y, kzgAggregatedProof) } -// KZGToVersionedHash implements kzg_to_versioned_hash from EIP-4844 -func KZGToVersionedHash(kzg KZGCommitment) VersionedHash { - h := crypto.Keccak256Hash(kzg[:]) - h[0] = params.BlobCommitmentVersionKZG - return VersionedHash([32]byte(h)) -} - -// PointEvaluationPrecompile implements point_evaluation_precompile from EIP-4844 -func PointEvaluationPrecompile(input []byte) ([]byte, error) { - if len(input) != 192 { - return nil, errors.New("invalid input length") - } - - // versioned hash: first 32 bytes - var versionedHash [32]byte - copy(versionedHash[:], input[:32]) - - var x, y [32]byte - // Evaluation point: next 32 bytes - copy(x[:], input[32:64]) - // Expected output: next 32 bytes - copy(y[:], input[64:96]) - - // successfully converting x and y to bls.Fr confirms they are < MODULUS per the spec - var xFr, yFr bls.Fr - ok := bls.FrFrom32(&xFr, x) - if !ok { - return nil, errors.New("invalid evaluation point") - } - ok = bls.FrFrom32(&yFr, y) - if !ok { - return nil, errors.New("invalid expected output") - } - - // input kzg point: next 48 bytes - var dataKZG [48]byte - copy(dataKZG[:], input[96:144]) - if KZGToVersionedHash(KZGCommitment(dataKZG)) != VersionedHash(versionedHash) { - return nil, errors.New("mismatched versioned hash") - } - - // Quotient kzg: next 48 bytes - var quotientKZG [48]byte - copy(quotientKZG[:], input[144:192]) - - ok, err := VerifyKZGProof(KZGCommitment(dataKZG), &xFr, &yFr, KZGProof(quotientKZG)) - if err != nil { - return nil, fmt.Errorf("verify_kzg_proof error: %v", err) - } - if !ok { - return nil, errors.New("failed to verify kzg proof") - } - return []byte{}, nil -} - // ComputePowers implements compute_powers from the EIP-4844 consensus spec: // https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#compute_powers func ComputePowers(r *bls.Fr, n int) []bls.Fr { @@ -136,9 +81,7 @@ func ComputePowers(r *bls.Fr, n int) []bls.Fr { return powers } -// BlobToKZGCommitment implements blob_to_kzg_commitment from the EIP-4844 consensus spec: -// https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#blob_to_kzg_commitment -func BlobToKZGCommitment(eval Blob) KZGCommitment { +func PolynomialToKZGCommitment(eval Polynomial) KZGCommitment { g1 := bls.LinCombG1(kzgSetupLagrange, []bls.Fr(eval)) var out KZGCommitment copy(out[:], bls.ToCompressedG1(g1)) @@ -161,7 +104,7 @@ func BytesToBLSField(h [32]byte) *bls.Fr { // ComputeAggregatedPolyAndcommitment implements compute_aggregated_poly_and_commitment from the EIP-4844 consensus spec: // https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#compute_aggregated_poly_and_commitment -func ComputeAggregatedPolyAndCommitment(blobs [][]bls.Fr, commitments []KZGCommitment) ([]bls.Fr, KZGCommitment, *bls.Fr, error) { +func ComputeAggregatedPolyAndCommitment(blobs Polynomials, commitments KZGCommitmentSequence) ([]bls.Fr, KZGCommitment, *bls.Fr, error) { // create challenges r, err := HashToBLSField(blobs, commitments) powers := ComputePowers(r, len(blobs)) @@ -177,9 +120,11 @@ func ComputeAggregatedPolyAndCommitment(blobs [][]bls.Fr, commitments []KZGCommi return nil, KZGCommitment{}, nil, err } - commitmentsG1 := make([]bls.G1Point, len(commitments)) - for i := 0; i < len(commitmentsG1); i++ { - p, err := bls.FromCompressedG1(commitments[i][:]) + l := commitments.Len() + commitmentsG1 := make([]bls.G1Point, l) + for i := 0; i < l; i++ { + c := commitments.At(i) + p, err := bls.FromCompressedG1(c[:]) if err != nil { return nil, KZGCommitment{}, nil, err } @@ -192,12 +137,12 @@ func ComputeAggregatedPolyAndCommitment(blobs [][]bls.Fr, commitments []KZGCommi return aggregatedPoly, aggregatedCommitment, &evaluationChallenge, nil } -// ComputeAggregateKZGProof implements compute_aggregate_kzg_proof from the EIP-4844 consensus spec: -// https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#compute_aggregate_kzg_proof -func ComputeAggregateKZGProof(blobs [][]bls.Fr) (KZGProof, error) { - commitments := make([]KZGCommitment, len(blobs)) +// ComputeAggregateKZGProofFromPolynomials implements compute_aggregate_kzg_proof from the EIP-4844 +// consensus spec, only operating over blobs that are already parsed into a polynomial. +func ComputeAggregateKZGProofFromPolynomials(blobs Polynomials) (KZGProof, error) { + commitments := make(CommitmentSequenceImpl, len(blobs)) for i, b := range blobs { - commitments[i] = BlobToKZGCommitment(Blob(b)) + commitments[i] = PolynomialToKZGCommitment(Polynomial(b)) } aggregatedPoly, _, evaluationChallenge, err := ComputeAggregatedPolyAndCommitment(blobs, commitments) if err != nil { @@ -244,7 +189,7 @@ func EvaluatePolynomialInEvaluationForm(poly []bls.Fr, x *bls.Fr) *bls.Fr { // HashToBLSField implements hash_to_bls_field from the EIP-4844 consensus specs: // https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md#hash_to_bls_field -func HashToBLSField(polys [][]bls.Fr, comms []KZGCommitment) (*bls.Fr, error) { +func HashToBLSField(polys Polynomials, comms KZGCommitmentSequence) (*bls.Fr, error) { sha := sha256.New() w := codec.NewEncodingWriter(sha) if err := w.Write([]byte(FIAT_SHAMIR_PROTOCOL_DOMAIN)); err != nil { @@ -264,8 +209,10 @@ func HashToBLSField(polys [][]bls.Fr, comms []KZGCommitment) (*bls.Fr, error) { } } } - for _, commitment := range comms { - if err := w.Write(commitment[:]); err != nil { + l := comms.Len() + for i := 0; i < l; i++ { + c := comms.At(i) + if err := w.Write(c[:]); err != nil { return nil, err } } diff --git a/signer/core/apitypes/types.go b/signer/core/apitypes/types.go index 8c4e672348dfd..c71178794bc9c 100644 --- a/signer/core/apitypes/types.go +++ b/signer/core/apitypes/types.go @@ -149,17 +149,14 @@ func (args *SendTxArgs) ToTransaction() *types.Transaction { msg.Data = input msg.AccessList = types.AccessListView(al) wrapData := types.BlobTxWrapData{} - for _, bl := range args.Blobs { - frs, ok := bl.ToKZGBlob() - if !ok { - // invalid BLS blob data (e.g. element not within field element range) - continue // can't error, so ignore the malformed blob + for _, blob := range args.Blobs { + c, ok := kzg.BlobToKZGCommitment(blob) + if ok { + versionedHash := common.Hash(kzg.KZGToVersionedHash(c)) + msg.BlobVersionedHashes = append(msg.BlobVersionedHashes, versionedHash) + wrapData.BlobKzgs = append(wrapData.BlobKzgs, types.KZGCommitment(c)) + wrapData.Blobs = append(wrapData.Blobs, blob) } - commitment := types.KZGCommitment(kzg.BlobToKZGCommitment(frs)) - versionedHash := common.Hash(kzg.KZGToVersionedHash(kzg.KZGCommitment(commitment))) - msg.BlobVersionedHashes = append(msg.BlobVersionedHashes, versionedHash) - wrapData.BlobKzgs = append(wrapData.BlobKzgs, commitment) - wrapData.Blobs = append(wrapData.Blobs, bl) } _, _, aggProof, err := types.Blobs(args.Blobs).ComputeCommitmentsAndAggregatedProof() if err == nil { diff --git a/tests/kzg_bench_test.go b/tests/kzg_bench_test.go index 56239dea1f03d..57b0b0db80f15 100644 --- a/tests/kzg_bench_test.go +++ b/tests/kzg_bench_test.go @@ -15,8 +15,8 @@ import ( "github.com/protolambda/ztyp/view" ) -func randomBlob() kzg.Blob { - blob := make(kzg.Blob, params.FieldElementsPerBlob) +func randomBlob() kzg.Polynomial { + blob := make(kzg.Polynomial, params.FieldElementsPerBlob) for i := 0; i < len(blob); i++ { blob[i] = *bls.RandomFr() } @@ -27,7 +27,7 @@ func BenchmarkBlobToKzg(b *testing.B) { blob := randomBlob() b.ResetTimer() for i := 0; i < b.N; i++ { - kzg.BlobToKZGCommitment(blob) + kzg.PolynomialToKZGCommitment(blob) } } diff --git a/tests/kzg_test.go b/tests/kzg_test.go index 621bbe35cc103..60116006a373a 100644 --- a/tests/kzg_test.go +++ b/tests/kzg_test.go @@ -156,20 +156,17 @@ func TestVerifyBlobs(t *testing.T) { copy(blob1[i][:], jsonBlobs.KzgBlob1[i*31:(i+1)*31]) copy(blob2[i][:], jsonBlobs.KzgBlob2[i*31:(i+1)*31]) } - // Compute KZG commitments for both of the blobs above - frs1, ok1 := blob1.ToKZGBlob() - frs2, ok2 := blob2.ToKZGBlob() + kzg1, ok1 := kzg.BlobToKZGCommitment(blob1.ToCryptoBlob()) + kzg2, ok2 := kzg.BlobToKZGCommitment(blob2.ToCryptoBlob()) if ok1 == false || ok2 == false { panic("failed to convert blobs") } - kzg1 := types.KZGCommitment(kzg.BlobToKZGCommitment(frs1)) - kzg2 := types.KZGCommitment(kzg.BlobToKZGCommitment(frs2)) // Create the dummy object with all that data we prepared blobData := types.BlobTxWrapData{ - BlobKzgs: []types.KZGCommitment{kzg1, kzg2}, - Blobs: []types.Blob{blob1, blob2}, + BlobKzgs: []types.KZGCommitment{types.KZGCommitment(kzg1), types.KZGCommitment(kzg2)}, + Blobs: []types.Blob{types.Blob(blob1), types.Blob(blob2)}, } var hashes []common.Hash @@ -225,7 +222,7 @@ func TestPointEvaluationTestVector(t *testing.T) { } // Create a commitment - commitment := kzg.BlobToKZGCommitment(evalPoly) + commitment := kzg.PolynomialToKZGCommitment(evalPoly) // Create proof for testing x := uint64(0x42)