#include <merkle_check.hpp>
|
| | MerkleCheck (Poseidon2Interface &poseidon2, EventEmitterInterface< MerkleCheckEvent > &event_emitter) |
| |
| void | assert_membership (const FF &leaf_value, const uint64_t leaf_index, std::span< const FF > sibling_path, const FF &root) override |
| | Assert membership of a leaf in a Merkle tree, i.e., verify that the leaf value, leaf index, and the sibling path lead to the given root. Size of the tree is implicitly given by the sibling path length.
|
| |
| FF | write (const FF ¤t_value, const FF &new_value, const uint64_t leaf_index, std::span< const FF > sibling_path, const FF ¤t_root) override |
| | Assert the membership of the current leaf value (same logic as assert_membership()). Write the new leaf value in the tree, i.e., compute the new root of the tree after the insertion of the new leaf value. Size of the tree is implicitly given by the sibling path length.
|
| |
| virtual | ~MerkleCheckInterface ()=default |
| |
Definition at line 14 of file merkle_check.hpp.
◆ MerkleCheck()
◆ assert_membership()
| void bb::avm2::simulation::MerkleCheck::assert_membership |
( |
const FF & |
leaf_value, |
|
|
const uint64_t |
leaf_index, |
|
|
std::span< const FF > |
sibling_path, |
|
|
const FF & |
root |
|
) |
| |
|
overridevirtual |
Assert membership of a leaf in a Merkle tree, i.e., verify that the leaf value, leaf index, and the sibling path lead to the given root. Size of the tree is implicitly given by the sibling path length.
- Note
- A precondition is that sibling_path.size() <= 64
- Exceptions
-
| std::runtime_error | if the membership check fails. |
- Parameters
-
| leaf_value | The value of the leaf to check. |
| leaf_index | The index of the leaf to check. |
| sibling_path | The sibling path to the leaf to check. |
| root | The root of the Merkle tree. |
Implements bb::avm2::simulation::MerkleCheckInterface.
Definition at line 22 of file merkle_check.cpp.
◆ write()
| FF bb::avm2::simulation::MerkleCheck::write |
( |
const FF & |
current_value, |
|
|
const FF & |
new_value, |
|
|
const uint64_t |
leaf_index, |
|
|
std::span< const FF > |
sibling_path, |
|
|
const FF & |
current_root |
|
) |
| |
|
overridevirtual |
Assert the membership of the current leaf value (same logic as assert_membership()). Write the new leaf value in the tree, i.e., compute the new root of the tree after the insertion of the new leaf value. Size of the tree is implicitly given by the sibling path length.
- Note
- A precondition is that sibling_path.size() <= 64
- Exceptions
-
| std::runtime_error | if the membership check fails. |
- Parameters
-
| current_value | The value of the current leaf. |
| new_value | The value of the new leaf. |
| leaf_index | The index of the leaf to write. |
| sibling_path | The sibling path to the leaf to write. |
| current_root | The root of the Merkle tree before the write. |
- Returns
- The new root of the Merkle tree after the write.
Implements bb::avm2::simulation::MerkleCheckInterface.
Definition at line 73 of file merkle_check.cpp.
◆ events
◆ poseidon2
The documentation for this class was generated from the following files: