Struct LeafNode

Source
pub struct LeafNode {
    pub hash: Hash,
    pub is_left_sibling: bool,
    pub value: Hash,
    pub label: Hash,
    pub next: Hash,
}
Expand description

Represents a leaf node in the indexed Merkle Tree.

Leaf nodes contain the actual data stored in the tree structure as well as metadata that, among other things, ensures the integrity and order of the tree structure. Each leaf node contains a hash of its metadata consisting of a SHA256 value, a link to neighboring elements for efficient traversal and verification. The links lead to the label field which is also a SHA256 value, making it sortable, which is crucial for e.g. Non-Membership proofs. For more information see https://eprint.iacr.org/2021/1263.pdf.

Fields:

  • hash: The hash of the values below, expect of the is_left_sibling-value.
  • is_left_sibling: Indicates if this node is a left child in its parent node.
  • value: The actual data value stored in the node.
  • label: A unique identifier for the node. This is used to sort by size and to link nodes together.
  • next: A reference to the next node in the tree.

Fields§

§hash: Hash§is_left_sibling: bool§value: Hash§label: Hash§next: Hash

Implementations§

Source§

impl LeafNode

Source

pub fn new(is_left: bool, label: Hash, value: Hash, next: Hash) -> Self

Initializes a new leaf node with the specified properties.

This function creates a leaf node with above defined attributes. The hash is generated based on its label, value, and next pointer. Additionally, the node is marked as a left sibling or not.

§Arguments
  • is_left - Boolean indicating if this is a left sibling.
  • label - Unique 256 bit identifier for the leaf.
  • value - 256 Bit data value of the leaf.
  • next - Reference to the next largest node (identified by the label value) in the sequence.
§Returns
  • A new leaf node with the specified properties.
Source

pub fn is_active(&self) -> bool

Trait Implementations§

Source§

impl Clone for LeafNode

Source§

fn clone(&self) -> LeafNode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LeafNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LeafNode

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for LeafNode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for LeafNode

Source§

fn eq(&self, other: &LeafNode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for LeafNode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for LeafNode

Source§

impl StructuralPartialEq for LeafNode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,