@aztec/pxe 0.0.1-commit.86469d5 → 0.0.1-commit.88c5703d4

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 (200) 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/block_synchronizer/block_synchronizer.d.ts +4 -2
  5. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  6. package/dest/block_synchronizer/block_synchronizer.js +7 -1
  7. package/dest/config/index.d.ts +2 -2
  8. package/dest/config/index.d.ts.map +1 -1
  9. package/dest/config/index.js +1 -1
  10. package/dest/config/package_info.js +1 -1
  11. package/dest/contract_function_simulator/contract_function_simulator.d.ts +61 -29
  12. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  13. package/dest/contract_function_simulator/contract_function_simulator.js +185 -72
  14. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +7 -7
  15. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  16. package/dest/contract_function_simulator/execution_tagging_index_cache.js +19 -11
  17. package/dest/contract_function_simulator/index.d.ts +2 -1
  18. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  19. package/dest/contract_function_simulator/index.js +1 -0
  20. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -3
  21. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  22. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -4
  23. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
  24. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  25. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -3
  26. package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts +16 -0
  27. package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts.map +1 -0
  28. package/dest/contract_function_simulator/noir-structs/message_tx_context.js +57 -0
  29. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -4
  30. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  31. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +3 -5
  32. package/dest/contract_function_simulator/oracle/interfaces.d.ts +49 -45
  33. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  34. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +9 -0
  35. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -0
  36. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +52 -0
  37. package/dest/contract_function_simulator/oracle/oracle.d.ts +44 -44
  38. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  39. package/dest/contract_function_simulator/oracle/oracle.js +161 -100
  40. package/dest/contract_function_simulator/oracle/private_execution.js +5 -3
  41. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +57 -78
  42. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  43. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +101 -86
  44. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +75 -45
  45. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  46. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +147 -75
  47. package/dest/contract_logging.d.ts +22 -0
  48. package/dest/contract_logging.d.ts.map +1 -0
  49. package/dest/contract_logging.js +23 -0
  50. package/dest/contract_sync/contract_sync_service.d.ts +43 -0
  51. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -0
  52. package/dest/contract_sync/contract_sync_service.js +97 -0
  53. package/dest/contract_sync/helpers.d.ts +29 -0
  54. package/dest/contract_sync/helpers.d.ts.map +1 -0
  55. package/dest/contract_sync/{index.js → helpers.js} +8 -14
  56. package/dest/debug/pxe_debug_utils.d.ts +14 -10
  57. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  58. package/dest/debug/pxe_debug_utils.js +16 -15
  59. package/dest/entrypoints/client/bundle/index.d.ts +4 -1
  60. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  61. package/dest/entrypoints/client/bundle/index.js +3 -0
  62. package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
  63. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  64. package/dest/entrypoints/client/bundle/utils.js +9 -1
  65. package/dest/entrypoints/client/lazy/index.d.ts +4 -1
  66. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  67. package/dest/entrypoints/client/lazy/index.js +3 -0
  68. package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
  69. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  70. package/dest/entrypoints/client/lazy/utils.js +9 -1
  71. package/dest/entrypoints/server/index.d.ts +4 -2
  72. package/dest/entrypoints/server/index.d.ts.map +1 -1
  73. package/dest/entrypoints/server/index.js +3 -1
  74. package/dest/entrypoints/server/utils.js +9 -1
  75. package/dest/logs/log_service.d.ts +3 -2
  76. package/dest/logs/log_service.d.ts.map +1 -1
  77. package/dest/logs/log_service.js +9 -14
  78. package/dest/messages/message_context_service.d.ts +17 -0
  79. package/dest/messages/message_context_service.d.ts.map +1 -0
  80. package/dest/messages/message_context_service.js +36 -0
  81. package/dest/notes/note_service.d.ts +4 -3
  82. package/dest/notes/note_service.d.ts.map +1 -1
  83. package/dest/notes/note_service.js +3 -2
  84. package/dest/notes_filter.d.ts +25 -0
  85. package/dest/notes_filter.d.ts.map +1 -0
  86. package/dest/notes_filter.js +4 -0
  87. package/dest/oracle_version.d.ts +2 -2
  88. package/dest/oracle_version.js +3 -3
  89. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
  90. package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
  91. package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
  92. package/dest/private_kernel/hints/index.d.ts +1 -1
  93. package/dest/private_kernel/hints/index.js +1 -1
  94. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
  95. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
  96. package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +129 -68
  97. package/dest/private_kernel/hints/test_utils.d.ts +122 -0
  98. package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
  99. package/dest/private_kernel/hints/test_utils.js +203 -0
  100. package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
  101. package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
  102. package/dest/private_kernel/private_kernel_execution_prover.js +19 -11
  103. package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
  104. package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
  105. package/dest/private_kernel/private_kernel_oracle.js +7 -3
  106. package/dest/pxe.d.ts +72 -24
  107. package/dest/pxe.d.ts.map +1 -1
  108. package/dest/pxe.js +118 -71
  109. package/dest/storage/contract_store/contract_store.d.ts +42 -15
  110. package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
  111. package/dest/storage/contract_store/contract_store.js +145 -69
  112. package/dest/storage/metadata.d.ts +1 -1
  113. package/dest/storage/metadata.js +1 -1
  114. package/dest/storage/note_store/note_store.d.ts +3 -3
  115. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  116. package/dest/storage/note_store/note_store.js +6 -4
  117. package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
  118. package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
  119. package/dest/storage/tagging_store/sender_tagging_store.d.ts +29 -28
  120. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  121. package/dest/storage/tagging_store/sender_tagging_store.js +141 -115
  122. package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
  123. package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
  124. package/dest/tagging/get_all_logs_by_tags.js +17 -3
  125. package/dest/tagging/index.d.ts +3 -3
  126. package/dest/tagging/index.d.ts.map +1 -1
  127. package/dest/tagging/index.js +1 -1
  128. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
  129. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
  130. package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
  131. package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
  132. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
  133. package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
  134. package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
  135. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
  136. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  137. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +13 -7
  138. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +4 -3
  139. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  140. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +20 -10
  141. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +5 -7
  142. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  143. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +36 -24
  144. package/package.json +25 -16
  145. package/src/access_scopes.ts +9 -0
  146. package/src/block_synchronizer/block_synchronizer.ts +6 -0
  147. package/src/config/index.ts +1 -1
  148. package/src/config/package_info.ts +1 -1
  149. package/src/contract_function_simulator/contract_function_simulator.ts +338 -133
  150. package/src/contract_function_simulator/execution_tagging_index_cache.ts +19 -14
  151. package/src/contract_function_simulator/index.ts +1 -0
  152. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +8 -5
  153. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -4
  154. package/src/contract_function_simulator/noir-structs/message_tx_context.ts +55 -0
  155. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +3 -6
  156. package/src/contract_function_simulator/oracle/interfaces.ts +53 -54
  157. package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +77 -0
  158. package/src/contract_function_simulator/oracle/oracle.ts +165 -140
  159. package/src/contract_function_simulator/oracle/private_execution.ts +4 -4
  160. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +128 -180
  161. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +222 -82
  162. package/src/contract_logging.ts +39 -0
  163. package/src/contract_sync/contract_sync_service.ts +152 -0
  164. package/src/contract_sync/{index.ts → helpers.ts} +13 -34
  165. package/src/debug/pxe_debug_utils.ts +48 -18
  166. package/src/entrypoints/client/bundle/index.ts +3 -0
  167. package/src/entrypoints/client/bundle/utils.ts +9 -1
  168. package/src/entrypoints/client/lazy/index.ts +3 -0
  169. package/src/entrypoints/client/lazy/utils.ts +9 -1
  170. package/src/entrypoints/server/index.ts +3 -1
  171. package/src/entrypoints/server/utils.ts +7 -7
  172. package/src/logs/log_service.ts +17 -24
  173. package/src/messages/message_context_service.ts +45 -0
  174. package/src/notes/note_service.ts +4 -3
  175. package/src/notes_filter.ts +26 -0
  176. package/src/oracle_version.ts +3 -3
  177. package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
  178. package/src/private_kernel/hints/index.ts +1 -1
  179. package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
  180. package/src/private_kernel/hints/test_utils.ts +325 -0
  181. package/src/private_kernel/private_kernel_execution_prover.ts +19 -12
  182. package/src/private_kernel/private_kernel_oracle.ts +7 -7
  183. package/src/pxe.ts +207 -124
  184. package/src/storage/contract_store/contract_store.ts +174 -75
  185. package/src/storage/metadata.ts +1 -1
  186. package/src/storage/note_store/note_store.ts +12 -5
  187. package/src/storage/tagging_store/recipient_tagging_store.ts +9 -5
  188. package/src/storage/tagging_store/sender_tagging_store.ts +185 -138
  189. package/src/tagging/get_all_logs_by_tags.ts +28 -4
  190. package/src/tagging/index.ts +2 -2
  191. package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +7 -10
  192. package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
  193. package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
  194. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +23 -10
  195. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +26 -11
  196. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +27 -26
  197. package/dest/contract_sync/index.d.ts +0 -24
  198. package/dest/contract_sync/index.d.ts.map +0 -1
  199. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
  200. package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
package/src/pxe.ts CHANGED
@@ -33,6 +33,7 @@ import type {
33
33
  PrivateKernelTailCircuitPublicInputs,
34
34
  } from '@aztec/stdlib/kernel';
35
35
  import {
36
+ BlockHeader,
36
37
  type ContractOverrides,
37
38
  type InTx,
38
39
  PrivateExecutionResult,
@@ -46,11 +47,12 @@ import {
46
47
  TxProfileResult,
47
48
  TxProvingResult,
48
49
  TxSimulationResult,
49
- UtilitySimulationResult,
50
+ UtilityExecutionResult,
50
51
  } from '@aztec/stdlib/tx';
51
52
 
52
53
  import { inspect } from 'util';
53
54
 
55
+ import type { AccessScopes } from './access_scopes.js';
54
56
  import { BlockSynchronizer } from './block_synchronizer/index.js';
55
57
  import type { PXEConfig } from './config/index.js';
56
58
  import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
@@ -59,11 +61,14 @@ import {
59
61
  generateSimulatedProvingResult,
60
62
  } from './contract_function_simulator/contract_function_simulator.js';
61
63
  import { ProxiedContractStoreFactory } from './contract_function_simulator/proxied_contract_data_source.js';
62
- import { ensureContractSynced, readCurrentClassId } from './contract_sync/index.js';
64
+ import { displayDebugLogs } from './contract_logging.js';
65
+ import { ContractSyncService } from './contract_sync/contract_sync_service.js';
66
+ import { readCurrentClassId } from './contract_sync/helpers.js';
63
67
  import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
64
68
  import { enrichPublicSimulationError, enrichSimulationError } from './error_enriching.js';
65
69
  import { PrivateEventFilterValidator } from './events/private_event_filter_validator.js';
66
70
  import { JobCoordinator } from './job_coordinator/job_coordinator.js';
71
+ import { MessageContextService } from './messages/message_context_service.js';
67
72
  import {
68
73
  PrivateKernelExecutionProver,
69
74
  type PrivateKernelExecutionProverConfig,
@@ -84,6 +89,56 @@ export type PackedPrivateEvent = InTx & {
84
89
  eventSelector: EventSelector;
85
90
  };
86
91
 
92
+ /** Options for PXE.profileTx. */
93
+ export type ProfileTxOpts = {
94
+ /** The profiling mode to use. */
95
+ profileMode: 'full' | 'execution-steps' | 'gates';
96
+ /** If true, proof generation is skipped during profiling. Defaults to true. */
97
+ skipProofGeneration?: boolean;
98
+ /** Addresses whose private state and keys are accessible during private execution. */
99
+ scopes: AccessScopes;
100
+ };
101
+
102
+ /** Options for PXE.simulateTx. */
103
+ export type SimulateTxOpts = {
104
+ /** Whether to simulate the public part of the transaction. */
105
+ simulatePublic: boolean;
106
+ /** If false, this function throws if the transaction is unable to be included in a block at the current state. */
107
+ skipTxValidation?: boolean;
108
+ /** If false, fees are enforced. */
109
+ skipFeeEnforcement?: boolean;
110
+ /** State overrides for the simulation, such as contract instances and artifacts. */
111
+ overrides?: SimulationOverrides;
112
+ /** Addresses whose private state and keys are accessible during private execution */
113
+ scopes: AccessScopes;
114
+ };
115
+
116
+ /** Options for PXE.executeUtility. */
117
+ export type ExecuteUtilityOpts = {
118
+ /** The authentication witnesses required for the function call. */
119
+ authwits?: AuthWitness[];
120
+ /** The accounts whose notes we can access in this call */
121
+ scopes: AccessScopes;
122
+ };
123
+
124
+ /** Args for PXE.create. */
125
+ export type PXECreateArgs = {
126
+ /** The Aztec node to connect to. */
127
+ node: AztecNode;
128
+ /** The key-value store for persisting PXE state. */
129
+ store: AztecAsyncKVStore;
130
+ /** The prover for generating private kernel proofs. */
131
+ proofCreator: PrivateKernelProver;
132
+ /** The circuit simulator for executing ACIR circuits. */
133
+ simulator: CircuitSimulator;
134
+ /** Provider for protocol contract artifacts and instances. */
135
+ protocolContractsProvider: ProtocolContractsProvider;
136
+ /** PXE configuration options. */
137
+ config: PXEConfig;
138
+ /** Optional logger instance or string suffix for the logger name. */
139
+ loggerOrSuffix?: string | Logger;
140
+ };
141
+
87
142
  /**
88
143
  * Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
89
144
  * manage private state of users.
@@ -91,6 +146,7 @@ export type PackedPrivateEvent = InTx & {
91
146
  export class PXE {
92
147
  private constructor(
93
148
  private node: AztecNode,
149
+ private db: AztecAsyncKVStore,
94
150
  private blockStateSynchronizer: BlockSynchronizer,
95
151
  private keyStore: KeyStore,
96
152
  private contractStore: ContractStore,
@@ -102,6 +158,8 @@ export class PXE {
102
158
  private recipientTaggingStore: RecipientTaggingStore,
103
159
  private addressStore: AddressStore,
104
160
  private privateEventStore: PrivateEventStore,
161
+ private contractSyncService: ContractSyncService,
162
+ private messageContextService: MessageContextService,
105
163
  private simulator: CircuitSimulator,
106
164
  private proverEnabled: boolean,
107
165
  private proofCreator: PrivateKernelProver,
@@ -119,15 +177,15 @@ export class PXE {
119
177
  *
120
178
  * @returns A promise that resolves PXE is ready to be used.
121
179
  */
122
- public static async create(
123
- node: AztecNode,
124
- store: AztecAsyncKVStore,
125
- proofCreator: PrivateKernelProver,
126
- simulator: CircuitSimulator,
127
- protocolContractsProvider: ProtocolContractsProvider,
128
- config: PXEConfig,
129
- loggerOrSuffix?: string | Logger,
130
- ) {
180
+ public static async create({
181
+ node,
182
+ store,
183
+ proofCreator,
184
+ simulator,
185
+ protocolContractsProvider,
186
+ config,
187
+ loggerOrSuffix,
188
+ }: PXECreateArgs) {
131
189
  // Extract bindings from the logger, or use empty bindings if a string suffix is provided.
132
190
  const bindings: LoggerBindings | undefined =
133
191
  loggerOrSuffix && typeof loggerOrSuffix !== 'string' ? loggerOrSuffix.getBindings() : undefined;
@@ -137,7 +195,9 @@ export class PXE {
137
195
  ? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`)
138
196
  : loggerOrSuffix;
139
197
 
140
- const proverEnabled = !!config.proverEnabled;
198
+ const info = await node.getNodeInfo();
199
+
200
+ const proverEnabled = config.proverEnabled !== undefined ? config.proverEnabled : info.realProofs;
141
201
  const addressStore = new AddressStore(store);
142
202
  const privateEventStore = new PrivateEventStore(store);
143
203
  const contractStore = new ContractStore(store);
@@ -149,6 +209,14 @@ export class PXE {
149
209
  const capsuleStore = new CapsuleStore(store);
150
210
  const keyStore = new KeyStore(store);
151
211
  const tipsStore = new L2TipsKVStore(store, 'pxe');
212
+ const contractSyncService = new ContractSyncService(
213
+ node,
214
+ contractStore,
215
+ noteStore,
216
+ createLogger('pxe:contract_sync', bindings),
217
+ );
218
+ const messageContextService = new MessageContextService(node);
219
+
152
220
  const synchronizer = new BlockSynchronizer(
153
221
  node,
154
222
  store,
@@ -156,6 +224,7 @@ export class PXE {
156
224
  noteStore,
157
225
  privateEventStore,
158
226
  tipsStore,
227
+ contractSyncService,
159
228
  config,
160
229
  bindings,
161
230
  );
@@ -167,14 +236,16 @@ export class PXE {
167
236
  recipientTaggingStore,
168
237
  privateEventStore,
169
238
  noteStore,
239
+ contractSyncService,
170
240
  ]);
171
241
 
172
- const debugUtils = new PXEDebugUtils(contractStore, noteStore, synchronizer, anchorBlockStore);
242
+ const debugUtils = new PXEDebugUtils(contractSyncService, noteStore, synchronizer, anchorBlockStore);
173
243
 
174
244
  const jobQueue = new SerialQueue();
175
245
 
176
246
  const pxe = new PXE(
177
247
  node,
248
+ store,
178
249
  synchronizer,
179
250
  keyStore,
180
251
  contractStore,
@@ -186,6 +257,8 @@ export class PXE {
186
257
  recipientTaggingStore,
187
258
  addressStore,
188
259
  privateEventStore,
260
+ contractSyncService,
261
+ messageContextService,
189
262
  simulator,
190
263
  proverEnabled,
191
264
  proofCreator,
@@ -196,12 +269,15 @@ export class PXE {
196
269
  debugUtils,
197
270
  );
198
271
 
199
- debugUtils.setPXE(pxe, pxe.#putInJobQueue.bind(pxe));
272
+ debugUtils.setPXEHelpers(
273
+ pxe.#putInJobQueue.bind(pxe),
274
+ pxe.#getSimulatorForTx.bind(pxe),
275
+ pxe.#executeUtility.bind(pxe),
276
+ );
200
277
 
201
278
  pxe.jobQueue.start();
202
279
 
203
280
  await pxe.#registerProtocolContracts();
204
- const info = await node.getNodeInfo();
205
281
  log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
206
282
  return pxe;
207
283
  }
@@ -211,19 +287,21 @@ export class PXE {
211
287
  #getSimulatorForTx(overrides?: { contracts?: ContractOverrides }) {
212
288
  const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
213
289
 
214
- return new ContractFunctionSimulator(
215
- proxyContractStore,
216
- this.noteStore,
217
- this.keyStore,
218
- this.addressStore,
219
- BenchmarkedNodeFactory.create(this.node),
220
- this.senderTaggingStore,
221
- this.recipientTaggingStore,
222
- this.senderAddressBookStore,
223
- this.capsuleStore,
224
- this.privateEventStore,
225
- this.simulator,
226
- );
290
+ return new ContractFunctionSimulator({
291
+ contractStore: proxyContractStore,
292
+ noteStore: this.noteStore,
293
+ keyStore: this.keyStore,
294
+ addressStore: this.addressStore,
295
+ aztecNode: BenchmarkedNodeFactory.create(this.node),
296
+ senderTaggingStore: this.senderTaggingStore,
297
+ recipientTaggingStore: this.recipientTaggingStore,
298
+ senderAddressBookStore: this.senderAddressBookStore,
299
+ capsuleStore: this.capsuleStore,
300
+ privateEventStore: this.privateEventStore,
301
+ simulator: this.simulator,
302
+ contractSyncService: this.contractSyncService,
303
+ messageContextService: this.messageContextService,
304
+ });
227
305
  }
228
306
 
229
307
  #contextualizeError(err: Error, ...context: string[]): Error {
@@ -275,9 +353,8 @@ export class PXE {
275
353
  async #registerProtocolContracts() {
276
354
  const registered: Record<string, string> = {};
277
355
  for (const name of protocolContractNames) {
278
- const { address, contractClass, instance, artifact } =
279
- await this.protocolContractsProvider.getProtocolContractArtifact(name);
280
- await this.contractStore.addContractArtifact(contractClass.id, artifact);
356
+ const { address, instance, artifact } = await this.protocolContractsProvider.getProtocolContractArtifact(name);
357
+ await this.contractStore.addContractArtifact(artifact);
281
358
  await this.contractStore.addContractInstance(instance);
282
359
  registered[name] = address.toString();
283
360
  }
@@ -289,7 +366,7 @@ export class PXE {
289
366
  async #executePrivate(
290
367
  contractFunctionSimulator: ContractFunctionSimulator,
291
368
  txRequest: TxExecutionRequest,
292
- scopes: AztecAddress[] | undefined,
369
+ scopes: AccessScopes,
293
370
  jobId: string,
294
371
  ): Promise<PrivateExecutionResult> {
295
372
  const { origin: contractAddress, functionSelector } = txRequest;
@@ -297,29 +374,23 @@ export class PXE {
297
374
  try {
298
375
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
299
376
 
300
- await ensureContractSynced(
377
+ await this.contractSyncService.ensureContractSynced(
301
378
  contractAddress,
302
379
  functionSelector,
303
- privateSyncCall => this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId),
304
- this.node,
305
- this.contractStore,
306
- this.noteStore,
380
+ (privateSyncCall, execScopes) =>
381
+ this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
307
382
  anchorBlockHeader,
308
383
  jobId,
384
+ scopes,
309
385
  );
310
386
 
311
- const result = await contractFunctionSimulator.run(
312
- txRequest,
387
+ const result = await contractFunctionSimulator.run(txRequest, {
313
388
  contractAddress,
314
- functionSelector,
315
- undefined,
389
+ selector: functionSelector,
316
390
  anchorBlockHeader,
317
- // The sender for tags is set by contracts, typically by an account
318
- // contract entrypoint
319
- undefined, // senderForTags
320
391
  scopes,
321
392
  jobId,
322
- );
393
+ });
323
394
  this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
324
395
  return result;
325
396
  } catch (err) {
@@ -331,25 +402,32 @@ export class PXE {
331
402
  }
332
403
 
333
404
  /**
334
- * Simulate a utility function call on the given contract.
405
+ * Execute a utility function call on the given contract.
335
406
  * @param contractFunctionSimulator - The simulator to use for the function call.
336
407
  * @param call - The function call to execute.
337
408
  * @param authWitnesses - Authentication witnesses required for the function call.
338
409
  * @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
339
410
  * accounts if not specified.
340
411
  * @param jobId - The job ID for staged writes.
341
- * @returns The simulation result containing the outputs of the utility function.
412
+ * @returns The execution result containing the outputs of the utility function.
342
413
  */
343
- async #simulateUtility(
414
+ async #executeUtility(
344
415
  contractFunctionSimulator: ContractFunctionSimulator,
345
416
  call: FunctionCall,
346
417
  authWitnesses: AuthWitness[] | undefined,
347
- scopes: AztecAddress[] | undefined,
418
+ scopes: AccessScopes,
348
419
  jobId: string,
349
420
  ) {
350
421
  try {
351
422
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
352
- return contractFunctionSimulator.runUtility(call, authWitnesses ?? [], anchorBlockHeader, scopes, jobId);
423
+ const { result, offchainEffects } = await contractFunctionSimulator.runUtility(
424
+ call,
425
+ authWitnesses ?? [],
426
+ anchorBlockHeader,
427
+ scopes,
428
+ jobId,
429
+ );
430
+ return { result, offchainEffects };
353
431
  } catch (err) {
354
432
  if (err instanceof SimulationError) {
355
433
  await enrichSimulationError(err, this.contractStore, this.log);
@@ -417,6 +495,19 @@ export class PXE {
417
495
 
418
496
  // Public API
419
497
 
498
+ /**
499
+ * Returns the block header up to which the PXE has synced.
500
+ * @returns The synced block header
501
+ */
502
+ public getSyncedBlockHeader(): Promise<BlockHeader> {
503
+ return this.anchorBlockStore.getBlockHeader();
504
+ }
505
+
506
+ /**
507
+ * Returns the contract instance for a given address, if it's registered in the PXE.
508
+ * @param address - The contract address.
509
+ * @returns The contract instance if found, undefined otherwise.
510
+ */
420
511
  public getContractInstance(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined> {
421
512
  return this.contractStore.getContractInstance(address);
422
513
  }
@@ -525,8 +616,7 @@ export class PXE {
525
616
  * @param artifact - The build artifact for the contract class.
526
617
  */
527
618
  public async registerContractClass(artifact: ContractArtifact): Promise<void> {
528
- const { id: contractClassId } = await getContractClassFromArtifact(artifact);
529
- await this.contractStore.addContractArtifact(contractClassId, artifact);
619
+ const contractClassId = await this.contractStore.addContractArtifact(artifact);
530
620
  this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
531
621
  }
532
622
 
@@ -545,17 +635,17 @@ export class PXE {
545
635
  if (artifact) {
546
636
  // If the user provides an artifact, validate it against the expected class id and register it
547
637
  const contractClass = await getContractClassFromArtifact(artifact);
548
- const contractClassId = contractClass.id;
549
- if (!contractClassId.equals(instance.currentContractClassId)) {
638
+ if (!contractClass.id.equals(instance.currentContractClassId)) {
550
639
  throw new Error(
551
- `Artifact does not match expected class id (computed ${contractClassId} but instance refers to ${instance.currentContractClassId})`,
640
+ `Artifact does not match expected class id (computed ${contractClass.id} but instance refers to ${instance.currentContractClassId})`,
552
641
  );
553
642
  }
554
643
  const computedAddress = await computeContractAddressFromInstance(instance);
555
644
  if (!computedAddress.equals(instance.address)) {
556
645
  throw new Error('Added a contract in which the address does not match the contract instance.');
557
646
  }
558
- await this.contractStore.addContractArtifact(contractClass.id, artifact);
647
+
648
+ await this.contractStore.addContractArtifact(artifact, contractClass);
559
649
 
560
650
  const publicFunctionSignatures = artifact.functions
561
651
  .filter(fn => fn.functionType === FunctionType.PUBLIC)
@@ -604,15 +694,16 @@ export class PXE {
604
694
  throw new Error('Could not update contract to a class different from the current one.');
605
695
  }
606
696
 
607
- await this.contractStore.addContractArtifact(contractClass.id, artifact);
608
-
609
697
  const publicFunctionSignatures = artifact.functions
610
698
  .filter(fn => fn.functionType === FunctionType.PUBLIC)
611
699
  .map(fn => decodeFunctionSignature(fn.name, fn.parameters));
612
700
  await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
613
701
 
614
702
  currentInstance.currentContractClassId = contractClass.id;
615
- await this.contractStore.addContractInstance(currentInstance);
703
+ await Promise.all([
704
+ this.contractStore.addContractArtifact(artifact, contractClass),
705
+ this.contractStore.addContractInstance(currentInstance),
706
+ ]);
616
707
  this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
617
708
  });
618
709
  }
@@ -630,11 +721,12 @@ export class PXE {
630
721
  * (where validators prove the public portion).
631
722
  *
632
723
  * @param txRequest - An authenticated tx request ready for proving
724
+ * @param scopes - Addresses whose private state and keys are accessible during private execution.
633
725
  * @returns A result containing the proof and public inputs of the tail circuit.
634
726
  * @throws If contract code not found, or public simulation reverts.
635
727
  * Also throws if simulatePublic is true and public simulation reverts.
636
728
  */
637
- public proveTx(txRequest: TxExecutionRequest): Promise<TxProvingResult> {
729
+ public proveTx(txRequest: TxExecutionRequest, scopes: AztecAddress[]): Promise<TxProvingResult> {
638
730
  let privateExecutionResult: PrivateExecutionResult;
639
731
  // We disable proving concurrently mostly out of caution, since it accesses some of our stores. Proving is so
640
732
  // computationally demanding that it'd be rare for someone to try to do it concurrently regardless.
@@ -645,7 +737,7 @@ export class PXE {
645
737
  await this.blockStateSynchronizer.sync();
646
738
  const syncTime = syncTimer.ms();
647
739
  const contractFunctionSimulator = this.#getSimulatorForTx();
648
- privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, undefined, jobId);
740
+ privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
649
741
 
650
742
  const {
651
743
  publicInputs,
@@ -687,17 +779,17 @@ export class PXE {
687
779
  // transaction before this one is included in a block from this PXE, and that transaction contains a log with
688
780
  // a tag derived from the same secret, we would reuse the tag and the transactions would be linked. Hence
689
781
  // storing the tags here prevents linkage of txs sent from the same PXE.
690
- const preTagsUsedInTheTx = privateExecutionResult.entrypoint.preTags;
691
- if (preTagsUsedInTheTx.length > 0) {
782
+ const taggingIndexRangesUsedInTheTx = privateExecutionResult.entrypoint.taggingIndexRanges;
783
+ if (taggingIndexRangesUsedInTheTx.length > 0) {
692
784
  // TODO(benesjan): The following is an expensive operation. Figure out a way to avoid it.
693
785
  const txHash = (await txProvingResult.toTx()).txHash;
694
786
 
695
- await this.senderTaggingStore.storePendingIndexes(preTagsUsedInTheTx, txHash, jobId);
696
- this.log.debug(`Stored used pre-tags as sender for the tx`, {
697
- preTagsUsedInTheTx,
787
+ await this.senderTaggingStore.storePendingIndexes(taggingIndexRangesUsedInTheTx, txHash, jobId);
788
+ this.log.debug(`Stored used tagging index ranges as sender for the tx`, {
789
+ taggingIndexRangesUsedInTheTx,
698
790
  });
699
791
  } else {
700
- this.log.debug(`No pre-tags used in the tx`);
792
+ this.log.debug(`No tagging index ranges used in the tx`);
701
793
  }
702
794
 
703
795
  return txProvingResult;
@@ -709,17 +801,13 @@ export class PXE {
709
801
 
710
802
  /**
711
803
  * Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
712
- *
713
- * @param txRequest - An authenticated tx request ready for simulation
714
- * @param msgSender - (Optional) The message sender to use for the simulation.
715
- * @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
804
+ * @param txRequest - An authenticated tx request ready for simulation.
716
805
  * @returns A trace of the program execution with gate counts.
717
806
  * @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
718
807
  */
719
808
  public profileTx(
720
809
  txRequest: TxExecutionRequest,
721
- profileMode: 'full' | 'execution-steps' | 'gates',
722
- skipProofGeneration: boolean = true,
810
+ { profileMode, skipProofGeneration = true, scopes }: ProfileTxOpts,
723
811
  ): Promise<TxProfileResult> {
724
812
  // We disable concurrent profiles for consistency with simulateTx.
725
813
  return this.#putInJobQueue(async jobId => {
@@ -742,12 +830,7 @@ export class PXE {
742
830
  const syncTime = syncTimer.ms();
743
831
 
744
832
  const contractFunctionSimulator = this.#getSimulatorForTx();
745
- const privateExecutionResult = await this.#executePrivate(
746
- contractFunctionSimulator,
747
- txRequest,
748
- undefined,
749
- jobId,
750
- );
833
+ const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
751
834
 
752
835
  const { executionSteps, timings: { proving } = {} } = await this.#prove(
753
836
  txRequest,
@@ -804,12 +887,7 @@ export class PXE {
804
887
  * In that case, the transaction returned is only potentially ready to be sent to the network for execution.
805
888
  *
806
889
  *
807
- * @param txRequest - An authenticated tx request ready for simulation
808
- * @param simulatePublic - Whether to simulate the public part of the transaction.
809
- * @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
810
- * @param skipFeeEnforcement - (Optional) If false, fees are enforced.
811
- * @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
812
- * @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
890
+ * @param txRequest - An authenticated tx request ready for simulation.
813
891
  * @returns A simulated transaction result object that includes public and private return values.
814
892
  * @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
815
893
  * Also throws if simulatePublic is true and public simulation reverts.
@@ -818,11 +896,7 @@ export class PXE {
818
896
  */
819
897
  public simulateTx(
820
898
  txRequest: TxExecutionRequest,
821
- simulatePublic: boolean,
822
- skipTxValidation: boolean = false,
823
- skipFeeEnforcement: boolean = false,
824
- overrides?: SimulationOverrides,
825
- scopes?: AztecAddress[],
899
+ { simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes }: SimulateTxOpts,
826
900
  ): Promise<TxSimulationResult> {
827
901
  // We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
828
902
  // to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
@@ -850,7 +924,14 @@ export class PXE {
850
924
  // Temporary: in case there are overrides, we have to skip the kernels or validations
851
925
  // will fail. Consider handing control to the user/wallet on whether they want to run them
852
926
  // or not.
853
- const skipKernels = overrides?.contracts !== undefined && Object.keys(overrides.contracts ?? {}).length > 0;
927
+ const overriddenContracts = overrides?.contracts ? new Set(Object.keys(overrides.contracts)) : undefined;
928
+ const hasOverriddenContracts = overriddenContracts !== undefined && overriddenContracts.size > 0;
929
+ const skipKernels = hasOverriddenContracts;
930
+
931
+ // Set overridden contracts on the sync service so it knows to skip syncing them
932
+ if (hasOverriddenContracts) {
933
+ this.contractSyncService.setOverriddenContracts(jobId, overriddenContracts);
934
+ }
854
935
 
855
936
  // Execution of private functions only; no proving, and no kernel logic.
856
937
  const privateExecutionResult = await this.#executePrivate(contractFunctionSimulator, txRequest, scopes, jobId);
@@ -861,7 +942,8 @@ export class PXE {
861
942
  if (skipKernels) {
862
943
  ({ publicInputs, executionSteps } = await generateSimulatedProvingResult(
863
944
  privateExecutionResult,
864
- this.contractStore,
945
+ (addr, sel) => this.contractStore.getDebugFunctionName(addr, sel),
946
+ this.node,
865
947
  ));
866
948
  } else {
867
949
  // Kernel logic, plus proving of all private functions and kernels.
@@ -880,6 +962,9 @@ export class PXE {
880
962
  const publicSimulationTimer = new Timer();
881
963
  publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement);
882
964
  publicSimulationTime = publicSimulationTimer.ms();
965
+ if (publicOutput?.debugLogs?.length) {
966
+ await displayDebugLogs(publicOutput.debugLogs, addr => this.contractStore.getDebugContractName(addr));
967
+ }
883
968
  }
884
969
 
885
970
  let validationTime: number | undefined;
@@ -888,7 +973,8 @@ export class PXE {
888
973
  const validationResult = await this.node.isValidTx(simulatedTx, { isSimulation: true, skipFeeEnforcement });
889
974
  validationTime = validationTimer.ms();
890
975
  if (validationResult.result === 'invalid') {
891
- throw new Error('The simulated transaction is unable to be added to state and is invalid.');
976
+ const reason = validationResult.reason.length > 0 ? ` Reason: ${validationResult.reason.join(', ')}` : '';
977
+ throw new Error(`The simulated transaction is unable to be added to state and is invalid.${reason}`);
892
978
  }
893
979
  }
894
980
 
@@ -939,29 +1025,23 @@ export class PXE {
939
1025
  inspect(txRequest),
940
1026
  `simulatePublic=${simulatePublic}`,
941
1027
  `skipTxValidation=${skipTxValidation}`,
942
- `scopes=${scopes?.map(s => s.toString()).join(', ') ?? 'undefined'}`,
1028
+ `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map(s => s.toString()).join(', ')}`,
943
1029
  );
944
1030
  }
945
1031
  });
946
1032
  }
947
1033
 
948
1034
  /**
949
- * Simulate the execution of a contract utility function.
950
- *
1035
+ * Executes a contract utility function.
951
1036
  * @param call - The function call containing the function details, arguments, and target contract address.
952
- * @param authwits - (Optional) The authentication witnesses required for the function call.
953
- * @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
954
- * default to all.
955
- * @returns The result of the utility function call, structured based on the function ABI.
956
1037
  */
957
- public simulateUtility(
1038
+ public executeUtility(
958
1039
  call: FunctionCall,
959
- authwits?: AuthWitness[],
960
- scopes?: AztecAddress[],
961
- ): Promise<UtilitySimulationResult> {
962
- // We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
1040
+ { authwits, scopes }: ExecuteUtilityOpts = { scopes: 'ALL_SCOPES' },
1041
+ ): Promise<UtilityExecutionResult> {
1042
+ // We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
963
1043
  // to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
964
- // delete the same read value, or reading values that another simulation is currently modifying).
1044
+ // delete the same read value, or reading values that another execution is currently modifying).
965
1045
  return this.#putInJobQueue(async jobId => {
966
1046
  try {
967
1047
  const totalTimer = new Timer();
@@ -972,18 +1052,17 @@ export class PXE {
972
1052
  const contractFunctionSimulator = this.#getSimulatorForTx();
973
1053
 
974
1054
  const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
975
- await ensureContractSynced(
1055
+ await this.contractSyncService.ensureContractSynced(
976
1056
  call.to,
977
1057
  call.selector,
978
- privateSyncCall => this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId),
979
- this.node,
980
- this.contractStore,
981
- this.noteStore,
1058
+ (privateSyncCall, execScopes) =>
1059
+ this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
982
1060
  anchorBlockHeader,
983
1061
  jobId,
1062
+ scopes,
984
1063
  );
985
1064
 
986
- const executionResult = await this.#simulateUtility(
1065
+ const { result: executionResult, offchainEffects } = await this.#executeUtility(
987
1066
  contractFunctionSimulator,
988
1067
  call,
989
1068
  authwits ?? [],
@@ -1004,14 +1083,19 @@ export class PXE {
1004
1083
  };
1005
1084
 
1006
1085
  const simulationStats = contractFunctionSimulator.getStats();
1007
- return { result: executionResult, stats: { timings, nodeRPCCalls: simulationStats.nodeRPCCalls } };
1086
+ return {
1087
+ result: executionResult,
1088
+ offchainEffects,
1089
+ anchorBlockTimestamp: anchorBlockHeader.globalVariables.timestamp,
1090
+ stats: { timings, nodeRPCCalls: simulationStats.nodeRPCCalls },
1091
+ };
1008
1092
  } catch (err: any) {
1009
1093
  const { to, name, args } = call;
1010
1094
  const stringifiedArgs = args.map(arg => arg.toString()).join(', ');
1011
1095
  throw this.#contextualizeError(
1012
1096
  err,
1013
- `simulateUtility ${to}:${name}(${stringifiedArgs})`,
1014
- `scopes=${scopes?.map(s => s.toString()).join(', ') ?? 'undefined'}`,
1097
+ `executeUtility ${to}:${name}(${stringifiedArgs})`,
1098
+ `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map(s => s.toString()).join(', ')}`,
1015
1099
  );
1016
1100
  }
1017
1101
  });
@@ -1044,16 +1128,14 @@ export class PXE {
1044
1128
 
1045
1129
  const contractFunctionSimulator = this.#getSimulatorForTx();
1046
1130
 
1047
- await ensureContractSynced(
1131
+ await this.contractSyncService.ensureContractSynced(
1048
1132
  filter.contractAddress,
1049
1133
  null,
1050
- async privateSyncCall =>
1051
- await this.#simulateUtility(contractFunctionSimulator, privateSyncCall, [], undefined, jobId),
1052
- this.node,
1053
- this.contractStore,
1054
- this.noteStore,
1134
+ async (privateSyncCall, execScopes) =>
1135
+ await this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
1055
1136
  anchorBlockHeader,
1056
1137
  jobId,
1138
+ filter.scopes,
1057
1139
  );
1058
1140
  });
1059
1141
 
@@ -1068,9 +1150,10 @@ export class PXE {
1068
1150
  }
1069
1151
 
1070
1152
  /**
1071
- * Stops the PXE's job queue.
1153
+ * Stops the PXE's job queue and closes the backing store.
1072
1154
  */
1073
- public stop(): Promise<void> {
1074
- return this.jobQueue.end();
1155
+ public async stop(): Promise<void> {
1156
+ await this.jobQueue.end();
1157
+ await this.db.close();
1075
1158
  }
1076
1159
  }