1- import { Experimental , Field , Gadgets } from 'o1js' ;
1+ import { assert , Experimental , Field , Gadgets } from 'o1js' ;
22const { ZkFunction } = Experimental ;
33
44/**
@@ -18,26 +18,33 @@ const main = ZkFunction({
1818 } ,
1919} ) ;
2020
21- /* console.time('compile...'); */
21+ console . time ( 'compile...' ) ;
2222const { verificationKey } = await main . compile ( ) ;
23+ console . timeEnd ( 'compile...' ) ;
24+
2325const x = Field ( 8 ) ;
2426const y = Field ( 2 ) ;
27+
28+ console . time ( 'prove...' ) ;
2529const proof = await main . prove ( x , y ) ;
30+ console . timeEnd ( 'prove...' ) ;
2631
32+ console . time ( 'verify...' ) ;
2733let ok = await main . verify ( proof , verificationKey ) ;
34+ console . timeEnd ( 'verify...' ) ;
2835
29- console . log ( 'ok?' , ok ) ;
36+ assert ( ok , 'proof should verify' ) ;
3037
3138console . log ( 'testing round trips' ) ;
3239
3340ok = await proofRoundTrip ( proof ) . verify ( verificationKey ) ;
34- console . log ( 'proof round trip ok?' , ok ) ;
41+ assert ( ok , 'proof should verify' ) ;
3542
3643console . log ( 'verification key round trip...' ) ;
3744
3845ok = await proof . verify ( verificationKeyRoundTrip ( verificationKey ) ) ;
3946
40- console . log ( 'verification key round trip ok?' , ok ) ;
47+ assert ( ok , 'proof should verify' ) ;
4148
4249function proofRoundTrip ( proof : Experimental . KimchiProof ) : Experimental . KimchiProof {
4350 let json = proof . toJSON ( ) ;
0 commit comments