@@ -57,8 +57,6 @@ import type { Address, PrefixedHexString } from '@ethereumjs/util'
57
57
import type { Logger } from '../src/logging.ts'
58
58
import type { ClientOpts } from '../src/types.ts'
59
59
60
- import * as ckzg from 'c-kzg'
61
-
62
60
export type Account = [ address : Address , privateKey : Uint8Array ]
63
61
64
62
const networks = Object . keys ( Chain ) . map ( ( network ) => network . toLowerCase ( ) )
@@ -631,65 +629,6 @@ function generateAccount(): Account {
631
629
632
630
export async function getCryptoFunctions ( useJsCrypto : boolean ) : Promise < CustomCrypto > {
633
631
const cryptoFunctions : CustomCrypto = { }
634
- ckzg . loadTrustedSetup ( 0 )
635
- const cKzg = {
636
- blobToKzgCommitment : ( blob : string ) => {
637
- const blobBytes = hexToBytes ( blob as PrefixedHexString )
638
- const commitmentBytes = ckzg . blobToKzgCommitment ( blobBytes )
639
- return bytesToHex ( commitmentBytes ) as string
640
- } ,
641
- computeBlobProof : ( blob : string , commitment : string ) => {
642
- const blobBytes = hexToBytes ( blob as PrefixedHexString )
643
- const commitmentBytes = hexToBytes ( commitment as PrefixedHexString )
644
- const proofBytes = ckzg . computeBlobKzgProof ( blobBytes , commitmentBytes )
645
- return bytesToHex ( proofBytes ) as string
646
- } ,
647
- verifyProof : ( commitment : string , z : string , y : string , proof : string ) => {
648
- const commitmentBytes = hexToBytes ( commitment as PrefixedHexString )
649
- const zBytes = hexToBytes ( z as PrefixedHexString )
650
- const yBytes = hexToBytes ( y as PrefixedHexString )
651
- const proofBytes = hexToBytes ( proof as PrefixedHexString )
652
- return ckzg . verifyKzgProof ( commitmentBytes , zBytes , yBytes , proofBytes )
653
- } ,
654
- verifyBlobProofBatch : ( blobs : string [ ] , commitments : string [ ] , proofs : string [ ] ) => {
655
- const blobsBytes = blobs . map ( ( blb ) => hexToBytes ( blb as PrefixedHexString ) )
656
- const commitmentsBytes = commitments . map ( ( cmt ) => hexToBytes ( cmt as PrefixedHexString ) )
657
- const proofsBytes = proofs . map ( ( prf ) => hexToBytes ( prf as PrefixedHexString ) )
658
- return ckzg . verifyBlobKzgProofBatch ( blobsBytes , commitmentsBytes , proofsBytes )
659
- } ,
660
- computeCells : ( blob : string ) => {
661
- const blobBytes = hexToBytes ( blob as PrefixedHexString )
662
- const cellsBytes = ckzg . computeCells ( blobBytes )
663
- return cellsBytes . map ( ( cellBytes ) => bytesToHex ( cellBytes ) ) as string [ ]
664
- } ,
665
- computeCellsAndProofs : ( blob : string ) => {
666
- const blobBytes = hexToBytes ( blob as PrefixedHexString )
667
- const [ cellsBytes , proofsBytes ] = ckzg . computeCellsAndKzgProofs ( blobBytes )
668
- return [
669
- cellsBytes . map ( ( cellBytes ) => bytesToHex ( cellBytes ) ) ,
670
- proofsBytes . map ( ( prfBytes ) => bytesToHex ( prfBytes ) ) ,
671
- ] as [ string [ ] , string [ ] ]
672
- } ,
673
- recoverCellsAndProofs : ( indices : number [ ] , cells : string [ ] ) => {
674
- const cellsBytes = cells . map ( ( cell ) => hexToBytes ( cell as PrefixedHexString ) )
675
- const [ allCellsBytes , allProofsBytes ] = ckzg . recoverCellsAndKzgProofs ( indices , cellsBytes )
676
- return [
677
- allCellsBytes . map ( ( cellBytes ) => bytesToHex ( cellBytes ) ) ,
678
- allProofsBytes . map ( ( prfBytes ) => bytesToHex ( prfBytes ) ) ,
679
- ] as [ string [ ] , string [ ] ]
680
- } ,
681
- verifyCellKzgProofBatch : (
682
- commitments : string [ ] ,
683
- indices : number [ ] ,
684
- cells : string [ ] ,
685
- proofs : string [ ] ,
686
- ) => {
687
- const commitmentsBytes = commitments . map ( ( commit ) => hexToBytes ( commit as PrefixedHexString ) )
688
- const cellsBytes = cells . map ( ( cell ) => hexToBytes ( cell as PrefixedHexString ) )
689
- const proofsBytes = proofs . map ( ( prf ) => hexToBytes ( prf as PrefixedHexString ) )
690
- return ckzg . verifyCellKzgProofBatch ( commitmentsBytes , indices , cellsBytes , proofsBytes )
691
- } ,
692
- }
693
632
694
633
const kzg = new microEthKZG ( trustedSetup )
695
634
// Initialize WASM crypto if JS crypto is not specified
@@ -736,8 +675,6 @@ export async function getCryptoFunctions(useJsCrypto: boolean): Promise<CustomCr
736
675
}
737
676
}
738
677
cryptoFunctions . kzg = kzg
739
- // override with cKzg for debugging
740
- cryptoFunctions . kzg = cKzg
741
678
cryptoFunctions . verkle = verkle
742
679
return cryptoFunctions
743
680
}
0 commit comments