Skip to content

feat(pxe): resolve tagging secret strategy via wallet hook - #24040

Merged
vezenovm merged 23 commits into
merge-train/fairies-v5from
nchamo/f-699-pxewallet-get_delivery_privacy_preference-oracle
Jun 25, 2026
Merged

feat(pxe): resolve tagging secret strategy via wallet hook#24040
vezenovm merged 23 commits into
merge-train/fairies-v5from
nchamo/f-699-pxewallet-get_delivery_privacy_preference-oracle

Conversation

@nchamo

@nchamo nchamo commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Motivation

There are several ways to deliver a message between users, each with a different privacy trade-off. Delivery can reuse a secret the two parties already share (a previously established handshake, or one agreed off-chain) and leak nothing. Or it can establish a non-interactive handshake on the fly, which works without coordination at the cost of publishing information about the recipient onchain. When no tagging secret has been established for a (sender, recipient) pair yet, someone has to decide how to source one. That decision belongs to the wallet, which owns the user's privacy stance and can ask the user if needed.

The change

aztec-nr gains a resolve_tagging_strategy(sender, recipient, mode) oracle. It is consulted only when no tagging secret has been established for the (sender, recipient) pair yet; an established secret is reused without asking. The send flow will call it when resolving the tagging secret (F-698, not wired in this PR).

The wallet expresses its decision as a TaggingSecretStrategy: which secret to use, plus any raw material PXE cannot derive on its own (an arbitrary secret point). PXE resolves that strategy, performing any Diffie-Hellman key exchange and app-siloing, and returns a ResolvedTaggingStrategy the contract uses directly. So wallets never reimplement the derivation, and the contract never sees raw key material. There are three strategies:

  • Non-interactive handshake — a secret the recipient derives from an onchain handshake. Works without prior coordination, but publishes information about the recipient onchain. Constrained or unconstrained.
  • Address-derived — derived from the sender's and recipient's address keys via Diffie-Hellman. PXE does the exchange, so the wallet supplies no material. Leaves no onchain trace; unconstrained only.
  • Arbitrary secret — a raw secret point the two parties already share off-chain. The wallet supplies the point and PXE app-silos it. Leaves no onchain trace; unconstrained only, since constrained delivery requires the secret to be backed by an onchain handshake, which this lacks.

PXE answers the oracle through a new optional resolveTaggingSecretStrategy execution hook. We chose a hook over a static config value because the decision is per message. The request carries:

  • the executing contract (address and class id)
  • the message's sender
  • the message's recipient
  • the delivery mode (constrained or unconstrained)

This lets wallets apply per-application or per-recipient policies, or surface the decision to the user. The hook follows the existing precedent of authorizeUtilityCall, PXE's other wallet policy callback.

When no hook is configured PXE applies a privacy-safe default: unconstrained delivery uses an address-derived shared secret (no onchain trace), while constrained delivery fails, since every sound constrained secret must be backed by an onchain handshake, which needs a wallet. Privacy is therefore never weakened without the wallet opting in.

TXE has no hooks, so tests configure the strategy through a test environment option (unset by default, which exercises PXE's default):

TestEnvironmentOptions::new().with_tagging_secret_strategy(TaggingSecretStrategy::non_interactive_handshake())

Docs: an Execution hooks page documents the hook mechanism and both hooks, the note delivery page gains a Tagging secret strategy section, and the note discovery page is updated.

Fixes F-699

@nchamo
nchamo requested a review from nventuro as a code owner June 11, 2026 22:19
@nchamo nchamo self-assigned this Jun 11, 2026
@nchamo
nchamo requested review from Thunkar and vezenovm June 12, 2026 02:36

@Thunkar Thunkar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I like it!

Comment thread docs/docs-developers/docs/aztec-nr/framework-description/note_delivery.md Outdated
Comment thread docs/docs-developers/docs/aztec-nr/framework-description/note_delivery.md Outdated
Comment thread docs/docs-developers/docs/aztec-nr/framework-description/note_delivery.md Outdated
Comment thread docs/docs-developers/docs/aztec-nr/framework-description/note_delivery.md Outdated
Comment thread docs/docs-developers/docs/aztec-nr/framework-description/note_delivery.md Outdated
Comment thread noir-projects/aztec-nr/aztec/src/oracle/delivery_privacy_preference.nr Outdated
Comment thread noir-projects/aztec-nr/aztec/src/test/helpers/test_environment.nr Outdated
Comment thread yarn-project/pxe/src/hooks/execution_hooks.ts Outdated
Comment thread yarn-project/txe/src/txe_session.ts Outdated
@nchamo
nchamo requested a review from nventuro June 12, 2026 21:46
@nchamo nchamo changed the title feat(pxe): add get_delivery_privacy_preference oracle feat(pxe): resolve tagging secret source via wallet hook Jun 19, 2026
Comment thread noir-projects/aztec-nr/aztec/src/messages/delivery/tagging_secret_source.nr Outdated
Comment thread docs/docs-developers/docs/aztec-nr/framework-description/note_delivery.md Outdated
Comment thread docs/docs-developers/docs/aztec-nr/framework-description/note_delivery.md Outdated
vezenovm pushed a commit that referenced this pull request Jun 22, 2026
)

## Summary

Addresses the review comments on #23866 (constrained message delivery).
Branched off and based on that PR so these follow-up changes can be
reviewed in isolation.

- **aztec-nr helpers**: tightened the constrained-delivery docs, fixed
the misleading `index > 0` nullifier comment, switched secret resolution
to `map`/`unwrap_or_else`, and renamed "chain" -> "sequence" across
code/tests to avoid colliding with the existing "chain" (blockchain)
meaning.
- **Noir tests/contracts**: pinned the `get_handshakes` selector in the
registry selector-match test, renamed the test helper to `authorizing`,
and dropped redundant TXE tests now covered by the e2e and unit suites
(plus the `delivery_unconstrained_handshake` compile-failure pin).
- **PXE**: removed the temporary `get_app_siloed_secret` caller-arg
authorization check (avoids conflicting with #24062), moved the
registry-read helpers below the class, and reworked the cross-contract
authorization test into `it.each` with shared `beforeEach`/`afterEach`.
- Removed a stray `pied!` file that had been accidentally committed.

The docs changes from the review are deferred to #24040, which owns the
tagging-secret-source framing.
@nchamo
nchamo marked this pull request as draft June 23, 2026 19:00
@nchamo nchamo changed the title feat(pxe): resolve tagging secret source via wallet hook feat(pxe): resolve tagging secret strategy via wallet hook Jun 24, 2026
@nchamo
nchamo marked this pull request as ready for review June 24, 2026 20:17
@nchamo
nchamo marked this pull request as draft June 24, 2026 20:17
@nchamo nchamo added the ci-draft Run CI on draft PRs. label Jun 24, 2026
@nchamo
nchamo marked this pull request as ready for review June 24, 2026 23:34

@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.

Mostly nits, but one main comment related to failing when the execution hook is incompatible with the delivery mode.

Comment thread docs/docs-developers/docs/aztec-nr/framework-description/note_delivery.md Outdated
Comment thread docs/docs-developers/docs/aztec-nr/framework-description/note_delivery.md Outdated
Comment thread docs/docs-developers/docs/aztec-nr/framework-description/note_delivery.md Outdated
Comment thread docs/docs-developers/docs/foundational-topics/advanced/storage/note_discovery.md Outdated
Comment thread docs/docs-developers/docs/foundational-topics/pxe/execution_hooks.md Outdated
Comment thread yarn-project/pxe/src/hooks/resolve_tagging_secret_strategy.ts Outdated
Comment thread yarn-project/pxe/src/hooks/resolve_tagging_secret_strategy.ts
Comment thread yarn-project/txe/src/oracle/txe_oracle_registry.ts
Comment thread yarn-project/txe/src/txe_session.ts Outdated

@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.

Nice!

@vezenovm
vezenovm enabled auto-merge (squash) June 25, 2026 18:22
@vezenovm
vezenovm merged commit db906ef into merge-train/fairies-v5 Jun 25, 2026
12 checks passed
@vezenovm
vezenovm deleted the nchamo/f-699-pxewallet-get_delivery_privacy_preference-oracle branch June 25, 2026 18:25
@nchamo
nchamo requested a review from vezenovm June 25, 2026 18:26
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants