@aztec/pxe 0.0.1-commit.f2ce05ee → 0.0.1-commit.f8ca9b2f3
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/contract_function_simulator/contract_function_simulator.d.ts +48 -26
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +63 -29
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.d.ts +2 -2
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +2 -2
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +34 -36
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +62 -17
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +29 -12
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +22 -24
- package/dest/entrypoints/client/bundle/utils.d.ts +1 -1
- package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/utils.js +9 -1
- package/dest/entrypoints/client/lazy/utils.d.ts +1 -1
- package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/utils.js +9 -1
- package/dest/entrypoints/server/utils.js +9 -1
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +2 -2
- package/dest/pxe.d.ts +52 -21
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +30 -26
- package/package.json +16 -16
- package/src/contract_function_simulator/contract_function_simulator.ts +106 -71
- package/src/contract_function_simulator/oracle/interfaces.ts +1 -1
- package/src/contract_function_simulator/oracle/oracle.ts +2 -2
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +81 -93
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +58 -21
- package/src/entrypoints/client/bundle/utils.ts +9 -1
- package/src/entrypoints/client/lazy/utils.ts +9 -1
- package/src/entrypoints/server/utils.ts +7 -7
- package/src/oracle_version.ts +2 -2
- package/src/pxe.ts +83 -58
|
@@ -40,6 +40,27 @@ import { pickNotes } from '../pick_notes.js';
|
|
|
40
40
|
import type { IMiscOracle, IUtilityExecutionOracle, NoteData } from './interfaces.js';
|
|
41
41
|
import { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
42
42
|
|
|
43
|
+
/** Args for UtilityExecutionOracle constructor. */
|
|
44
|
+
export type UtilityExecutionOracleArgs = {
|
|
45
|
+
contractAddress: AztecAddress;
|
|
46
|
+
/** List of transient auth witnesses to be used during this simulation */
|
|
47
|
+
authWitnesses: AuthWitness[];
|
|
48
|
+
capsules: Capsule[]; // TODO(#12425): Rename to transientCapsules
|
|
49
|
+
anchorBlockHeader: BlockHeader;
|
|
50
|
+
contractStore: ContractStore;
|
|
51
|
+
noteStore: NoteStore;
|
|
52
|
+
keyStore: KeyStore;
|
|
53
|
+
addressStore: AddressStore;
|
|
54
|
+
aztecNode: AztecNode;
|
|
55
|
+
recipientTaggingStore: RecipientTaggingStore;
|
|
56
|
+
senderAddressBookStore: SenderAddressBookStore;
|
|
57
|
+
capsuleStore: CapsuleStore;
|
|
58
|
+
privateEventStore: PrivateEventStore;
|
|
59
|
+
jobId: string;
|
|
60
|
+
log?: ReturnType<typeof createLogger>;
|
|
61
|
+
scopes?: AztecAddress[];
|
|
62
|
+
};
|
|
63
|
+
|
|
43
64
|
/**
|
|
44
65
|
* The oracle for an execution of utility contract functions.
|
|
45
66
|
*/
|
|
@@ -49,25 +70,41 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
49
70
|
|
|
50
71
|
private contractLogger: Logger | undefined;
|
|
51
72
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
protected readonly contractAddress: AztecAddress;
|
|
74
|
+
protected readonly authWitnesses: AuthWitness[];
|
|
75
|
+
protected readonly capsules: Capsule[];
|
|
76
|
+
protected readonly anchorBlockHeader: BlockHeader;
|
|
77
|
+
protected readonly contractStore: ContractStore;
|
|
78
|
+
protected readonly noteStore: NoteStore;
|
|
79
|
+
protected readonly keyStore: KeyStore;
|
|
80
|
+
protected readonly addressStore: AddressStore;
|
|
81
|
+
protected readonly aztecNode: AztecNode;
|
|
82
|
+
protected readonly recipientTaggingStore: RecipientTaggingStore;
|
|
83
|
+
protected readonly senderAddressBookStore: SenderAddressBookStore;
|
|
84
|
+
protected readonly capsuleStore: CapsuleStore;
|
|
85
|
+
protected readonly privateEventStore: PrivateEventStore;
|
|
86
|
+
protected readonly jobId: string;
|
|
87
|
+
protected log: ReturnType<typeof createLogger>;
|
|
88
|
+
protected readonly scopes?: AztecAddress[];
|
|
89
|
+
|
|
90
|
+
constructor(args: UtilityExecutionOracleArgs) {
|
|
91
|
+
this.contractAddress = args.contractAddress;
|
|
92
|
+
this.authWitnesses = args.authWitnesses;
|
|
93
|
+
this.capsules = args.capsules;
|
|
94
|
+
this.anchorBlockHeader = args.anchorBlockHeader;
|
|
95
|
+
this.contractStore = args.contractStore;
|
|
96
|
+
this.noteStore = args.noteStore;
|
|
97
|
+
this.keyStore = args.keyStore;
|
|
98
|
+
this.addressStore = args.addressStore;
|
|
99
|
+
this.aztecNode = args.aztecNode;
|
|
100
|
+
this.recipientTaggingStore = args.recipientTaggingStore;
|
|
101
|
+
this.senderAddressBookStore = args.senderAddressBookStore;
|
|
102
|
+
this.capsuleStore = args.capsuleStore;
|
|
103
|
+
this.privateEventStore = args.privateEventStore;
|
|
104
|
+
this.jobId = args.jobId;
|
|
105
|
+
this.log = args.log ?? createLogger('simulator:client_view_context');
|
|
106
|
+
this.scopes = args.scopes;
|
|
107
|
+
}
|
|
71
108
|
|
|
72
109
|
public utilityAssertCompatibleOracleVersion(version: number): void {
|
|
73
110
|
if (version !== ORACLE_VERSION) {
|
|
@@ -369,9 +406,9 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
|
|
|
369
406
|
return this.contractLogger;
|
|
370
407
|
}
|
|
371
408
|
|
|
372
|
-
public async
|
|
409
|
+
public async utilityLog(level: number, message: string, fields: Fr[]): Promise<void> {
|
|
373
410
|
if (!LogLevels[level]) {
|
|
374
|
-
throw new Error(`Invalid
|
|
411
|
+
throw new Error(`Invalid log level: ${level}`);
|
|
375
412
|
}
|
|
376
413
|
const levelName = LogLevels[level];
|
|
377
414
|
const logger = await this.#getContractLogger();
|
|
@@ -52,6 +52,14 @@ export async function createPXE(
|
|
|
52
52
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
53
53
|
|
|
54
54
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
|
|
55
|
-
const pxe = await PXE.create(
|
|
55
|
+
const pxe = await PXE.create({
|
|
56
|
+
node: aztecNode,
|
|
57
|
+
store,
|
|
58
|
+
proofCreator: prover,
|
|
59
|
+
simulator,
|
|
60
|
+
protocolContractsProvider,
|
|
61
|
+
config,
|
|
62
|
+
loggerOrSuffix: pxeLogger,
|
|
63
|
+
});
|
|
56
64
|
return pxe;
|
|
57
65
|
}
|
|
@@ -52,6 +52,14 @@ export async function createPXE(
|
|
|
52
52
|
const protocolContractsProvider = new LazyProtocolContractsProvider();
|
|
53
53
|
|
|
54
54
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
|
|
55
|
-
const pxe = await PXE.create(
|
|
55
|
+
const pxe = await PXE.create({
|
|
56
|
+
node: aztecNode,
|
|
57
|
+
store,
|
|
58
|
+
proofCreator: prover,
|
|
59
|
+
simulator,
|
|
60
|
+
protocolContractsProvider,
|
|
61
|
+
config,
|
|
62
|
+
loggerOrSuffix: pxeLogger,
|
|
63
|
+
});
|
|
56
64
|
return pxe;
|
|
57
65
|
}
|
|
@@ -58,14 +58,14 @@ export async function createPXE(
|
|
|
58
58
|
const protocolContractsProvider = new BundledProtocolContractsProvider();
|
|
59
59
|
|
|
60
60
|
const pxeLogger = loggers.pxe ?? createLogger('pxe:service', { actor });
|
|
61
|
-
const pxe = await PXE.create(
|
|
62
|
-
aztecNode,
|
|
63
|
-
options.store,
|
|
64
|
-
prover,
|
|
61
|
+
const pxe = await PXE.create({
|
|
62
|
+
node: aztecNode,
|
|
63
|
+
store: options.store,
|
|
64
|
+
proofCreator: prover,
|
|
65
65
|
simulator,
|
|
66
66
|
protocolContractsProvider,
|
|
67
|
-
configWithContracts,
|
|
68
|
-
pxeLogger,
|
|
69
|
-
);
|
|
67
|
+
config: configWithContracts,
|
|
68
|
+
loggerOrSuffix: pxeLogger,
|
|
69
|
+
});
|
|
70
70
|
return pxe;
|
|
71
71
|
}
|
package/src/oracle_version.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
///
|
|
5
5
|
/// @dev Whenever a contract function or Noir test is run, the `utilityAssertCompatibleOracleVersion` oracle is called
|
|
6
6
|
/// and if the oracle version is incompatible an error is thrown.
|
|
7
|
-
export const ORACLE_VERSION =
|
|
7
|
+
export const ORACLE_VERSION = 12;
|
|
8
8
|
|
|
9
9
|
/// This hash is computed as by hashing the Oracle interface and it is used to detect when the Oracle interface changes,
|
|
10
10
|
/// which in turn implies that you need to update the ORACLE_VERSION constant in this file and in
|
|
11
11
|
/// `noir-projects/aztec-nr/aztec/src/oracle/version.nr`.
|
|
12
|
-
export const ORACLE_INTERFACE_HASH = '
|
|
12
|
+
export const ORACLE_INTERFACE_HASH = '666a8a7fc697f72b29dbf0ae7464db269cf5afa019acac8861f814543147dbb4';
|
package/src/pxe.ts
CHANGED
|
@@ -86,6 +86,54 @@ export type PackedPrivateEvent = InTx & {
|
|
|
86
86
|
eventSelector: EventSelector;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
+
/** Options for PXE.profileTx. */
|
|
90
|
+
export type ProfileTxOpts = {
|
|
91
|
+
/** The profiling mode to use. */
|
|
92
|
+
profileMode: 'full' | 'execution-steps' | 'gates';
|
|
93
|
+
/** If true, proof generation is skipped during profiling. Defaults to true. */
|
|
94
|
+
skipProofGeneration?: boolean;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/** Options for PXE.simulateTx. */
|
|
98
|
+
export type SimulateTxOpts = {
|
|
99
|
+
/** Whether to simulate the public part of the transaction. */
|
|
100
|
+
simulatePublic: boolean;
|
|
101
|
+
/** If false, this function throws if the transaction is unable to be included in a block at the current state. */
|
|
102
|
+
skipTxValidation?: boolean;
|
|
103
|
+
/** If false, fees are enforced. */
|
|
104
|
+
skipFeeEnforcement?: boolean;
|
|
105
|
+
/** State overrides for the simulation, such as contract instances and artifacts. */
|
|
106
|
+
overrides?: SimulationOverrides;
|
|
107
|
+
/** The accounts whose notes we can access in this call. Defaults to all. */
|
|
108
|
+
scopes?: AztecAddress[];
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** Options for PXE.simulateUtility. */
|
|
112
|
+
export type SimulateUtilityOpts = {
|
|
113
|
+
/** The authentication witnesses required for the function call. */
|
|
114
|
+
authwits?: AuthWitness[];
|
|
115
|
+
/** The accounts whose notes we can access in this call. Defaults to all. */
|
|
116
|
+
scopes?: AztecAddress[];
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/** Args for PXE.create. */
|
|
120
|
+
export type PXECreateArgs = {
|
|
121
|
+
/** The Aztec node to connect to. */
|
|
122
|
+
node: AztecNode;
|
|
123
|
+
/** The key-value store for persisting PXE state. */
|
|
124
|
+
store: AztecAsyncKVStore;
|
|
125
|
+
/** The prover for generating private kernel proofs. */
|
|
126
|
+
proofCreator: PrivateKernelProver;
|
|
127
|
+
/** The circuit simulator for executing ACIR circuits. */
|
|
128
|
+
simulator: CircuitSimulator;
|
|
129
|
+
/** Provider for protocol contract artifacts and instances. */
|
|
130
|
+
protocolContractsProvider: ProtocolContractsProvider;
|
|
131
|
+
/** PXE configuration options. */
|
|
132
|
+
config: PXEConfig;
|
|
133
|
+
/** Optional logger instance or string suffix for the logger name. */
|
|
134
|
+
loggerOrSuffix?: string | Logger;
|
|
135
|
+
};
|
|
136
|
+
|
|
89
137
|
/**
|
|
90
138
|
* Private eXecution Environment (PXE) is a library used by wallets to simulate private phase of transactions and to
|
|
91
139
|
* manage private state of users.
|
|
@@ -122,15 +170,15 @@ export class PXE {
|
|
|
122
170
|
*
|
|
123
171
|
* @returns A promise that resolves PXE is ready to be used.
|
|
124
172
|
*/
|
|
125
|
-
public static async create(
|
|
126
|
-
node
|
|
127
|
-
store
|
|
128
|
-
proofCreator
|
|
129
|
-
simulator
|
|
130
|
-
protocolContractsProvider
|
|
131
|
-
config
|
|
132
|
-
loggerOrSuffix
|
|
133
|
-
) {
|
|
173
|
+
public static async create({
|
|
174
|
+
node,
|
|
175
|
+
store,
|
|
176
|
+
proofCreator,
|
|
177
|
+
simulator,
|
|
178
|
+
protocolContractsProvider,
|
|
179
|
+
config,
|
|
180
|
+
loggerOrSuffix,
|
|
181
|
+
}: PXECreateArgs) {
|
|
134
182
|
// Extract bindings from the logger, or use empty bindings if a string suffix is provided.
|
|
135
183
|
const bindings: LoggerBindings | undefined =
|
|
136
184
|
loggerOrSuffix && typeof loggerOrSuffix !== 'string' ? loggerOrSuffix.getBindings() : undefined;
|
|
@@ -140,7 +188,9 @@ export class PXE {
|
|
|
140
188
|
? createLogger(loggerOrSuffix ? `pxe:service:${loggerOrSuffix}` : `pxe:service`)
|
|
141
189
|
: loggerOrSuffix;
|
|
142
190
|
|
|
143
|
-
const
|
|
191
|
+
const info = await node.getNodeInfo();
|
|
192
|
+
|
|
193
|
+
const proverEnabled = config.proverEnabled !== undefined ? config.proverEnabled : info.realProofs;
|
|
144
194
|
const addressStore = new AddressStore(store);
|
|
145
195
|
const privateEventStore = new PrivateEventStore(store);
|
|
146
196
|
const contractStore = new ContractStore(store);
|
|
@@ -217,7 +267,6 @@ export class PXE {
|
|
|
217
267
|
pxe.jobQueue.start();
|
|
218
268
|
|
|
219
269
|
await pxe.#registerProtocolContracts();
|
|
220
|
-
const info = await node.getNodeInfo();
|
|
221
270
|
log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
|
|
222
271
|
return pxe;
|
|
223
272
|
}
|
|
@@ -227,20 +276,20 @@ export class PXE {
|
|
|
227
276
|
#getSimulatorForTx(overrides?: { contracts?: ContractOverrides }) {
|
|
228
277
|
const proxyContractStore = ProxiedContractStoreFactory.create(this.contractStore, overrides?.contracts);
|
|
229
278
|
|
|
230
|
-
return new ContractFunctionSimulator(
|
|
231
|
-
proxyContractStore,
|
|
232
|
-
this.noteStore,
|
|
233
|
-
this.keyStore,
|
|
234
|
-
this.addressStore,
|
|
235
|
-
BenchmarkedNodeFactory.create(this.node),
|
|
236
|
-
this.senderTaggingStore,
|
|
237
|
-
this.recipientTaggingStore,
|
|
238
|
-
this.senderAddressBookStore,
|
|
239
|
-
this.capsuleStore,
|
|
240
|
-
this.privateEventStore,
|
|
241
|
-
this.simulator,
|
|
242
|
-
this.contractSyncService,
|
|
243
|
-
);
|
|
279
|
+
return new ContractFunctionSimulator({
|
|
280
|
+
contractStore: proxyContractStore,
|
|
281
|
+
noteStore: this.noteStore,
|
|
282
|
+
keyStore: this.keyStore,
|
|
283
|
+
addressStore: this.addressStore,
|
|
284
|
+
aztecNode: BenchmarkedNodeFactory.create(this.node),
|
|
285
|
+
senderTaggingStore: this.senderTaggingStore,
|
|
286
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
287
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
288
|
+
capsuleStore: this.capsuleStore,
|
|
289
|
+
privateEventStore: this.privateEventStore,
|
|
290
|
+
simulator: this.simulator,
|
|
291
|
+
contractSyncService: this.contractSyncService,
|
|
292
|
+
});
|
|
244
293
|
}
|
|
245
294
|
|
|
246
295
|
#contextualizeError(err: Error, ...context: string[]): Error {
|
|
@@ -322,18 +371,13 @@ export class PXE {
|
|
|
322
371
|
jobId,
|
|
323
372
|
);
|
|
324
373
|
|
|
325
|
-
const result = await contractFunctionSimulator.run(
|
|
326
|
-
txRequest,
|
|
374
|
+
const result = await contractFunctionSimulator.run(txRequest, {
|
|
327
375
|
contractAddress,
|
|
328
|
-
functionSelector,
|
|
329
|
-
undefined,
|
|
376
|
+
selector: functionSelector,
|
|
330
377
|
anchorBlockHeader,
|
|
331
|
-
// The sender for tags is set by contracts, typically by an account
|
|
332
|
-
// contract entrypoint
|
|
333
|
-
undefined, // senderForTags
|
|
334
378
|
scopes,
|
|
335
379
|
jobId,
|
|
336
|
-
);
|
|
380
|
+
});
|
|
337
381
|
this.log.debug(`Private simulation completed for ${contractAddress.toString()}:${functionSelector}`);
|
|
338
382
|
return result;
|
|
339
383
|
} catch (err) {
|
|
@@ -736,17 +780,13 @@ export class PXE {
|
|
|
736
780
|
|
|
737
781
|
/**
|
|
738
782
|
* Profiles a transaction, reporting gate counts (unless disabled) and returns an execution trace.
|
|
739
|
-
*
|
|
740
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
741
|
-
* @param msgSender - (Optional) The message sender to use for the simulation.
|
|
742
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
783
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
743
784
|
* @returns A trace of the program execution with gate counts.
|
|
744
785
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
745
786
|
*/
|
|
746
787
|
public profileTx(
|
|
747
788
|
txRequest: TxExecutionRequest,
|
|
748
|
-
profileMode
|
|
749
|
-
skipProofGeneration: boolean = true,
|
|
789
|
+
{ profileMode, skipProofGeneration = true }: ProfileTxOpts,
|
|
750
790
|
): Promise<TxProfileResult> {
|
|
751
791
|
// We disable concurrent profiles for consistency with simulateTx.
|
|
752
792
|
return this.#putInJobQueue(async jobId => {
|
|
@@ -831,12 +871,7 @@ export class PXE {
|
|
|
831
871
|
* In that case, the transaction returned is only potentially ready to be sent to the network for execution.
|
|
832
872
|
*
|
|
833
873
|
*
|
|
834
|
-
* @param txRequest - An authenticated tx request ready for simulation
|
|
835
|
-
* @param simulatePublic - Whether to simulate the public part of the transaction.
|
|
836
|
-
* @param skipTxValidation - (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state.
|
|
837
|
-
* @param skipFeeEnforcement - (Optional) If false, fees are enforced.
|
|
838
|
-
* @param overrides - (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts.
|
|
839
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
874
|
+
* @param txRequest - An authenticated tx request ready for simulation.
|
|
840
875
|
* @returns A simulated transaction result object that includes public and private return values.
|
|
841
876
|
* @throws If the code for the functions executed in this transaction have not been made available via `addContracts`.
|
|
842
877
|
* Also throws if simulatePublic is true and public simulation reverts.
|
|
@@ -845,11 +880,7 @@ export class PXE {
|
|
|
845
880
|
*/
|
|
846
881
|
public simulateTx(
|
|
847
882
|
txRequest: TxExecutionRequest,
|
|
848
|
-
simulatePublic:
|
|
849
|
-
skipTxValidation: boolean = false,
|
|
850
|
-
skipFeeEnforcement: boolean = false,
|
|
851
|
-
overrides?: SimulationOverrides,
|
|
852
|
-
scopes?: AztecAddress[],
|
|
883
|
+
{ simulatePublic, skipTxValidation = false, skipFeeEnforcement = false, overrides, scopes }: SimulateTxOpts,
|
|
853
884
|
): Promise<TxSimulationResult> {
|
|
854
885
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
855
886
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
@@ -980,18 +1011,12 @@ export class PXE {
|
|
|
980
1011
|
}
|
|
981
1012
|
|
|
982
1013
|
/**
|
|
983
|
-
*
|
|
984
|
-
*
|
|
1014
|
+
* Simulates the execution of a contract utility function.
|
|
985
1015
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
986
|
-
* @param authwits - (Optional) The authentication witnesses required for the function call.
|
|
987
|
-
* @param scopes - (Optional) The accounts whose notes we can access in this call. Currently optional and will
|
|
988
|
-
* default to all.
|
|
989
|
-
* @returns The result of the utility function call, structured based on the function ABI.
|
|
990
1016
|
*/
|
|
991
1017
|
public simulateUtility(
|
|
992
1018
|
call: FunctionCall,
|
|
993
|
-
authwits
|
|
994
|
-
scopes?: AztecAddress[],
|
|
1019
|
+
{ authwits, scopes }: SimulateUtilityOpts = {},
|
|
995
1020
|
): Promise<UtilitySimulationResult> {
|
|
996
1021
|
// We disable concurrent simulations since those might execute oracles which read and write to the PXE stores (e.g.
|
|
997
1022
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|