From 2886df304069e8b066945f8988fb909225e7b1b8 Mon Sep 17 00:00:00 2001 From: "dustin.ray" Date: Tue, 17 Dec 2024 14:14:58 -0800 Subject: [PATCH] fix: add sumcheck range length field --- crates/proof-of-sql/src/sql/proof/first_round_builder.rs | 9 +++++++++ crates/proof-of-sql/src/sql/proof/query_proof.rs | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/crates/proof-of-sql/src/sql/proof/first_round_builder.rs b/crates/proof-of-sql/src/sql/proof/first_round_builder.rs index 15989adf4..675d7adba 100644 --- a/crates/proof-of-sql/src/sql/proof/first_round_builder.rs +++ b/crates/proof-of-sql/src/sql/proof/first_round_builder.rs @@ -8,6 +8,8 @@ pub struct FirstRoundBuilder { num_post_result_challenges: usize, /// The extra one evaluation lengths used in the proof. one_evaluation_lengths: Vec, + /// The extra sumcheck range lengths used in the proof. + sumcheck_range_lengths: Vec, } impl Default for FirstRoundBuilder { @@ -21,14 +23,21 @@ impl FirstRoundBuilder { Self { num_post_result_challenges: 0, one_evaluation_lengths: Vec::new(), + sumcheck_range_lengths: Vec::new(), } } /// Get the one evaluation lengths used in the proof. + #[allow(dead_code)] pub(crate) fn one_evaluation_lengths(&self) -> &[usize] { &self.one_evaluation_lengths } + /// Get the sumcheck range lengths used in the proof. + pub(crate) fn sumcheck_range_lengths(&self) -> &[usize] { + &self.sumcheck_range_lengths + } + /// Append the length to the list of one evaluation lengths. pub(crate) fn produce_one_evaluation_length(&mut self, length: usize) { self.one_evaluation_lengths.push(length); 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 708b330d1..cfc065e09 100644 --- a/crates/proof-of-sql/src/sql/proof/query_proof.rs +++ b/crates/proof-of-sql/src/sql/proof/query_proof.rs @@ -104,9 +104,9 @@ impl QueryProof { let query_result = expr.first_round_evaluate(&mut first_round_builder, &alloc, &table_map); let owned_table_result = OwnedTable::from(&query_result); let provable_result = query_result.into(); - let one_evaluation_lengths = first_round_builder.one_evaluation_lengths(); + let range_evaluation_lengths = first_round_builder.sumcheck_range_lengths(); - let range_length = one_evaluation_lengths + let range_length = range_evaluation_lengths .iter() .copied() .chain(core::iter::once(initial_range_length)) @@ -123,7 +123,7 @@ impl QueryProof { &owned_table_result, range_length, min_row_num, - one_evaluation_lengths, + range_evaluation_lengths, post_result_challenge_count, ); @@ -206,7 +206,7 @@ impl QueryProof { let proof = Self { bit_distributions: builder.bit_distributions().to_vec(), - one_evaluation_lengths: one_evaluation_lengths.to_vec(), + one_evaluation_lengths: range_evaluation_lengths.to_vec(), commitments, sumcheck_proof, pcs_proof_evaluations,