@@ -56,17 +56,10 @@ impl ZKVMEngine {
5656 /// - The aggregated [`AlignedProof`], representing the combined proof
5757 /// - The Merkle root computed within the ZKVM, exposed as a public input
5858 ///
59- /// This function performs proof aggregation and ensures the resulting Merkle root
60- /// can be independently verified by external systems.
61- ///
62- /// If the number of proofs exceeds [`MAX_PROOFS_PER_AGGREGATION`], it first aggregates
63- /// them in chunks of [`MAX_PROOFS_PER_AGGREGATION`], and then aggregates those intermediate results into
64- /// the final proof.
65- ///
66- /// Note: Intermediate proof commitments are not computed using the Keccak hash of the
67- /// verification key and public inputs. Instead, the raw bytes of the public input—
68- /// which represent the chunk's merkle root are used directly. This is to ensure
69- /// the final Merkle root matches the leaf hashes published on the blob.
59+ /// This function performs multi-level proof aggregation. It splits the input proofs into chunks of
60+ /// [`MAX_PROOFS_PER_AGGREGATION`] and uses the `chunk_aggregator` to aggregate each chunk.
61+ /// Then, the `root_aggregator` takes the resulting chunk proofs and their corresponding leaves commitments
62+ /// to produce the final aggregated proof.
7063 pub fn aggregate_proofs (
7164 & self ,
7265 proofs : Vec < AlignedProof > ,
@@ -84,15 +77,14 @@ impl ZKVMEngine {
8477 } )
8578 . collect ( ) ;
8679
87- info ! ( "Total proofs to aggregate {}" , proofs. len( ) ) ;
8880 let chunks = proofs. chunks ( MAX_PROOFS_PER_AGGREGATION ) ;
89- let mut agg_proofs: Vec < ( SP1ProofWithPubValuesAndElf , Vec < [ u8 ; 32 ] > ) > = vec ! [ ] ;
90-
9181 info ! (
92- "Proofs length is higher than {}, aggregation will be performed in {} chunks" ,
93- MAX_PROOFS_PER_AGGREGATION ,
82+ "Total proofs to aggregate {}. They aggregation will be perform in {} chunks" ,
83+ proofs . len ( ) ,
9484 chunks. len( )
9585 ) ;
86+
87+ let mut agg_proofs: Vec < ( SP1ProofWithPubValuesAndElf , Vec < [ u8 ; 32 ] > ) > = vec ! [ ] ;
9688 for ( i, chunk) in chunks. enumerate ( ) {
9789 let leaves_commitment =
9890 chunk. iter ( ) . map ( |e| e. hash_vk_and_pub_inputs ( ) ) . collect ( ) ;
@@ -126,15 +118,14 @@ impl ZKVMEngine {
126118 } )
127119 . collect ( ) ;
128120
129- info ! ( "Total proofs to aggregate {}" , proofs. len( ) ) ;
130121 let chunks = proofs. chunks ( MAX_PROOFS_PER_AGGREGATION ) ;
131- let mut agg_proofs: Vec < ( Risc0ProofReceiptAndImageId , Vec < [ u8 ; 32 ] > ) > = vec ! [ ] ;
132-
133122 info ! (
134- "Proofs length is higher than {}, aggregation will be performed in {} chunks" ,
135- MAX_PROOFS_PER_AGGREGATION ,
123+ "Total proofs to aggregate {}. They aggregation will be perform in {} chunks" ,
124+ proofs . len ( ) ,
136125 chunks. len( )
137126 ) ;
127+
128+ let mut agg_proofs: Vec < ( Risc0ProofReceiptAndImageId , Vec < [ u8 ; 32 ] > ) > = vec ! [ ] ;
138129 for ( i, chunk) in chunks. enumerate ( ) {
139130 let leaves_commitment = chunk
140131 . iter ( )
0 commit comments