#include <public_data_tree_check.hpp>
|
| | PublicDataTreeCheck (Poseidon2Interface &poseidon2, MerkleCheckInterface &merkle_check, FieldGreaterThanInterface &field_gt, ExecutionIdGetterInterface &execution_id_manager, EventEmitterInterface< PublicDataTreeCheckEvent > &read_event_emitter) |
| |
| void | assert_read (const FF &slot, const AztecAddress &contract_address, const FF &value, const PublicDataTreeLeafPreimage &low_leaf_preimage, uint64_t low_leaf_index, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &snapshot) override |
| | Assert that a public data tree read is valid.
|
| |
| AppendOnlyTreeSnapshot | write (const FF &slot, const AztecAddress &contract_address, const FF &value, const PublicDataTreeLeafPreimage &low_leaf_preimage, uint64_t low_leaf_index, std::span< const FF > low_leaf_sibling_path, const AppendOnlyTreeSnapshot &prev_snapshot, std::span< const FF > insertion_sibling_path, bool is_protocol_write) override |
| | Write a value to the public data tree.
|
| |
| void | on_checkpoint_created () override |
| | Emit a checkpoint-created event for discard reconstruction.
|
| |
| void | on_checkpoint_committed () override |
| | Emit a checkpoint-committed event for discard reconstruction.
|
| |
| void | on_checkpoint_reverted () override |
| | Emit a checkpoint-reverted event for discard reconstruction.
|
| |
| void | generate_ff_gt_events_for_squashing (const std::vector< FF > &written_leaf_slots) |
| | Generates ff_gt events for squashing.
|
| |
| virtual | ~PublicDataTreeCheckInterface ()=default |
| |
| virtual | ~CheckpointNotifiable ()=default |
| |
Definition at line 21 of file public_data_tree_check.hpp.
◆ PublicDataTreeCheck()
◆ assert_read()
Assert that a public data tree read is valid.
Verifies a membership proof for the low leaf, then checks the value:
- If the leaf exists (low_leaf.slot == leaf_slot), asserts that the stored value matches.
- If the leaf does not exist, validates the low leaf range and asserts value is zero.
- Parameters
-
| slot | The storage slot being read. |
| contract_address | The contract address to silo the slot with. |
| value | The expected value at this slot. |
| low_leaf_preimage | The preimage of the low leaf in the indexed tree. |
| low_leaf_index | The index of the low leaf in the tree. |
| sibling_path | The Merkle sibling path for the low leaf. |
| snapshot | The tree snapshot (root and size) to verify against. |
- Exceptions
-
| std::runtime_error | If the leaf value does not match or the non-membership proof fails. |
Implements bb::avm2::simulation::PublicDataTreeCheckInterface.
Definition at line 63 of file public_data_tree_check.cpp.
◆ compute_leaf_slot()
| FF bb::avm2::simulation::PublicDataTreeCheck::compute_leaf_slot |
( |
const AztecAddress & |
contract_address, |
|
|
const FF & |
slot |
|
) |
| |
|
private |
◆ generate_ff_gt_events_for_squashing()
| void bb::avm2::simulation::PublicDataTreeCheck::generate_ff_gt_events_for_squashing |
( |
const std::vector< FF > & |
written_leaf_slots | ) |
|
Generates ff_gt events for squashing.
- Parameters
-
| written_leaf_slots | The leaf slots that were written in the tx (unique and nondiscarded). |
Definition at line 234 of file public_data_tree_check.cpp.
◆ on_checkpoint_committed()
| void bb::avm2::simulation::PublicDataTreeCheck::on_checkpoint_committed |
( |
| ) |
|
|
overridevirtual |
◆ on_checkpoint_created()
| void bb::avm2::simulation::PublicDataTreeCheck::on_checkpoint_created |
( |
| ) |
|
|
overridevirtual |
◆ on_checkpoint_reverted()
| void bb::avm2::simulation::PublicDataTreeCheck::on_checkpoint_reverted |
( |
| ) |
|
|
overridevirtual |
◆ validate_low_leaf_jumps_over_slot()
| void bb::avm2::simulation::PublicDataTreeCheck::validate_low_leaf_jumps_over_slot |
( |
const PublicDataTreeLeafPreimage & |
low_leaf_preimage, |
|
|
const FF & |
leaf_slot |
|
) |
| |
|
private |
Validate that the low leaf's slot range covers (jumps over) the given leaf slot.
Checks that low_leaf.slot < leaf_slot and (low_leaf.next_slot > leaf_slot or next_slot == 0 meaning infinity). This is used to prove non-membership of the leaf slot in the indexed tree.
- Parameters
-
| low_leaf_preimage | The preimage of the low leaf. |
| leaf_slot | The siloed leaf slot to validate against. |
- Exceptions
-
| std::runtime_error | If low leaf slot is >= leaf slot. |
| std::runtime_error | If leaf slot is >= low leaf next slot (when next slot is nonzero). |
Definition at line 35 of file public_data_tree_check.cpp.
◆ write()
Write a value to the public data tree.
Updates the low leaf (value if slot exists, pointers if it doesn't) If the slot doesn't exist, also inserts a new leaf into the tree.
- Parameters
-
| slot | The storage slot being written. |
| contract_address | The contract address to silo the slot with. |
| value | The value to write. |
| low_leaf_preimage | The preimage of the low leaf in the indexed tree. |
| low_leaf_index | The index of the low leaf in the tree. |
| low_leaf_sibling_path | The Merkle sibling path for the low leaf. |
| prev_snapshot | The tree snapshot before the write. |
| insertion_sibling_path | The Merkle sibling path for inserting a new leaf (used only if slot is new). |
| is_protocol_write | Whether this is a protocol-level write (e.g., fee payment). |
- Returns
- The new tree snapshot after the write.
- Exceptions
-
| std::runtime_error | If low leaf / merkle validation fails |
Implements bb::avm2::simulation::PublicDataTreeCheckInterface.
Definition at line 121 of file public_data_tree_check.cpp.
◆ events
◆ execution_id_manager
◆ field_gt
◆ merkle_check
◆ poseidon2
The documentation for this class was generated from the following files: