@aztec/pxe 0.0.1-commit.7cf39cb55 → 0.0.1-commit.808bf7f90

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 (102) hide show
  1. package/dest/access_scopes.d.ts +9 -0
  2. package/dest/access_scopes.d.ts.map +1 -0
  3. package/dest/access_scopes.js +6 -0
  4. package/dest/config/package_info.js +1 -1
  5. package/dest/contract_function_simulator/contract_function_simulator.d.ts +5 -4
  6. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  7. package/dest/contract_function_simulator/contract_function_simulator.js +6 -6
  8. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
  9. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
  10. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  11. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
  12. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +3 -2
  13. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  14. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +2 -10
  15. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +4 -3
  16. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  17. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +5 -8
  18. package/dest/contract_logging.d.ts +22 -0
  19. package/dest/contract_logging.d.ts.map +1 -0
  20. package/dest/contract_logging.js +23 -0
  21. package/dest/contract_sync/contract_sync_service.d.ts +4 -3
  22. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
  23. package/dest/contract_sync/contract_sync_service.js +10 -10
  24. package/dest/contract_sync/helpers.d.ts +3 -2
  25. package/dest/contract_sync/helpers.d.ts.map +1 -1
  26. package/dest/contract_sync/helpers.js +3 -3
  27. package/dest/debug/pxe_debug_utils.d.ts +5 -4
  28. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  29. package/dest/debug/pxe_debug_utils.js +4 -4
  30. package/dest/entrypoints/client/bundle/index.d.ts +4 -1
  31. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  32. package/dest/entrypoints/client/bundle/index.js +3 -0
  33. package/dest/entrypoints/client/lazy/index.d.ts +4 -1
  34. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  35. package/dest/entrypoints/client/lazy/index.js +3 -0
  36. package/dest/entrypoints/server/index.d.ts +3 -1
  37. package/dest/entrypoints/server/index.d.ts.map +1 -1
  38. package/dest/entrypoints/server/index.js +2 -0
  39. package/dest/logs/log_service.d.ts +3 -2
  40. package/dest/logs/log_service.d.ts.map +1 -1
  41. package/dest/logs/log_service.js +1 -1
  42. package/dest/notes/note_service.d.ts +4 -3
  43. package/dest/notes/note_service.d.ts.map +1 -1
  44. package/dest/notes/note_service.js +3 -2
  45. package/dest/notes_filter.d.ts +25 -0
  46. package/dest/notes_filter.d.ts.map +1 -0
  47. package/dest/notes_filter.js +4 -0
  48. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  49. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  50. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  51. package/dest/private_kernel/hints/index.d.ts +1 -1
  52. package/dest/private_kernel/hints/index.js +1 -1
  53. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +4 -4
  54. package/dest/private_kernel/private_kernel_execution_prover.js +6 -6
  55. package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
  56. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  57. package/dest/private_kernel/private_kernel_oracle.js +7 -3
  58. package/dest/pxe.d.ts +12 -11
  59. package/dest/pxe.d.ts.map +1 -1
  60. package/dest/pxe.js +30 -24
  61. package/dest/storage/contract_store/contract_store.d.ts +42 -15
  62. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  63. package/dest/storage/contract_store/contract_store.js +140 -64
  64. package/dest/storage/note_store/note_store.d.ts +3 -2
  65. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  66. package/dest/storage/note_store/note_store.js +2 -2
  67. package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
  68. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  69. package/dest/tagging/get_all_logs_by_tags.js +17 -3
  70. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +4 -4
  71. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  72. package/package.json +16 -16
  73. package/src/access_scopes.ts +9 -0
  74. package/src/config/package_info.ts +1 -1
  75. package/src/contract_function_simulator/contract_function_simulator.ts +17 -11
  76. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
  77. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
  78. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +5 -13
  79. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +12 -10
  80. package/src/contract_logging.ts +39 -0
  81. package/src/contract_sync/contract_sync_service.ts +19 -12
  82. package/src/contract_sync/helpers.ts +7 -2
  83. package/src/debug/pxe_debug_utils.ts +9 -8
  84. package/src/entrypoints/client/bundle/index.ts +3 -0
  85. package/src/entrypoints/client/lazy/index.ts +3 -0
  86. package/src/entrypoints/server/index.ts +2 -0
  87. package/src/logs/log_service.ts +3 -6
  88. package/src/notes/note_service.ts +4 -3
  89. package/src/notes_filter.ts +26 -0
  90. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  91. package/src/private_kernel/hints/index.ts +1 -1
  92. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +7 -7
  93. package/src/private_kernel/private_kernel_execution_prover.ts +6 -6
  94. package/src/private_kernel/private_kernel_oracle.ts +7 -7
  95. package/src/pxe.ts +43 -39
  96. package/src/storage/contract_store/contract_store.ts +170 -71
  97. package/src/storage/note_store/note_store.ts +7 -3
  98. package/src/tagging/get_all_logs_by_tags.ts +28 -4
  99. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +4 -4
  100. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  101. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  102. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
@@ -26,7 +26,7 @@ import {
26
26
  type PrivateKernelSimulateOutput,
27
27
  ReadRequestActionEnum,
28
28
  ReadRequestResetActions,
29
- type ScopedKeyValidationRequestAndGenerator,
29
+ type ScopedKeyValidationRequestAndSeparator,
30
30
  ScopedNoteHash,
31
31
  ScopedNullifier,
32
32
  ScopedReadRequest,
@@ -68,9 +68,9 @@ function getNullifierMembershipWitnessResolver(oracle: PrivateKernelOracle) {
68
68
  };
69
69
  }
70
70
 
71
- async function getMasterSecretKeysAndAppKeyGenerators(
71
+ async function getMasterSecretKeysAndKeyTypeDomainSeparators(
72
72
  keyValidationRequests: ClaimedLengthArray<
73
- ScopedKeyValidationRequestAndGenerator,
73
+ ScopedKeyValidationRequestAndSeparator,
74
74
  typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX
75
75
  >,
76
76
  numRequestsToVerify: number,
@@ -189,8 +189,8 @@ export class PrivateKernelResetPrivateInputsBuilder {
189
189
  this.previousKernel.validationRequests.nullifierReadRequests,
190
190
  this.nullifierResetActions,
191
191
  ),
192
- getMasterSecretKeysAndAppKeyGenerators(
193
- this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators,
192
+ getMasterSecretKeysAndKeyTypeDomainSeparators(
193
+ this.previousKernel.validationRequests.scopedKeyValidationRequestsAndSeparators,
194
194
  dimensions.KEY_VALIDATION,
195
195
  oracle,
196
196
  ),
@@ -357,8 +357,8 @@ export class PrivateKernelResetPrivateInputsBuilder {
357
357
  }
358
358
 
359
359
  private needsResetNullifierKeys() {
360
- const numCurr = this.previousKernel.validationRequests.scopedKeyValidationRequestsAndGenerators.claimedLength;
361
- const numNext = this.nextIteration ? this.nextIteration.keyValidationRequestsAndGenerators.claimedLength : 0;
360
+ const numCurr = this.previousKernel.validationRequests.scopedKeyValidationRequestsAndSeparators.claimedLength;
361
+ const numNext = this.nextIteration ? this.nextIteration.keyValidationRequestsAndSeparators.claimedLength : 0;
362
362
  const maxAmountToKeep = !this.nextIteration ? 0 : MAX_KEY_VALIDATION_REQUESTS_PER_TX;
363
363
  if (numCurr + numNext <= maxAmountToKeep) {
364
364
  return false;
@@ -260,20 +260,20 @@ export class PrivateKernelExecutionProver {
260
260
  // TODO: Enable padding once we better understand the final amounts to pad to.
261
261
  const paddedSideEffectAmounts = PaddedSideEffectAmounts.empty();
262
262
 
263
- // Use the aggregated includeByTimestamp set throughout the tx execution.
264
- // TODO: Call `computeTxIncludeByTimestamp` to round the value down and reduce precision, improving privacy.
265
- const includeByTimestampUpperBound = previousKernelData.publicInputs.includeByTimestamp;
263
+ // Use the aggregated expirationTimestamp set throughout the tx execution.
264
+ // TODO: Call `computeTxExpirationTimestamp` to round the value down and reduce precision, improving privacy.
265
+ const expirationTimestampUpperBound = previousKernelData.publicInputs.expirationTimestamp;
266
266
  const anchorBlockTimestamp = previousKernelData.publicInputs.constants.anchorBlockHeader.globalVariables.timestamp;
267
- if (includeByTimestampUpperBound <= anchorBlockTimestamp) {
267
+ if (expirationTimestampUpperBound <= anchorBlockTimestamp) {
268
268
  throw new Error(
269
- `Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${includeByTimestampUpperBound}.`,
269
+ `Include-by timestamp must be greater than the anchor block timestamp. Anchor block timestamp: ${anchorBlockTimestamp}. Include-by timestamp: ${expirationTimestampUpperBound}.`,
270
270
  );
271
271
  }
272
272
 
273
273
  const privateInputs = new PrivateKernelTailCircuitPrivateInputs(
274
274
  previousKernelData,
275
275
  paddedSideEffectAmounts,
276
- includeByTimestampUpperBound,
276
+ expirationTimestampUpperBound,
277
277
  );
278
278
 
279
279
  const witgenTimer = new Timer();
@@ -8,11 +8,7 @@ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
8
8
  import type { FunctionSelector } from '@aztec/stdlib/abi';
9
9
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
10
10
  import { BlockHash } from '@aztec/stdlib/block';
11
- import {
12
- type ContractInstanceWithAddress,
13
- computeContractClassIdPreimage,
14
- computeSaltedInitializationHash,
15
- } from '@aztec/stdlib/contract';
11
+ import { type ContractInstanceWithAddress, computeSaltedInitializationHash } from '@aztec/stdlib/contract';
16
12
  import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
17
13
  import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
18
14
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
@@ -49,11 +45,15 @@ export class PrivateKernelOracle {
49
45
 
50
46
  /** Retrieves the preimage of a contract class id from the contract classes db. */
51
47
  public async getContractClassIdPreimage(contractClassId: Fr) {
52
- const contractClass = await this.contractStore.getContractClass(contractClassId);
48
+ const contractClass = await this.contractStore.getContractClassWithPreimage(contractClassId);
53
49
  if (!contractClass) {
54
50
  throw new Error(`Contract class not found when getting class id preimage. Class id: ${contractClassId}.`);
55
51
  }
56
- return computeContractClassIdPreimage(contractClass);
52
+ return {
53
+ artifactHash: contractClass.artifactHash,
54
+ privateFunctionsRoot: contractClass.privateFunctionsRoot,
55
+ publicBytecodeCommitment: contractClass.publicBytecodeCommitment,
56
+ };
57
57
  }
58
58
 
59
59
  /** Returns a membership witness with the sibling path and leaf index in our private functions tree. */
package/src/pxe.ts CHANGED
@@ -47,11 +47,12 @@ import {
47
47
  TxProfileResult,
48
48
  TxProvingResult,
49
49
  TxSimulationResult,
50
- UtilitySimulationResult,
50
+ UtilityExecutionResult,
51
51
  } from '@aztec/stdlib/tx';
52
52
 
53
53
  import { inspect } from 'util';
54
54
 
55
+ import type { AccessScopes } from './access_scopes.js';
55
56
  import { BlockSynchronizer } from './block_synchronizer/index.js';
56
57
  import type { PXEConfig } from './config/index.js';
57
58
  import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
@@ -60,6 +61,7 @@ import {
60
61
  generateSimulatedProvingResult,
61
62
  } from './contract_function_simulator/contract_function_simulator.js';
62
63
  import { ProxiedContractStoreFactory } from './contract_function_simulator/proxied_contract_data_source.js';
64
+ import { displayDebugLogs } from './contract_logging.js';
63
65
  import { ContractSyncService } from './contract_sync/contract_sync_service.js';
64
66
  import { readCurrentClassId } from './contract_sync/helpers.js';
65
67
  import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
@@ -93,7 +95,7 @@ export type ProfileTxOpts = {
93
95
  /** If true, proof generation is skipped during profiling. Defaults to true. */
94
96
  skipProofGeneration?: boolean;
95
97
  /** Addresses whose private state and keys are accessible during private execution. */
96
- scopes?: AztecAddress[];
98
+ scopes: AccessScopes;
97
99
  };
98
100
 
99
101
  /** Options for PXE.simulateTx. */
@@ -106,16 +108,16 @@ export type SimulateTxOpts = {
106
108
  skipFeeEnforcement?: boolean;
107
109
  /** State overrides for the simulation, such as contract instances and artifacts. */
108
110
  overrides?: SimulationOverrides;
109
- /** Addresses whose private state and keys are accessible during private execution. Defaults to all. */
110
- scopes?: AztecAddress[];
111
+ /** Addresses whose private state and keys are accessible during private execution */
112
+ scopes: AccessScopes;
111
113
  };
112
114
 
113
- /** Options for PXE.simulateUtility. */
114
- export type SimulateUtilityOpts = {
115
+ /** Options for PXE.executeUtility. */
116
+ export type ExecuteUtilityOpts = {
115
117
  /** The authentication witnesses required for the function call. */
116
118
  authwits?: AuthWitness[];
117
- /** The accounts whose notes we can access in this call. Defaults to all. */
118
- scopes?: AztecAddress[];
119
+ /** The accounts whose notes we can access in this call */
120
+ scopes: AccessScopes;
119
121
  };
120
122
 
121
123
  /** Args for PXE.create. */
@@ -263,7 +265,7 @@ export class PXE {
263
265
  debugUtils.setPXEHelpers(
264
266
  pxe.#putInJobQueue.bind(pxe),
265
267
  pxe.#getSimulatorForTx.bind(pxe),
266
- pxe.#simulateUtility.bind(pxe),
268
+ pxe.#executeUtility.bind(pxe),
267
269
  );
268
270
 
269
271
  pxe.jobQueue.start();
@@ -343,9 +345,8 @@ export class PXE {
343
345
  async #registerProtocolContracts() {
344
346
  const registered: Record<string, string> = {};
345
347
  for (const name of protocolContractNames) {
346
- const { address, contractClass, instance, artifact } =
347
- await this.protocolContractsProvider.getProtocolContractArtifact(name);
348
- await this.contractStore.addContractArtifact(contractClass.id, artifact);
348
+ const { address, instance, artifact } = await this.protocolContractsProvider.getProtocolContractArtifact(name);
349
+ await this.contractStore.addContractArtifact(artifact);
349
350
  await this.contractStore.addContractInstance(instance);
350
351
  registered[name] = address.toString();
351
352
  }
@@ -357,7 +358,7 @@ export class PXE {
357
358
  async #executePrivate(
358
359
  contractFunctionSimulator: ContractFunctionSimulator,
359
360
  txRequest: TxExecutionRequest,
360
- scopes: AztecAddress[] | undefined,
361
+ scopes: AccessScopes,
361
362
  jobId: string,
362
363
  ): Promise<PrivateExecutionResult> {
363
364
  const { origin: contractAddress, functionSelector } = txRequest;
@@ -369,7 +370,7 @@ export class PXE {
369
370
  contractAddress,
370
371
  functionSelector,
371
372
  (privateSyncCall, execScopes) =>
372
- this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
373
+ this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
373
374
  anchorBlockHeader,
374
375
  jobId,
375
376
  scopes,
@@ -393,20 +394,20 @@ export class PXE {
393
394
  }
394
395
 
395
396
  /**
396
- * Simulate a utility function call on the given contract.
397
+ * Execute a utility function call on the given contract.
397
398
  * @param contractFunctionSimulator - The simulator to use for the function call.
398
399
  * @param call - The function call to execute.
399
400
  * @param authWitnesses - Authentication witnesses required for the function call.
400
401
  * @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
401
402
  * accounts if not specified.
402
403
  * @param jobId - The job ID for staged writes.
403
- * @returns The simulation result containing the outputs of the utility function.
404
+ * @returns The execution result containing the outputs of the utility function.
404
405
  */
405
- async #simulateUtility(
406
+ async #executeUtility(
406
407
  contractFunctionSimulator: ContractFunctionSimulator,
407
408
  call: FunctionCall,
408
409
  authWitnesses: AuthWitness[] | undefined,
409
- scopes: AztecAddress[] | undefined,
410
+ scopes: AccessScopes,
410
411
  jobId: string,
411
412
  ) {
412
413
  try {
@@ -600,8 +601,7 @@ export class PXE {
600
601
  * @param artifact - The build artifact for the contract class.
601
602
  */
602
603
  public async registerContractClass(artifact: ContractArtifact): Promise<void> {
603
- const { id: contractClassId } = await getContractClassFromArtifact(artifact);
604
- await this.contractStore.addContractArtifact(contractClassId, artifact);
604
+ const contractClassId = await this.contractStore.addContractArtifact(artifact);
605
605
  this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
606
606
  }
607
607
 
@@ -620,17 +620,17 @@ export class PXE {
620
620
  if (artifact) {
621
621
  // If the user provides an artifact, validate it against the expected class id and register it
622
622
  const contractClass = await getContractClassFromArtifact(artifact);
623
- const contractClassId = contractClass.id;
624
- if (!contractClassId.equals(instance.currentContractClassId)) {
623
+ if (!contractClass.id.equals(instance.currentContractClassId)) {
625
624
  throw new Error(
626
- `Artifact does not match expected class id (computed ${contractClassId} but instance refers to ${instance.currentContractClassId})`,
625
+ `Artifact does not match expected class id (computed ${contractClass.id} but instance refers to ${instance.currentContractClassId})`,
627
626
  );
628
627
  }
629
628
  const computedAddress = await computeContractAddressFromInstance(instance);
630
629
  if (!computedAddress.equals(instance.address)) {
631
630
  throw new Error('Added a contract in which the address does not match the contract instance.');
632
631
  }
633
- await this.contractStore.addContractArtifact(contractClass.id, artifact);
632
+
633
+ await this.contractStore.addContractArtifact(artifact, contractClass);
634
634
 
635
635
  const publicFunctionSignatures = artifact.functions
636
636
  .filter(fn => fn.functionType === FunctionType.PUBLIC)
@@ -679,15 +679,16 @@ export class PXE {
679
679
  throw new Error('Could not update contract to a class different from the current one.');
680
680
  }
681
681
 
682
- await this.contractStore.addContractArtifact(contractClass.id, artifact);
683
-
684
682
  const publicFunctionSignatures = artifact.functions
685
683
  .filter(fn => fn.functionType === FunctionType.PUBLIC)
686
684
  .map(fn => decodeFunctionSignature(fn.name, fn.parameters));
687
685
  await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
688
686
 
689
687
  currentInstance.currentContractClassId = contractClass.id;
690
- await this.contractStore.addContractInstance(currentInstance);
688
+ await Promise.all([
689
+ this.contractStore.addContractArtifact(artifact, contractClass),
690
+ this.contractStore.addContractInstance(currentInstance),
691
+ ]);
691
692
  this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
692
693
  });
693
694
  }
@@ -946,6 +947,9 @@ export class PXE {
946
947
  const publicSimulationTimer = new Timer();
947
948
  publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement);
948
949
  publicSimulationTime = publicSimulationTimer.ms();
950
+ if (publicOutput?.debugLogs?.length) {
951
+ await displayDebugLogs(publicOutput.debugLogs, addr => this.contractStore.getDebugContractName(addr));
952
+ }
949
953
  }
950
954
 
951
955
  let validationTime: number | undefined;
@@ -1005,23 +1009,23 @@ export class PXE {
1005
1009
  inspect(txRequest),
1006
1010
  `simulatePublic=${simulatePublic}`,
1007
1011
  `skipTxValidation=${skipTxValidation}`,
1008
- `scopes=${scopes?.map(s => s.toString()).join(', ') ?? 'undefined'}`,
1012
+ `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map(s => s.toString()).join(', ')}`,
1009
1013
  );
1010
1014
  }
1011
1015
  });
1012
1016
  }
1013
1017
 
1014
1018
  /**
1015
- * Simulates the execution of a contract utility function.
1019
+ * Executes a contract utility function.
1016
1020
  * @param call - The function call containing the function details, arguments, and target contract address.
1017
1021
  */
1018
- public simulateUtility(
1022
+ public executeUtility(
1019
1023
  call: FunctionCall,
1020
- { authwits, scopes }: SimulateUtilityOpts = {},
1021
- ): Promise<UtilitySimulationResult> {
1022
- // We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
1024
+ { authwits, scopes }: ExecuteUtilityOpts = { scopes: 'ALL_SCOPES' },
1025
+ ): Promise<UtilityExecutionResult> {
1026
+ // We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
1023
1027
  // to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
1024
- // delete the same read value, or reading values that another simulation is currently modifying).
1028
+ // delete the same read value, or reading values that another execution is currently modifying).
1025
1029
  return this.#putInJobQueue(async jobId => {
1026
1030
  try {
1027
1031
  const totalTimer = new Timer();
@@ -1036,13 +1040,13 @@ export class PXE {
1036
1040
  call.to,
1037
1041
  call.selector,
1038
1042
  (privateSyncCall, execScopes) =>
1039
- this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
1043
+ this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
1040
1044
  anchorBlockHeader,
1041
1045
  jobId,
1042
1046
  scopes,
1043
1047
  );
1044
1048
 
1045
- const executionResult = await this.#simulateUtility(
1049
+ const executionResult = await this.#executeUtility(
1046
1050
  contractFunctionSimulator,
1047
1051
  call,
1048
1052
  authwits ?? [],
@@ -1069,8 +1073,8 @@ export class PXE {
1069
1073
  const stringifiedArgs = args.map(arg => arg.toString()).join(', ');
1070
1074
  throw this.#contextualizeError(
1071
1075
  err,
1072
- `simulateUtility ${to}:${name}(${stringifiedArgs})`,
1073
- `scopes=${scopes?.map(s => s.toString()).join(', ') ?? 'undefined'}`,
1076
+ `executeUtility ${to}:${name}(${stringifiedArgs})`,
1077
+ `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map(s => s.toString()).join(', ')}`,
1074
1078
  );
1075
1079
  }
1076
1080
  });
@@ -1107,7 +1111,7 @@ export class PXE {
1107
1111
  filter.contractAddress,
1108
1112
  null,
1109
1113
  async (privateSyncCall, execScopes) =>
1110
- await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
1114
+ await this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
1111
1115
  anchorBlockHeader,
1112
1116
  jobId,
1113
1117
  filter.scopes,