@aztec/txe 0.0.1-commit.4ad48494d → 0.0.1-commit.4d3c002
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/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +88 -54
- package/dest/oracle/interfaces.d.ts +29 -28
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +13 -13
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +12 -12
- package/dest/oracle/txe_oracle_top_level_context.d.ts +23 -23
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +60 -44
- package/dest/rpc_translator.d.ts +87 -82
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +285 -152
- package/dest/state_machine/archiver.d.ts +3 -3
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +7 -8
- package/dest/state_machine/dummy_p2p_client.d.ts +8 -6
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +12 -6
- package/dest/state_machine/global_variable_builder.d.ts +3 -3
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +1 -1
- package/dest/state_machine/index.d.ts +4 -2
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +7 -3
- package/dest/state_machine/mock_epoch_cache.d.ts +17 -3
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +32 -2
- package/dest/state_machine/synchronizer.d.ts +5 -5
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +3 -3
- package/dest/txe_session.d.ts +10 -6
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +36 -25
- package/dest/util/encoding.d.ts +69 -1
- package/dest/util/encoding.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.d.ts +2 -3
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +6 -25
- package/package.json +15 -15
- package/src/index.ts +89 -52
- package/src/oracle/interfaces.ts +32 -31
- package/src/oracle/txe_oracle_public_context.ts +12 -12
- package/src/oracle/txe_oracle_top_level_context.ts +74 -44
- package/src/rpc_translator.ts +332 -174
- package/src/state_machine/archiver.ts +6 -5
- package/src/state_machine/dummy_p2p_client.ts +17 -9
- package/src/state_machine/global_variable_builder.ts +7 -1
- package/src/state_machine/index.ts +7 -1
- package/src/state_machine/mock_epoch_cache.ts +42 -3
- package/src/state_machine/synchronizer.ts +4 -4
- package/src/txe_session.ts +45 -24
- package/src/util/txe_public_contract_data_source.ts +10 -38
- package/dest/util/txe_contract_store.d.ts +0 -12
- package/dest/util/txe_contract_store.d.ts.map +0 -1
- package/dest/util/txe_contract_store.js +0 -22
- package/src/util/txe_contract_store.ts +0 -36
|
@@ -14,7 +14,10 @@ import { TestDateProvider } from '@aztec/foundation/timer';
|
|
|
14
14
|
import type { KeyStore } from '@aztec/key-store';
|
|
15
15
|
import {
|
|
16
16
|
AddressStore,
|
|
17
|
+
CapsuleService,
|
|
17
18
|
CapsuleStore,
|
|
19
|
+
type ContractStore,
|
|
20
|
+
type ContractSyncService,
|
|
18
21
|
NoteStore,
|
|
19
22
|
ORACLE_VERSION,
|
|
20
23
|
PrivateEventStore,
|
|
@@ -83,7 +86,6 @@ import { ForkCheckpoint } from '@aztec/world-state';
|
|
|
83
86
|
import { DEFAULT_ADDRESS } from '../constants.js';
|
|
84
87
|
import type { TXEStateMachine } from '../state_machine/index.js';
|
|
85
88
|
import type { TXEAccountStore } from '../util/txe_account_store.js';
|
|
86
|
-
import type { TXEContractStore } from '../util/txe_contract_store.js';
|
|
87
89
|
import { TXEPublicContractDataSource } from '../util/txe_public_contract_data_source.js';
|
|
88
90
|
import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from '../utils/block_creation.js';
|
|
89
91
|
import type { ITxeExecutionOracle } from './interfaces.js';
|
|
@@ -96,7 +98,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
96
98
|
|
|
97
99
|
constructor(
|
|
98
100
|
private stateMachine: TXEStateMachine,
|
|
99
|
-
private contractStore:
|
|
101
|
+
private contractStore: ContractStore,
|
|
100
102
|
private noteStore: NoteStore,
|
|
101
103
|
private keyStore: KeyStore,
|
|
102
104
|
private addressStore: AddressStore,
|
|
@@ -106,32 +108,36 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
106
108
|
private senderAddressBookStore: SenderAddressBookStore,
|
|
107
109
|
private capsuleStore: CapsuleStore,
|
|
108
110
|
private privateEventStore: PrivateEventStore,
|
|
109
|
-
private jobId: string,
|
|
110
111
|
private nextBlockTimestamp: bigint,
|
|
111
112
|
private version: Fr,
|
|
112
113
|
private chainId: Fr,
|
|
113
114
|
private authwits: Map<string, AuthWitness>,
|
|
115
|
+
private readonly contractSyncService: ContractSyncService,
|
|
114
116
|
) {
|
|
115
117
|
this.logger = createLogger('txe:top_level_context');
|
|
116
118
|
this.logger.debug('Entering Top Level Context');
|
|
117
119
|
}
|
|
118
120
|
|
|
119
|
-
|
|
121
|
+
assertCompatibleOracleVersion(version: number): void {
|
|
120
122
|
if (version !== ORACLE_VERSION) {
|
|
123
|
+
const hint =
|
|
124
|
+
version > ORACLE_VERSION
|
|
125
|
+
? 'The contract was compiled with a newer version of Aztec.nr than this aztec cli version supports. Upgrade your aztec cli version to a compatible version.'
|
|
126
|
+
: 'The contract was compiled with an older version of Aztec.nr than this aztec cli version supports. Recompile the contract with a compatible version of Aztec.nr.';
|
|
121
127
|
throw new Error(
|
|
122
|
-
`Incompatible
|
|
128
|
+
`Incompatible aztec cli version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle version ${ORACLE_VERSION}, got ${version})`,
|
|
123
129
|
);
|
|
124
130
|
}
|
|
125
131
|
}
|
|
126
132
|
|
|
127
133
|
// This is typically only invoked in private contexts, but it is convenient to also have it in top-level for testing
|
|
128
134
|
// setup.
|
|
129
|
-
|
|
135
|
+
getRandomField(): Fr {
|
|
130
136
|
return Fr.random();
|
|
131
137
|
}
|
|
132
138
|
|
|
133
139
|
// We instruct users to debug contracts via this oracle, so it makes sense that they'd expect it to also work in tests
|
|
134
|
-
|
|
140
|
+
log(level: number, message: string, fields: Fr[]): Promise<void> {
|
|
135
141
|
if (!LogLevels[level]) {
|
|
136
142
|
throw new Error(`Invalid log level: ${level}`);
|
|
137
143
|
}
|
|
@@ -141,23 +147,23 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
141
147
|
return Promise.resolve();
|
|
142
148
|
}
|
|
143
149
|
|
|
144
|
-
|
|
150
|
+
getDefaultAddress(): AztecAddress {
|
|
145
151
|
return DEFAULT_ADDRESS;
|
|
146
152
|
}
|
|
147
153
|
|
|
148
|
-
async
|
|
154
|
+
async getNextBlockNumber(): Promise<BlockNumber> {
|
|
149
155
|
return BlockNumber((await this.getLastBlockNumber()) + 1);
|
|
150
156
|
}
|
|
151
157
|
|
|
152
|
-
|
|
158
|
+
getNextBlockTimestamp(): Promise<bigint> {
|
|
153
159
|
return Promise.resolve(this.nextBlockTimestamp);
|
|
154
160
|
}
|
|
155
161
|
|
|
156
|
-
async
|
|
162
|
+
async getLastBlockTimestamp() {
|
|
157
163
|
return (await this.stateMachine.node.getBlockHeader('latest'))!.globalVariables.timestamp;
|
|
158
164
|
}
|
|
159
165
|
|
|
160
|
-
async
|
|
166
|
+
async getLastTxEffects() {
|
|
161
167
|
const latestBlockNumber = await this.stateMachine.archiver.getBlockNumber();
|
|
162
168
|
const block = await this.stateMachine.archiver.getBlock(latestBlockNumber);
|
|
163
169
|
|
|
@@ -171,7 +177,26 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
171
177
|
return { txHash: txEffects.txHash, noteHashes: txEffects.noteHashes, nullifiers: txEffects.nullifiers };
|
|
172
178
|
}
|
|
173
179
|
|
|
174
|
-
async
|
|
180
|
+
async syncContractNonOracleMethod(contractAddress: AztecAddress, scope: AztecAddress, jobId: string) {
|
|
181
|
+
if (contractAddress.equals(DEFAULT_ADDRESS)) {
|
|
182
|
+
this.logger.debug(`Skipping sync in getPrivateEvents because the events correspond to the default address.`);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
187
|
+
await this.stateMachine.contractSyncService.ensureContractSynced(
|
|
188
|
+
contractAddress,
|
|
189
|
+
null,
|
|
190
|
+
async (call, execScopes) => {
|
|
191
|
+
await this.executeUtilityCall(call, execScopes, jobId);
|
|
192
|
+
},
|
|
193
|
+
blockHeader,
|
|
194
|
+
jobId,
|
|
195
|
+
[scope],
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async getPrivateEvents(selector: EventSelector, contractAddress: AztecAddress, scope: AztecAddress) {
|
|
175
200
|
return (
|
|
176
201
|
await this.privateEventStore.getPrivateEvents(selector, {
|
|
177
202
|
contractAddress,
|
|
@@ -182,7 +207,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
182
207
|
).map(e => e.packedEvent);
|
|
183
208
|
}
|
|
184
209
|
|
|
185
|
-
async
|
|
210
|
+
async advanceBlocksBy(blocks: number) {
|
|
186
211
|
this.logger.debug(`time traveling ${blocks} blocks`);
|
|
187
212
|
|
|
188
213
|
for (let i = 0; i < blocks; i++) {
|
|
@@ -190,12 +215,12 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
190
215
|
}
|
|
191
216
|
}
|
|
192
217
|
|
|
193
|
-
|
|
218
|
+
advanceTimestampBy(duration: UInt64) {
|
|
194
219
|
this.logger.debug(`time traveling ${duration} seconds`);
|
|
195
220
|
this.nextBlockTimestamp += duration;
|
|
196
221
|
}
|
|
197
222
|
|
|
198
|
-
async
|
|
223
|
+
async deploy(artifact: ContractArtifact, instance: ContractInstanceWithAddress, secret: Fr) {
|
|
199
224
|
// Emit deployment nullifier
|
|
200
225
|
await this.mineBlock({
|
|
201
226
|
nullifiers: [
|
|
@@ -207,20 +232,20 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
207
232
|
});
|
|
208
233
|
|
|
209
234
|
if (!secret.equals(Fr.ZERO)) {
|
|
210
|
-
await this.
|
|
235
|
+
await this.addAccount(artifact, instance, secret);
|
|
211
236
|
} else {
|
|
212
237
|
await this.contractStore.addContractInstance(instance);
|
|
213
|
-
await this.contractStore.addContractArtifact(
|
|
238
|
+
await this.contractStore.addContractArtifact(artifact);
|
|
214
239
|
this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
|
|
215
240
|
}
|
|
216
241
|
}
|
|
217
242
|
|
|
218
|
-
async
|
|
243
|
+
async addAccount(artifact: ContractArtifact, instance: ContractInstanceWithAddress, secret: Fr) {
|
|
219
244
|
const partialAddress = await computePartialAddress(instance);
|
|
220
245
|
|
|
221
246
|
this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
|
|
222
247
|
await this.contractStore.addContractInstance(instance);
|
|
223
|
-
await this.contractStore.addContractArtifact(
|
|
248
|
+
await this.contractStore.addContractArtifact(artifact);
|
|
224
249
|
|
|
225
250
|
const completeAddress = await this.keyStore.addAccount(secret, partialAddress);
|
|
226
251
|
await this.accountStore.setAccount(completeAddress.address, completeAddress);
|
|
@@ -230,7 +255,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
230
255
|
return completeAddress;
|
|
231
256
|
}
|
|
232
257
|
|
|
233
|
-
async
|
|
258
|
+
async createAccount(secret: Fr) {
|
|
234
259
|
// This is a foot gun !
|
|
235
260
|
const completeAddress = await this.keyStore.addAccount(secret, secret);
|
|
236
261
|
await this.accountStore.setAccount(completeAddress.address, completeAddress);
|
|
@@ -240,7 +265,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
240
265
|
return completeAddress;
|
|
241
266
|
}
|
|
242
267
|
|
|
243
|
-
async
|
|
268
|
+
async addAuthWitness(address: AztecAddress, messageHash: Fr) {
|
|
244
269
|
const account = await this.accountStore.getAccount(address);
|
|
245
270
|
const privateKey = await this.keyStore.getMasterSecretKey(account.publicKeys.masterIncomingViewingPublicKey);
|
|
246
271
|
|
|
@@ -253,7 +278,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
253
278
|
}
|
|
254
279
|
|
|
255
280
|
async mineBlock(options: { nullifiers?: Fr[] } = {}) {
|
|
256
|
-
const blockNumber = await this.
|
|
281
|
+
const blockNumber = await this.getNextBlockNumber();
|
|
257
282
|
|
|
258
283
|
const txEffect = TxEffect.empty();
|
|
259
284
|
txEffect.nullifiers = [getSingleTxBlockRequestHash(blockNumber), ...(options.nullifiers ?? [])];
|
|
@@ -277,13 +302,14 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
277
302
|
await this.stateMachine.handleL2Block(block);
|
|
278
303
|
}
|
|
279
304
|
|
|
280
|
-
async
|
|
305
|
+
async privateCallNewFlow(
|
|
281
306
|
from: AztecAddress,
|
|
282
307
|
targetContractAddress: AztecAddress = AztecAddress.zero(),
|
|
283
308
|
functionSelector: FunctionSelector = FunctionSelector.empty(),
|
|
284
309
|
args: Fr[],
|
|
285
310
|
argsHash: Fr = Fr.zero(),
|
|
286
311
|
isStaticCall: boolean = false,
|
|
312
|
+
jobId: string,
|
|
287
313
|
) {
|
|
288
314
|
this.logger.verbose(
|
|
289
315
|
`Executing external function ${await this.contractStore.getDebugFunctionName(targetContractAddress, functionSelector)}@${targetContractAddress} isStaticCall=${isStaticCall}`,
|
|
@@ -302,8 +328,8 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
302
328
|
const effectiveScopes = from.isZero() ? [] : [from];
|
|
303
329
|
|
|
304
330
|
// Sync notes before executing private function to discover notes from previous transactions
|
|
305
|
-
const utilityExecutor = async (call: FunctionCall, execScopes:
|
|
306
|
-
await this.executeUtilityCall(call, execScopes);
|
|
331
|
+
const utilityExecutor = async (call: FunctionCall, execScopes: AztecAddress[]) => {
|
|
332
|
+
await this.executeUtilityCall(call, execScopes, jobId);
|
|
307
333
|
};
|
|
308
334
|
|
|
309
335
|
const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
@@ -312,11 +338,11 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
312
338
|
functionSelector,
|
|
313
339
|
utilityExecutor,
|
|
314
340
|
blockHeader,
|
|
315
|
-
|
|
341
|
+
jobId,
|
|
316
342
|
effectiveScopes,
|
|
317
343
|
);
|
|
318
344
|
|
|
319
|
-
const blockNumber = await this.
|
|
345
|
+
const blockNumber = await this.getNextBlockNumber();
|
|
320
346
|
|
|
321
347
|
const callContext = new CallContext(from, targetContractAddress, functionSelector, isStaticCall);
|
|
322
348
|
|
|
@@ -356,10 +382,10 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
356
382
|
senderTaggingStore: this.senderTaggingStore,
|
|
357
383
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
358
384
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
359
|
-
|
|
385
|
+
capsuleService: new CapsuleService(this.capsuleStore, effectiveScopes),
|
|
360
386
|
privateEventStore: this.privateEventStore,
|
|
361
387
|
contractSyncService: this.stateMachine.contractSyncService,
|
|
362
|
-
jobId
|
|
388
|
+
jobId,
|
|
363
389
|
totalPublicCalldataCount: 0,
|
|
364
390
|
sideEffectCounter: minRevertibleSideEffectCounter,
|
|
365
391
|
scopes: effectiveScopes,
|
|
@@ -367,6 +393,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
367
393
|
// contract would perform, including setting senderForTags.
|
|
368
394
|
senderForTags: from,
|
|
369
395
|
simulator,
|
|
396
|
+
messageContextService: this.stateMachine.messageContextService,
|
|
370
397
|
});
|
|
371
398
|
|
|
372
399
|
// Note: This is a slight modification of simulator.run without any of the checks. Maybe we should modify simulator.run with a boolean value to skip checks.
|
|
@@ -389,7 +416,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
389
416
|
);
|
|
390
417
|
const publicFunctionsCalldata = await Promise.all(
|
|
391
418
|
publicCallRequests.map(async r => {
|
|
392
|
-
const calldata = await privateExecutionOracle.
|
|
419
|
+
const calldata = await privateExecutionOracle.getHashPreimage(r.calldataHash);
|
|
393
420
|
return new HashedValues(calldata, r.calldataHash);
|
|
394
421
|
}),
|
|
395
422
|
);
|
|
@@ -503,7 +530,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
503
530
|
return executionResult.returnValues ?? [];
|
|
504
531
|
}
|
|
505
532
|
|
|
506
|
-
async
|
|
533
|
+
async publicCallNewFlow(
|
|
507
534
|
from: AztecAddress,
|
|
508
535
|
targetContractAddress: AztecAddress,
|
|
509
536
|
calldata: Fr[],
|
|
@@ -513,7 +540,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
513
540
|
`Executing public function ${await this.contractStore.getDebugFunctionName(targetContractAddress, FunctionSelector.fromField(calldata[0]))}@${targetContractAddress} isStaticCall=${isStaticCall}`,
|
|
514
541
|
);
|
|
515
542
|
|
|
516
|
-
const blockNumber = await this.
|
|
543
|
+
const blockNumber = await this.getNextBlockNumber();
|
|
517
544
|
|
|
518
545
|
const gasLimits = new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
|
|
519
546
|
|
|
@@ -590,7 +617,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
590
617
|
constantData,
|
|
591
618
|
/*gasUsed=*/ new Gas(0, 0),
|
|
592
619
|
/*feePayer=*/ AztecAddress.zero(),
|
|
593
|
-
/*
|
|
620
|
+
/*expirationTimestamp=*/ 0n,
|
|
594
621
|
inputsForPublic,
|
|
595
622
|
undefined,
|
|
596
623
|
);
|
|
@@ -658,10 +685,11 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
658
685
|
return returnValues ?? [];
|
|
659
686
|
}
|
|
660
687
|
|
|
661
|
-
async
|
|
688
|
+
async executeUtilityFunction(
|
|
662
689
|
targetContractAddress: AztecAddress,
|
|
663
690
|
functionSelector: FunctionSelector,
|
|
664
691
|
args: Fr[],
|
|
692
|
+
jobId: string,
|
|
665
693
|
) {
|
|
666
694
|
const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
|
|
667
695
|
if (!artifact) {
|
|
@@ -674,11 +702,11 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
674
702
|
targetContractAddress,
|
|
675
703
|
functionSelector,
|
|
676
704
|
async (call, execScopes) => {
|
|
677
|
-
await this.executeUtilityCall(call, execScopes);
|
|
705
|
+
await this.executeUtilityCall(call, execScopes, jobId);
|
|
678
706
|
},
|
|
679
707
|
blockHeader,
|
|
680
|
-
|
|
681
|
-
|
|
708
|
+
jobId,
|
|
709
|
+
await this.keyStore.getAccounts(),
|
|
682
710
|
);
|
|
683
711
|
|
|
684
712
|
const call = FunctionCall.from({
|
|
@@ -692,10 +720,10 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
692
720
|
returnTypes: [],
|
|
693
721
|
});
|
|
694
722
|
|
|
695
|
-
return this.executeUtilityCall(call,
|
|
723
|
+
return this.executeUtilityCall(call, await this.keyStore.getAccounts(), jobId);
|
|
696
724
|
}
|
|
697
725
|
|
|
698
|
-
private async executeUtilityCall(call: FunctionCall, scopes:
|
|
726
|
+
private async executeUtilityCall(call: FunctionCall, scopes: AztecAddress[], jobId: string): Promise<Fr[]> {
|
|
699
727
|
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
700
728
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
701
729
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
@@ -720,9 +748,11 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
720
748
|
aztecNode: this.stateMachine.node,
|
|
721
749
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
722
750
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
723
|
-
|
|
751
|
+
capsuleService: new CapsuleService(this.capsuleStore, scopes),
|
|
724
752
|
privateEventStore: this.privateEventStore,
|
|
725
|
-
|
|
753
|
+
messageContextService: this.stateMachine.messageContextService,
|
|
754
|
+
contractSyncService: this.contractSyncService,
|
|
755
|
+
jobId,
|
|
726
756
|
scopes,
|
|
727
757
|
});
|
|
728
758
|
const acirExecutionResult = await new WASMSimulator()
|
|
@@ -740,10 +770,10 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
740
770
|
);
|
|
741
771
|
});
|
|
742
772
|
|
|
743
|
-
this.logger.verbose(`Utility
|
|
773
|
+
this.logger.verbose(`Utility execution for ${call.to}.${call.selector} completed`);
|
|
744
774
|
return witnessMapToFields(acirExecutionResult.returnWitness);
|
|
745
775
|
} catch (err) {
|
|
746
|
-
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during utility
|
|
776
|
+
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during utility execution'));
|
|
747
777
|
}
|
|
748
778
|
}
|
|
749
779
|
|