ralexstokes / ssz-rs

Implementation of ethereum's `ssz`
Apache License 2.0
103 stars 41 forks source link

Use `prysmaticlabs/hashtree` to accelerate Merkle computations #156

Open ralexstokes opened 4 months ago

ralexstokes commented 4 months ago

We can accelerate the computation of a parent layer of a Merkle tree using this library: https://github.com/prysmaticlabs/hashtree

The core routine for this computation currently is in this function: https://github.com/ralexstokes/ssz-rs/blob/84ef2b71aa004f6767420badb42c902ad56b8b72/ssz-rs/src/merkleization/merkleize.rs#L96

It would be nice to add this library behind a Cargo feature flag, and write some benchmarks to determine if we get substantial speedups on realistic workloads (e.g. computing hash_tree_root on a mainnet BeaconState).

See #93 for a bit more context.