pub struct MerkleVerify;
Expand description
Verify membership in a Merkle tree.
Verify that a leaf lives in a Merkle tree, given the tree’s root, its height, the leaf’s index, and the leaf itself. The authentication path is non-deterministically divined. This algorithm asserts that the leaf is a member of the tree; phrased differently, if membership could not be established, it crashes the VM.
§Behavior
BEFORE: _ [root: Digest] tree_height leaf_index [leaf: Digest]
AFTER: _
§Preconditions
- all input arguments are properly
BFieldCodec
encoded
§Postconditions
None.
Implementations§
Source§impl MerkleVerify
impl MerkleVerify
pub const TREE_TOO_HIGH_ERROR_ID: i128 = 0i128
pub const OUT_OF_BOUNDS_LEAF_ERROR_ID: i128 = 1i128
pub const ROOT_MISMATCH_ERROR_ID: i128 = 2i128
Trait Implementations§
Source§impl BasicSnippet for MerkleVerify
impl BasicSnippet for MerkleVerify
fn inputs(&self) -> Vec<(DataType, String)>
fn outputs(&self) -> Vec<(DataType, String)>
fn entrypoint(&self) -> String
fn code(&self, _: &mut Library) -> Vec<LabelledInstruction>
Source§fn sign_offs(&self) -> HashMap<Reviewer, SignOffFingerprint>
fn sign_offs(&self) -> HashMap<Reviewer, SignOffFingerprint>
Contains an entry for every sign off. Read more
fn annotated_code(&self, library: &mut Library) -> Vec<LabelledInstruction>
fn link_for_isolated_run(&self) -> Vec<LabelledInstruction>
Source§fn init_stack_for_isolated_run(&self) -> Vec<BFieldElement>
fn init_stack_for_isolated_run(&self) -> Vec<BFieldElement>
Initial stack on program start, when the snippet runs in isolation.
fn stack_diff(&self) -> isize
Source§impl Clone for MerkleVerify
impl Clone for MerkleVerify
Source§fn clone(&self) -> MerkleVerify
fn clone(&self) -> MerkleVerify
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for MerkleVerify
impl RefUnwindSafe for MerkleVerify
impl Send for MerkleVerify
impl Sync for MerkleVerify
impl Unpin for MerkleVerify
impl UnwindSafe for MerkleVerify
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SignedOffSnippet for Twhere
T: BasicSnippet + ?Sized,
impl<T> SignedOffSnippet for Twhere
T: BasicSnippet + ?Sized,
Source§fn fingerprint(&self) -> SignOffFingerprint
fn fingerprint(&self) -> SignOffFingerprint
The unique fingerprint as used for signing off on
this snippet.
Source§fn assert_all_sign_offs_are_up_to_date(&self)
fn assert_all_sign_offs_are_up_to_date(&self)
Panics if any sign-offs disagree with the actual
fingerprint.