Skip to content

fix(aztec-nr): use registered accounts as capsule test scopes#22171

Merged
benesjan merged 11 commits intomerge-train/fairiesfrom
be/fix-capsule-test-scopes
Mar 31, 2026
Merged

fix(aztec-nr): use registered accounts as capsule test scopes#22171
benesjan merged 11 commits intomerge-train/fairiesfrom
be/fix-capsule-test-scopes

Conversation

@benesjan
Copy link
Copy Markdown
Contributor

Summary

  • The removal of ALL_SCOPES (feat!: remove ALL_SCOPES #22136) broke CapsuleArray tests because they used hardcoded scope addresses (0xface, 0xaaa, 0xbbb) not registered in the keystore
  • Replaced with real accounts created via create_light_account(), which registers them as allowed scopes in CapsuleService

Test plan

  • All 12 capsules::test::* tests pass locally with TXE server

🤖 Generated with Claude Code

The removal of ALL_SCOPES (#22136) broke CapsuleArray tests because they
used hardcoded scope addresses (0xface, 0xaaa, 0xbbb) that were not
registered in the keystore. Replace them with real accounts created via
create_light_account(), which registers them as allowed scopes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@benesjan benesjan requested a review from nventuro as a code owner March 31, 2026 03:01
@benesjan
Copy link
Copy Markdown
Contributor Author

/claudebox remove the redundant import that makes CI fail

@AztecBot
Copy link
Copy Markdown
Collaborator

AztecBot commented Mar 31, 2026

Run #1 — Created fix PR #22172, writing gist (4m)
Live status

Removed the unused AztecAddress import left behind after replacing hardcoded addresses with create_light_account(). Details: https://gist.github.com/AztecBot/c843998dfc38eb69a052bc7574a80d9f

## Summary
- Removes the unused `AztecAddress` import in the capsule test module
that was left behind after #22171 replaced hardcoded addresses with
`env.create_light_account()`.
- This fixes the CI compilation failure caused by the redundant import.

ClaudeBox log: https://claudebox.work/s/1c6961aa70441540?run=1
@benesjan benesjan marked this pull request as draft March 31, 2026 03:50
benesjan and others added 3 commits March 31, 2026 03:52
Same issue as the capsule tests — the hardcoded NOTE_OWNER address
(0x32) was not registered in the keystore, causing scope validation
to fail after ALL_SCOPES removal.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace hardcoded scope/owner addresses (0xcafe, from_field(50)) with
real accounts from create_light_account() in:
- oracle/capsules tests
- messages/processing/offchain tests
- messages/discovery tests
- state_vars/private_set tests
- test environment note tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Thunkar Thunkar marked this pull request as ready for review March 31, 2026 04:02
@Thunkar Thunkar enabled auto-merge (squash) March 31, 2026 04:03
@Thunkar Thunkar added the claudebox Owned by claudebox. it can push to this PR. label Mar 31, 2026
@Thunkar Thunkar disabled auto-merge March 31, 2026 04:29
The contract sync step before private execution needs access to all
registered accounts' keys (for note nullifier computation during
discovery), not just the calling account. This fixes the
contract_accounts_accept_valid_private_authwits test which failed
because getKeyValidationRequest was denied during sync_state.
@Thunkar Thunkar added the ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure label Mar 31, 2026
AztecBot and others added 2 commits March 31, 2026 05:35
Constructors (from=zero) need key access for note log encryption, and
sync needs all accounts for nullifier computation. In TXE all accounts
are co-located in the same key store, so using all accounts as scopes
is safe and matches the utility execution path.
@benesjan benesjan self-assigned this Mar 31, 2026
@benesjan benesjan marked this pull request as draft March 31, 2026 06:31
…tructor

The constructor needs access to its own keys for
SinglePrivateImmutable.initialize(). Passing the account's address
instead of zero gives the correct minimal scope.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@benesjan benesjan marked this pull request as ready for review March 31, 2026 07:11
@benesjan benesjan removed ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR. labels Mar 31, 2026
@benesjan benesjan merged commit f4221b5 into merge-train/fairies Mar 31, 2026
5 of 7 checks passed
@benesjan benesjan deleted the be/fix-capsule-test-scopes branch March 31, 2026 07:40
@AztecBot
Copy link
Copy Markdown
Collaborator

✅ Successfully backported to backport-to-v4-next-staging #22174.

Comment on lines +330 to +333
// For the sync step, we use all registered accounts as scopes. Note discovery during sync needs
// broader key access (e.g. to compute nullifiers for notes belonging to any registered account),
// while the private execution itself remains restricted to `effectiveScopes`.
const syncScopes = from.isZero() ? [] : await this.keyStore.getAccounts();
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.

🤔 this is not how the real thing works, normally it should be enough to sync using the execution scopes... perhaps there's something in how we're wiring TXE that I'm not seeing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Shit, this is an accident.

Mistakenly thought I reverted this with 5ee5f55

Will send a fix of fix PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Revert PR here

AztecBot added a commit that referenced this pull request Mar 31, 2026
BEGIN_COMMIT_OVERRIDE
fix(aztec-nr): use registered accounts as capsule test scopes (#22171)
END_COMMIT_OVERRIDE
github-merge-queue Bot pushed a commit that referenced this pull request Apr 1, 2026
BEGIN_COMMIT_OVERRIDE
feat!: remove ALL_SCOPES (#22136)
chore: syncing oracle versions (#22131)
fix(aztec-nr): use registered accounts as capsule test scopes (#22171)
chore: reverting accidentally merged AI slop (#22175)
feat: move event size check from declaration to private emission
(#22168)
fix: prevent oracle failure on tag computation for invalid recipient
(#22163)
feat: disable noir test cache on merge-train/fairies (#22206)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants