From 1ab16c319acef890095cf5923baef474b6ba40e8 Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Wed, 5 Apr 2023 03:27:19 +0700 Subject: [PATCH] No-ops on best_multiexp and best_fft when #[cfg(feature=counter)] Co-authored-by: Andrija --- halo2_proofs/src/arithmetic.rs | 4 ++++ halo2_proofs/src/plonk/keygen.rs | 2 ++ halo2_proofs/src/plonk/prover.rs | 3 +++ 3 files changed, 9 insertions(+) diff --git a/halo2_proofs/src/arithmetic.rs b/halo2_proofs/src/arithmetic.rs index c76c22fe..c5ffdba7 100644 --- a/halo2_proofs/src/arithmetic.rs +++ b/halo2_proofs/src/arithmetic.rs @@ -165,6 +165,8 @@ pub fn best_multiexp(coeffs: &[C::Scalar], bases: &[C]) -> C::Cu .entry(coeffs.len()) .and_modify(|cnt| *cnt += 1) .or_insert(1); + + return C::Curve::generator(); } assert_eq!(coeffs.len(), bases.len()); @@ -215,6 +217,8 @@ pub fn best_fft>(a: &mut [G], omega: Scalar, .entry(a.len()) .and_modify(|cnt| *cnt += 1) .or_insert(1); + + return; } fn bitreverse(mut n: usize, l: usize) -> usize { diff --git a/halo2_proofs/src/plonk/keygen.rs b/halo2_proofs/src/plonk/keygen.rs index bb26d5a6..5d3c8d96 100644 --- a/halo2_proofs/src/plonk/keygen.rs +++ b/halo2_proofs/src/plonk/keygen.rs @@ -210,6 +210,7 @@ where _marker: std::marker::PhantomData, }; + #[cfg(not(feature = "counter"))] // Synthesize the circuit to obtain URS ConcreteCircuit::FloorPlanner::synthesize( &mut assembly, @@ -271,6 +272,7 @@ where _marker: std::marker::PhantomData, }; + #[cfg(not(feature = "counter"))] // Synthesize the circuit to obtain URS ConcreteCircuit::FloorPlanner::synthesize( &mut assembly, diff --git a/halo2_proofs/src/plonk/prover.rs b/halo2_proofs/src/plonk/prover.rs index 76ca6c0f..c95355aa 100644 --- a/halo2_proofs/src/plonk/prover.rs +++ b/halo2_proofs/src/plonk/prover.rs @@ -290,6 +290,7 @@ pub fn create_proof< _marker: std::marker::PhantomData, }; + #[cfg(not(feature = "counter"))] // Synthesize the circuit to obtain the witness and other information. ConcreteCircuit::FloorPlanner::synthesize( &mut witness, @@ -741,6 +742,8 @@ pub fn create_proof< // reset counters at the end of the proving *MSM_COUNTER.lock().unwrap() = BTreeMap::new(); *FFT_COUNTER.lock().unwrap() = BTreeMap::new(); + + return Ok(()); } multiopen::create_proof(params, rng, transcript, instances).map_err(|_| Error::Opening)