weave-weft · tree
Source declarations, signatures and documentation for tree.
Reviewed implementation boundary: Producer signatures must be computed over the exact manifest before validate/from_bytes or publication; an empty signature is rejected. Reader interfaces do not establish constant-memory storage, and chain reference metadata alone does not submit or prove anchoring. See /libraries/weft/publish.
Source: sigil/weave/models/weft/src/tree.rs. SHA-256: 9a56d7eabd75e8df973d4c4de4d1d61f204ad40f7d445f1961dd52899118993a.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
tree::TREE_EMPTY_DOMAIN
Domain tag for the empty Weft tree root.
pub const TREE_EMPTY_DOMAIN: &[u8];Source line: 7.
tree::TREE_LEAF_DOMAIN
Domain tag for leaf nodes.
pub const TREE_LEAF_DOMAIN: &[u8];Source line: 9.
tree::TREE_NODE_DOMAIN
Domain tag for internal nodes.
pub const TREE_NODE_DOMAIN: &[u8];Source line: 11.
tree::ProofPosition
Sibling position relative to the current proof path node.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ProofPosition {
/// Sibling is on the left side.
Left,
/// Sibling is on the right side.
Right,
}Source line: 16.
tree::ProofSibling
One sibling hash in a Merkle proof.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct ProofSibling {
/// Sibling position.
pub position: ProofPosition,
/// Sibling hash at this level.
pub hash: WeftHash
}Source line: 25.
tree::MerkleProof
Merkle proof for a single chunk ID.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct MerkleProof {
/// Zero-based leaf index.
pub leaf_index: u64,
/// Total number of leaves in the tree.
pub leaf_count: u64,
/// Sibling path. Odd unpaired leaves are promoted and do not add siblings.
pub siblings: Vec<ProofSibling>
}Source line: 34.
tree::MerkleTree
A deterministic binary Merkle tree over Weft chunk IDs.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MerkleTree {
}Source line: 45.
tree::MerkleTree::from_leaves
Build a tree from chunk IDs.
pub fn from_leaves(leaves: Vec<WeftHash>) -> Result<Self>;Source line: 53.
tree::MerkleTree::root
Return the Merkle root.
pub fn root(&self) -> WeftHash;Source line: 93.
tree::MerkleTree::proof
Return a Merkle proof for one leaf index.
pub fn proof(&self, index: u64) -> Result<MerkleProof>;Source line: 98.
tree::MerkleTree::verify_proof
Verify a proof for a chunk ID against a root.
pub fn verify_proof(root: WeftHash, leaf: WeftHash, proof: &MerkleProof) -> Result<bool>;Source line: 136.