Struct indexed_merkle_tree::node::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, an active flag that indicates whether the leaf is active or not and links 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: HashImplementations§
source§impl LeafNode
impl LeafNode
sourcepub fn new(is_left: bool, label: Hash, value: Hash, next: Hash) -> Self
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 active status, 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.
pub fn is_active(&self) -> bool
Trait Implementations§
source§impl<'de> Deserialize<'de> for LeafNode
impl<'de> Deserialize<'de> for LeafNode
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for LeafNode
impl PartialEq for LeafNode
impl Eq for LeafNode
impl StructuralPartialEq for LeafNode
Auto Trait Implementations§
impl Freeze for LeafNode
impl RefUnwindSafe for LeafNode
impl Send for LeafNode
impl Sync for LeafNode
impl Unpin for LeafNode
impl UnwindSafe for LeafNode
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)