Skip to content

Commit

Permalink
address comments from hratoanina
Browse files Browse the repository at this point in the history
  • Loading branch information
sai-deng committed Jun 21, 2024
1 parent 7006244 commit 49e663d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion plonky2/src/batch_fri/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use plonky2_field::extension::flatten;
#[allow(unused_imports)]
use plonky2_field::types::Field;
use plonky2_maybe_rayon::*;
use plonky2_util::reverse_index_bits_in_place;
use plonky2_util::{log2_strict, reverse_index_bits_in_place};

use crate::field::extension::{unflatten, Extendable};
use crate::field::polynomial::{PolynomialCoeffs, PolynomialValues};
Expand Down Expand Up @@ -36,6 +36,18 @@ pub fn batch_fri_proof<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>,
assert!(lde_polynomial_values
.windows(2)
.all(|pair| { pair[0].len() > pair[1].len() }));
// Check that reduction_arity_bits covers all polynomials
let mut cur_n = log2_strict(n);
let mut cur_poly_index = 1;
for arity_bits in &fri_params.reduction_arity_bits {
cur_n -= arity_bits;
if cur_poly_index < lde_polynomial_values.len()
&& cur_n == log2_strict(lde_polynomial_values[cur_poly_index].len())
{
cur_poly_index += 1;
}
}
assert_eq!(cur_poly_index, lde_polynomial_values.len());

// Commit phase
let (trees, final_coeffs) = timed!(
Expand Down
2 changes: 1 addition & 1 deletion plonky2/src/hash/merkle_proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
{
let mut new_leaves = state.elements.to_vec();
new_leaves.extend_from_slice(&leaf_data[leaf_data_index]);
state = self.hash_or_noop::<H>(new_leaves.clone());
state = self.hash_or_noop::<H>(new_leaves);

leaf_data_index += 1;
}
Expand Down

0 comments on commit 49e663d

Please sign in to comment.