Skip to content

Commit

Permalink
Fix Brakedown for ChallengeGenerator and AsRef for Merkle tree
Browse files Browse the repository at this point in the history
  • Loading branch information
autquis committed Jan 9, 2024
1 parent 8f81b3b commit 6d5659b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
8 changes: 4 additions & 4 deletions poly-commit/src/linear_codes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ where
C: Config + 'static,
Vec<F>: Borrow<<H as CRHScheme>::Input>,
H::Output: Into<C::Leaf> + Send,
C::Leaf: Sized + Clone + Default + Send,
C::Leaf: Sized + Clone + Default + Send + AsRef<C::Leaf>,
H: CRHScheme + 'static,
{
type UniversalParams = L::LinCodePCParams;
Expand Down Expand Up @@ -302,7 +302,7 @@ where
_labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: &'a P::Point,
_challenge_generator: &mut crate::challenge::ChallengeGenerator<F, S>,
_sponge: &mut S,
states: impl IntoIterator<Item = &'a Self::CommitmentState>,
_rng: Option<&mut dyn RngCore>,
) -> Result<Self::Proof, Self::Error>
Expand Down Expand Up @@ -395,7 +395,7 @@ where
point: &'a P::Point,
values: impl IntoIterator<Item = F>,
proof_array: &Self::Proof,
_challenge_generator: &mut crate::challenge::ChallengeGenerator<F, S>,
_sponge: &mut S,
_rng: Option<&mut dyn RngCore>,
) -> Result<bool, Self::Error>
where
Expand Down Expand Up @@ -545,7 +545,7 @@ fn create_merkle_tree<C>(
) -> Result<MerkleTree<C>, Error>
where
C: Config,
C::Leaf: Default + Clone + Send,
C::Leaf: Default + Clone + Send + AsRef<C::Leaf>,
{
// pad the column hashes with zeroes
let next_pow_of_two = leaves.len().next_power_of_two();
Expand Down
12 changes: 4 additions & 8 deletions poly-commit/src/linear_codes/multilinear_brakedown/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mod tests {
use crate::linear_codes::LinearCodePCS;
use crate::utils::test_sponge;
use crate::{
challenge::ChallengeGenerator,
linear_codes::{utils::*, BrakedownPCParams, MultilinearBrakedown, PolynomialCommitment},
LabeledPolynomial,
};
Expand Down Expand Up @@ -114,22 +113,19 @@ mod tests {
);

let mut test_sponge = test_sponge::<Fr>();
let (c, rands) = BrakedownPCS::<Fr>::commit(&ck, &[labeled_poly.clone()], None).unwrap();
let (c, states) = BrakedownPCS::<Fr>::commit(&ck, &[labeled_poly.clone()], None).unwrap();

let point = rand_point(Some(num_vars), rand_chacha);

let value = labeled_poly.evaluate(&point);

let mut challenge_generator: ChallengeGenerator<Fr, PoseidonSponge<Fr>> =
ChallengeGenerator::new_univariate(&mut test_sponge);

let proof = BrakedownPCS::<Fr>::open(
&ck,
&[labeled_poly],
&c,
&point,
&mut (challenge_generator.clone()),
&rands,
&mut (test_sponge.clone()),
&states,
None,
)
.unwrap();
Expand All @@ -139,7 +135,7 @@ mod tests {
&point,
[value],
&proof,
&mut challenge_generator,
&mut test_sponge,
None
)
.unwrap());
Expand Down

0 comments on commit 6d5659b

Please sign in to comment.