3 releases (1 unstable)

new 26.2.1-non-semver-compat Jan 29, 2025
26.1.0-non-semver-compat Jan 22, 2025
0.1.0 Jul 12, 2024

#683 in Magic Beans

Download history 59/week @ 2024-10-13 59/week @ 2024-10-20 82/week @ 2024-10-27 55/week @ 2024-11-03 28/week @ 2024-11-10 42/week @ 2024-11-17 115/week @ 2024-11-24 75/week @ 2024-12-01 128/week @ 2024-12-08 81/week @ 2024-12-15 46/week @ 2024-12-22 42/week @ 2024-12-29 63/week @ 2025-01-05 33/week @ 2025-01-12 207/week @ 2025-01-19 314/week @ 2025-01-26

617 downloads per month
Used in 56 crates (2 directly)

MIT/Apache

215KB
5K SLoC

In-memory Merkle tree

Simple in-memory binary Merkle tree implementation. The tree is of bounded depth (up to 1,024 leaves) and uses the keccak-256 hash function.

Benchmarking

The tree implementation comes with a criterion benchmark that can be run with a command like this:

cargo bench -p zksync_mini_merkle_tree --bench tree

The order of timings should be 2M elements/s for all tree sizes (measured on MacBook Pro with 12-core Apple M2 Max CPU), both for calculating the root and the root + Merkle path. This translates to approximately 130µs for a tree with 512 leaves (the tree size used for L2ToL1Logs).


lib.rs:

Crate allowing to calculate root hashes and Merkle proofs for small in-memory Merkle trees.

Dependencies

~13MB
~185K SLoC