Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit dc52147

Browse files
committed
refactor
1 parent 0ad5448 commit dc52147

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

aggregator/src/aggregation/circuit.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,29 @@ impl<const N_SNARKS: usize> Circuit<Fr> for BatchCircuit<N_SNARKS> {
287287
&self.snarks_with_padding,
288288
self.as_proof(),
289289
);
290-
let mut ctx = Rc::into_inner(loader).unwrap().into_ctx();
290+
291+
// extract the following cells for later constraints
292+
// - the accumulators
293+
// - the public inputs from each snark
294+
accumulator_instances.extend(flatten_accumulator(acc).iter().copied());
295+
// the snark is not a fresh one, assigned_instances already contains an
296+
// accumulator so we want to skip the first 12 elements from the public
297+
// input
298+
snark_inputs.extend(
299+
assigned_aggregation_instances
300+
.iter()
301+
.flat_map(|instance_column| instance_column.iter().skip(ACC_LEN)),
302+
);
291303
for (i, e) in assigned_aggregation_instances[0].iter().enumerate() {
292304
log::trace!("{}-th instance: {:?}", i, e.value)
293305
}
294306

307+
loader
308+
.ctx_mut()
309+
.print_stats(&["snark aggregation"]);
310+
311+
let mut ctx = Rc::into_inner(loader).unwrap().into_ctx();
312+
295313
// We must ensure that the commitments to preprocessed polynomial and initial
296314
// state of transcripts for every SNARK that is being aggregated belongs to the
297315
// fixed set of values expected.
@@ -402,20 +420,7 @@ impl<const N_SNARKS: usize> Circuit<Fr> for BatchCircuit<N_SNARKS> {
402420
.assert_is_const(&mut ctx, &transcript_check, Fr::ONE);
403421
}
404422

405-
// extract the following cells for later constraints
406-
// - the accumulators
407-
// - the public inputs from each snark
408-
accumulator_instances.extend(flatten_accumulator(acc).iter().copied());
409-
// the snark is not a fresh one, assigned_instances already contains an
410-
// accumulator so we want to skip the first 12 elements from the public
411-
// input
412-
snark_inputs.extend(
413-
assigned_aggregation_instances
414-
.iter()
415-
.flat_map(|instance_column| instance_column.iter().skip(ACC_LEN)),
416-
);
417-
418-
ctx.print_stats(&["snark aggregation [chunks -> batch]"]);
423+
ctx.print_stats(&["protocol check"]);
419424

420425
log::debug!("batching: assigning barycentric");
421426
let barycentric = config.barycentric.assign(

0 commit comments

Comments
 (0)