Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
note_hash_tree_check.hpp
Go to the documentation of this file.
1#pragma once
2
8
9namespace bb::avm2::simulation {
10
12 public:
13 virtual ~NoteHashTreeCheckInterface() = default;
14
15 virtual bool note_hash_exists(const FF& unique_note_hash,
16 const FF& leaf_value,
17 uint64_t leaf_index,
18 std::span<const FF> sibling_path,
19 const AppendOnlyTreeSnapshot& snapshot) = 0;
20 virtual FF get_first_nullifier() const = 0;
21 virtual AppendOnlyTreeSnapshot append_note_hash(const FF& note_hash,
23 uint64_t note_hash_counter,
24 std::span<const FF> sibling_path,
25 const AppendOnlyTreeSnapshot& prev_snapshot) = 0;
26 virtual AppendOnlyTreeSnapshot append_siloed_note_hash(const FF& siloed_note_hash,
27 uint64_t note_hash_counter,
28 std::span<const FF> sibling_path,
29 const AppendOnlyTreeSnapshot& prev_snapshot) = 0;
30 virtual AppendOnlyTreeSnapshot append_unique_note_hash(const FF& unique_note_hash,
31 uint64_t note_hash_counter,
32 std::span<const FF> sibling_path,
33 const AppendOnlyTreeSnapshot& prev_snapshot) = 0;
34};
35
37 public:
47
48 FF get_first_nullifier() const override { return first_nullifier; }
49
50 bool note_hash_exists(const FF& unique_note_hash,
51 const FF& leaf_value,
52 uint64_t leaf_index,
53 std::span<const FF> sibling_path,
54 const AppendOnlyTreeSnapshot& snapshot) override;
57 uint64_t note_hash_counter,
58 std::span<const FF> sibling_path,
59 const AppendOnlyTreeSnapshot& prev_snapshot) override;
61 uint64_t note_hash_counter,
62 std::span<const FF> sibling_path,
63 const AppendOnlyTreeSnapshot& prev_snapshot) override;
65 uint64_t note_hash_counter,
66 std::span<const FF> sibling_path,
67 const AppendOnlyTreeSnapshot& prev_snapshot) override;
68
69 void on_checkpoint_created() override;
70 void on_checkpoint_committed() override;
71 void on_checkpoint_reverted() override;
72
73 private:
74 FF make_siloed(AztecAddress contract_address, const FF& note_hash) const;
75 FF make_nonce(uint64_t note_hash_counter) const;
76 FF make_unique(const FF& siloed_note_hash, const FF& nonce) const;
79 bool should_make_unique,
80 uint64_t note_hash_counter,
81 std::span<const FF> sibling_path,
82 const AppendOnlyTreeSnapshot& prev_snapshot);
83
88};
89
90} // namespace bb::avm2::simulation
AppendOnlyTreeSnapshot append_siloed_note_hash(const FF &siloed_note_hash, uint64_t note_hash_counter, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &prev_snapshot) override
EventEmitterInterface< NoteHashTreeCheckEvent > & events
AppendOnlyTreeSnapshot append_note_hash(const FF &note_hash, AztecAddress contract_address, uint64_t note_hash_counter, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &prev_snapshot) override
NoteHashTreeCheck(const FF &first_nullifier, Poseidon2Interface &poseidon2, MerkleCheckInterface &merkle_check, EventEmitterInterface< NoteHashTreeCheckEvent > &event_emitter)
FF make_nonce(uint64_t note_hash_counter) const
FF make_unique(const FF &siloed_note_hash, const FF &nonce) const
FF make_siloed(AztecAddress contract_address, const FF &note_hash) const
AppendOnlyTreeSnapshot append_note_hash_internal(FF note_hash, std::optional< AztecAddress > contract_address, bool should_make_unique, uint64_t note_hash_counter, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &prev_snapshot)
bool note_hash_exists(const FF &unique_note_hash, const FF &leaf_value, uint64_t leaf_index, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &snapshot) override
AppendOnlyTreeSnapshot append_unique_note_hash(const FF &unique_note_hash, uint64_t note_hash_counter, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &prev_snapshot) override
virtual bool note_hash_exists(const FF &unique_note_hash, const FF &leaf_value, uint64_t leaf_index, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &snapshot)=0
virtual AppendOnlyTreeSnapshot append_unique_note_hash(const FF &unique_note_hash, uint64_t note_hash_counter, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &prev_snapshot)=0
virtual AppendOnlyTreeSnapshot append_note_hash(const FF &note_hash, AztecAddress contract_address, uint64_t note_hash_counter, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &prev_snapshot)=0
virtual AppendOnlyTreeSnapshot append_siloed_note_hash(const FF &siloed_note_hash, uint64_t note_hash_counter, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &prev_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