@@ -31,26 +31,33 @@ fn test_e2e_prove_verify() {
31
31
let chunks1 = load_batch ( "./tests/extra_traces/batch1" ) . unwrap ( ) ;
32
32
let chunks2 = load_batch ( "./tests/extra_traces/batch2" ) . unwrap ( ) ;
33
33
34
- let batch1 = gen_batch_proving_task ( & output_dir, & chunks1, None ) ;
35
- let batch2 = gen_batch_proving_task ( & output_dir, & chunks2, Some ( batch1. batch_header ) ) ;
36
-
37
- dump_chunk_protocol ( & batch1, & output_dir) ;
38
- dump_as_json ( & output_dir, "batch_prove_1" , & batch1) . unwrap ( ) ;
39
- dump_as_json ( & output_dir, "batch_prove_2" , & batch2) . unwrap ( ) ;
40
-
41
34
let mut batch_prover = new_batch_prover ( & output_dir) ;
42
- let batch1_proof = prove_and_verify_batch ( & output_dir, & mut batch_prover, batch1) ;
43
- let proof_path = Path :: new ( & output_dir) . join ( "full_proof_batch_agg.json" ) ;
44
- let proof_path_to = Path :: new ( & output_dir) . join ( "full_proof_batch_agg_1.json" ) ;
45
- fs:: rename ( proof_path, proof_path_to) . unwrap ( ) ;
46
-
47
- let batch2_proof = prove_and_verify_batch ( & output_dir, & mut batch_prover, batch2) ;
48
- let proof_path = Path :: new ( & output_dir) . join ( "full_proof_batch_agg.json" ) ;
49
- let proof_path_to = Path :: new ( & output_dir) . join ( "full_proof_batch_agg_2.json" ) ;
50
- fs:: rename ( proof_path, proof_path_to) . unwrap ( ) ;
35
+ let mut batch_header = None ;
36
+ let mut batch_proofs = Vec :: new ( ) ;
37
+
38
+ for ( i, chunk) in [
39
+ chunks1,
40
+ chunks2,
41
+ ] . into_iter ( ) . enumerate ( ) {
42
+
43
+ let batch = gen_batch_proving_task ( & output_dir, & chunk, batch_header) ;
44
+ dump_as_json ( & output_dir, format ! ( "batch_prove_{}" , i+1 ) . as_str ( ) , & batch) . unwrap ( ) ;
45
+ if i == 0 {
46
+ dump_chunk_protocol ( & batch, & output_dir) ;
47
+ }
48
+
49
+ let batch_proof = prove_and_verify_batch ( & output_dir, & mut batch_prover, batch) ;
50
+ let proof_path = Path :: new ( & output_dir) . join ( "full_proof_batch_agg.json" ) ;
51
+ let proof_path_to = Path :: new ( & output_dir) . join ( format ! ( "full_proof_batch_agg_{}.json" , i+1 ) . as_str ( ) ) ;
52
+ fs:: rename ( proof_path, proof_path_to) . unwrap ( ) ;
53
+
54
+ log:: info!( "batch proof {}, prev hash {:x?}, current {:x?}" , i, batch_proof. batch_header. parent_batch_hash, batch_proof. batch_header. batch_hash( ) ) ;
55
+ batch_header. replace ( batch_proof. batch_header . clone ( ) ) ;
56
+ batch_proofs. push ( batch_proof) ;
57
+ }
51
58
52
59
let bundle = prover:: BundleProvingTask {
53
- batch_proofs : vec ! [ batch1_proof , batch2_proof ] ,
60
+ batch_proofs,
54
61
} ;
55
62
prove_and_verify_bundle ( & output_dir, & mut batch_prover, bundle) ;
56
63
}
@@ -80,7 +87,7 @@ fn gen_batch_proving_task(
80
87
let chunk_proofs: Vec < _ > = chunks
81
88
. into_iter ( )
82
89
. enumerate ( )
83
- . map ( |( i , block_traces) | {
90
+ . map ( |( _ , block_traces) | {
84
91
zkevm_prover
85
92
. gen_chunk_proof (
86
93
ChunkProvingTask :: from ( block_traces) ,
0 commit comments