@@ -16,7 +16,7 @@ use crate::{
16
16
types:: BundleProvingTask ,
17
17
utils:: { force_to_read, try_to_read} ,
18
18
BatchProofV2 , BatchProofV2Metadata , BatchProvingTask , BundleProofV2 , ChunkKind , ChunkProof ,
19
- ParamsMap , ProverError ,
19
+ ChunkProofV2 , ParamsMap , ProverError ,
20
20
} ;
21
21
22
22
/// Prover capable of generating [`BatchProof`] and [`BundleProof`].
@@ -197,8 +197,8 @@ impl<'params> Prover<'params> {
197
197
let bundle_snarks = bundle
198
198
. batch_proofs
199
199
. iter ( )
200
- . map ( |proof| proof . into ( ) )
201
- . collect :: < Vec < _ > > ( ) ;
200
+ . map ( Snark :: try_from )
201
+ . collect :: < Result < Vec < Snark > , _ > > ( ) ? ;
202
202
203
203
// Load from disk or generate a layer-5 Recursive Circuit SNARK.
204
204
let layer5_snark = self
@@ -266,11 +266,16 @@ impl<'params> Prover<'params> {
266
266
self . check_protocol_of_chunks ( & batch. chunk_proofs ) ?;
267
267
268
268
// Split chunk info and snarks from the batch proving task.
269
- let ( mut chunk_infos, mut layer2_snarks) : ( Vec < _ > , Vec < _ > ) = batch
269
+ let mut chunk_infos = batch
270
+ . chunk_proofs
271
+ . iter ( )
272
+ . map ( |proof| proof. inner . chunk_info ( ) . clone ( ) )
273
+ . collect :: < Vec < _ > > ( ) ;
274
+ let mut layer2_snarks = batch
270
275
. chunk_proofs
271
276
. iter ( )
272
- . map ( |proof| ( proof . chunk_info . clone ( ) , proof . to_snark ( ) ) )
273
- . unzip ( ) ;
277
+ . map ( Snark :: try_from )
278
+ . collect :: < Result < Vec < Snark > , ProverError > > ( ) ? ;
274
279
275
280
// Pad the SNARKs with the last SNARK until we have MAX_AGG_SNARKS number of SNARKs.
276
281
if num_chunks < MAX_AGG_SNARKS {
@@ -372,15 +377,15 @@ impl<'params> Prover<'params> {
372
377
/// Sanity check: validate that the SNARK [`protocol`][snark_verifier::Protocol] for the SNARKs
373
378
/// being aggregated by the [`BatchCircuit`][aggregator::BatchCircuit] match the expected SNARK
374
379
/// protocols conditional to the chunk proof generation route utilised, i.e. halo2 or sp1.
375
- fn check_protocol_of_chunks ( & self , chunk_proofs : & [ ChunkProof ] ) -> Result < ( ) , ProverError > {
380
+ fn check_protocol_of_chunks ( & self , chunk_proofs : & [ ChunkProofV2 ] ) -> Result < ( ) , ProverError > {
376
381
for ( i, proof) in chunk_proofs. iter ( ) . enumerate ( ) {
377
- let expected = match proof. chunk_kind {
382
+ let expected = match proof. inner . chunk_kind ( ) {
378
383
ChunkKind :: Halo2 => & self . halo2_protocol ,
379
384
ChunkKind :: Sp1 => & self . sp1_protocol ,
380
385
} ;
381
- if proof. protocol . ne ( expected) {
386
+ if proof. inner . protocol ( ) . ne ( expected) {
382
387
let expected_digest = format ! ( "{:x}" , Sha256 :: digest( expected) ) ;
383
- let found_digest = format ! ( "{:x}" , Sha256 :: digest( & proof. protocol) ) ;
388
+ let found_digest = format ! ( "{:x}" , Sha256 :: digest( proof. inner . protocol( ) ) ) ;
384
389
log:: error!(
385
390
"BatchProver: SNARK protocol mismatch! index={}, expected={}, found={}" ,
386
391
i,
0 commit comments