Skip to content

Commit

Permalink
No-ops on best_multiexp and best_fft when #[cfg(feature=counter)]
Browse files Browse the repository at this point in the history
Co-authored-by: Andrija <[email protected]>
  • Loading branch information
therealyingtong and akinovak committed Apr 4, 2023
1 parent 6a8f28c commit 1ab16c3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions halo2_proofs/src/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ pub fn best_multiexp<C: CurveAffine>(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());
Expand Down Expand Up @@ -215,6 +217,8 @@ pub fn best_fft<Scalar: Field, G: FftGroup<Scalar>>(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 {
Expand Down
2 changes: 2 additions & 0 deletions halo2_proofs/src/plonk/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ where
_marker: std::marker::PhantomData,
};

#[cfg(not(feature = "counter"))]
// Synthesize the circuit to obtain URS
ConcreteCircuit::FloorPlanner::synthesize(
&mut assembly,
Expand Down Expand Up @@ -271,6 +272,7 @@ where
_marker: std::marker::PhantomData,
};

#[cfg(not(feature = "counter"))]
// Synthesize the circuit to obtain URS
ConcreteCircuit::FloorPlanner::synthesize(
&mut assembly,
Expand Down
3 changes: 3 additions & 0 deletions halo2_proofs/src/plonk/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1ab16c3

Please sign in to comment.