Skip to main content

tree_hash

Function tree_hash 

Source
pub fn tree_hash(tree: &Tree) -> Hash
Expand description

Compute the canonical SPEC-OBJECTS tree hash.

Phase 2 swaps the Phase-1 placeholder for the canonical hash: BLAKE3(serialize(Object::Tree(t))). This is the same digest the rest of the codebase uses to address a tree object — commits, remix roots, and the object store all key trees by this value.

Binding the manifest to the canonical tree hash means the verifier can cross-check the manifest against any independently-known commitment to the source tree (a parent commit’s tree_hash, a merge base’s tree, the local object store) without re-deriving a sparse-private digest.

The empty tree still serializes to a valid 10-byte object (6-byte prologue || u32 LE 0 entries) and hashes to a non-zero digest — there is no longer a ZERO short-circuit.