|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <written_public_data_slots_tree_check.hpp>
Public Member Functions | |
| WrittenPublicDataSlotsTreeCheck (IndexedTreeCheckInterface &indexed_tree_check, WrittenPublicDataSlotsTree initial_state) | |
| bool | contains (const AztecAddress &contract_address, const FF &slot) override |
| Checks whether a public data slot exists in the written public data slots tree. | |
| void | insert (const AztecAddress &contract_address, const FF &slot) override |
| Inserts a public data slot into the written public data slots tree. | |
| AppendOnlyTreeSnapshot | get_snapshot () const override |
| Returns the current tree snapshot from the top of the checkpoint stack. | |
| uint32_t | size () const override |
| Returns the number of written public data slots in the tree. | |
| void | create_checkpoint () override |
| Creates a checkpoint by pushing a copy of the current tree state onto the stack. | |
| void | commit_checkpoint () override |
| Commits the current checkpoint by replacing the previous tree state with the current one. | |
| void | revert_checkpoint () override |
| Reverts the current checkpoint by discarding the top of the tree state stack. | |
Public Member Functions inherited from bb::avm2::simulation::WrittenPublicDataSlotsInterface | |
| virtual | ~WrittenPublicDataSlotsInterface ()=default |
Private Attributes | |
| IndexedTreeCheckInterface & | indexed_tree_check |
| std::stack< WrittenPublicDataSlotsTree > | written_public_data_slots_tree_stack = {} |
Definition at line 15 of file written_public_data_slots_tree_check.hpp.
|
inline |
Definition at line 17 of file written_public_data_slots_tree_check.hpp.
|
overridevirtual |
Commits the current checkpoint by replacing the previous tree state with the current one.
Pops the top of the stack and overwrites the new top, finalizing all writes made since the last create_checkpoint call.
Implements bb::avm2::simulation::WrittenPublicDataSlotsInterface.
Definition at line 132 of file written_public_data_slots_tree_check.cpp.
|
overridevirtual |
Checks whether a public data slot exists in the written public data slots tree.
Computes the leaf slot from the contract address and slot, queries the in memory tree for the low leaf, converts it to generic IndexedTreeLeafData, and delegates the membership/non-membership proof to the indexed tree check gadget. Siloing is applied using the public leaf slot domain separator.
| contract_address | The address of the contract that owns the slot. |
| slot | The public data slot to look up. |
Implements bb::avm2::simulation::WrittenPublicDataSlotsInterface.
Definition at line 20 of file written_public_data_slots_tree_check.cpp.
|
overridevirtual |
Creates a checkpoint by pushing a copy of the current tree state onto the stack.
Subsequent writes modify only the top of the stack, allowing the checkpoint to be reverted (discarding changes) or committed (propagating changes down).
Implements bb::avm2::simulation::WrittenPublicDataSlotsInterface.
Definition at line 120 of file written_public_data_slots_tree_check.cpp.
|
overridevirtual |
Returns the current tree snapshot from the top of the checkpoint stack.
Implements bb::avm2::simulation::WrittenPublicDataSlotsTreeCheckInterface.
Definition at line 97 of file written_public_data_slots_tree_check.cpp.
|
overridevirtual |
Inserts a public data slot into the written public data slots tree.
Computes the leaf slot, performs the insertion on the in memory tree, then delegates the constrained write (or duplicate detection) to the indexed tree check gadget. Siloing is applied using the public leaf slot domain separator.
| contract_address | The address of the contract that owns the slot. |
| slot | The public data slot to insert. |
| std::runtime_error | If the indexed tree check write returns a snapshot that does not match the in memory tree. |
Implements bb::avm2::simulation::WrittenPublicDataSlotsInterface.
Definition at line 58 of file written_public_data_slots_tree_check.cpp.
|
overridevirtual |
Reverts the current checkpoint by discarding the top of the tree state stack.
All writes made since the last create_checkpoint call are discarded, restoring the tree to its previous state.
Implements bb::avm2::simulation::WrittenPublicDataSlotsInterface.
Definition at line 146 of file written_public_data_slots_tree_check.cpp.
|
overridevirtual |
Returns the number of written public data slots in the tree.
Implements bb::avm2::simulation::WrittenPublicDataSlotsInterface.
Definition at line 107 of file written_public_data_slots_tree_check.cpp.
|
private |
Definition at line 37 of file written_public_data_slots_tree_check.hpp.
|
private |
Definition at line 39 of file written_public_data_slots_tree_check.hpp.