## std::collections::mmr
| Procedure | Description |
| ----------- | ------------- |
| get | Loads the leaf at the absolute `pos` in the MMR.
This MMR implementation supports only u32 positions.
Stack transition:
Input: [pos, mmr_ptr, ...]
Output: [N, ...] where `N` is the leaf and `R` is the MMR peak that owns the leaf.
Cycles: 115
|
| num_leaves_to_num_peaks | Given the num_leaves of a MMR returns the num_peaks.
Input: [num_leaves, ...]
Output: [num_peaks, ...]
Cycles: 69
|
| num_peaks_to_message_size | Given the num_peaks of a MMR, returns the hasher state size after accounting
for the required padding.
Input: [num_peaks, ...]
Output: [len, ...]
Cycles: 17
|
| unpack | Load the MMR peak data based on its hash.
Input: [HASH, mmr_ptr, ...]
Output: [...]
Where:
- HASH: is the MMR peak hash, the hash is expected to be padded to an even
length and to have a minimum size of 16 elements
- The advice map must contain a key with HASH, and its value is
`num_leaves \|\| hash_data`, and hash_data is the data used to computed `HASH`
- mmt_ptr: the memory location where the MMR data will be written to,
starting with the MMR forest (its total leaves count) followed by its peaks
Cycles: 162 + 9 * extra_peak_pair cycles
where `extra_peak` is the number of peak pairs in addition to the first
16, i.e. `round_up((num_of_peaks - 16) / 2)`
|
| pack | Computes the hash of the given MMR and copies it to the Advice Map using its hash as a key.
Input: [mmr_ptr, ...]
Output: [HASH, ...]
Cycles: 128 + 3 * num_peaks
|
| add | Adds a new element to the MMR.
This will update the MMR peaks in the VM's memory and the advice provider
with any merged nodes.
Input: [EL, mmr_ptr, ...]
Output: [...]
Cycles: 144 + 39 * peak_merges
|