diff --git a/crates/prover/src/constraint_framework/logup.rs b/crates/prover/src/constraint_framework/logup.rs index 696a7b935..c6023bee2 100644 --- a/crates/prover/src/constraint_framework/logup.rs +++ b/crates/prover/src/constraint_framework/logup.rs @@ -236,10 +236,7 @@ impl LogupTraceGenerator { .into_iter() .flat_map(|eval| { eval.columns.map(|c| { - CircleEvaluation::::new( - CanonicCoset::new(self.log_size).circle_domain(), - c, - ) + CircleEvaluation::new(CanonicCoset::new(self.log_size).circle_domain(), c) }) }) .collect_vec(); diff --git a/crates/prover/src/core/backend/simd/quotients.rs b/crates/prover/src/core/backend/simd/quotients.rs index 3cb664aeb..382d2a14c 100644 --- a/crates/prover/src/core/backend/simd/quotients.rs +++ b/crates/prover/src/core/backend/simd/quotients.rs @@ -282,13 +282,8 @@ mod tests { }]; let cpu_columns = columns .iter() - .map(|c| { - CircleEvaluation::::new( - c.domain, - c.values.to_cpu(), - ) - }) - .collect::>(); + .map(|c| CircleEvaluation::new(c.domain, c.values.to_cpu())) + .collect_vec(); let cpu_result = CpuBackend::accumulate_quotients( domain, &cpu_columns.iter().collect_vec(), diff --git a/crates/prover/src/core/pcs/prover.rs b/crates/prover/src/core/pcs/prover.rs index 7a761eaa9..6da991150 100644 --- a/crates/prover/src/core/pcs/prover.rs +++ b/crates/prover/src/core/pcs/prover.rs @@ -167,30 +167,28 @@ pub struct TreeBuilder<'a, 'b, B: BackendForChannel, MC: MerkleChannel> { impl<'a, 'b, B: BackendForChannel, MC: MerkleChannel> TreeBuilder<'a, 'b, B, MC> { pub fn extend_evals( &mut self, - columns: ColumnVec>, + columns: impl IntoIterator>, ) -> TreeSubspan { let span = span!(Level::INFO, "Interpolation for commitment").entered(); - let col_start = self.polys.len(); let polys = columns .into_iter() .map(|eval| eval.interpolate_with_twiddles(self.commitment_scheme.twiddles)) .collect_vec(); span.exit(); - self.polys.extend(polys); - TreeSubspan { - tree_index: self.tree_index, - col_start, - col_end: self.polys.len(), - } + self.extend_polys(polys) } - pub fn extend_polys(&mut self, polys: ColumnVec>) -> TreeSubspan { + pub fn extend_polys( + &mut self, + columns: impl IntoIterator>, + ) -> TreeSubspan { let col_start = self.polys.len(); - self.polys.extend(polys); + self.polys.extend(columns); + let col_end = self.polys.len(); TreeSubspan { tree_index: self.tree_index, col_start, - col_end: self.polys.len(), + col_end, } } diff --git a/crates/prover/src/core/poly/circle/secure_poly.rs b/crates/prover/src/core/poly/circle/secure_poly.rs index a503bd2c6..de6d75d40 100644 --- a/crates/prover/src/core/poly/circle/secure_poly.rs +++ b/crates/prover/src/core/poly/circle/secure_poly.rs @@ -43,6 +43,10 @@ impl SecureCirclePoly { let columns = polys.map(|poly| poly.evaluate_with_twiddles(domain, twiddles).values); SecureEvaluation::new(domain, SecureColumnByCoords { columns }) } + + pub fn into_coordinate_polys(self) -> [CirclePoly; SECURE_EXTENSION_DEGREE] { + self.0 + } } impl> Deref for SecureCirclePoly { diff --git a/crates/prover/src/core/prover/mod.rs b/crates/prover/src/core/prover/mod.rs index eea4a4b22..4ad9ac44a 100644 --- a/crates/prover/src/core/prover/mod.rs +++ b/crates/prover/src/core/prover/mod.rs @@ -11,13 +11,10 @@ use super::fields::secure_column::SECURE_EXTENSION_DEGREE; use super::fri::FriVerificationError; use super::pcs::{CommitmentSchemeProof, TreeVec}; use super::vcs::ops::MerkleHasher; -use crate::core::backend::CpuBackend; use crate::core::channel::Channel; use crate::core::circle::CirclePoint; use crate::core::fields::qm31::SecureField; use crate::core::pcs::{CommitmentSchemeProver, CommitmentSchemeVerifier}; -use crate::core::poly::circle::CircleEvaluation; -use crate::core::poly::BitReversedOrder; use crate::core::vcs::verifier::MerkleVerificationError; #[derive(Debug, Serialize, Deserialize)] @@ -26,14 +23,6 @@ pub struct StarkProof { pub commitment_scheme_proof: CommitmentSchemeProof, } -#[derive(Debug)] -pub struct AdditionalProofData { - pub composition_polynomial_oods_value: SecureField, - pub composition_polynomial_random_coeff: SecureField, - pub oods_point: CirclePoint, - pub oods_quotients: Vec>, -} - pub fn prove, MC: MerkleChannel>( components: &[&dyn ComponentProver], channel: &mut MC::C, @@ -47,12 +36,11 @@ pub fn prove, MC: MerkleChannel>( let span = span!(Level::INFO, "Composition").entered(); let span1 = span!(Level::INFO, "Generation").entered(); - let composition_polynomial_poly = - component_provers.compute_composition_polynomial(random_coeff, &trace); + let composition_poly = component_provers.compute_composition_polynomial(random_coeff, &trace); span1.exit(); let mut tree_builder = commitment_scheme.tree_builder(); - tree_builder.extend_polys(composition_polynomial_poly.to_vec()); + tree_builder.extend_polys(composition_poly.into_coordinate_polys()); tree_builder.commit(channel); span.exit(); diff --git a/crates/prover/src/examples/blake/air.rs b/crates/prover/src/examples/blake/air.rs index e655ee658..58bb8633b 100644 --- a/crates/prover/src/examples/blake/air.rs +++ b/crates/prover/src/examples/blake/air.rs @@ -389,9 +389,7 @@ where // Prove constraints. let components = BlakeComponents::new(&stmt0, &all_elements, &stmt1); - let stark_proof = - prove::(&components.component_provers(), channel, commitment_scheme) - .unwrap(); + let stark_proof = prove(&components.component_provers(), channel, commitment_scheme).unwrap(); BlakeProof { stmt0, diff --git a/crates/prover/src/examples/blake/round/gen.rs b/crates/prover/src/examples/blake/round/gen.rs index ba9933b99..7adbe6fd5 100644 --- a/crates/prover/src/examples/blake/round/gen.rs +++ b/crates/prover/src/examples/blake/round/gen.rs @@ -230,8 +230,8 @@ pub fn generate_trace( generator .trace .into_iter() - .map(|eval| CircleEvaluation::::new(domain, eval)) - .collect_vec(), + .map(|eval| CircleEvaluation::new(domain, eval)) + .collect(), BlakeRoundLookupData { xor_lookups: generator.xor_lookups, round_lookup: generator.round_lookup, diff --git a/crates/prover/src/examples/blake/scheduler/gen.rs b/crates/prover/src/examples/blake/scheduler/gen.rs index 0581b2fe1..cd6a99b2f 100644 --- a/crates/prover/src/examples/blake/scheduler/gen.rs +++ b/crates/prover/src/examples/blake/scheduler/gen.rs @@ -107,8 +107,8 @@ pub fn gen_trace( let domain = CanonicCoset::new(log_size).circle_domain(); let trace = trace .into_iter() - .map(|eval| CircleEvaluation::::new(domain, eval)) - .collect_vec(); + .map(|eval| CircleEvaluation::new(domain, eval)) + .collect(); (trace, lookup_data, round_inputs) } diff --git a/crates/prover/src/examples/plonk/mod.rs b/crates/prover/src/examples/plonk/mod.rs index 58248a0bc..eabfdc5bd 100644 --- a/crates/prover/src/examples/plonk/mod.rs +++ b/crates/prover/src/examples/plonk/mod.rs @@ -108,8 +108,8 @@ pub fn gen_trace( &circuit.c_val, ] .into_iter() - .map(|eval| CircleEvaluation::::new(domain, eval.clone())) - .collect_vec() + .map(|eval| CircleEvaluation::new(domain, eval.clone())) + .collect() } pub fn gen_interaction_trace( @@ -207,17 +207,14 @@ pub fn prove_fibonacci_plonk( // Constant trace. let span = span!(Level::INFO, "Constant").entered(); let mut tree_builder = commitment_scheme.tree_builder(); - let constants_trace_location = tree_builder.extend_evals( - chain!([circuit.a_wire, circuit.b_wire, circuit.c_wire, circuit.op] - .into_iter() - .map(|col| { - CircleEvaluation::::new( - CanonicCoset::new(log_n_rows).circle_domain(), - col, - ) - })) - .collect_vec(), - ); + let constants_trace_location = tree_builder.extend_evals(chain!([ + circuit.a_wire, + circuit.b_wire, + circuit.c_wire, + circuit.op + ] + .into_iter() + .map(|col| CircleEvaluation::new(CanonicCoset::new(log_n_rows).circle_domain(), col)))); tree_builder.commit(channel); span.exit(); @@ -243,7 +240,7 @@ pub fn prove_fibonacci_plonk( component.evaluate(eval); }); - let proof = prove::(&[&component], channel, commitment_scheme).unwrap(); + let proof = prove(&[&component], channel, commitment_scheme).unwrap(); (component, proof) } diff --git a/crates/prover/src/examples/poseidon/mod.rs b/crates/prover/src/examples/poseidon/mod.rs index c94f0ba1d..9eb9b1c1a 100644 --- a/crates/prover/src/examples/poseidon/mod.rs +++ b/crates/prover/src/examples/poseidon/mod.rs @@ -278,8 +278,8 @@ pub fn gen_trace( let domain = CanonicCoset::new(log_size).circle_domain(); let trace = trace .into_iter() - .map(|eval| CircleEvaluation::::new(domain, eval)) - .collect_vec(); + .map(|eval| CircleEvaluation::new(domain, eval)) + .collect(); (trace, lookup_data) } @@ -367,7 +367,8 @@ pub fn prove_poseidon( claimed_sum, }, ); - let proof = prove::(&[&component], channel, commitment_scheme).unwrap(); + let proof = prove(&[&component], channel, commitment_scheme).unwrap(); + (component, proof) }