This PR renames Mmr::open() into Mmr::open_at() and Mmr::peaks() into Mmr::peaks_at() and also introduces Mmr::open() and Mmr::peaks() which rely on Mmr::open_at() and Mmr::peaks() respectively.
This makes the API a bit more ergonomic when we are working with the latest state of the MMR. For example, things like mmr.open(leaf_pos, mmr.forest() become just mmr.open(leaf_pos).
As an aside, open() method is a bit inconsistent as it doesn't actually return the leaf at the specified position. To improve it further, we'd need to either modify the MmrProof to include the leaf, or return (MmrProof, RpoDigest) from open(). But I left it for future PRs.
This PR renames
Mmr::open()
intoMmr::open_at()
andMmr::peaks()
intoMmr::peaks_at()
and also introducesMmr::open()
andMmr::peaks()
which rely onMmr::open_at()
andMmr::peaks()
respectively.This makes the API a bit more ergonomic when we are working with the latest state of the MMR. For example, things like
mmr.open(leaf_pos, mmr.forest()
become justmmr.open(leaf_pos)
.As an aside,
open()
method is a bit inconsistent as it doesn't actually return the leaf at the specified position. To improve it further, we'd need to either modify theMmrProof
to include the leaf, or return(MmrProof, RpoDigest)
fromopen()
. But I left it for future PRs.