mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 16:23:12 +00:00
Move Merkle root out of opening proof.
This commit is contained in:
parent
477fe1ea4a
commit
41008cf421
@ -110,7 +110,6 @@ impl<F: Field> ListPolynomialCommitment<F> {
|
|||||||
|
|
||||||
(
|
(
|
||||||
OpeningProof {
|
OpeningProof {
|
||||||
merkle_root: self.merkle_tree.root,
|
|
||||||
fri_proof,
|
fri_proof,
|
||||||
quotient_degree: quotient.len(),
|
quotient_degree: quotient.len(),
|
||||||
},
|
},
|
||||||
@ -144,7 +143,6 @@ impl<F: Field> ListPolynomialCommitment<F> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct OpeningProof<F: Field> {
|
pub struct OpeningProof<F: Field> {
|
||||||
merkle_root: Hash<F>,
|
|
||||||
fri_proof: FriProof<F>,
|
fri_proof: FriProof<F>,
|
||||||
// TODO: Get the degree from `CommonCircuitData` instead.
|
// TODO: Get the degree from `CommonCircuitData` instead.
|
||||||
quotient_degree: usize,
|
quotient_degree: usize,
|
||||||
@ -155,6 +153,7 @@ impl<F: Field> OpeningProof<F> {
|
|||||||
&self,
|
&self,
|
||||||
points: &[F],
|
points: &[F],
|
||||||
evaluations: &[Vec<F>],
|
evaluations: &[Vec<F>],
|
||||||
|
merkle_root: Hash<F>,
|
||||||
challenger: &mut Challenger<F>,
|
challenger: &mut Challenger<F>,
|
||||||
fri_config: &FriConfig,
|
fri_config: &FriConfig,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
@ -162,7 +161,7 @@ impl<F: Field> OpeningProof<F> {
|
|||||||
challenger.observe_elements(evals);
|
challenger.observe_elements(evals);
|
||||||
}
|
}
|
||||||
|
|
||||||
challenger.observe_hash(&self.merkle_root);
|
challenger.observe_hash(&merkle_root);
|
||||||
let alpha = challenger.get_challenge();
|
let alpha = challenger.get_challenge();
|
||||||
|
|
||||||
let scaled_evals = evaluations
|
let scaled_evals = evaluations
|
||||||
@ -180,7 +179,7 @@ impl<F: Field> OpeningProof<F> {
|
|||||||
log2_strict(self.quotient_degree),
|
log2_strict(self.quotient_degree),
|
||||||
&pairs,
|
&pairs,
|
||||||
alpha,
|
alpha,
|
||||||
&[self.merkle_root],
|
&[merkle_root],
|
||||||
&self.fri_proof,
|
&self.fri_proof,
|
||||||
challenger,
|
challenger,
|
||||||
fri_config,
|
fri_config,
|
||||||
@ -230,7 +229,13 @@ mod tests {
|
|||||||
|
|
||||||
let lpc = ListPolynomialCommitment::new(polys, &fri_config);
|
let lpc = ListPolynomialCommitment::new(polys, &fri_config);
|
||||||
let (proof, evaluations) = lpc.open(&points, &mut Challenger::new());
|
let (proof, evaluations) = lpc.open(&points, &mut Challenger::new());
|
||||||
proof.verify(&points, &evaluations, &mut Challenger::new(), &fri_config)
|
proof.verify(
|
||||||
|
&points,
|
||||||
|
&evaluations,
|
||||||
|
lpc.merkle_tree.root,
|
||||||
|
&mut Challenger::new(),
|
||||||
|
&fri_config,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -251,6 +256,12 @@ mod tests {
|
|||||||
|
|
||||||
let lpc = ListPolynomialCommitment::new(polys, &fri_config);
|
let lpc = ListPolynomialCommitment::new(polys, &fri_config);
|
||||||
let (proof, evaluations) = lpc.open(&points, &mut Challenger::new());
|
let (proof, evaluations) = lpc.open(&points, &mut Challenger::new());
|
||||||
proof.verify(&points, &evaluations, &mut Challenger::new(), &fri_config)
|
proof.verify(
|
||||||
|
&points,
|
||||||
|
&evaluations,
|
||||||
|
lpc.merkle_tree.root,
|
||||||
|
&mut Challenger::new(),
|
||||||
|
&fri_config,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user