Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify code-style in tests #1342

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions aggregator/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ macro_rules! layer_0 {
param
};

let pk = gen_pk(
&param, &$circuit, None,
// Some(&$path.join(Path::new("layer_0.pkey"))),
);
let pk = gen_pk(&param, &$circuit, None);
log::trace!("finished layer 0 pk generation for circuit");

let snark =
gen_snark_shplonk(&param, &pk, $circuit.clone(), &mut rng, None::<String>).unwrap();
let snark = gen_snark_shplonk(&param, &pk, $circuit.clone(), &mut rng, None::<String>).unwrap();
log::trace!("finished layer 0 snark generation for circuit");

assert!(verify_snark_shplonk::<$circuit_type>(
Expand All @@ -35,10 +31,7 @@ macro_rules! layer_0 {

log::trace!("finished layer 0 snark verification");
log::trace!("proof size: {}", snark.proof.len());
log::trace!(
"pi size: {}",
snark.instances.iter().map(|x| x.len()).sum::<usize>()
);
log::trace!("pi size: {}", snark.instances.iter().map(|x| x.len()).sum::<usize>());

log::trace!("layer 0 circuit instances");
for (i, e) in $circuit.instances()[0].iter().enumerate() {
Expand All @@ -63,7 +56,7 @@ macro_rules! compression_layer_snark {

let mut rng = test_rng();

let is_fresh = if $layer_index == 1 { true } else { false };
let is_fresh = $layer_index == 1;
let compression_circuit =
CompressionCircuit::new(&$param, $previous_snark.clone(), is_fresh, &mut rng).unwrap();

Expand Down Expand Up @@ -134,11 +127,7 @@ macro_rules! compression_layer_evm {
);
log::trace!("finished layer 4 bytecode generation");

evm_verify(
deployment_code,
compression_circuit.instances(),
proof.clone(),
);
evm_verify(deployment_code, compression_circuit.instances(), proof.clone());
log::trace!("layer 2 evm verification finished");

end_timer!(timer);
Expand Down Expand Up @@ -166,19 +155,16 @@ macro_rules! aggregation_layer_snark {
$chunks.as_ref(),
);

let pk = gen_pk(&$param, &aggregation_circuit, None);
let pk = gen_pk(&$param, &aggregation_circuit, None)?;
// build the snark for next layer
let snark = gen_snark_shplonk(
&param,
&pk,
aggregation_circuit.clone(),
&mut rng,
None::<String>, // Some(&$path.join(Path::new("layer_3.snark"))),
);
log::trace!(
"finished layer {} snark generation for circuit",
$layer_index
);
)?;
log::trace!("finished layer {} snark generation for circuit", $layer_index);

assert!(verify_snark_shplonk::<AggregationCircuit>(
&param,
Expand Down
Loading