Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
indexed_tree_check.hpp
Go to the documentation of this file.
1#pragma once
2
12
13#include <cstdint>
14#include <optional>
15#include <span>
16
17namespace bb::avm2::simulation {
18
20 public:
30
31 void assert_read(const FF& value,
33 bool exists,
34 const IndexedTreeLeafData& low_leaf_preimage,
35 uint64_t low_leaf_index,
36 std::span<const FF> sibling_path,
37 const AppendOnlyTreeSnapshot& snapshot) override;
40 std::optional<uint64_t> public_inputs_index,
41 const IndexedTreeLeafData& low_leaf_preimage,
42 uint64_t low_leaf_index,
43 std::span<const FF> low_leaf_sibling_path,
44 const AppendOnlyTreeSnapshot& prev_snapshot,
45 std::optional<std::span<const FF>> insertion_sibling_path) override;
46
47 void on_checkpoint_created() override;
48 void on_checkpoint_committed() override;
49 void on_checkpoint_reverted() override;
50
51 private:
52 FF silo(const FF& nullifier, IndexedTreeSiloingParameters siloing_params);
53 void validate_low_leaf(const FF& value, const IndexedTreeLeafData& low_leaf_preimage, bool exists);
54
59};
60
61} // namespace bb::avm2::simulation
Interface for a checkpoint notifiable.
Definition db.hpp:124
void on_checkpoint_committed() override
Emits a checkpoint commit event, finalizing pending indexed tree changes.
void assert_read(const FF &value, std::optional< IndexedTreeSiloingParameters > siloing_params, bool exists, const IndexedTreeLeafData &low_leaf_preimage, uint64_t low_leaf_index, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &snapshot) override
Performs a membership/non-membership read check on an indexed tree.
void on_checkpoint_created() override
Emits a checkpoint creation event for the indexed tree.
void validate_low_leaf(const FF &value, const IndexedTreeLeafData &low_leaf_preimage, bool exists)
Validates the low leaf preimage against the target value for membership/non-membership.
EventEmitterInterface< IndexedTreeCheckEvent > & events
void on_checkpoint_reverted() override
Emits a checkpoint revert event, rolling back pending indexed tree changes.
AppendOnlyTreeSnapshot write(const FF &value, std::optional< IndexedTreeSiloingParameters > siloing_params, std::optional< uint64_t > public_inputs_index, const IndexedTreeLeafData &low_leaf_preimage, uint64_t low_leaf_index, std::span< const FF > low_leaf_sibling_path, const AppendOnlyTreeSnapshot &prev_snapshot, std::optional< std::span< const FF > > insertion_sibling_path) override
Writes a value into an indexed tree, or validates it already exists.
IndexedTreeCheck(Poseidon2Interface &poseidon2, MerkleCheckInterface &merkle_check, FieldGreaterThanInterface &field_gt, EventEmitterInterface< IndexedTreeCheckEvent > &event_emitter)
FF silo(const FF &nullifier, IndexedTreeSiloingParameters siloing_params)
Computes the siloed value by hashing the separator, address, and value via Poseidon2.
EventEmitter< DataCopyEvent > event_emitter
AVM range check gadget for witness generation.
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13