Skip to content

feat: check event commitment nullifier existence on Noir side#21151

Closed
benesjan wants to merge 3 commits into
merge-train/fairiesfrom
jan/event-commitment-nullifier-check-2
Closed

feat: check event commitment nullifier existence on Noir side#21151
benesjan wants to merge 3 commits into
merge-train/fairiesfrom
jan/event-commitment-nullifier-check-2

Conversation

@benesjan

@benesjan benesjan commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Implemented this PR as a reaction to this comment. Makes sense to have the check in Noir for events as well as it's a good software design to handle invalid data as soon as possible in the data processing pipeline. It will also make the behavior the same between note and events since in the case of notes we have already performed this validation in Noir when brute forcing nonces.

Summary

  • Adds a check_nullifier_exists call in process_private_event_msg (Noir) to verify the event commitment exists in the nullifier tree before enqueuing it for validation
  • This mirrors the existing TypeScript-side check in event_service.ts that verifies the siloed event commitment is present in the tx's nullifiers

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@benesjan benesjan requested a review from nventuro as a code owner March 5, 2026 06:45
@benesjan benesjan marked this pull request as draft March 5, 2026 06:48
benesjan and others added 2 commits March 5, 2026 06:49
@benesjan benesjan marked this pull request as ready for review March 5, 2026 07:26
Comment on lines +24 to +33
if check_nullifier_exists(event_commitment) {
enqueue_event_for_validation(
contract_address,
event_type_id,
randomness,
serialized_event,
event_commitment,
tx_hash,
recipient,
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, this is not what I meant. This would be terrible as it'd introduce an extra roundtrip per message.

I meant that the callers of this function already have access to the tx effects, and that we'd just search there (just like we do for the note hash when finding the nonce). But I just realized we don't have all nullifiers, only the first one, so we can't search for this. Given that I'd abandon this then.

@nventuro nventuro closed this Mar 6, 2026
@benesjan benesjan deleted the jan/event-commitment-nullifier-check-2 branch March 25, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants