From 0cd73399408fd84c7d2bbad1e96a8dc2cb2acd09 Mon Sep 17 00:00:00 2001 From: Daniel Lubarov Date: Wed, 7 Apr 2021 09:10:06 -0700 Subject: [PATCH] Fixes based on PR feedback --- src/gadgets/merkle_proofs.rs | 15 +++++++++++---- src/proof.rs | 4 ++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/gadgets/merkle_proofs.rs b/src/gadgets/merkle_proofs.rs index 94abb0e1..246406b6 100644 --- a/src/gadgets/merkle_proofs.rs +++ b/src/gadgets/merkle_proofs.rs @@ -1,30 +1,37 @@ use crate::circuit_builder::CircuitBuilder; use crate::field::field::Field; +use crate::proof::{Hash, HashTarget}; use crate::target::Target; pub struct MerkleProof { /// The Merkle digest of each sibling subtree, staying from the bottommost layer. - pub siblings: Vec, + pub siblings: Vec>, } pub struct MerkleProofTarget { /// The Merkle digest of each sibling subtree, staying from the bottommost layer. - pub siblings: Vec, + pub siblings: Vec, } +/// 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( - leaf_index: usize, leaf_data: Vec, + leaf_index: usize, + merkle_root: Hash, proof: MerkleProof, ) { todo!() } impl CircuitBuilder { + /// 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( &mut self, - leaf_index: Target, leaf_data: Vec, + leaf_index: Target, + merkle_root: HashTarget, proof: MerkleProofTarget, ) { todo!() diff --git a/src/proof.rs b/src/proof.rs index 9bfd5843..d25196cb 100644 --- a/src/proof.rs +++ b/src/proof.rs @@ -53,6 +53,8 @@ pub struct ProofTarget { } pub struct FriProof { + /// A Merkle root for each reduced polynomial in the commit phase. + pub commit_phase_merkle_roots: Vec>, /// Merkle proofs for the original purported codewords, i.e. the subject of the LDT. pub initial_merkle_proofs: Vec>, /// Merkle proofs for the reduced polynomials that were sent in the commit phase. @@ -63,6 +65,8 @@ pub struct FriProof { /// Represents a single FRI query, i.e. a path through the reduction tree. pub struct FriProofTarget { + /// A Merkle root for each reduced polynomial in the commit phase. + pub commit_phase_merkle_roots: Vec, /// Merkle proofs for the original purported codewords, i.e. the subject of the LDT. pub initial_merkle_proofs: Vec, /// Merkle proofs for the reduced polynomials that were sent in the commit phase.