27 merkle_check.assert_membership(leaf_value, leaf_index, sibling_path, snapshot.
root);
29 .existing_leaf_value = leaf_value,
30 .leaf_index = leaf_index,
31 .prev_snapshot = snapshot });
32 return unique_note_hash == leaf_value;
93 uint64_t note_hash_counter,
98 note_hash, contract_address,
true, note_hash_counter, sibling_path, prev_snapshot);
114 uint64_t note_hash_counter,
139 uint64_t note_hash_counter,
168 bool should_make_unique,
169 uint64_t note_hash_counter,
176 if (contract_address.has_value()) {
181 if (should_make_unique) {
195 .existing_leaf_value = 0,
197 .prev_snapshot = prev_snapshot,
200 .uniqueness_data = uniqueness_data,
201 .note_hash_counter = note_hash_counter,
202 .next_snapshot = next_snapshot,
204 return next_snapshot;
#define DOM_SEP__SILOED_NOTE_HASH
#define DOM_SEP__UNIQUE_NOTE_HASH
#define DOM_SEP__NOTE_HASH_NONCE
virtual void emit(Event &&event)=0
void on_checkpoint_created() override
Emits a checkpoint creation event for the note hash tree.
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
Appends a pre-siloed note hash to the tree after making it unique.
EventEmitterInterface< NoteHashTreeCheckEvent > & events
AppendOnlyTreeSnapshot append_note_hash(const FF ¬e_hash, AztecAddress contract_address, uint64_t note_hash_counter, std::span< const FF > sibling_path, const AppendOnlyTreeSnapshot &prev_snapshot) override
Appends a raw (inner) note hash to the tree after siloing and making it unique.
FF make_nonce(uint64_t note_hash_counter) const
Derives a nonce for a note hash from the transaction's first nullifier and the note hash counter.
FF make_unique(const FF &siloed_note_hash, const FF &nonce) const
Computes a unique note hash by combining a siloed note hash with its nonce.
FF make_siloed(AztecAddress contract_address, const FF ¬e_hash) const
Computes the siloed note hash by hashing the contract address with the note hash.
void on_checkpoint_committed() override
Emits a checkpoint commit event, finalizing pending note hash tree changes.
void on_checkpoint_reverted() override
Emits a checkpoint revert event, rolling back pending note hash tree changes.
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)
Internal implementation for all note hash append variants.
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
Checks whether a note hash exists in the note hash tree via Merkle membership proof.
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
Appends a pre-computed unique note hash directly to the tree.
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
AVM range check gadget for witness generation.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
uint64_t next_available_leaf_index
std::optional< NoteHashSiloingData > siloing_data