Skip to content

fix(pxe): return no shared secrets when scope keys are not held - #24487

Merged
nchamo merged 3 commits into
merge-train/fairies-v5from
nchamo/f-741-getsharedsecrets-throws-no-public-key-during-recipient
Jul 3, 2026
Merged

fix(pxe): return no shared secrets when scope keys are not held#24487
nchamo merged 3 commits into
merge-train/fairies-v5from
nchamo/f-741-getsharedsecrets-throws-no-public-key-during-recipient

Conversation

@nchamo

@nchamo nchamo commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Simulating a utility function for a scope the PXE does not control (e.g. balance_of_private(A) on a PXE that only knows A as a registered sender) fails with "No public key registered" at Token.sync_state. The e2e tests have always expected this to read 0, and they used to pass, but only because the failing path was unreachable: with no handshakes on chain, sync skipped secret derivation entirely. Once onchain delivery started establishing a non-interactive handshake for every recipient (including each account's own constructor note), handshake discovery began deriving secrets for foreign scopes and hit the throw. The affected tests were skipped under TODO(F-741) until we could tackle this. This PR makes the path handle the no-keys case and restores the tests.

Fix

  • getSharedSecrets returns an empty array instead of throwing when the scope's keys are not held. Controlled accounts always have their complete address registered, so an empty response uniquely means "no key access".
  • get_shared_secrets accepts the empty response, so handshake discovery yields no secrets for a foreign scope.
  • get_shared_secret returns Option<Field>, and message decryption treats none as undecryptable and skips the message. This path was also broken for foreign scopes, previously masked by the discovery throw.
  • The two skipped e2e tests are unskipped. Standard contracts are re-pinned since aztec-nr changed.

Fixes F-741

@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 3, 2026
@nchamo nchamo self-assigned this Jul 3, 2026
@nchamo
nchamo marked this pull request as ready for review July 3, 2026 00:09
@nchamo
nchamo requested a review from nventuro as a code owner July 3, 2026 00:09
@nchamo
nchamo requested a review from mverzilli July 3, 2026 00:38
Comment thread noir-projects/aztec-nr/aztec/src/messages/encryption/aes128.nr
Comment thread noir-projects/aztec-nr/aztec/src/messages/encryption/aes128.nr Outdated

@mverzilli mverzilli 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!

@nchamo
nchamo enabled auto-merge (squash) July 3, 2026 14:29
@nchamo
nchamo merged commit 6f5e8b9 into merge-train/fairies-v5 Jul 3, 2026
12 checks passed
@nchamo
nchamo deleted the nchamo/f-741-getsharedsecrets-throws-no-public-key-during-recipient branch July 3, 2026 14:54
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