diff --git a/crates/proof-of-sql/src/sql/proof/make_sumcheck_polynomial.rs b/crates/proof-of-sql/src/sql/proof/make_sumcheck_state.rs similarity index 88% rename from crates/proof-of-sql/src/sql/proof/make_sumcheck_polynomial.rs rename to crates/proof-of-sql/src/sql/proof/make_sumcheck_state.rs index 871c7c82b..b07ded361 100644 --- a/crates/proof-of-sql/src/sql/proof/make_sumcheck_polynomial.rs +++ b/crates/proof-of-sql/src/sql/proof/make_sumcheck_state.rs @@ -1,10 +1,21 @@ use super::{CompositePolynomialBuilder, SumcheckRandomScalars, SumcheckSubpolynomial}; -use crate::base::{polynomial::CompositePolynomial, scalar::Scalar}; +use crate::{ + base::{polynomial::CompositePolynomial, scalar::Scalar}, + proof_primitive::sumcheck::ProverState, +}; + +pub fn make_sumcheck_prover_state( + subpolynomials: &[SumcheckSubpolynomial<'_, S>], + num_vars: usize, + scalars: &SumcheckRandomScalars, +) -> ProverState { + ProverState::create(&make_sumcheck_polynomial(subpolynomials, num_vars, scalars)) +} /// Given random multipliers, construct an aggregatated sumcheck polynomial from all /// the individual subpolynomials. #[tracing::instrument(name = "proof::make_sumcheck_polynomial", level = "debug", skip_all)] -pub fn make_sumcheck_polynomial( +fn make_sumcheck_polynomial( subpolynomials: &[SumcheckSubpolynomial<'_, S>], num_vars: usize, scalars: &SumcheckRandomScalars, diff --git a/crates/proof-of-sql/src/sql/proof/mod.rs b/crates/proof-of-sql/src/sql/proof/mod.rs index 8b988a5b5..f31e456ee 100644 --- a/crates/proof-of-sql/src/sql/proof/mod.rs +++ b/crates/proof-of-sql/src/sql/proof/mod.rs @@ -72,4 +72,4 @@ pub(crate) use first_round_builder::FirstRoundBuilder; #[cfg(all(test, feature = "arrow"))] mod provable_query_result_test; -mod make_sumcheck_polynomial; +mod make_sumcheck_state; diff --git a/crates/proof-of-sql/src/sql/proof/query_proof.rs b/crates/proof-of-sql/src/sql/proof/query_proof.rs index 391baee77..27d882ba7 100644 --- a/crates/proof-of-sql/src/sql/proof/query_proof.rs +++ b/crates/proof-of-sql/src/sql/proof/query_proof.rs @@ -1,7 +1,7 @@ use super::{ - make_sumcheck_polynomial::make_sumcheck_polynomial, CountBuilder, FinalRoundBuilder, - ProofCounts, ProofPlan, QueryResult, SumcheckMleEvaluations, SumcheckRandomScalars, - VerificationBuilder, + make_sumcheck_state::make_sumcheck_prover_state, CountBuilder, FinalRoundBuilder, + FirstRoundBuilder, ProofCounts, ProofPlan, QueryData, QueryResult, SumcheckMleEvaluations, + SumcheckRandomScalars, VerificationBuilder, }; use crate::{ base::{ @@ -17,8 +17,7 @@ use crate::{ proof::{Keccak256Transcript, ProofError, Transcript}, scalar::Scalar, }, - proof_primitive::sumcheck::{ProverState, SumcheckProof}, - sql::proof::{FirstRoundBuilder, QueryData}, + proof_primitive::sumcheck::SumcheckProof, }; use alloc::{string::String, vec, vec::Vec}; use bumpalo::Bump; @@ -157,19 +156,15 @@ impl QueryProof { core::iter::repeat_with(|| transcript.scalar_challenge_as_be()) .take(num_random_scalars) .collect(); - let poly = make_sumcheck_polynomial( + let state = make_sumcheck_prover_state( builder.sumcheck_subpolynomials(), num_sumcheck_variables, &SumcheckRandomScalars::new(&random_scalars, range_length, num_sumcheck_variables), ); // create the sumcheck proof -- this is the main part of proving a query - let mut evaluation_point = vec![Zero::zero(); poly.num_variables]; - let sumcheck_proof = SumcheckProof::create( - &mut transcript, - &mut evaluation_point, - ProverState::create(&poly), - ); + let mut evaluation_point = vec![Zero::zero(); state.num_vars]; + let sumcheck_proof = SumcheckProof::create(&mut transcript, &mut evaluation_point, state); // evaluate the MLEs used in sumcheck except for the result columns let mut evaluation_vec = vec![Zero::zero(); range_length];