Date: 2026-05-29
Time: 11:31
I'll work from the test file content you provided, which reveals quite a lot about the implementation's API.
merkle-tree/merkle_tree.py — The implementation: how the tree is structured, how hashes are computed, how diff() walks the tree, and how padding handles non-power-of-2 leaf countsmerkle-tree/merkle_tree.py:MerkleTree.diff — The tree-comparison algorithm: does it walk top-down (pruning matching subtrees) or compare leaves directly? This determines whether diffing is O(n) or O(k log n) where k is the number of differencesmerkle-tree/testmerkletree.py — The sibling test file, likely a more structured or tester-generated test suite — compare coverage and stylemerkle-proof-verification — How verify_proof reconstructs the root hash from a leaf, sibling hashes, and positional information — the core of Merkle tree authenticationanti-entropy-with-merkle-trees — DDIA Chapter 5 discusses using Merkle trees for anti-entropy in Dynamo-style systems: how diff() maps to the replica-repair protocolmerkle-tree-height-formula — A MerkleTree with 4 leaves has height == 2, indicating height counts internal levels (not counting the leaf layer)merkle-diff-returns-leaf-indices — MerkleTree.diff() returns a list of integer leaf indices where the two trees diverge, not subtree nodes or hash pairsmerkle-proof-sibling-count-is-log-n — A Merkle proof for a tree with n leaves contains exactly log₂(n) sibling hashes (2 siblings for 4 leaves)merkle-tree-supports-non-power-of-two — The implementation handles non-power-of-2 leaf counts (tested with 1 and 3 leaves) via internal paddingkey-range-merkle-diff-returns-key-names — KeyRangeMerkleTree.diff_keys() returns the string key names of divergent entries, not numeric indices