mirror of
https://github.com/arnaucube/miden-crypto.git
synced 2026-01-09 23:51:30 +01:00
feat: add empty subtree constants to cover u8::MAX depth
Prior to this commit, we limited the constants count to 64 for the empty subtrees depth computation. This is a hard-assumption that every tree of Miden will have a depth up to 64 - and will cause undefined behavior if it doesn't. With the introduction of `MerkleStore::merge_roots` and the deprecation of `mtree_cwm` instruction from the VM, this assumption is broken and the user might end with trees with depth greater than 64. This broken assumption could lead to attack vectors. We can easily fix that by extending the pre-computed hashes list to the maximum of `u8` (i.e. 255). This will have zero impact on functionality, and will be completely safe to use without hard assumptions.
This commit is contained in: