From e16e0f828ec31e83ed5700a7e9ead20288131cd3 Mon Sep 17 00:00:00 2001 From: AztecBot Date: Mon, 30 Mar 2026 21:50:35 +0000 Subject: [PATCH 1/2] fix: restore unrestricted capsule scope access in TXE PR #22136 replaced ALL_SCOPES with keyStore.getAccounts() in the TXE's CapsuleService construction. This broke capsule unit tests that use arbitrary scope addresses (e.g. 0xface) since no accounts are registered in those tests, resulting in an empty allowed scopes list. Add CapsuleService.unrestricted() factory method and use it in TXE to restore the pre-#22136 behavior where test environments allow all scopes. --- .../pxe/src/storage/capsule_store/capsule_service.ts | 12 ++++++++++-- .../txe/src/oracle/txe_oracle_top_level_context.ts | 4 ++-- yarn-project/txe/src/txe_session.ts | 6 +++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/yarn-project/pxe/src/storage/capsule_store/capsule_service.ts b/yarn-project/pxe/src/storage/capsule_store/capsule_service.ts index cdb61859cb13..e6ba262e92c2 100644 --- a/yarn-project/pxe/src/storage/capsule_store/capsule_service.ts +++ b/yarn-project/pxe/src/storage/capsule_store/capsule_service.ts @@ -11,9 +11,14 @@ import type { CapsuleStore } from './capsule_store.js'; export class CapsuleService { constructor( private readonly capsuleStore: CapsuleStore, - private readonly allowedScopes: AztecAddress[], + private readonly allowedScopes: AztecAddress[] | 'unrestricted', ) {} + /** Creates a CapsuleService that allows all scopes without restriction. Intended for test environments (TXE). */ + static unrestricted(capsuleStore: CapsuleStore): CapsuleService { + return new CapsuleService(capsuleStore, 'unrestricted'); + } + setCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[], jobId: string, scope: AztecAddress) { assertAllowedScope(scope, this.allowedScopes); this.capsuleStore.setCapsule(contractAddress, slot, capsule, jobId, scope); @@ -78,7 +83,10 @@ export class CapsuleService { } } -function assertAllowedScope(scope: AztecAddress, allowedScopes: AztecAddress[]) { +function assertAllowedScope(scope: AztecAddress, allowedScopes: AztecAddress[] | 'unrestricted') { + if (allowedScopes === 'unrestricted') { + return; + } if (scope.equals(AztecAddress.ZERO)) { return; } diff --git a/yarn-project/txe/src/oracle/txe_oracle_top_level_context.ts b/yarn-project/txe/src/oracle/txe_oracle_top_level_context.ts index d5b01754c8ec..1bc340ada37c 100644 --- a/yarn-project/txe/src/oracle/txe_oracle_top_level_context.ts +++ b/yarn-project/txe/src/oracle/txe_oracle_top_level_context.ts @@ -382,7 +382,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl senderTaggingStore: this.senderTaggingStore, recipientTaggingStore: this.recipientTaggingStore, senderAddressBookStore: this.senderAddressBookStore, - capsuleService: new CapsuleService(this.capsuleStore, effectiveScopes), + capsuleService: CapsuleService.unrestricted(this.capsuleStore), privateEventStore: this.privateEventStore, contractSyncService: this.stateMachine.contractSyncService, jobId, @@ -748,7 +748,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl aztecNode: this.stateMachine.node, recipientTaggingStore: this.recipientTaggingStore, senderAddressBookStore: this.senderAddressBookStore, - capsuleService: new CapsuleService(this.capsuleStore, scopes), + capsuleService: CapsuleService.unrestricted(this.capsuleStore), privateEventStore: this.privateEventStore, messageContextService: this.stateMachine.messageContextService, contractSyncService: this.contractSyncService, diff --git a/yarn-project/txe/src/txe_session.ts b/yarn-project/txe/src/txe_session.ts index ffb8574597a4..5863142bd622 100644 --- a/yarn-project/txe/src/txe_session.ts +++ b/yarn-project/txe/src/txe_session.ts @@ -372,7 +372,7 @@ export class TXESession implements TXESessionStateHandler { senderTaggingStore: this.senderTaggingStore, recipientTaggingStore: this.recipientTaggingStore, senderAddressBookStore: this.senderAddressBookStore, - capsuleService: new CapsuleService(this.capsuleStore, await this.keyStore.getAccounts()), + capsuleService: CapsuleService.unrestricted(this.capsuleStore), privateEventStore: this.privateEventStore, contractSyncService: this.stateMachine.contractSyncService, jobId: this.currentJobId, @@ -444,7 +444,7 @@ export class TXESession implements TXESessionStateHandler { aztecNode: this.stateMachine.node, recipientTaggingStore: this.recipientTaggingStore, senderAddressBookStore: this.senderAddressBookStore, - capsuleService: new CapsuleService(this.capsuleStore, await this.keyStore.getAccounts()), + capsuleService: CapsuleService.unrestricted(this.capsuleStore), privateEventStore: this.privateEventStore, messageContextService: this.stateMachine.messageContextService, contractSyncService: this.contractSyncService, @@ -537,7 +537,7 @@ export class TXESession implements TXESessionStateHandler { aztecNode: this.stateMachine.node, recipientTaggingStore: this.recipientTaggingStore, senderAddressBookStore: this.senderAddressBookStore, - capsuleService: new CapsuleService(this.capsuleStore, scopes), + capsuleService: CapsuleService.unrestricted(this.capsuleStore), privateEventStore: this.privateEventStore, messageContextService: this.stateMachine.messageContextService, contractSyncService: this.contractSyncService, From 4d635ecf6d6db1ee1ba7453e71e45969c3dc7075 Mon Sep 17 00:00:00 2001 From: AztecBot Date: Mon, 30 Mar 2026 21:50:48 +0000 Subject: [PATCH 2/2] fix: restore unrestricted capsule scope access in TXE --- yarn-project/yarn.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/yarn-project/yarn.lock b/yarn-project/yarn.lock index 379d06dde6c1..986a64d790cd 100644 --- a/yarn-project/yarn.lock +++ b/yarn-project/yarn.lock @@ -1638,6 +1638,7 @@ __metadata: "@aztec/noir-noirc_abi": "npm:1.0.0-beta.19" "@aztec/noir-types": "npm:1.0.0-beta.19" pako: "npm:^2.1.0" + checksum: 10/8e144df7c33c34852a2e26dfff1efeb6d28b7d55e121f4047f53beee09fc73d5b3ba610e1abd108eb55911e084f346e0d101beb8830d916a79883bc6a78d0b6e languageName: node linkType: hard