Skip to content

Commit

Permalink
fix: add sumcheck range length field
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin-Ray committed Dec 18, 2024
1 parent 792aaf3 commit 2886df3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions crates/proof-of-sql/src/sql/proof/first_round_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize>,
/// The extra sumcheck range lengths used in the proof.
sumcheck_range_lengths: Vec<usize>,
}

impl Default for FirstRoundBuilder {
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions crates/proof-of-sql/src/sql/proof/query_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ impl<CP: CommitmentEvaluationProof> QueryProof<CP> {
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))
Expand All @@ -123,7 +123,7 @@ impl<CP: CommitmentEvaluationProof> QueryProof<CP> {
&owned_table_result,
range_length,
min_row_num,
one_evaluation_lengths,
range_evaluation_lengths,
post_result_challenge_count,
);

Expand Down Expand Up @@ -206,7 +206,7 @@ impl<CP: CommitmentEvaluationProof> QueryProof<CP> {

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,
Expand Down

0 comments on commit 2886df3

Please sign in to comment.