39 throw std::runtime_error(
"Low leaf slot is GTE leaf slot");
43 throw std::runtime_error(
"Leaf slot is GTE low leaf next slot");
67 uint64_t low_leaf_index,
81 throw std::runtime_error(
"Leaf value does not match value");
87 throw std::runtime_error(
"Value is nonzero for a non existing slot");
95 .leaf_slot = leaf_slot,
96 .prev_snapshot = snapshot,
97 .low_leaf_preimage = low_leaf_preimage,
98 .low_leaf_hash = low_leaf_hash,
99 .low_leaf_index = low_leaf_index,
125 uint64_t low_leaf_index,
129 bool is_protocol_write)
148 updated_low_leaf_preimage.
nextKey = leaf_slot;
155 updated_low_leaf_hash,
157 low_leaf_sibling_path,
161 .
root = intermediate_root,
164 FF new_leaf_hash = 0;
176 insertion_sibling_path,
182 uint32_t execution_id =
189 .leaf_slot = leaf_slot,
190 .prev_snapshot = prev_snapshot,
191 .low_leaf_preimage = low_leaf_preimage,
192 .low_leaf_hash = low_leaf_hash,
193 .low_leaf_index = low_leaf_index,
195 .updated_low_leaf_hash = updated_low_leaf_hash,
196 .new_leaf_hash = new_leaf_hash,
197 .intermediate_root = intermediate_root,
198 .next_snapshot = next_snapshot },
199 .execution_id = execution_id,
202 return next_snapshot;
237 std::vector<FF> sorted_written_leaf_slots = written_leaf_slots;
240 std::ranges::sort(sorted_written_leaf_slots,
243 if (sorted_written_leaf_slots.size() > 1) {
244 for (
size_t i = 0; i < sorted_written_leaf_slots.size() - 1; i++) {
245 field_gt.
ff_gt(sorted_written_leaf_slots.at(i + 1), sorted_written_leaf_slots.at(i));
#define DOM_SEP__PUBLIC_LEAF_SLOT
#define DOM_SEP__PUBLIC_DATA_MERKLE
virtual void emit(Event &&event)=0
virtual uint32_t get_execution_id() const =0
virtual bool ff_gt(const FF &a, const FF &b)=0
void on_checkpoint_created() override
Emit a checkpoint-created event for discard reconstruction.
FF compute_leaf_slot(const AztecAddress &contract_address, const FF &slot)
Compute the siloed leaf slot from a contract address and storage slot.
void validate_low_leaf_jumps_over_slot(const PublicDataTreeLeafPreimage &low_leaf_preimage, const FF &leaf_slot)
Validate that the low leaf's slot range covers (jumps over) the given leaf slot.
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_committed() override
Emit a checkpoint-committed event for discard reconstruction.
ExecutionIdGetterInterface & execution_id_manager
FieldGreaterThanInterface & field_gt
void generate_ff_gt_events_for_squashing(const std::vector< FF > &written_leaf_slots)
Generates ff_gt events for squashing.
void on_checkpoint_reverted() override
Emit a checkpoint-reverted event for discard reconstruction.
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.
EventEmitterInterface< PublicDataTreeCheckEvent > & events
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
AVM range check gadget for witness generation.
IndexedLeaf< PublicDataLeafValue > PublicDataTreeLeafPreimage
::bb::crypto::merkle_tree::PublicDataLeafValue PublicDataLeafValue
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
uint64_t next_available_leaf_index
AztecAddress contract_address
PublicDataTreeLeafPreimage updated_low_leaf_preimage
static IndexedLeaf< PublicDataLeafValue > empty()
std::vector< fr > get_hash_inputs() const