
## miden::core::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 + 6 * pair_count<br />Leaf multiple, empty value: 186 + 6 * 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 /> |
| peek | Emits the "miden::core::collections::smt::smt_peek" event, which pushes onto the advice stack<br />the value associated with the specified key in a Sparse Merkle Tree defined by the specified<br />root.<br /><br />If no value was previously associated with the specified key, [ZERO; 4] is pushed onto the advice<br />stack.<br /><br />Inputs:<br />Operand stack: [KEY, ROOT]<br />Advice stack:  []<br /><br />Outputs:<br />Operand stack: [KEY, ROOT]<br />Advice stack:  [VALUE]<br /><br />Panics if:<br />- the tree with the specified root does not exits in the VM's advice provider.<br /><br />Cycles: 3 cycles<br /> |
