@@ -6,10 +6,10 @@ import (
6
6
"fmt"
7
7
"io"
8
8
9
- "github.com/crate-crypto/go-proto-danksharding-crypto/eth"
10
- api "github.com/crate-crypto/go-proto-danksharding-crypto/serialization"
9
+ "github.com/crate-crypto/go-proto-danksharding-crypto/serialization"
11
10
"github.com/ethereum/go-ethereum/common"
12
11
"github.com/ethereum/go-ethereum/common/hexutil"
12
+ "github.com/ethereum/go-ethereum/crypto/kzg"
13
13
"github.com/ethereum/go-ethereum/params"
14
14
15
15
"github.com/protolambda/ztyp/codec"
@@ -51,7 +51,7 @@ func (p *KZGCommitment) UnmarshalText(text []byte) error {
51
51
}
52
52
53
53
func (c KZGCommitment ) ComputeVersionedHash () common.Hash {
54
- return common .Hash (eth .KZGToVersionedHash (api .KZGCommitment (c )))
54
+ return common .Hash (kzg .KZGToVersionedHash (serialization .KZGCommitment (c )))
55
55
}
56
56
57
57
// Compressed BLS12-381 G1 element
@@ -266,41 +266,41 @@ func (blobs Blobs) ComputeCommitmentsAndProofs() (commitments []KZGCommitment, v
266
266
versionedHashes = make ([]common.Hash , len (blobs ))
267
267
268
268
for i , blob := range blobs {
269
- commitment , err := eth .CryptoCtx .BlobToKZGCommitment (blob )
269
+ commitment , err := kzg .CryptoCtx .BlobToKZGCommitment (blob )
270
270
if err != nil {
271
271
return nil , nil , nil , fmt .Errorf ("could not convert blob to commitment: %v" , err )
272
272
}
273
273
274
- proof , err := eth .CryptoCtx .ComputeBlobKZGProof (blob , commitment )
274
+ proof , err := kzg .CryptoCtx .ComputeBlobKZGProof (blob , commitment )
275
275
if err != nil {
276
276
return nil , nil , nil , fmt .Errorf ("could not compute proof for blob: %v" , err )
277
277
}
278
278
commitments [i ] = KZGCommitment (commitment )
279
279
proofs [i ] = KZGProof (proof )
280
- versionedHashes [i ] = common .Hash (eth .KZGToVersionedHash (commitment ))
280
+ versionedHashes [i ] = common .Hash (kzg .KZGToVersionedHash (commitment ))
281
281
}
282
282
283
283
return commitments , versionedHashes , proofs , nil
284
284
}
285
285
286
- func toBlobs (_blobs Blobs ) []api .Blob {
287
- blobs := make ([]api .Blob , len (_blobs ))
286
+ func toBlobs (_blobs Blobs ) []serialization .Blob {
287
+ blobs := make ([]serialization .Blob , len (_blobs ))
288
288
for i , _blob := range _blobs {
289
- blobs [i ] = api .Blob (_blob )
289
+ blobs [i ] = serialization .Blob (_blob )
290
290
}
291
291
return blobs
292
292
}
293
- func toComms (_comms BlobKzgs ) []api .KZGCommitment {
294
- comms := make ([]api .KZGCommitment , len (_comms ))
293
+ func toComms (_comms BlobKzgs ) []serialization .KZGCommitment {
294
+ comms := make ([]serialization .KZGCommitment , len (_comms ))
295
295
for i , _comm := range _comms {
296
- comms [i ] = api .KZGCommitment (_comm )
296
+ comms [i ] = serialization .KZGCommitment (_comm )
297
297
}
298
298
return comms
299
299
}
300
- func toProofs (_proofs KZGProofs ) []api .KZGProof {
301
- proofs := make ([]api .KZGProof , len (_proofs ))
300
+ func toProofs (_proofs KZGProofs ) []serialization .KZGProof {
301
+ proofs := make ([]serialization .KZGProof , len (_proofs ))
302
302
for i , _proof := range _proofs {
303
- proofs [i ] = api .KZGProof (_proof )
303
+ proofs [i ] = serialization .KZGProof (_proof )
304
304
}
305
305
return proofs
306
306
}
@@ -357,7 +357,7 @@ func (b *BlobTxWrapData) validateBlobTransactionWrapper(inner TxData) error {
357
357
if l1 > params .MaxBlobsPerBlock {
358
358
return fmt .Errorf ("number of blobs exceeds max: %v" , l1 )
359
359
}
360
- err := eth .CryptoCtx .VerifyBlobKZGProofBatch (toBlobs (b .Blobs ), toComms (b .BlobKzgs ), toProofs (b .Proofs ))
360
+ err := kzg .CryptoCtx .VerifyBlobKZGProofBatch (toBlobs (b .Blobs ), toComms (b .BlobKzgs ), toProofs (b .Proofs ))
361
361
if err != nil {
362
362
return fmt .Errorf ("error during proof verification: %v" , err )
363
363
}
0 commit comments