mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-06 15:53:10 +00:00
Fixes based on PR feedback
This commit is contained in:
parent
9a8a7b6105
commit
0cd7339940
@ -1,30 +1,37 @@
|
|||||||
use crate::circuit_builder::CircuitBuilder;
|
use crate::circuit_builder::CircuitBuilder;
|
||||||
use crate::field::field::Field;
|
use crate::field::field::Field;
|
||||||
|
use crate::proof::{Hash, HashTarget};
|
||||||
use crate::target::Target;
|
use crate::target::Target;
|
||||||
|
|
||||||
pub struct MerkleProof<F: Field> {
|
pub struct MerkleProof<F: Field> {
|
||||||
/// The Merkle digest of each sibling subtree, staying from the bottommost layer.
|
/// The Merkle digest of each sibling subtree, staying from the bottommost layer.
|
||||||
pub siblings: Vec<F>,
|
pub siblings: Vec<Hash<F>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MerkleProofTarget {
|
pub struct MerkleProofTarget {
|
||||||
/// The Merkle digest of each sibling subtree, staying from the bottommost layer.
|
/// The Merkle digest of each sibling subtree, staying from the bottommost layer.
|
||||||
pub siblings: Vec<Target>,
|
pub siblings: Vec<HashTarget>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Verifies that the given leaf data is present at the given index in the Merkle tree with the
|
||||||
|
/// given root.
|
||||||
pub(crate) fn verify_merkle_proof<F: Field>(
|
pub(crate) fn verify_merkle_proof<F: Field>(
|
||||||
leaf_index: usize,
|
|
||||||
leaf_data: Vec<F>,
|
leaf_data: Vec<F>,
|
||||||
|
leaf_index: usize,
|
||||||
|
merkle_root: Hash<F>,
|
||||||
proof: MerkleProof<F>,
|
proof: MerkleProof<F>,
|
||||||
) {
|
) {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F: Field> CircuitBuilder<F> {
|
impl<F: Field> CircuitBuilder<F> {
|
||||||
|
/// Verifies that the given leaf data is present at the given index in the Merkle tree with the
|
||||||
|
/// given root.
|
||||||
pub(crate) fn verify_merkle_proof(
|
pub(crate) fn verify_merkle_proof(
|
||||||
&mut self,
|
&mut self,
|
||||||
leaf_index: Target,
|
|
||||||
leaf_data: Vec<Target>,
|
leaf_data: Vec<Target>,
|
||||||
|
leaf_index: Target,
|
||||||
|
merkle_root: HashTarget,
|
||||||
proof: MerkleProofTarget,
|
proof: MerkleProofTarget,
|
||||||
) {
|
) {
|
||||||
todo!()
|
todo!()
|
||||||
|
|||||||
@ -53,6 +53,8 @@ pub struct ProofTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct FriProof<F: Field> {
|
pub struct FriProof<F: Field> {
|
||||||
|
/// A Merkle root for each reduced polynomial in the commit phase.
|
||||||
|
pub commit_phase_merkle_roots: Vec<Hash<F>>,
|
||||||
/// Merkle proofs for the original purported codewords, i.e. the subject of the LDT.
|
/// Merkle proofs for the original purported codewords, i.e. the subject of the LDT.
|
||||||
pub initial_merkle_proofs: Vec<MerkleProof<F>>,
|
pub initial_merkle_proofs: Vec<MerkleProof<F>>,
|
||||||
/// Merkle proofs for the reduced polynomials that were sent in the commit phase.
|
/// Merkle proofs for the reduced polynomials that were sent in the commit phase.
|
||||||
@ -63,6 +65,8 @@ pub struct FriProof<F: Field> {
|
|||||||
|
|
||||||
/// Represents a single FRI query, i.e. a path through the reduction tree.
|
/// Represents a single FRI query, i.e. a path through the reduction tree.
|
||||||
pub struct FriProofTarget {
|
pub struct FriProofTarget {
|
||||||
|
/// A Merkle root for each reduced polynomial in the commit phase.
|
||||||
|
pub commit_phase_merkle_roots: Vec<HashTarget>,
|
||||||
/// Merkle proofs for the original purported codewords, i.e. the subject of the LDT.
|
/// Merkle proofs for the original purported codewords, i.e. the subject of the LDT.
|
||||||
pub initial_merkle_proofs: Vec<MerkleProofTarget>,
|
pub initial_merkle_proofs: Vec<MerkleProofTarget>,
|
||||||
/// Merkle proofs for the reduced polynomials that were sent in the commit phase.
|
/// Merkle proofs for the reduced polynomials that were sent in the commit phase.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user