Skip to content

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

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

fix: handle bad note lengths on compute_note_hash_and_nullifier (backport #21271)#21362
AztecBot wants to merge 3 commits into
backport-to-v4-stagingfrom
claudebox/backport-21271-bad-note-lengths

Conversation

@AztecBot

Copy link
Copy Markdown
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 on v4-next

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

AztecBot and others added 3 commits March 10, 2026 17:23
BEGIN_COMMIT_OVERRIDE
chore: chonk proof compression poc (#20645)
feat: Update L1 to L2 message APIs (#20913)
fix: adapt chonk proof compression for v4 Translator layout (#21067)
fix: omit bigint priceBumpPercentage from IPC config in testbench worker
(#21086)
feat: standby mode for prover broker (#21098)
fix(p2p): remove default block handler in favor of block handler
(#21105)
chore: prepare barretenberg-rs for crates.io publishing (#20496)
feat: reenable function selectors + additional validation in public
setup allowlist (backport #20909, #21122) (#21129)
chore: remove stale aes comments (#21133)
chore: remove auto-tag job (#21127)
feat: calldata length validation of public setup function allowlist
(#21139)
feat: run AVM NAPI simulations on dedicated threads instead of libuv
pool (#21138)
feat: Remove non-protocol contracts from public setup allowlist (#21154)
feat!: Expose offchain effects when simulating/sending txs (backport
#20563) (#21110)
chore: bump minor version (#21171)
chore: backport #21161 (tally slashing pruning improvements) to v4
(#21166)
chore: More updated Alpha configuration (backport #21155) (#21165)
fix(p2p): report most severe failure in runValidations (#21185)
feat: add ergonomic conversions for Noir's `Option<T>` (#21107)
docs: clarifying Noir fields vs struct fields in event metadata (#21172)
fix: bump lighthouse consensus client v7.1.0 -> v8.0.1 (#21170)
fix: update dependencies (#20997)
chore: New alpha-net environment (#20800) (#21202)
chore: code decuplication + refactor (public setup allowlist) (#21200)
feat: mask all ciphertext fields with Poseidon2-derived values (backport
#21009) (#21140)
chore: disable sponsored FPC in testnet (#21235)
feat!: exposing pub event pagination on wallet (#21197)
refactor(pxe): narrow tryGetPublicKeysAndPartialAddress return type
(backport #21208) (#21236)
feat: orchestrator enqueues via serial queue (#21247)
feat: rollup mana limit gas validation (#21219)
chore: deploy SPONSORED_FPC in test networks (#21254)
fix(sequencer): fix log when not enough txs (#21297)
END_COMMIT_OVERRIDE

---------

Co-authored-by: ledwards2225 <ledwards2225@users.noreply.github.com>
Co-authored-by: PhilWindle <PhilWindle@users.noreply.github.com>
Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: mrzeszutko <mrzeszutko@users.noreply.github.com>
Co-authored-by: spalladino <spalladino@users.noreply.github.com>
Co-authored-by: johnathan79717 <johnathan79717@users.noreply.github.com>
Co-authored-by: nventuro <nventuro@users.noreply.github.com>
Co-authored-by: alexghr <alexghr@users.noreply.github.com>
Co-authored-by: AztecBot <AztecBot@users.noreply.github.com>
Co-authored-by: Martin Verzilli <martin@aztec-labs.com>
Co-authored-by: PhilWindle <60546371+PhilWindle@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: mverzilli <mverzilli@users.noreply.github.com>
Co-authored-by: benesjan <benesjan@users.noreply.github.com>
Co-authored-by: danielntmd <danielntmd@users.noreply.github.com>
Co-authored-by: deffrian <deffrian@users.noreply.github.com>
Co-authored-by: benesjan <janbenes1234@gmail.com>
…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
@AztecBot AztecBot changed the base branch from next to backport-to-v4-staging March 11, 2026 13:42
@AztecBot AztecBot closed this Mar 11, 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.

2 participants