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:
32
33 void assert_read(const FF& value,
35 bool exists,
36 const IndexedTreeLeafData& low_leaf_preimage,
37 uint64_t low_leaf_index,
38 std::span<const FF> sibling_path,
39 const AppendOnlyTreeSnapshot& snapshot) override;
42 std::optional<uint64_t> public_inputs_index,
43 const IndexedTreeLeafData& low_leaf_preimage,
44 uint64_t low_leaf_index,
45 std::span<const FF> low_leaf_sibling_path,
46 const AppendOnlyTreeSnapshot& prev_snapshot,
47 std::optional<std::span<const FF>> insertion_sibling_path) override;
48
49 void on_checkpoint_created() override;
50 void on_checkpoint_committed() override;
51 void on_checkpoint_reverted() override;
52
53 private:
54 FF silo(const FF& nullifier, IndexedTreeSiloingParameters siloing_params);
55 void validate_low_leaf(const FF& value, const IndexedTreeLeafData& low_leaf_preimage, bool exists);
56
62};
63
64} // 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.
IndexedTreeCheck(Poseidon2Interface &poseidon2, MerkleCheckInterface &merkle_check, FieldGreaterThanInterface &field_gt, uint64_t merkle_hash_domain_separator, EventEmitterInterface< IndexedTreeCheckEvent > &event_emitter)
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.
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