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

Commit f9d59f2

Browse files
committed
refactor
1 parent 9ffe874 commit f9d59f2

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
@@ -235,11 +235,29 @@ impl<const N_SNARKS: usize> Circuit<Fr> for BatchCircuit<N_SNARKS> {
235235
&self.snarks_with_padding,
236236
self.as_proof(),
237237
);
238-
let mut ctx = Rc::into_inner(loader).unwrap().into_ctx();
238+
239+
// extract the following cells for later constraints
240+
// - the accumulators
241+
// - the public inputs from each snark
242+
accumulator_instances.extend(flatten_accumulator(acc).iter().copied());
243+
// the snark is not a fresh one, assigned_instances already contains an
244+
// accumulator so we want to skip the first 12 elements from the public
245+
// input
246+
snark_inputs.extend(
247+
assigned_aggregation_instances
248+
.iter()
249+
.flat_map(|instance_column| instance_column.iter().skip(ACC_LEN)),
250+
);
239251
for (i, e) in assigned_aggregation_instances[0].iter().enumerate() {
240252
log::trace!("{}-th instance: {:?}", i, e.value)
241253
}
242254

255+
loader
256+
.ctx_mut()
257+
.print_stats(&["snark aggregation"]);
258+
259+
let mut ctx = Rc::into_inner(loader).unwrap().into_ctx();
260+
243261
// We must ensure that the commitments to preprocessed polynomial and initial
244262
// state of transcripts for every SNARK that is being aggregated belongs to the
245263
// fixed set of values expected.
@@ -348,20 +366,7 @@ impl<const N_SNARKS: usize> Circuit<Fr> for BatchCircuit<N_SNARKS> {
348366
.assert_is_const(&mut ctx, &transcript_check, Fr::ONE);
349367
}
350368

351-
// extract the following cells for later constraints
352-
// - the accumulators
353-
// - the public inputs from each snark
354-
accumulator_instances.extend(flatten_accumulator(acc).iter().copied());
355-
// the snark is not a fresh one, assigned_instances already contains an
356-
// accumulator so we want to skip the first 12 elements from the public
357-
// input
358-
snark_inputs.extend(
359-
assigned_aggregation_instances
360-
.iter()
361-
.flat_map(|instance_column| instance_column.iter().skip(ACC_LEN)),
362-
);
363-
364-
ctx.print_stats(&["snark aggregation [chunks -> batch]"]);
369+
ctx.print_stats(&["protocol check"]);
365370

366371
log::debug!("batching: assigning barycentric");
367372
let barycentric = config.blob_consistency_config.assign_barycentric(

0 commit comments

Comments
 (0)