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
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 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.