@aztec/pxe 0.0.1-commit.4d79d1f2d → 0.0.1-commit.5358163d3
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.
- package/dest/access_scopes.d.ts +9 -0
- package/dest/access_scopes.d.ts.map +1 -0
- package/dest/access_scopes.js +6 -0
- package/dest/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +8 -6
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +109 -39
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
- package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_tagging_index_cache.js +3 -3
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +3 -2
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +10 -18
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +4 -3
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +5 -8
- package/dest/contract_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/contract_sync/contract_sync_service.d.ts +4 -3
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +10 -10
- package/dest/contract_sync/helpers.d.ts +3 -2
- package/dest/contract_sync/helpers.d.ts.map +1 -1
- package/dest/contract_sync/helpers.js +3 -3
- package/dest/debug/pxe_debug_utils.d.ts +5 -4
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +4 -4
- package/dest/entrypoints/client/bundle/index.d.ts +4 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +3 -0
- package/dest/entrypoints/client/lazy/index.d.ts +4 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +3 -0
- package/dest/entrypoints/server/index.d.ts +3 -1
- package/dest/entrypoints/server/index.d.ts.map +1 -1
- package/dest/entrypoints/server/index.js +2 -0
- package/dest/logs/log_service.d.ts +3 -2
- package/dest/logs/log_service.d.ts.map +1 -1
- package/dest/logs/log_service.js +5 -5
- package/dest/notes/note_service.d.ts +4 -3
- package/dest/notes/note_service.d.ts.map +1 -1
- package/dest/notes/note_service.js +3 -2
- package/dest/notes_filter.d.ts +25 -0
- package/dest/notes_filter.d.ts.map +1 -0
- package/dest/notes_filter.js +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_expiration_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/{compute_tx_include_by_timestamp.js → compute_tx_expiration_timestamp.js} +12 -12
- package/dest/private_kernel/hints/index.d.ts +1 -1
- package/dest/private_kernel/hints/index.js +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +129 -68
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +19 -11
- package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +7 -3
- package/dest/pxe.d.ts +14 -12
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +41 -31
- package/dest/storage/contract_store/contract_store.d.ts +42 -15
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +140 -64
- package/dest/storage/note_store/note_store.d.ts +3 -2
- package/dest/storage/note_store/note_store.d.ts.map +1 -1
- package/dest/storage/note_store/note_store.js +2 -2
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts +6 -6
- package/dest/storage/tagging_store/recipient_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +5 -5
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +4 -4
- package/dest/tagging/get_all_logs_by_tags.d.ts +1 -1
- package/dest/tagging/get_all_logs_by_tags.d.ts.map +1 -1
- package/dest/tagging/get_all_logs_by_tags.js +17 -3
- package/dest/tagging/index.d.ts +2 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/index.js +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts +4 -5
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.js +7 -7
- package/dest/tagging/recipient_sync/utils/find_highest_indexes.js +2 -2
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts +6 -7
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.d.ts.map +1 -1
- package/dest/tagging/recipient_sync/utils/load_logs_for_range.js +12 -11
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +4 -8
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +3 -6
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +4 -7
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +14 -15
- package/package.json +16 -16
- package/src/access_scopes.ts +9 -0
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +215 -58
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +5 -5
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +17 -22
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +12 -10
- package/src/contract_logging.ts +39 -0
- package/src/contract_sync/contract_sync_service.ts +19 -12
- package/src/contract_sync/helpers.ts +7 -2
- package/src/debug/pxe_debug_utils.ts +9 -8
- package/src/entrypoints/client/bundle/index.ts +3 -0
- package/src/entrypoints/client/lazy/index.ts +3 -0
- package/src/entrypoints/server/index.ts +2 -0
- package/src/logs/log_service.ts +13 -11
- package/src/notes/note_service.ts +4 -3
- package/src/notes_filter.ts +26 -0
- package/src/private_kernel/hints/{compute_tx_include_by_timestamp.ts → compute_tx_expiration_timestamp.ts} +13 -13
- package/src/private_kernel/hints/index.ts +1 -1
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +19 -12
- package/src/private_kernel/private_kernel_oracle.ts +7 -7
- package/src/pxe.ts +52 -43
- package/src/storage/contract_store/contract_store.ts +170 -71
- package/src/storage/note_store/note_store.ts +7 -3
- package/src/storage/tagging_store/recipient_tagging_store.ts +9 -5
- package/src/storage/tagging_store/sender_tagging_store.ts +8 -8
- package/src/tagging/get_all_logs_by_tags.ts +28 -4
- package/src/tagging/index.ts +1 -1
- package/src/tagging/recipient_sync/load_private_logs_for_sender_recipient_pair.ts +7 -10
- package/src/tagging/recipient_sync/utils/find_highest_indexes.ts +2 -2
- package/src/tagging/recipient_sync/utils/load_logs_for_range.ts +10 -15
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +4 -9
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +11 -20
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +0 -4
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +0 -1
package/src/pxe.ts
CHANGED
|
@@ -47,11 +47,12 @@ import {
|
|
|
47
47
|
TxProfileResult,
|
|
48
48
|
TxProvingResult,
|
|
49
49
|
TxSimulationResult,
|
|
50
|
-
|
|
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
|
|
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
|
|
110
|
-
scopes
|
|
111
|
+
/** Addresses whose private state and keys are accessible during private execution */
|
|
112
|
+
scopes: AccessScopes;
|
|
111
113
|
};
|
|
112
114
|
|
|
113
|
-
/** Options for PXE.
|
|
114
|
-
export type
|
|
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
|
|
118
|
-
scopes
|
|
119
|
+
/** The accounts whose notes we can access in this call */
|
|
120
|
+
scopes: AccessScopes;
|
|
119
121
|
};
|
|
120
122
|
|
|
121
123
|
/** Args for PXE.create. */
|
|
@@ -143,6 +145,7 @@ export type PXECreateArgs = {
|
|
|
143
145
|
export class PXE {
|
|
144
146
|
private constructor(
|
|
145
147
|
private node: AztecNode,
|
|
148
|
+
private db: AztecAsyncKVStore,
|
|
146
149
|
private blockStateSynchronizer: BlockSynchronizer,
|
|
147
150
|
private keyStore: KeyStore,
|
|
148
151
|
private contractStore: ContractStore,
|
|
@@ -238,6 +241,7 @@ export class PXE {
|
|
|
238
241
|
|
|
239
242
|
const pxe = new PXE(
|
|
240
243
|
node,
|
|
244
|
+
store,
|
|
241
245
|
synchronizer,
|
|
242
246
|
keyStore,
|
|
243
247
|
contractStore,
|
|
@@ -263,7 +267,7 @@ export class PXE {
|
|
|
263
267
|
debugUtils.setPXEHelpers(
|
|
264
268
|
pxe.#putInJobQueue.bind(pxe),
|
|
265
269
|
pxe.#getSimulatorForTx.bind(pxe),
|
|
266
|
-
pxe.#
|
|
270
|
+
pxe.#executeUtility.bind(pxe),
|
|
267
271
|
);
|
|
268
272
|
|
|
269
273
|
pxe.jobQueue.start();
|
|
@@ -343,9 +347,8 @@ export class PXE {
|
|
|
343
347
|
async #registerProtocolContracts() {
|
|
344
348
|
const registered: Record<string, string> = {};
|
|
345
349
|
for (const name of protocolContractNames) {
|
|
346
|
-
const { address,
|
|
347
|
-
|
|
348
|
-
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
350
|
+
const { address, instance, artifact } = await this.protocolContractsProvider.getProtocolContractArtifact(name);
|
|
351
|
+
await this.contractStore.addContractArtifact(artifact);
|
|
349
352
|
await this.contractStore.addContractInstance(instance);
|
|
350
353
|
registered[name] = address.toString();
|
|
351
354
|
}
|
|
@@ -357,7 +360,7 @@ export class PXE {
|
|
|
357
360
|
async #executePrivate(
|
|
358
361
|
contractFunctionSimulator: ContractFunctionSimulator,
|
|
359
362
|
txRequest: TxExecutionRequest,
|
|
360
|
-
scopes:
|
|
363
|
+
scopes: AccessScopes,
|
|
361
364
|
jobId: string,
|
|
362
365
|
): Promise<PrivateExecutionResult> {
|
|
363
366
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
@@ -369,7 +372,7 @@ export class PXE {
|
|
|
369
372
|
contractAddress,
|
|
370
373
|
functionSelector,
|
|
371
374
|
(privateSyncCall, execScopes) =>
|
|
372
|
-
this.#
|
|
375
|
+
this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
|
|
373
376
|
anchorBlockHeader,
|
|
374
377
|
jobId,
|
|
375
378
|
scopes,
|
|
@@ -393,20 +396,20 @@ export class PXE {
|
|
|
393
396
|
}
|
|
394
397
|
|
|
395
398
|
/**
|
|
396
|
-
*
|
|
399
|
+
* Execute a utility function call on the given contract.
|
|
397
400
|
* @param contractFunctionSimulator - The simulator to use for the function call.
|
|
398
401
|
* @param call - The function call to execute.
|
|
399
402
|
* @param authWitnesses - Authentication witnesses required for the function call.
|
|
400
403
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
401
404
|
* accounts if not specified.
|
|
402
405
|
* @param jobId - The job ID for staged writes.
|
|
403
|
-
* @returns The
|
|
406
|
+
* @returns The execution result containing the outputs of the utility function.
|
|
404
407
|
*/
|
|
405
|
-
async #
|
|
408
|
+
async #executeUtility(
|
|
406
409
|
contractFunctionSimulator: ContractFunctionSimulator,
|
|
407
410
|
call: FunctionCall,
|
|
408
411
|
authWitnesses: AuthWitness[] | undefined,
|
|
409
|
-
scopes:
|
|
412
|
+
scopes: AccessScopes,
|
|
410
413
|
jobId: string,
|
|
411
414
|
) {
|
|
412
415
|
try {
|
|
@@ -600,8 +603,7 @@ export class PXE {
|
|
|
600
603
|
* @param artifact - The build artifact for the contract class.
|
|
601
604
|
*/
|
|
602
605
|
public async registerContractClass(artifact: ContractArtifact): Promise<void> {
|
|
603
|
-
const
|
|
604
|
-
await this.contractStore.addContractArtifact(contractClassId, artifact);
|
|
606
|
+
const contractClassId = await this.contractStore.addContractArtifact(artifact);
|
|
605
607
|
this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
|
|
606
608
|
}
|
|
607
609
|
|
|
@@ -620,17 +622,17 @@ export class PXE {
|
|
|
620
622
|
if (artifact) {
|
|
621
623
|
// If the user provides an artifact, validate it against the expected class id and register it
|
|
622
624
|
const contractClass = await getContractClassFromArtifact(artifact);
|
|
623
|
-
|
|
624
|
-
if (!contractClassId.equals(instance.currentContractClassId)) {
|
|
625
|
+
if (!contractClass.id.equals(instance.currentContractClassId)) {
|
|
625
626
|
throw new Error(
|
|
626
|
-
`Artifact does not match expected class id (computed ${
|
|
627
|
+
`Artifact does not match expected class id (computed ${contractClass.id} but instance refers to ${instance.currentContractClassId})`,
|
|
627
628
|
);
|
|
628
629
|
}
|
|
629
630
|
const computedAddress = await computeContractAddressFromInstance(instance);
|
|
630
631
|
if (!computedAddress.equals(instance.address)) {
|
|
631
632
|
throw new Error('Added a contract in which the address does not match the contract instance.');
|
|
632
633
|
}
|
|
633
|
-
|
|
634
|
+
|
|
635
|
+
await this.contractStore.addContractArtifact(artifact, contractClass);
|
|
634
636
|
|
|
635
637
|
const publicFunctionSignatures = artifact.functions
|
|
636
638
|
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
@@ -679,15 +681,16 @@ export class PXE {
|
|
|
679
681
|
throw new Error('Could not update contract to a class different from the current one.');
|
|
680
682
|
}
|
|
681
683
|
|
|
682
|
-
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
683
|
-
|
|
684
684
|
const publicFunctionSignatures = artifact.functions
|
|
685
685
|
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
686
686
|
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
687
687
|
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
688
688
|
|
|
689
689
|
currentInstance.currentContractClassId = contractClass.id;
|
|
690
|
-
await
|
|
690
|
+
await Promise.all([
|
|
691
|
+
this.contractStore.addContractArtifact(artifact, contractClass),
|
|
692
|
+
this.contractStore.addContractInstance(currentInstance),
|
|
693
|
+
]);
|
|
691
694
|
this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
|
|
692
695
|
});
|
|
693
696
|
}
|
|
@@ -927,6 +930,7 @@ export class PXE {
|
|
|
927
930
|
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(
|
|
928
931
|
privateExecutionResult,
|
|
929
932
|
(addr, sel) => this.contractStore.getDebugFunctionName(addr, sel),
|
|
933
|
+
this.node,
|
|
930
934
|
));
|
|
931
935
|
} else {
|
|
932
936
|
// Kernel logic, plus proving of all private functions and kernels.
|
|
@@ -945,6 +949,9 @@ export class PXE {
|
|
|
945
949
|
const publicSimulationTimer = new Timer();
|
|
946
950
|
publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement);
|
|
947
951
|
publicSimulationTime = publicSimulationTimer.ms();
|
|
952
|
+
if (publicOutput?.debugLogs?.length) {
|
|
953
|
+
await displayDebugLogs(publicOutput.debugLogs, addr => this.contractStore.getDebugContractName(addr));
|
|
954
|
+
}
|
|
948
955
|
}
|
|
949
956
|
|
|
950
957
|
let validationTime: number | undefined;
|
|
@@ -953,7 +960,8 @@ export class PXE {
|
|
|
953
960
|
const validationResult = await this.node.isValidTx(simulatedTx, { isSimulation: true, skipFeeEnforcement });
|
|
954
961
|
validationTime = validationTimer.ms();
|
|
955
962
|
if (validationResult.result === 'invalid') {
|
|
956
|
-
|
|
963
|
+
const reason = validationResult.reason.length > 0 ? ` Reason: ${validationResult.reason.join(', ')}` : '';
|
|
964
|
+
throw new Error(`The simulated transaction is unable to be added to state and is invalid.${reason}`);
|
|
957
965
|
}
|
|
958
966
|
}
|
|
959
967
|
|
|
@@ -1004,23 +1012,23 @@ export class PXE {
|
|
|
1004
1012
|
inspect(txRequest),
|
|
1005
1013
|
`simulatePublic=${simulatePublic}`,
|
|
1006
1014
|
`skipTxValidation=${skipTxValidation}`,
|
|
1007
|
-
`scopes=${scopes
|
|
1015
|
+
`scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map(s => s.toString()).join(', ')}`,
|
|
1008
1016
|
);
|
|
1009
1017
|
}
|
|
1010
1018
|
});
|
|
1011
1019
|
}
|
|
1012
1020
|
|
|
1013
1021
|
/**
|
|
1014
|
-
*
|
|
1022
|
+
* Executes a contract utility function.
|
|
1015
1023
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
1016
1024
|
*/
|
|
1017
|
-
public
|
|
1025
|
+
public executeUtility(
|
|
1018
1026
|
call: FunctionCall,
|
|
1019
|
-
{ authwits, scopes }:
|
|
1020
|
-
): Promise<
|
|
1021
|
-
// We disable concurrent
|
|
1027
|
+
{ authwits, scopes }: ExecuteUtilityOpts = { scopes: 'ALL_SCOPES' },
|
|
1028
|
+
): Promise<UtilityExecutionResult> {
|
|
1029
|
+
// We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
|
|
1022
1030
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
1023
|
-
// delete the same read value, or reading values that another
|
|
1031
|
+
// delete the same read value, or reading values that another execution is currently modifying).
|
|
1024
1032
|
return this.#putInJobQueue(async jobId => {
|
|
1025
1033
|
try {
|
|
1026
1034
|
const totalTimer = new Timer();
|
|
@@ -1035,13 +1043,13 @@ export class PXE {
|
|
|
1035
1043
|
call.to,
|
|
1036
1044
|
call.selector,
|
|
1037
1045
|
(privateSyncCall, execScopes) =>
|
|
1038
|
-
this.#
|
|
1046
|
+
this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
|
|
1039
1047
|
anchorBlockHeader,
|
|
1040
1048
|
jobId,
|
|
1041
1049
|
scopes,
|
|
1042
1050
|
);
|
|
1043
1051
|
|
|
1044
|
-
const executionResult = await this.#
|
|
1052
|
+
const executionResult = await this.#executeUtility(
|
|
1045
1053
|
contractFunctionSimulator,
|
|
1046
1054
|
call,
|
|
1047
1055
|
authwits ?? [],
|
|
@@ -1068,8 +1076,8 @@ export class PXE {
|
|
|
1068
1076
|
const stringifiedArgs = args.map(arg => arg.toString()).join(', ');
|
|
1069
1077
|
throw this.#contextualizeError(
|
|
1070
1078
|
err,
|
|
1071
|
-
`
|
|
1072
|
-
`scopes=${scopes
|
|
1079
|
+
`executeUtility ${to}:${name}(${stringifiedArgs})`,
|
|
1080
|
+
`scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map(s => s.toString()).join(', ')}`,
|
|
1073
1081
|
);
|
|
1074
1082
|
}
|
|
1075
1083
|
});
|
|
@@ -1106,7 +1114,7 @@ export class PXE {
|
|
|
1106
1114
|
filter.contractAddress,
|
|
1107
1115
|
null,
|
|
1108
1116
|
async (privateSyncCall, execScopes) =>
|
|
1109
|
-
await this.#
|
|
1117
|
+
await this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId),
|
|
1110
1118
|
anchorBlockHeader,
|
|
1111
1119
|
jobId,
|
|
1112
1120
|
filter.scopes,
|
|
@@ -1124,9 +1132,10 @@ export class PXE {
|
|
|
1124
1132
|
}
|
|
1125
1133
|
|
|
1126
1134
|
/**
|
|
1127
|
-
* Stops the PXE's job queue.
|
|
1135
|
+
* Stops the PXE's job queue and closes the backing store.
|
|
1128
1136
|
*/
|
|
1129
|
-
public stop(): Promise<void> {
|
|
1130
|
-
|
|
1137
|
+
public async stop(): Promise<void> {
|
|
1138
|
+
await this.jobQueue.end();
|
|
1139
|
+
await this.db.close();
|
|
1131
1140
|
}
|
|
1132
1141
|
}
|