@aztec/pxe 0.0.1-commit.f5d02921e → 0.0.1-commit.f650c0a5c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dest/bin/check_oracle_version.js +4 -4
  2. package/dest/contract_function_simulator/contract_function_simulator.d.ts +3 -4
  3. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  4. package/dest/contract_function_simulator/ephemeral_array_service.d.ts +28 -0
  5. package/dest/contract_function_simulator/ephemeral_array_service.d.ts.map +1 -0
  6. package/dest/contract_function_simulator/ephemeral_array_service.js +78 -0
  7. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +1 -1
  8. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  9. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +1 -1
  10. package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +1 -1
  11. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
  12. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
  13. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
  14. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  15. package/dest/contract_function_simulator/oracle/interfaces.d.ts +13 -2
  16. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +1 -1
  18. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -1
  19. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +10 -1
  20. package/dest/contract_function_simulator/oracle/oracle.d.ts +13 -2
  21. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/oracle/oracle.js +98 -3
  23. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +2 -3
  24. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +9 -0
  26. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +25 -12
  27. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  28. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +102 -34
  29. package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
  30. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/pick_notes.js +9 -2
  32. package/dest/contract_sync/contract_sync_service.d.ts +4 -6
  33. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
  34. package/dest/contract_sync/contract_sync_service.js +7 -27
  35. package/dest/contract_sync/helpers.d.ts +2 -3
  36. package/dest/contract_sync/helpers.d.ts.map +1 -1
  37. package/dest/debug/pxe_debug_utils.d.ts +3 -3
  38. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  39. package/dest/entrypoints/client/bundle/index.d.ts +1 -2
  40. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  41. package/dest/entrypoints/client/bundle/index.js +0 -1
  42. package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
  43. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  44. package/dest/entrypoints/client/bundle/utils.js +2 -2
  45. package/dest/entrypoints/client/lazy/index.d.ts +1 -2
  46. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  47. package/dest/entrypoints/client/lazy/index.js +0 -1
  48. package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
  49. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  50. package/dest/entrypoints/client/lazy/utils.js +2 -2
  51. package/dest/entrypoints/pxe_creation_options.d.ts +3 -1
  52. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  53. package/dest/entrypoints/pxe_creation_options.js +3 -1
  54. package/dest/entrypoints/server/index.d.ts +2 -3
  55. package/dest/entrypoints/server/index.d.ts.map +1 -1
  56. package/dest/entrypoints/server/index.js +1 -2
  57. package/dest/entrypoints/server/utils.d.ts +2 -2
  58. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  59. package/dest/entrypoints/server/utils.js +2 -2
  60. package/dest/logs/log_service.d.ts +4 -6
  61. package/dest/logs/log_service.d.ts.map +1 -1
  62. package/dest/logs/log_service.js +11 -20
  63. package/dest/notes/note_service.d.ts +3 -4
  64. package/dest/notes/note_service.d.ts.map +1 -1
  65. package/dest/notes_filter.d.ts +2 -3
  66. package/dest/notes_filter.d.ts.map +1 -1
  67. package/dest/oracle_version.d.ts +4 -3
  68. package/dest/oracle_version.d.ts.map +1 -1
  69. package/dest/oracle_version.js +20 -10
  70. package/dest/pxe.d.ts +4 -5
  71. package/dest/pxe.d.ts.map +1 -1
  72. package/dest/pxe.js +4 -4
  73. package/dest/storage/capsule_store/capsule_service.d.ts +2 -3
  74. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -1
  75. package/dest/storage/capsule_store/capsule_service.js +1 -1
  76. package/dest/storage/note_store/note_store.d.ts +1 -1
  77. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  78. package/dest/storage/note_store/note_store.js +2 -2
  79. package/package.json +16 -16
  80. package/src/bin/check_oracle_version.ts +4 -4
  81. package/src/contract_function_simulator/contract_function_simulator.ts +2 -3
  82. package/src/contract_function_simulator/ephemeral_array_service.ts +110 -0
  83. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  84. package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
  85. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
  86. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  87. package/src/contract_function_simulator/oracle/interfaces.ts +20 -1
  88. package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +7 -1
  89. package/src/contract_function_simulator/oracle/oracle.ts +143 -3
  90. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +12 -3
  91. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +164 -63
  92. package/src/contract_function_simulator/pick_notes.ts +9 -2
  93. package/src/contract_sync/contract_sync_service.ts +15 -37
  94. package/src/contract_sync/helpers.ts +2 -3
  95. package/src/debug/pxe_debug_utils.ts +3 -3
  96. package/src/entrypoints/client/bundle/index.ts +0 -1
  97. package/src/entrypoints/client/bundle/utils.ts +2 -3
  98. package/src/entrypoints/client/lazy/index.ts +0 -1
  99. package/src/entrypoints/client/lazy/utils.ts +2 -3
  100. package/src/entrypoints/pxe_creation_options.ts +7 -0
  101. package/src/entrypoints/server/index.ts +1 -2
  102. package/src/entrypoints/server/utils.ts +2 -3
  103. package/src/logs/log_service.ts +19 -50
  104. package/src/notes/note_service.ts +2 -3
  105. package/src/notes_filter.ts +1 -3
  106. package/src/oracle_version.ts +20 -10
  107. package/src/pxe.ts +8 -10
  108. package/src/storage/capsule_store/capsule_service.ts +5 -6
  109. package/src/storage/note_store/note_store.ts +2 -5
  110. package/dest/access_scopes.d.ts +0 -9
  111. package/dest/access_scopes.d.ts.map +0 -1
  112. package/dest/access_scopes.js +0 -6
  113. package/src/access_scopes.ts +0 -9
@@ -1,4 +1,3 @@
1
- import { BBPrivateKernelProver } from '@aztec/bb-prover/client';
2
1
  import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
3
2
  import { createLogger } from '@aztec/foundation/log';
4
3
  import { createStore } from '@aztec/kv-store/lmdb-v2';
@@ -10,7 +9,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
10
9
  import type { PXEConfig } from '../../config/index.js';
11
10
  import { PXE } from '../../pxe.js';
12
11
  import { PXE_DATA_SCHEMA_VERSION } from '../../storage/index.js';
13
- import type { PXECreationOptions } from '../pxe_creation_options.js';
12
+ import { type PXECreationOptions, isPrivateKernelProver } from '../pxe_creation_options.js';
14
13
 
15
14
  type PXEConfigWithoutDefaults = Omit<PXEConfig, 'l1Contracts' | 'l1ChainId' | 'l2BlockBatchSize' | 'rollupVersion'>;
16
15
 
@@ -49,7 +48,7 @@ export async function createPXE(
49
48
  const proverLogger = loggers.prover ?? createLogger('pxe:bb:native', { actor });
50
49
 
51
50
  let prover;
52
- if (options.proverOrOptions instanceof BBPrivateKernelProver) {
51
+ if (isPrivateKernelProver(options.proverOrOptions)) {
53
52
  prover = options.proverOrOptions;
54
53
  } else {
55
54
  prover = new BBBundlePrivateKernelProver(simulator, { ...options.proverOrOptions, logger: proverLogger });
@@ -1,21 +1,13 @@
1
- import type { Fr } from '@aztec/foundation/curves/bn254';
2
1
  import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
3
2
  import type { KeyStore } from '@aztec/key-store';
4
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
4
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
6
- import {
7
- ExtendedDirectionalAppTaggingSecret,
8
- PendingTaggedLog,
9
- SiloedTag,
10
- Tag,
11
- TxScopedL2Log,
12
- } from '@aztec/stdlib/logs';
5
+ import { ExtendedDirectionalAppTaggingSecret, PendingTaggedLog, SiloedTag, Tag } from '@aztec/stdlib/logs';
13
6
  import type { BlockHeader } from '@aztec/stdlib/tx';
14
7
 
15
8
  import type { LogRetrievalRequest } from '../contract_function_simulator/noir-structs/log_retrieval_request.js';
16
9
  import { LogRetrievalResponse } from '../contract_function_simulator/noir-structs/log_retrieval_response.js';
17
10
  import { AddressStore } from '../storage/address_store/address_store.js';
18
- import type { CapsuleService } from '../storage/capsule_store/capsule_service.js';
19
11
  import type { RecipientTaggingStore } from '../storage/tagging_store/recipient_tagging_store.js';
20
12
  import type { SenderAddressBookStore } from '../storage/tagging_store/sender_address_book_store.js';
21
13
  import {
@@ -31,7 +23,6 @@ export class LogService {
31
23
  private readonly aztecNode: AztecNode,
32
24
  private readonly anchorBlockHeader: BlockHeader,
33
25
  private readonly keyStore: KeyStore,
34
- private readonly capsuleService: CapsuleService,
35
26
  private readonly recipientTaggingStore: RecipientTaggingStore,
36
27
  private readonly senderAddressBookStore: SenderAddressBookStore,
37
28
  private readonly addressStore: AddressStore,
@@ -120,11 +111,7 @@ export class LogService {
120
111
  );
121
112
  }
122
113
 
123
- public async fetchTaggedLogs(
124
- contractAddress: AztecAddress,
125
- pendingTaggedLogArrayBaseSlot: Fr,
126
- recipient: AztecAddress,
127
- ) {
114
+ public async fetchTaggedLogs(contractAddress: AztecAddress, recipient: AztecAddress): Promise<PendingTaggedLog[]> {
128
115
  this.log.verbose(`Fetching tagged logs for ${contractAddress.toString()}`);
129
116
 
130
117
  // We only load logs from block up to and including the anchor block number
@@ -148,12 +135,12 @@ export class LogService {
148
135
  ),
149
136
  );
150
137
 
151
- // Flatten all logs from all secrets
152
- const allLogs = logArrays.flat();
153
-
154
- if (allLogs.length > 0) {
155
- await this.#storePendingTaggedLogs(contractAddress, pendingTaggedLogArrayBaseSlot, recipient, allLogs);
156
- }
138
+ return logArrays
139
+ .flat()
140
+ .map(
141
+ scopedLog =>
142
+ new PendingTaggedLog(scopedLog.logData, scopedLog.txHash, scopedLog.noteHashes, scopedLog.firstNullifier),
143
+ );
157
144
  }
158
145
 
159
146
  async #getSecretsForSenders(
@@ -176,43 +163,25 @@ export class LogService {
176
163
  );
177
164
 
178
165
  return Promise.all(
179
- deduplicatedSenders.map(sender => {
180
- return ExtendedDirectionalAppTaggingSecret.compute(
166
+ deduplicatedSenders.map(async sender => {
167
+ const secret = await ExtendedDirectionalAppTaggingSecret.compute(
181
168
  recipientCompleteAddress,
182
169
  recipientIvsk,
183
170
  sender,
184
171
  contractAddress,
185
172
  recipient,
186
173
  );
187
- }),
188
- );
189
- }
190
174
 
191
- #storePendingTaggedLogs(
192
- contractAddress: AztecAddress,
193
- capsuleArrayBaseSlot: Fr,
194
- recipient: AztecAddress,
195
- privateLogs: TxScopedL2Log[],
196
- ) {
197
- // Build all pending tagged logs from the scoped logs
198
- const pendingTaggedLogs = privateLogs.map(scopedLog => {
199
- const pendingTaggedLog = new PendingTaggedLog(
200
- scopedLog.logData,
201
- scopedLog.txHash,
202
- scopedLog.noteHashes,
203
- scopedLog.firstNullifier,
204
- );
205
-
206
- return pendingTaggedLog.toFields();
207
- });
175
+ if (!secret) {
176
+ // Note that all senders originate from either the SenderAddressBookStore or the KeyStore.
177
+ // TODO(F-512): make sure we actually prevent registering invalid senders.
178
+ throw new Error(
179
+ `Failed to compute a tagging secret for sender ${sender} - this implies this is an invalid address, which should not happen as they have been previously registered in PXE.`,
180
+ );
181
+ }
208
182
 
209
- // TODO: This looks like it could belong more at the oracle interface level
210
- return this.capsuleService.appendToCapsuleArray(
211
- contractAddress,
212
- capsuleArrayBaseSlot,
213
- pendingTaggedLogs,
214
- this.jobId,
215
- recipient,
183
+ return secret;
184
+ }),
216
185
  );
217
186
  }
218
187
  }
@@ -7,7 +7,6 @@ import { Note, NoteDao, NoteStatus } from '@aztec/stdlib/note';
7
7
  import { MerkleTreeId } from '@aztec/stdlib/trees';
8
8
  import type { BlockHeader, TxHash } from '@aztec/stdlib/tx';
9
9
 
10
- import type { AccessScopes } from '../access_scopes.js';
11
10
  import type { NoteStore } from '../storage/note_store/note_store.js';
12
11
 
13
12
  export class NoteService {
@@ -32,7 +31,7 @@ export class NoteService {
32
31
  owner: AztecAddress | undefined,
33
32
  storageSlot: Fr,
34
33
  status: NoteStatus,
35
- scopes: AccessScopes,
34
+ scopes: AztecAddress[],
36
35
  ) {
37
36
  const noteDaos = await this.noteStore.getNotes(
38
37
  {
@@ -71,7 +70,7 @@ export class NoteService {
71
70
  *
72
71
  * @param contractAddress - The contract whose notes should be checked and nullified.
73
72
  */
74
- public async syncNoteNullifiers(contractAddress: AztecAddress, scopes: AccessScopes): Promise<void> {
73
+ public async syncNoteNullifiers(contractAddress: AztecAddress, scopes: AztecAddress[]): Promise<void> {
75
74
  const anchorBlockHash = await this.anchorBlockHeader.hash();
76
75
 
77
76
  const contractNotes = await this.noteStore.getNotes({ contractAddress, scopes }, this.jobId);
@@ -2,8 +2,6 @@ import type { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
3
  import type { NoteStatus } from '@aztec/stdlib/note';
4
4
 
5
- import type { AccessScopes } from './access_scopes.js';
6
-
7
5
  /**
8
6
  * A filter used to fetch notes.
9
7
  * @remarks This filter is applied as an intersection of all its params.
@@ -22,5 +20,5 @@ export type NotesFilter = {
22
20
  status?: NoteStatus;
23
21
  /** The siloed nullifier for the note. */
24
22
  siloedNullifier?: Fr;
25
- scopes: AccessScopes;
23
+ scopes: AztecAddress[];
26
24
  };
@@ -1,12 +1,22 @@
1
- /// The ORACLE_VERSION constant is used to check that the oracle interface is in sync between PXE and Aztec.nr. We need
2
- /// to version the oracle interface to ensure that developers get a reasonable error message if they use incompatible
3
- /// versions of Aztec.nr and PXE. The Noir counterpart is in `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
1
+ /// The oracle version constants are used to check that the oracle interface is in sync between PXE and Aztec.nr.
2
+ /// We version the oracle interface as `major.minor` where:
3
+ /// - `major` = backward-breaking changes (must match exactly between PXE and Aztec.nr)
4
+ /// - `minor` = oracle additions (non-breaking; PXE minor >= contract minor)
4
5
  ///
5
- /// @dev Whenever a contract function or Noir test is run, the `aztec_utl_assertCompatibleOracleVersion` oracle is called
6
- /// and if the oracle version is incompatible an error is thrown.
7
- export const ORACLE_VERSION = 21;
6
+ /// The Noir counterparts are in `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
7
+ ///
8
+ /// @dev Whenever a contract function or Noir test is run, the `aztec_utl_assertCompatibleOracleVersion` oracle is called.
9
+ /// If the major version is incompatible, an error is thrown immediately. The minor version is recorded by the PXE and
10
+ /// used to provide helpful error messages if a contract calls an oracle that doesn't exist. We don't throw immediately
11
+ /// if AZTEC_NR_MINOR > PXE_MINOR because if a contract is updated to use a newer Aztec.nr dependency without actually
12
+ /// using any of the new oracles then there is no reason to throw.
13
+ export const ORACLE_VERSION_MAJOR = 22;
14
+ export const ORACLE_VERSION_MINOR = 1;
8
15
 
9
- /// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
10
- /// which in turn implies that you need to update the ORACLE_VERSION constant in this file and in
11
- /// `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
12
- export const ORACLE_INTERFACE_HASH = '83f1de1a9741a34916fd58cf12b857d0bac90f74bf00751b20304301a3f5c8eb';
16
+ /// This hash is computed from the Oracle interface and is used to detect when that interface changes. When it does,
17
+ /// you need to either:
18
+ /// - increment `ORACLE_VERSION_MAJOR` and reset `ORACLE_VERSION_MINOR` to zero if the change is breaking, or
19
+ /// - increment only `ORACLE_VERSION_MINOR` if the change is additive (a new oracle was added).
20
+ ///
21
+ /// These constants must be kept in sync between this file and `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
22
+ export const ORACLE_INTERFACE_HASH = 'efafa0db2cc1f94e26d794d0079c8f71115261df0c3d0fa8cb5b64f17a12db92';
package/src/pxe.ts CHANGED
@@ -52,7 +52,6 @@ import {
52
52
 
53
53
  import { inspect } from 'util';
54
54
 
55
- import type { AccessScopes } from './access_scopes.js';
56
55
  import { BlockSynchronizer } from './block_synchronizer/index.js';
57
56
  import type { PXEConfig } from './config/index.js';
58
57
  import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
@@ -96,7 +95,7 @@ export type ProfileTxOpts = {
96
95
  /** If true, proof generation is skipped during profiling. Defaults to true. */
97
96
  skipProofGeneration?: boolean;
98
97
  /** Addresses whose private state and keys are accessible during private execution. */
99
- scopes: AccessScopes;
98
+ scopes: AztecAddress[];
100
99
  };
101
100
 
102
101
  /** Options for PXE.simulateTx. */
@@ -112,7 +111,7 @@ export type SimulateTxOpts = {
112
111
  /** State overrides for the simulation, such as contract instances and artifacts. Requires skipKernels: true */
113
112
  overrides?: SimulationOverrides;
114
113
  /** Addresses whose private state and keys are accessible during private execution */
115
- scopes: AccessScopes;
114
+ scopes: AztecAddress[];
116
115
  };
117
116
 
118
117
  /** Options for PXE.executeUtility. */
@@ -120,7 +119,7 @@ export type ExecuteUtilityOpts = {
120
119
  /** The authentication witnesses required for the function call. */
121
120
  authwits?: AuthWitness[];
122
121
  /** The accounts whose notes we can access in this call */
123
- scopes: AccessScopes;
122
+ scopes: AztecAddress[];
124
123
  };
125
124
 
126
125
  /** Args for PXE.create. */
@@ -215,7 +214,6 @@ export class PXE {
215
214
  node,
216
215
  contractStore,
217
216
  noteStore,
218
- () => keyStore.getAccounts(),
219
217
  createLogger('pxe:contract_sync', bindings),
220
218
  );
221
219
  const messageContextService = new MessageContextService(node);
@@ -369,7 +367,7 @@ export class PXE {
369
367
  async #executePrivate(
370
368
  contractFunctionSimulator: ContractFunctionSimulator,
371
369
  txRequest: TxExecutionRequest,
372
- scopes: AccessScopes,
370
+ scopes: AztecAddress[],
373
371
  jobId: string,
374
372
  ): Promise<PrivateExecutionResult> {
375
373
  const { origin: contractAddress, functionSelector } = txRequest;
@@ -418,7 +416,7 @@ export class PXE {
418
416
  contractFunctionSimulator: ContractFunctionSimulator,
419
417
  call: FunctionCall,
420
418
  authWitnesses: AuthWitness[] | undefined,
421
- scopes: AccessScopes,
419
+ scopes: AztecAddress[],
422
420
  jobId: string,
423
421
  ) {
424
422
  try {
@@ -1043,7 +1041,7 @@ export class PXE {
1043
1041
  inspect(txRequest),
1044
1042
  `simulatePublic=${simulatePublic}`,
1045
1043
  `skipTxValidation=${skipTxValidation}`,
1046
- `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map(s => s.toString()).join(', ')}`,
1044
+ `scopes=${scopes.map(s => s.toString()).join(', ')}`,
1047
1045
  );
1048
1046
  }
1049
1047
  });
@@ -1055,7 +1053,7 @@ export class PXE {
1055
1053
  */
1056
1054
  public executeUtility(
1057
1055
  call: FunctionCall,
1058
- { authwits, scopes }: ExecuteUtilityOpts = { scopes: 'ALL_SCOPES' },
1056
+ { authwits, scopes }: ExecuteUtilityOpts = { scopes: [] },
1059
1057
  ): Promise<UtilityExecutionResult> {
1060
1058
  // We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
1061
1059
  // to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
@@ -1113,7 +1111,7 @@ export class PXE {
1113
1111
  throw this.#contextualizeError(
1114
1112
  err,
1115
1113
  `executeUtility ${to}:${name}(${stringifiedArgs})`,
1116
- `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map(s => s.toString()).join(', ')}`,
1114
+ `scopes=${scopes.map(s => s.toString()).join(', ')}`,
1117
1115
  );
1118
1116
  }
1119
1117
  });
@@ -2,7 +2,6 @@ import type { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
3
3
  import type { Capsule } from '@aztec/stdlib/tx';
4
4
 
5
- import type { AccessScopes } from '../../access_scopes.js';
6
5
  import type { CapsuleStore } from './capsule_store.js';
7
6
 
8
7
  /**
@@ -12,7 +11,7 @@ import type { CapsuleStore } from './capsule_store.js';
12
11
  export class CapsuleService {
13
12
  constructor(
14
13
  private readonly capsuleStore: CapsuleStore,
15
- private readonly allowedScopes: AccessScopes,
14
+ private readonly allowedScopes: AztecAddress[],
16
15
  ) {}
17
16
 
18
17
  setCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[], jobId: string, scope: AztecAddress) {
@@ -79,13 +78,13 @@ export class CapsuleService {
79
78
  }
80
79
  }
81
80
 
82
- function assertAllowedScope(scope: AztecAddress, allowedScopes: AccessScopes) {
83
- if (allowedScopes === 'ALL_SCOPES' || scope.equals(AztecAddress.ZERO)) {
81
+ function assertAllowedScope(scope: AztecAddress, allowedScopes: AztecAddress[]) {
82
+ if (scope.equals(AztecAddress.ZERO)) {
84
83
  return;
85
84
  }
86
- if (!allowedScopes.some(allowed => allowed.equals(scope))) {
85
+ if (!allowedScopes.some((allowed: AztecAddress) => allowed.equals(scope))) {
87
86
  throw new Error(
88
- `Scope ${scope.toString()} is not in the allowed scopes list: [${allowedScopes.map(s => s.toString()).join(', ')}]. See https://docs.aztec.network/errors/10`,
87
+ `Scope ${scope.toString()} is not in the allowed scopes list: [${allowedScopes.map((s: AztecAddress) => s.toString()).join(', ')}]. See https://docs.aztec.network/errors/10`,
89
88
  );
90
89
  }
91
90
  }
@@ -106,7 +106,7 @@ export class NoteStore implements StagedStore {
106
106
  * returned once if this is the case)
107
107
  */
108
108
  getNotes(filter: NotesFilter, jobId: string): Promise<NoteDao[]> {
109
- if (filter.scopes !== 'ALL_SCOPES' && filter.scopes.length === 0) {
109
+ if (filter.scopes.length === 0) {
110
110
  return Promise.resolve([]);
111
111
  }
112
112
 
@@ -180,10 +180,7 @@ export class NoteStore implements StagedStore {
180
180
  continue;
181
181
  }
182
182
 
183
- if (
184
- filter.scopes !== 'ALL_SCOPES' &&
185
- note.scopes.intersection(new Set(filter.scopes.map(s => s.toString()))).size === 0
186
- ) {
183
+ if (note.scopes.intersection(new Set(filter.scopes.map(s => s.toString()))).size === 0) {
187
184
  continue;
188
185
  }
189
186
 
@@ -1,9 +0,0 @@
1
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
- /**
3
- * Controls which accounts' private state and keys are accessible during execution.
4
- * - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
5
- * - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
6
- * - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
7
- */
8
- export type AccessScopes = 'ALL_SCOPES' | AztecAddress[];
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjZXNzX3Njb3Blcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2FjY2Vzc19zY29wZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFFaEU7Ozs7O0dBS0c7QUFDSCxNQUFNLE1BQU0sWUFBWSxHQUFHLFlBQVksR0FBRyxZQUFZLEVBQUUsQ0FBQyJ9
@@ -1 +0,0 @@
1
- {"version":3,"file":"access_scopes.d.ts","sourceRoot":"","sources":["../src/access_scopes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,YAAY,EAAE,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Controls which accounts' private state and keys are accessible during execution.
3
- * - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
4
- * - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
5
- * - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
6
- */ export { };
@@ -1,9 +0,0 @@
1
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
-
3
- /**
4
- * Controls which accounts' private state and keys are accessible during execution.
5
- * - `'ALL_SCOPES'`: All registered accounts' private state and keys are accessible.
6
- * - `AztecAddress[]` with entries: Only the specified accounts' private state and keys are accessible.
7
- * - `[]` (empty array): Deny-all. No private state is visible and no keys are accessible.
8
- */
9
- export type AccessScopes = 'ALL_SCOPES' | AztecAddress[];