Files
amethyst/quartz
Claude b01ea3f567 fix: BinaryTree.root for non-power-of-2 leaf counts
The root of an MLS left-balanced tree uses ceil(log2(n)), not
floor(log2(n)). For power-of-2 leaf counts both give the same result,
which is why the tree-math test vectors (all power-of-2) didn't catch
this. For non-power-of-2 counts like 9 leaves, root was computed as
node 7 (subtree root) instead of node 15 (actual tree root).

Also restored _leafCount = (nodesList.size + 1) / 2 for full serialized
node count, with tree-validation using logical leaf count from
tree_hashes.size for trees with trailing blanks.

Test results: 38/41 passing (93%).

Remaining 3 failures:
- EncryptWithLabel: HPKE X25519 DH discrepancy
- TranscriptHash (2): Needs AuthenticatedContent decomposition

https://claude.ai/code/session_01NocQDWj2Y92FugjfgazzL3
2026-04-03 21:43:44 +00:00
..
2026-04-01 15:45:46 -04:00