Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
nullifier_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& nullifier,
33 bool exists,
34 const NullifierTreeLeafPreimage& low_leaf_preimage,
35 uint64_t low_leaf_index,
36 std::span<const FF> sibling_path,
37 const AppendOnlyTreeSnapshot& snapshot) override;
40 uint64_t nullifier_counter,
41 const NullifierTreeLeafPreimage& 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:
53 void validate_low_leaf(const FF& nullifier, const NullifierTreeLeafPreimage& low_leaf_preimage, bool exists);
54
59};
60
61} // namespace bb::avm2::simulation
Interface for a checkpoint notifiable.
Definition db.hpp:124
void validate_low_leaf(const FF &nullifier, const NullifierTreeLeafPreimage &low_leaf_preimage, bool exists)
Validates the low leaf preimage against the nullifier for membership/non-membership checks.
void on_checkpoint_committed() override
Emits a checkpoint commit event, finalizing pending nullifier tree changes.
AppendOnlyTreeSnapshot write(const FF &nullifier, std::optional< AztecAddress > contract_address, uint64_t nullifier_counter, const NullifierTreeLeafPreimage &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
Inserts a nullifier into the nullifier tree or verifies it already exists.
FF silo_nullifier(const FF &nullifier, AztecAddress contract_address)
Computes the siloed nullifier by hashing the contract address with the nullifier.
void assert_read(const FF &nullifier, std::optional< AztecAddress > contract_address, bool exists, const NullifierTreeLeafPreimage &low_leaf_preimage, uint64_t low_leaf_index, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &snapshot) override
Performs a nullifier membership/non-membership check on the nullifier tree.
void on_checkpoint_reverted() override
Emits a checkpoint revert event, rolling back pending nullifier tree changes.
EventEmitterInterface< NullifierTreeCheckEvent > & events
NullifierTreeCheck(Poseidon2Interface &poseidon2, MerkleCheckInterface &merkle_check, FieldGreaterThanInterface &field_gt, EventEmitterInterface< NullifierTreeCheckEvent > &event_emitter)
void on_checkpoint_created() override
Emits a checkpoint creation event for the nullifier tree.
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