miden-stdlib 0.19.1

Miden VM standard library
Documentation
1
2
3
4
5
6

## std::collections::smt
| Procedure | Description |
| ----------- | ------------- |
| get | Returns the value located under the specified key in the Sparse Merkle Tree defined by the<br />specified root.<br /><br />If no values had been previously inserted under the specified key, an empty word (i.e.,<br />[ZERO; 4]) is returned.<br /><br />Inputs:<br />Operand stack: [K, R, ...]<br /><br />Outputs:<br />Operand stack: [V, R, ...]<br /><br />Fails if the tree with the specified root does not exits in the VM's advice provider.<br /><br />Cycles<br />Leaf empty: 66 cycles<br />Leaf single: 115 cycles<br />Leaf multiple, non-empty value: 189 + 3 * pair_count<br />Leaf multiple, empty value: 186 + 3 * pair_count<br /> |
| set | Inserts the specified value under the specified key in a Sparse Merkle Tree defined by the<br />specified root. If the insert is successful, the old value located under the specified key<br />is returned via the stack.<br /><br />If the VALUE is an empty word (i.e., [ZERO; 4]), the new state of the tree is guaranteed to<br />be equivalent to the state as if the updated value was never inserted.<br /><br />Inputs:<br />Operand stack: [V, K, R, ...]<br />Outputs:<br />Operand stack: [V_old, R_new, ...]<br /><br />Fails if the tree with the specified root does not exits in the VM's advice provider.<br /><br />Cycles<br />Leaf empty<br />removal: 74 cycles<br />insertion: 133 cycles<br />Leaf single<br />removal: 227 cycles<br />insertion (leaf remains single): 205<br />insertion (leaf becomes multiple): X cycles<br />Leaf multiple<br />X cycles<br /> |