File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 77import {
88 assert ,
99 Bool ,
10+ Experimental ,
1011 Field ,
1112 Poseidon ,
1213 Provable ,
@@ -42,17 +43,18 @@ const hashChain = ZkProgram({
4243 // we have y = hash^k(x)
4344 // now do z = hash^(n-k)(y) = hash^n(x) by calling this method recursively
4445 // except if we have k = n, then ignore the output and use y
45- let z : Field = await hashChain . proveRecursivelyIf . chain (
46- reachedN . not ( ) ,
47- { x : y , n : n . sub ( k ) }
48- ) ;
46+ let z : Field = await hashChainRecursive . chain . if ( reachedN . not ( ) , {
47+ x : y ,
48+ n : n . sub ( k ) ,
49+ } ) ;
4950 z = Provable . if ( reachedN , y , z ) ;
5051 Provable . log ( 'hashChain (start proving)' , n ) ;
5152 return { publicOutput : z } ;
5253 } ,
5354 } ,
5455 } ,
5556} ) ;
57+ let hashChainRecursive = Experimental . Recursive ( hashChain ) ;
5658
5759await hashChain . compile ( ) ;
5860
You can’t perform that action at this time.
0 commit comments