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
8
9namespace bb::avm2::simulation {
10
12 public:
13 virtual ~NullifierTreeCheckInterface() = default;
14 virtual void assert_read(const FF& nullifier,
16 bool exists,
17 const NullifierTreeLeafPreimage& low_leaf_preimage,
18 uint64_t low_leaf_index,
19 std::span<const FF> sibling_path,
20 const AppendOnlyTreeSnapshot& snapshot) = 0;
23 uint64_t nullifier_counter,
24 const NullifierTreeLeafPreimage& low_leaf_preimage,
25 uint64_t low_leaf_index,
26 std::span<const FF> low_leaf_sibling_path,
27 const AppendOnlyTreeSnapshot& prev_snapshot,
28 // Null if this is a failing write.
29 std::optional<std::span<const FF>> insertion_sibling_path) = 0;
30};
31
33 public:
43
44 void assert_read(const FF& nullifier,
46 bool exists,
47 const NullifierTreeLeafPreimage& low_leaf_preimage,
48 uint64_t low_leaf_index,
49 std::span<const FF> sibling_path,
50 const AppendOnlyTreeSnapshot& snapshot) override;
53 uint64_t nullifier_counter,
54 const NullifierTreeLeafPreimage& low_leaf_preimage,
55 uint64_t low_leaf_index,
56 std::span<const FF> low_leaf_sibling_path,
57 const AppendOnlyTreeSnapshot& prev_snapshot,
58 std::optional<std::span<const FF>> insertion_sibling_path) override;
59
60 void on_checkpoint_created() override;
61 void on_checkpoint_committed() override;
62 void on_checkpoint_reverted() override;
63
64 private:
66 void validate_low_leaf(const FF& nullifier, const NullifierTreeLeafPreimage& low_leaf_preimage, bool exists);
67
72};
73
74} // namespace bb::avm2::simulation
void validate_low_leaf(const FF &nullifier, const NullifierTreeLeafPreimage &low_leaf_preimage, bool exists)
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
FF silo_nullifier(const FF &nullifier, AztecAddress contract_address)
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
EventEmitterInterface< NullifierTreeCheckEvent > & events
NullifierTreeCheck(Poseidon2Interface &poseidon2, MerkleCheckInterface &merkle_check, FieldGreaterThanInterface &field_gt, EventEmitterInterface< NullifierTreeCheckEvent > &event_emitter)
virtual 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)=0
virtual 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)=0
EventEmitter< DataCopyEvent > event_emitter
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13