5 releases (1 unstable)

new 27.0.0-non-semver-compat Mar 21, 2025
26.7.0-non-semver-compat Mar 6, 2025
26.2.1-non-semver-compat Jan 29, 2025
26.1.0-non-semver-compat Jan 22, 2025
0.1.0 Jul 12, 2024

#983 in Magic Beans

Download history 108/week @ 2024-11-27 149/week @ 2024-12-04 73/week @ 2024-12-11 47/week @ 2024-12-18 49/week @ 2024-12-25 65/week @ 2025-01-01 34/week @ 2025-01-08 26/week @ 2025-01-15 218/week @ 2025-01-22 385/week @ 2025-01-29 215/week @ 2025-02-05 177/week @ 2025-02-12 32/week @ 2025-02-19 21/week @ 2025-02-26 232/week @ 2025-03-05 53/week @ 2025-03-12

342 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

~14MB
~191K SLoC