Skip to content

fix: handle bad note lengths on compute_note_hash_and_nullifier (backport #21271)#21363

Closed
AztecBot wants to merge 2 commits intobackport-to-v4-stagingfrom
claudebox/backport-21271-bad-note-lengths
Closed

fix: handle bad note lengths on compute_note_hash_and_nullifier (backport #21271)#21363
AztecBot wants to merge 2 commits intobackport-to-v4-stagingfrom
claudebox/backport-21271-bad-note-lengths

Conversation

@AztecBot
Copy link
Collaborator

Summary

Backport of #21271 to v4-next.

Returns Option::none() instead of panicking when the packed note length doesn't match the expected value in _compute_note_hash_and_nullifier.

Conflict Resolution

The cherry-pick had a conflict in noir-projects/aztec-nr/aztec/src/messages/discovery/mod.nr — the v4-next branch had an older docstring for ComputeNoteHashAndNullifier while the PR introduced a more detailed one. Resolved by taking the incoming (PR) version which documents the new Option::none() behavior for bad note lengths.

Changes

  • noir-projects/aztec-nr/aztec/src/macros/aztec.nr: Return Option::none() with warning log instead of asserting on packed note length mismatch
  • noir-projects/aztec-nr/aztec/src/messages/discovery/mod.nr: Updated docstring for ComputeNoteHashAndNullifier
  • New test contract note_hash_and_nullifier_contract with tests for bad length handling

Test plan

  • CI passes

ClaudeBox log: https://claudebox.work/s/4bd6b5cf5928859c?run=1

nchamo and others added 2 commits March 11, 2026 13:43
…llifier (#21271)

Cherry-pick of 20d6c29 with conflicts preserved for review.
Resolved conflict in noir-projects/aztec-nr/aztec/src/messages/discovery/mod.nr - took incoming (PR) version which replaces the old docstring with updated documentation describing the new Option::none() behavior for bad note lengths.
@AztecBot AztecBot added the claudebox Owned by claudebox. it can push to this PR. label Mar 11, 2026
@ludamad
Copy link
Collaborator

ludamad commented Mar 12, 2026

Closing as duplicate — superseded by a newer attempt.

@ludamad ludamad closed this Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants