47 if (low_leaf_matches) {
49 throw std::runtime_error(
"Nullifier non-membership check failed");
53 throw std::runtime_error(
"Low leaf value is GTE leaf value");
56 throw std::runtime_error(
"Leaf value is GTE low leaf next value");
59 throw std::runtime_error(
"Nullifier membership check failed");
87 uint64_t low_leaf_index,
99 merkle_check.assert_membership(low_leaf_hash, low_leaf_index, sibling_path, snapshot.
root);
106 .prev_snapshot = snapshot,
107 .next_snapshot = snapshot,
108 .low_leaf_preimage = low_leaf_preimage,
109 .low_leaf_hash = low_leaf_hash,
110 .low_leaf_index = low_leaf_index,
111 .siloing_data = siloing_data,
142 uint64_t nullifier_counter,
144 uint64_t low_leaf_index,
155 bool exists = !insertion_sibling_path.has_value();
166 merkle_check.assert_membership(low_leaf_hash, low_leaf_index, low_leaf_sibling_path, prev_snapshot.
root);
175 low_leaf_hash, updated_low_leaf_hash, low_leaf_index, low_leaf_sibling_path, prev_snapshot.
root);
186 insertion_sibling_path.value(),
195 .new_leaf_hash = new_leaf_hash,
196 .intermediate_root = intermediate_root,
201 .prev_snapshot = prev_snapshot,
202 .next_snapshot = next_snapshot,
203 .low_leaf_preimage = low_leaf_preimage,
204 .low_leaf_hash = low_leaf_hash,
205 .low_leaf_index = low_leaf_index,
207 .siloing_data = siloing_data,
208 .nullifier_counter = nullifier_counter,
209 .append_data = append_data });
211 return next_snapshot;
#define DOM_SEP__SILOED_NULLIFIER
virtual void emit(Event &&event)=0
virtual bool ff_gt(const FF &a, const FF &b)=0
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.
FieldGreaterThanInterface & field_gt
void on_checkpoint_reverted() override
Emits a checkpoint revert event, rolling back pending nullifier tree changes.
EventEmitterInterface< NullifierTreeCheckEvent > & events
void on_checkpoint_created() override
Emits a checkpoint creation event for the nullifier tree.
static FF hash(const std::vector< FF > &input)
Hashes a vector of field elements.
AztecAddress contract_address
AVM range check gadget for witness generation.
crypto::merkle_tree::IndexedLeaf< crypto::merkle_tree::NullifierLeafValue > NullifierTreeLeafPreimage
::bb::crypto::merkle_tree::NullifierLeafValue NullifierLeafValue
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
uint64_t next_available_leaf_index
std::vector< fr > get_hash_inputs() const