From 8d926e7c1c69c28b356faf6c2168da9245e82690 Mon Sep 17 00:00:00 2001 From: Stepan Shimigonov Date: Sun, 16 Jun 2024 02:38:32 +0300 Subject: [PATCH 1/2] brought the code to a unified style, removed the commented-out remaining code --- aggregator/src/tests.rs | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/aggregator/src/tests.rs b/aggregator/src/tests.rs index 88fdb10710..419ed586fe 100644 --- a/aggregator/src/tests.rs +++ b/aggregator/src/tests.rs @@ -17,14 +17,10 @@ macro_rules! layer_0 { param }; - let pk = gen_pk( - ¶m, &$circuit, None, - // Some(&$path.join(Path::new("layer_0.pkey"))), - ); + let pk = gen_pk(¶m, &$circuit, None,); log::trace!("finished layer 0 pk generation for circuit"); - let snark = - gen_snark_shplonk(¶m, &pk, $circuit.clone(), &mut rng, None::).unwrap(); + let snark = gen_snark_shplonk(¶m, &pk, $circuit.clone(), &mut rng, None::).unwrap(); log::trace!("finished layer 0 snark generation for circuit"); assert!(verify_snark_shplonk::<$circuit_type>( @@ -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::() - ); + log::trace!("pi size: {}", snark.instances.iter().map(|x| x.len()).sum::()); log::trace!("layer 0 circuit instances"); for (i, e) in $circuit.instances()[0].iter().enumerate() { @@ -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(); @@ -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); log::trace!("layer 2 evm verification finished"); end_timer!(timer); @@ -166,7 +155,7 @@ 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( ¶m, @@ -174,11 +163,8 @@ macro_rules! aggregation_layer_snark { aggregation_circuit.clone(), &mut rng, None::, // 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::( ¶m, @@ -190,3 +176,4 @@ macro_rules! aggregation_layer_snark { snark }}; } + From ada56122f66366de324611a29a6a130e3906f202 Mon Sep 17 00:00:00 2001 From: Stepan Shimigonov Date: Sun, 16 Jun 2024 03:06:19 +0300 Subject: [PATCH 2/2] small fix --- aggregator/src/tests.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/aggregator/src/tests.rs b/aggregator/src/tests.rs index 419ed586fe..1b8e78e07e 100644 --- a/aggregator/src/tests.rs +++ b/aggregator/src/tests.rs @@ -17,7 +17,7 @@ macro_rules! layer_0 { param }; - let pk = gen_pk(¶m, &$circuit, None,); + let pk = gen_pk(¶m, &$circuit, None); log::trace!("finished layer 0 pk generation for circuit"); let snark = gen_snark_shplonk(¶m, &pk, $circuit.clone(), &mut rng, None::).unwrap(); @@ -127,7 +127,7 @@ macro_rules! compression_layer_evm { ); log::trace!("finished layer 4 bytecode generation"); - evm_verify(deployment_code, compression_circuit.instances(), proof); + evm_verify(deployment_code, compression_circuit.instances(), proof.clone()); log::trace!("layer 2 evm verification finished"); end_timer!(timer); @@ -176,4 +176,3 @@ macro_rules! aggregation_layer_snark { snark }}; } -