[−][src]Struct storage_proofs::merkle::MerkleProof
Representation of a merkle proof.
Each element in the path
vector consists of a tuple (hash, is_right)
, with hash
being the the hash of the node at the current level and is_right
a boolean indicating if the path is taking the right path.
The first element is the hash of leaf itself, and the last is the root hash.
Fields
root: H::Domain
Methods
impl<H: Hasher> MerkleProof<H>
[src]
pub fn new(n: usize) -> MerkleProof<H>
[src]
pub fn new_from_proof(p: &Proof<H::Domain>) -> MerkleProof<H>
[src]
pub fn as_options(&self) -> Vec<Option<(Fr, bool)>>
[src]
Convert the merkle path into the format expected by the circuits, which is a vector of options of the tuples. This does not include the root and the leaf.
pub fn as_pairs(&self) -> Vec<(Fr, bool)>
[src]
pub fn validate(&self, node: usize) -> bool
[src]
Validates the MerkleProof and that it corresponds to the supplied node.
pub fn validate_data(&self, data: &[u8]) -> bool
[src]
Validates that the data hashes to the leaf of the merkle path.
pub fn leaf(&self) -> &H::Domain
[src]
Returns the hash of leaf that this MerkleProof represents.
pub fn root(&self) -> &H::Domain
[src]
Returns the root hash
pub fn len(&self) -> usize
[src]
Returns the length of the proof. That is all path elements plus 1 for the leaf and 1 for the root.
pub fn serialize(&self) -> Vec<u8>
[src]
Serialize into bytes. TODO: probably improve
pub fn path(&self) -> &Vec<(H::Domain, bool)>
[src]
Trait Implementations
impl<H: Clone + Hasher> Clone for MerkleProof<H> where
H::Domain: Clone,
H::Domain: Clone,
H::Domain: Clone,
[src]
H::Domain: Clone,
H::Domain: Clone,
H::Domain: Clone,
fn clone(&self) -> MerkleProof<H>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<H: Default + Hasher> Default for MerkleProof<H> where
H::Domain: Default,
H::Domain: Default,
H::Domain: Default,
[src]
H::Domain: Default,
H::Domain: Default,
H::Domain: Default,
fn default() -> MerkleProof<H>
[src]
impl<H: Debug + Hasher> Debug for MerkleProof<H> where
H::Domain: Debug,
H::Domain: Debug,
H::Domain: Debug,
[src]
H::Domain: Debug,
H::Domain: Debug,
H::Domain: Debug,
impl<H: Hasher> Serialize for MerkleProof<H> where
H::Domain: Serialize,
H::Domain: Serialize,
[src]
H::Domain: Serialize,
H::Domain: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de, H: Hasher> Deserialize<'de> for MerkleProof<H> where
H::Domain: Deserialize<'de>,
H::Domain: Deserialize<'de>,
[src]
H::Domain: Deserialize<'de>,
H::Domain: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl<H> Unpin for MerkleProof<H> where
H: Unpin,
<H as Hasher>::Domain: Unpin,
H: Unpin,
<H as Hasher>::Domain: Unpin,
impl<H> Sync for MerkleProof<H> where
<H as Hasher>::Domain: Sync,
<H as Hasher>::Domain: Sync,
impl<H> Send for MerkleProof<H> where
<H as Hasher>::Domain: Send,
<H as Hasher>::Domain: Send,
impl<H> RefUnwindSafe for MerkleProof<H> where
H: RefUnwindSafe,
<H as Hasher>::Domain: RefUnwindSafe,
H: RefUnwindSafe,
<H as Hasher>::Domain: RefUnwindSafe,
impl<H> UnwindSafe for MerkleProof<H> where
H: UnwindSafe,
<H as Hasher>::Domain: UnwindSafe,
H: UnwindSafe,
<H as Hasher>::Domain: UnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,