Skip to content

feat(aztec-nr): let contracts choose the message tag derivation - #24432

Merged
nchamo merged 3 commits into
merge-train/fairies-v5from
nchamo/handshake-tag-derivation
Jul 1, 2026
Merged

feat(aztec-nr): let contracts choose the message tag derivation#24432
nchamo merged 3 commits into
merge-train/fairies-v5from
nchamo/handshake-tag-derivation

Conversation

@nchamo

@nchamo nchamo commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Motivation

The handshake registry delivers its own notes as a self-send, tagged through the generic on-chain tagging path. That path references STANDARD_HANDSHAKE_REGISTRY_ADDRESS, so the registry embeds its own address in its own bytecode. A contract's deploy address is a hash of its bytecode, so the pinned address never converges: re-pinning moves the bytecode, which moves the address.

Building on #24387, a contract can now fix its tag derivation at compile time. When the registry fixes the address-derived derivation, the handshake-registry references fold out of its bytecode via dead-code elimination, the self-reference disappears, and the address converges, all without changing the emitted tag.

The change

  • A contract selects its tag derivation via the on-chain delivery builder's via_* methods, honored over the wallet's default resolution:
    • via_non_interactive_handshake()
    • via_address_derived_secret()
  • The on-chain builder is split into OnchainUnconstrainedDelivery and OnchainConstrainedDelivery; the address-derived derivation is exposed only on the unconstrained builder, since it cannot back constrained delivery.
  • The default (no via_* call) is unchanged: reuse a registered handshake, otherwise the wallet-resolved strategy.
  • Re-pins the standard contracts; the registry address now converges (idempotent re-pin).

@nchamo nchamo added ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure ci-draft Run CI on draft PRs. labels Jul 1, 2026
@nchamo nchamo self-assigned this Jul 1, 2026
@nchamo
nchamo marked this pull request as ready for review July 1, 2026 15:29
@nchamo
nchamo requested a review from nventuro as a code owner July 1, 2026 15:29
@nchamo
nchamo requested a review from vezenovm July 1, 2026 15:29

@vezenovm vezenovm left a comment

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.

looks good, mostly nits, approving as I leave to you to decide which you want to adopt

Comment thread noir-projects/aztec-nr/aztec/src/messages/delivery/builder.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/messages/delivery/builder.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/messages/delivery/builder.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/messages/delivery/builder.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/messages/delivery/builder.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/messages/delivery/tag_derivation.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/messages/delivery/tag_derivation.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/messages/delivery/tag_derivation.nr Outdated
@nchamo
nchamo enabled auto-merge (squash) July 1, 2026 16:40
@nchamo
nchamo disabled auto-merge July 1, 2026 16:57
@nchamo
nchamo merged commit 6f2355d into merge-train/fairies-v5 Jul 1, 2026
12 checks passed
@nchamo
nchamo deleted the nchamo/handshake-tag-derivation branch July 1, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants