Skip to content

Commit

Permalink
Don't overwrite configure method
Browse files Browse the repository at this point in the history
  • Loading branch information
ed255 committed Apr 18, 2023
1 parent c6448d4 commit 2cb2693
Show file tree
Hide file tree
Showing 34 changed files with 81 additions and 175 deletions.
5 changes: 1 addition & 4 deletions halo2_gadgets/benches/poseidon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ where
}
}

fn configure(
meta: &mut ConstraintSystem<Fp>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<Fp>) -> Self::Config {
let state = (0..WIDTH).map(|_| meta.advice_column()).collect::<Vec<_>>();
let expected = meta.instance_column();
meta.enable_equality(expected);
Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/benches/sha256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ fn bench(name: &str, k: u32, c: &mut Criterion) {
Self::default()
}

fn configure(
meta: &mut ConstraintSystem<pallas::Base>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<pallas::Base>) -> Self::Config {
Table16Chip::configure(meta)
}

Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/src/ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,10 +738,7 @@ pub(crate) mod tests {
MyCircuit { test_errors: false }
}

fn configure(
meta: &mut ConstraintSystem<pallas::Base>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<pallas::Base>) -> Self::Config {
let advices = [
meta.advice_column(),
meta.advice_column(),
Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/src/ecc/chip/mul_fixed/short.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,7 @@ pub mod tests {
Self::default()
}

fn configure(
meta: &mut ConstraintSystem<pallas::Base>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<pallas::Base>) -> Self::Config {
let advices = [
meta.advice_column(),
meta.advice_column(),
Expand Down
10 changes: 2 additions & 8 deletions halo2_gadgets/src/poseidon/pow5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,7 @@ mod tests {
PermuteCircuit::<S, WIDTH, RATE>(PhantomData)
}

fn configure(
meta: &mut ConstraintSystem<Fp>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Pow5Config<Fp, WIDTH, RATE> {
fn configure(meta: &mut ConstraintSystem<Fp>) -> Pow5Config<Fp, WIDTH, RATE> {
let state = (0..WIDTH).map(|_| meta.advice_column()).collect::<Vec<_>>();
let partial_sbox = meta.advice_column();

Expand Down Expand Up @@ -751,10 +748,7 @@ mod tests {
}
}

fn configure(
meta: &mut ConstraintSystem<Fp>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Pow5Config<Fp, WIDTH, RATE> {
fn configure(meta: &mut ConstraintSystem<Fp>) -> Pow5Config<Fp, WIDTH, RATE> {
let state = (0..WIDTH).map(|_| meta.advice_column()).collect::<Vec<_>>();
let partial_sbox = meta.advice_column();

Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/src/sha256/table16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,7 @@ mod tests {
MyCircuit {}
}

fn configure(
meta: &mut ConstraintSystem<pallas::Base>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<pallas::Base>) -> Self::Config {
Table16Chip::configure(meta)
}

Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/src/sha256/table16/compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -961,10 +961,7 @@ mod tests {
MyCircuit {}
}

fn configure(
meta: &mut ConstraintSystem<pallas::Base>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<pallas::Base>) -> Self::Config {
Table16Chip::configure(meta)
}

Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/src/sha256/table16/message_schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,7 @@ mod tests {
MyCircuit {}
}

fn configure(
meta: &mut ConstraintSystem<pallas::Base>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<pallas::Base>) -> Self::Config {
Table16Chip::configure(meta)
}

Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/src/sha256/table16/spread_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,7 @@ mod tests {
MyCircuit {}
}

fn configure(
meta: &mut ConstraintSystem<F>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config {
let input_tag = meta.advice_column();
let input_dense = meta.advice_column();
let input_spread = meta.advice_column();
Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/src/sinsemilla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,7 @@ pub(crate) mod tests {
}

#[allow(non_snake_case)]
fn configure(
meta: &mut ConstraintSystem<pallas::Base>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<pallas::Base>) -> Self::Config {
let advices = [
meta.advice_column(),
meta.advice_column(),
Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/src/sinsemilla/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,7 @@ pub mod tests {
Self::default()
}

fn configure(
meta: &mut ConstraintSystem<pallas::Base>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<pallas::Base>) -> Self::Config {
let advices = [
meta.advice_column(),
meta.advice_column(),
Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/src/utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,7 @@ mod tests {
MyCircuit(self.0)
}

fn configure(
meta: &mut ConstraintSystem<pallas::Base>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<pallas::Base>) -> Self::Config {
let selector = meta.selector();
let advice = meta.advice_column();

Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/src/utilities/cond_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,7 @@ mod tests {
Self::default()
}

fn configure(
meta: &mut ConstraintSystem<F>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config {
let advices = [
meta.advice_column(),
meta.advice_column(),
Expand Down
5 changes: 1 addition & 4 deletions halo2_gadgets/src/utilities/decompose_running_sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,7 @@ mod tests {
}
}

fn configure(
meta: &mut ConstraintSystem<F>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config {
let z = meta.advice_column();
let q_range_check = meta.selector();
let constants = meta.fixed_column();
Expand Down
10 changes: 2 additions & 8 deletions halo2_gadgets/src/utilities/lookup_range_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,7 @@ mod tests {
*self
}

fn configure(
meta: &mut ConstraintSystem<F>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config {
let running_sum = meta.advice_column();
let table_idx = meta.lookup_table_column();
let constants = meta.fixed_column();
Expand Down Expand Up @@ -521,10 +518,7 @@ mod tests {
}
}

fn configure(
meta: &mut ConstraintSystem<F>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config {
let running_sum = meta.advice_column();
let table_idx = meta.lookup_table_column();
let constants = meta.fixed_column();
Expand Down
5 changes: 1 addition & 4 deletions halo2_proofs/benches/dev_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ fn criterion_benchmark(c: &mut Criterion) {
Self::default()
}

fn configure(
meta: &mut ConstraintSystem<F>,
#[cfg(feature = "circuit-params")] _: &(),
) -> MyConfig {
fn configure(meta: &mut ConstraintSystem<F>) -> MyConfig {
let config = MyConfig {
selector: meta.complex_selector(),
table: meta.lookup_table_column(),
Expand Down
5 changes: 1 addition & 4 deletions halo2_proofs/benches/plonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,7 @@ fn criterion_benchmark(c: &mut Criterion) {
}
}

fn configure(
meta: &mut ConstraintSystem<F>,
#[cfg(feature = "circuit-params")] _: &(),
) -> PlonkConfig {
fn configure(meta: &mut ConstraintSystem<F>) -> PlonkConfig {
meta.set_minimum_degree(5);

let a = meta.advice_column();
Expand Down
5 changes: 1 addition & 4 deletions halo2_proofs/examples/circuit-layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,7 @@ impl<F: Field> Circuit<F> for MyCircuit<F> {
}

#[allow(clippy::many_single_char_names)]
fn configure(
meta: &mut ConstraintSystem<F>,
#[cfg(feature = "circuit-params")] _: &(),
) -> PlonkConfig {
fn configure(meta: &mut ConstraintSystem<F>) -> PlonkConfig {
let e = meta.advice_column();
let a = meta.advice_column();
let b = meta.advice_column();
Expand Down
8 changes: 3 additions & 5 deletions halo2_proofs/examples/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ impl Circuit<Fr> for StandardPlonk {
Self::default()
}

fn configure(
meta: &mut ConstraintSystem<Fr>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<Fr>) -> Self::Config {
StandardPlonkConfig::configure(meta)
}

Expand Down Expand Up @@ -145,11 +142,12 @@ fn main() {

let f = File::open("serialization-test.pk").unwrap();
let mut reader = BufReader::new(f);
#[allow(clippy::unit_arg)]
let pk = ProvingKey::<G1Affine>::read::<_, StandardPlonk>(
&mut reader,
SerdeFormat::RawBytes,
#[cfg(feature = "circuit-params")]
&circuit.params(),
circuit.params(),
)
.unwrap();

Expand Down
5 changes: 1 addition & 4 deletions halo2_proofs/examples/shuffle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ impl<F: Field, const W: usize, const H: usize> Circuit<F> for MyCircuit<F, W, H>
Self::default()
}

fn configure(
meta: &mut ConstraintSystem<F>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config {
MyConfig::configure(meta)
}

Expand Down
5 changes: 1 addition & 4 deletions halo2_proofs/examples/simple-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,7 @@ impl<F: Field> Circuit<F> for MyCircuit<F> {
Self::default()
}

fn configure(
meta: &mut ConstraintSystem<F>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config {
// We create the two advice columns that FieldChip uses for I/O.
let advice = [meta.advice_column(), meta.advice_column()];

Expand Down
5 changes: 1 addition & 4 deletions halo2_proofs/examples/two-chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,7 @@ impl<F: Field> Circuit<F> for MyCircuit<F> {
Self::default()
}

fn configure(
meta: &mut ConstraintSystem<F>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<F>) -> Self::Config {
// We create the two advice columns that FieldChip uses for I/O.
let advice = [meta.advice_column(), meta.advice_column()];

Expand Down
5 changes: 1 addition & 4 deletions halo2_proofs/src/circuit/floor_planner/single_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,7 @@ mod tests {
MyCircuit {}
}

fn configure(
meta: &mut crate::plonk::ConstraintSystem<vesta::Scalar>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut crate::plonk::ConstraintSystem<vesta::Scalar>) -> Self::Config {
meta.advice_column()
}

Expand Down
5 changes: 1 addition & 4 deletions halo2_proofs/src/circuit/floor_planner/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,7 @@ mod tests {
MyCircuit {}
}

fn configure(
meta: &mut crate::plonk::ConstraintSystem<vesta::Scalar>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut crate::plonk::ConstraintSystem<vesta::Scalar>) -> Self::Config {
meta.advice_column()
}

Expand Down
29 changes: 8 additions & 21 deletions halo2_proofs/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,11 +603,10 @@ impl<F: FromUniformBytes<64> + Ord> MockProver<F> {
let n = 1 << k;

let mut cs = ConstraintSystem::default();
let config = ConcreteCircuit::configure(
&mut cs,
#[cfg(feature = "circuit-params")]
&circuit.params(),
);
#[cfg(feature = "circuit-params")]
let config = ConcreteCircuit::configure_with_params(&mut cs, circuit.params());
#[cfg(not(feature = "circuit-params"))]
let config = ConcreteCircuit::configure(&mut cs);
let cs = cs;

assert!(
Expand Down Expand Up @@ -1545,10 +1544,7 @@ mod tests {
#[cfg(feature = "circuit-params")]
type Params = ();

fn configure(
meta: &mut ConstraintSystem<Fp>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<Fp>) -> Self::Config {
let a = meta.advice_column();
let b = meta.advice_column();
let q = meta.selector();
Expand Down Expand Up @@ -1636,10 +1632,7 @@ mod tests {
#[cfg(feature = "circuit-params")]
type Params = ();

fn configure(
meta: &mut ConstraintSystem<Fp>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<Fp>) -> Self::Config {
let a = meta.advice_column();
let q = meta.complex_selector();
let table = meta.instance_column();
Expand Down Expand Up @@ -1810,10 +1803,7 @@ mod tests {
#[cfg(feature = "circuit-params")]
type Params = ();

fn configure(
meta: &mut ConstraintSystem<Fp>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<Fp>) -> Self::Config {
let a = meta.advice_column();
let q = meta.complex_selector();
let table = meta.lookup_table_column();
Expand Down Expand Up @@ -1949,10 +1939,7 @@ mod tests {
#[cfg(feature = "circuit-params")]
type Params = ();

fn configure(
meta: &mut ConstraintSystem<Fp>,
#[cfg(feature = "circuit-params")] _: &(),
) -> Self::Config {
fn configure(meta: &mut ConstraintSystem<Fp>) -> Self::Config {
let a = meta.advice_column();
let b = meta.advice_column();
let c = meta.advice_column();
Expand Down
Loading

0 comments on commit 2cb2693

Please sign in to comment.