From 7d7f01da46c994a76185ab5d705ebd9545fc91b1 Mon Sep 17 00:00:00 2001 From: Tamir Hemo Date: Tue, 19 Sep 2023 11:32:13 -0700 Subject: [PATCH 1/3] refactor prove method --- plonky2/src/plonk/prover.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/plonky2/src/plonk/prover.rs b/plonky2/src/plonk/prover.rs index b77f7aa5ff..c53ea78e29 100644 --- a/plonky2/src/plonk/prover.rs +++ b/plonky2/src/plonk/prover.rs @@ -112,6 +112,21 @@ pub fn prove, C: GenericConfig, const D: common_data: &CommonCircuitData, inputs: PartialWitness, timing: &mut TimingTree, +) -> Result> { + let partition_witness = timed!( + timing, + &format!("run {} generators", prover_data.generators.len()), + generate_partial_witness(inputs, prover_data, common_data) + ); + + prove_with_partition_witness(prover_data, common_data, partition_witness, timing) +} + +pub fn prove_with_partition_witness, C: GenericConfig, const D: usize>( + prover_data: &ProverOnlyCircuitData, + common_data: &CommonCircuitData, + mut partition_witness: PartitionWitness, + timing: &mut TimingTree, ) -> Result> where C::Hasher: Hasher, @@ -123,12 +138,6 @@ where let quotient_degree = common_data.quotient_degree(); let degree = common_data.degree(); - let mut partition_witness = timed!( - timing, - &format!("run {} generators", prover_data.generators.len()), - generate_partial_witness(inputs, prover_data, common_data) - ); - set_lookup_wires(prover_data, common_data, &mut partition_witness); let public_inputs = partition_witness.get_targets(&prover_data.public_inputs); From a44379b5a18bc5111e1fa1e305e4e60acffe2d53 Mon Sep 17 00:00:00 2001 From: Tamir Hemo Date: Tue, 19 Sep 2023 11:39:20 -0700 Subject: [PATCH 2/3] fmt and clippy --- plonky2/src/plonk/prover.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plonky2/src/plonk/prover.rs b/plonky2/src/plonk/prover.rs index c53ea78e29..ee94288e43 100644 --- a/plonky2/src/plonk/prover.rs +++ b/plonky2/src/plonk/prover.rs @@ -122,7 +122,11 @@ pub fn prove, C: GenericConfig, const D: prove_with_partition_witness(prover_data, common_data, partition_witness, timing) } -pub fn prove_with_partition_witness, C: GenericConfig, const D: usize>( +pub fn prove_with_partition_witness< + F: RichField + Extendable, + C: GenericConfig, + const D: usize, +>( prover_data: &ProverOnlyCircuitData, common_data: &CommonCircuitData, mut partition_witness: PartitionWitness, From 8839285f4d6a6f344705cafb8d3f4b04d7635dd4 Mon Sep 17 00:00:00 2001 From: Tamir Hemo Date: Tue, 19 Sep 2023 11:45:42 -0700 Subject: [PATCH 3/3] add trait bound --- plonky2/src/plonk/prover.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plonky2/src/plonk/prover.rs b/plonky2/src/plonk/prover.rs index ee94288e43..41aebdb1e9 100644 --- a/plonky2/src/plonk/prover.rs +++ b/plonky2/src/plonk/prover.rs @@ -112,7 +112,11 @@ pub fn prove, C: GenericConfig, const D: common_data: &CommonCircuitData, inputs: PartialWitness, timing: &mut TimingTree, -) -> Result> { +) -> Result> +where + C::Hasher: Hasher, + C::InnerHasher: Hasher, +{ let partition_witness = timed!( timing, &format!("run {} generators", prover_data.generators.len()),