@aztec/pxe 0.0.1-commit.c949de6bc → 0.0.1-commit.cbf2c2d5d
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/config/index.d.ts +2 -2
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +9 -3
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +28 -6
- 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 +17 -9
- package/dest/contract_function_simulator/index.d.ts +2 -1
- package/dest/contract_function_simulator/index.d.ts.map +1 -1
- package/dest/contract_function_simulator/index.js +1 -0
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +2 -3
- package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +5 -4
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -3
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts +16 -0
- package/dest/contract_function_simulator/noir-structs/message_tx_context.d.ts.map +1 -0
- package/dest/contract_function_simulator/noir-structs/message_tx_context.js +57 -0
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -4
- 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 +3 -5
- package/dest/contract_function_simulator/oracle/interfaces.d.ts +50 -45
- package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +9 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +42 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +45 -44
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +163 -94
- package/dest/contract_function_simulator/oracle/private_execution.js +5 -3
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +22 -47
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +30 -62
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +53 -35
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +101 -43
- package/dest/contract_sync/contract_sync_service.d.ts +5 -3
- package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
- package/dest/contract_sync/contract_sync_service.js +47 -30
- package/dest/messages/message_context_service.d.ts +17 -0
- package/dest/messages/message_context_service.d.ts.map +1 -0
- package/dest/messages/message_context_service.js +36 -0
- package/dest/oracle_version.d.ts +2 -2
- package/dest/oracle_version.js +3 -3
- package/dest/pxe.d.ts +8 -4
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +39 -22
- package/dest/storage/metadata.d.ts +1 -1
- package/dest/storage/metadata.js +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.d.ts +26 -25
- package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
- package/dest/storage/tagging_store/sender_tagging_store.js +141 -115
- package/dest/tagging/index.d.ts +2 -2
- package/dest/tagging/index.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
- package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +10 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +4 -3
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
- package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +20 -10
- package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +2 -1
- 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 +24 -11
- package/package.json +16 -16
- package/src/config/index.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +39 -7
- package/src/contract_function_simulator/execution_tagging_index_cache.ts +16 -11
- package/src/contract_function_simulator/index.ts +1 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +8 -5
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -4
- package/src/contract_function_simulator/noir-structs/message_tx_context.ts +55 -0
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +3 -6
- package/src/contract_function_simulator/oracle/interfaces.ts +54 -54
- package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +135 -0
- package/src/contract_function_simulator/oracle/oracle.ts +176 -138
- package/src/contract_function_simulator/oracle/private_execution.ts +4 -4
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +32 -80
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +136 -53
- package/src/contract_sync/contract_sync_service.ts +67 -38
- package/src/messages/message_context_service.ts +45 -0
- package/src/oracle_version.ts +3 -3
- package/src/pxe.ts +57 -21
- package/src/storage/metadata.ts +1 -1
- package/src/storage/tagging_store/sender_tagging_store.ts +182 -135
- package/src/tagging/index.ts +1 -1
- package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +19 -1
- package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +26 -11
- package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +19 -9
|
@@ -76,12 +76,12 @@ export async function executePrivateFunction(
|
|
|
76
76
|
|
|
77
77
|
const contractClassLogs = privateExecutionOracle.getContractClassLogs();
|
|
78
78
|
|
|
79
|
-
const rawReturnValues = await privateExecutionOracle.
|
|
79
|
+
const rawReturnValues = await privateExecutionOracle.loadFromExecutionCache(publicInputs.returnsHash);
|
|
80
80
|
|
|
81
81
|
const newNotes = privateExecutionOracle.getNewNotes();
|
|
82
82
|
const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
|
|
83
83
|
const offchainEffects = privateExecutionOracle.getOffchainEffects();
|
|
84
|
-
const
|
|
84
|
+
const taggingIndexRanges = privateExecutionOracle.getUsedTaggingIndexRanges();
|
|
85
85
|
const nestedExecutionResults = privateExecutionOracle.getNestedExecutionResults();
|
|
86
86
|
|
|
87
87
|
let timerSubtractionList = nestedExecutionResults;
|
|
@@ -103,8 +103,8 @@ export async function executePrivateFunction(
|
|
|
103
103
|
newNotes,
|
|
104
104
|
noteHashNullifierCounterMap,
|
|
105
105
|
rawReturnValues,
|
|
106
|
-
offchainEffects,
|
|
107
|
-
|
|
106
|
+
offchainEffects.map(e => ({ data: e.data })),
|
|
107
|
+
taggingIndexRanges,
|
|
108
108
|
nestedExecutionResults,
|
|
109
109
|
contractClassLogs,
|
|
110
110
|
{
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
15
15
|
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
16
16
|
import { PrivateContextInputs } from '@aztec/stdlib/kernel';
|
|
17
|
-
import { type ContractClassLog, ExtendedDirectionalAppTaggingSecret, type
|
|
17
|
+
import { type ContractClassLog, ExtendedDirectionalAppTaggingSecret, type TaggingIndexRange } from '@aztec/stdlib/logs';
|
|
18
18
|
import { Tag } from '@aztec/stdlib/logs';
|
|
19
19
|
import { Note, type NoteStatus } from '@aztec/stdlib/note';
|
|
20
20
|
import {
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
} from '@aztec/stdlib/tx';
|
|
27
27
|
|
|
28
28
|
import type { AccessScopes } from '../../access_scopes.js';
|
|
29
|
-
import type { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
|
|
30
29
|
import { NoteService } from '../../notes/note_service.js';
|
|
31
30
|
import type { SenderTaggingStore } from '../../storage/tagging_store/sender_tagging_store.js';
|
|
32
31
|
import { syncSenderTaggingIndexes } from '../../tagging/index.js';
|
|
@@ -49,7 +48,6 @@ export type PrivateExecutionOracleArgs = Omit<UtilityExecutionOracleArgs, 'contr
|
|
|
49
48
|
noteCache: ExecutionNoteCache;
|
|
50
49
|
taggingIndexCache: ExecutionTaggingIndexCache;
|
|
51
50
|
senderTaggingStore: SenderTaggingStore;
|
|
52
|
-
contractSyncService: ContractSyncService;
|
|
53
51
|
totalPublicCalldataCount?: number;
|
|
54
52
|
sideEffectCounter?: number;
|
|
55
53
|
senderForTags?: AztecAddress;
|
|
@@ -73,7 +71,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
73
71
|
private newNotes: NoteAndSlot[] = [];
|
|
74
72
|
private noteHashNullifierCounterMap: Map<number, number> = new Map();
|
|
75
73
|
private contractClassLogs: CountedContractClassLog[] = [];
|
|
76
|
-
private offchainEffects: { data: Fr[] }[] = [];
|
|
77
74
|
private nestedExecutionResults: PrivateCallExecutionResult[] = [];
|
|
78
75
|
|
|
79
76
|
private readonly argsHash: Fr;
|
|
@@ -84,7 +81,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
84
81
|
private readonly noteCache: ExecutionNoteCache;
|
|
85
82
|
private readonly taggingIndexCache: ExecutionTaggingIndexCache;
|
|
86
83
|
private readonly senderTaggingStore: SenderTaggingStore;
|
|
87
|
-
private readonly contractSyncService: ContractSyncService;
|
|
88
84
|
private totalPublicCalldataCount: number;
|
|
89
85
|
protected sideEffectCounter: number;
|
|
90
86
|
private senderForTags?: AztecAddress;
|
|
@@ -104,7 +100,6 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
104
100
|
this.noteCache = args.noteCache;
|
|
105
101
|
this.taggingIndexCache = args.taggingIndexCache;
|
|
106
102
|
this.senderTaggingStore = args.senderTaggingStore;
|
|
107
|
-
this.contractSyncService = args.contractSyncService;
|
|
108
103
|
this.totalPublicCalldataCount = args.totalPublicCalldataCount ?? 0;
|
|
109
104
|
this.sideEffectCounter = args.sideEffectCounter ?? 0;
|
|
110
105
|
this.senderForTags = args.senderForTags;
|
|
@@ -159,17 +154,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
159
154
|
}
|
|
160
155
|
|
|
161
156
|
/**
|
|
162
|
-
*
|
|
157
|
+
* Returns the tagging index ranges that were used in this execution (and that need to be stored in the db).
|
|
163
158
|
*/
|
|
164
|
-
public
|
|
165
|
-
return this.
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Returns the pre-tags that were used in this execution (and that need to be stored in the db).
|
|
170
|
-
*/
|
|
171
|
-
public getUsedPreTags(): PreTag[] {
|
|
172
|
-
return this.taggingIndexCache.getUsedPreTags();
|
|
159
|
+
public getUsedTaggingIndexRanges(): TaggingIndexRange[] {
|
|
160
|
+
return this.taggingIndexCache.getUsedTaggingIndexRanges();
|
|
173
161
|
}
|
|
174
162
|
|
|
175
163
|
/**
|
|
@@ -189,7 +177,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
189
177
|
* The value persists through nested calls, meaning all calls down the stack will use the same
|
|
190
178
|
* 'senderForTags' value (unless it is replaced).
|
|
191
179
|
*/
|
|
192
|
-
public
|
|
180
|
+
public getSenderForTags(): Promise<AztecAddress | undefined> {
|
|
193
181
|
return Promise.resolve(this.senderForTags);
|
|
194
182
|
}
|
|
195
183
|
|
|
@@ -204,7 +192,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
204
192
|
* through nested calls, meaning all calls down the stack will use the same 'senderForTags'
|
|
205
193
|
* value (unless it is replaced by another call to this setter).
|
|
206
194
|
*/
|
|
207
|
-
public
|
|
195
|
+
public setSenderForTags(senderForTags: AztecAddress): Promise<void> {
|
|
208
196
|
this.senderForTags = senderForTags;
|
|
209
197
|
return Promise.resolve();
|
|
210
198
|
}
|
|
@@ -215,7 +203,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
215
203
|
* @param recipient - The address receiving the log
|
|
216
204
|
* @returns An app tag to be used in a log.
|
|
217
205
|
*/
|
|
218
|
-
public async
|
|
206
|
+
public async getNextAppTagAsSender(sender: AztecAddress, recipient: AztecAddress): Promise<Tag> {
|
|
219
207
|
const extendedSecret = await this.#calculateExtendedDirectionalAppTaggingSecret(
|
|
220
208
|
this.contractAddress,
|
|
221
209
|
sender,
|
|
@@ -223,7 +211,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
223
211
|
);
|
|
224
212
|
|
|
225
213
|
const index = await this.#getIndexToUseForSecret(extendedSecret);
|
|
226
|
-
this.
|
|
214
|
+
this.logger.debug(
|
|
227
215
|
`Incrementing tagging index for sender: ${sender}, recipient: ${recipient}, contract: ${this.contractAddress} to ${index}`,
|
|
228
216
|
);
|
|
229
217
|
this.taggingIndexCache.setLastUsedIndex(extendedSecret, index);
|
|
@@ -277,7 +265,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
277
265
|
* @param values - Values to store.
|
|
278
266
|
* @returns The hash of the values.
|
|
279
267
|
*/
|
|
280
|
-
public
|
|
268
|
+
public storeInExecutionCache(values: Fr[], hash: Fr) {
|
|
281
269
|
return this.executionCache.store(values, hash);
|
|
282
270
|
}
|
|
283
271
|
|
|
@@ -286,7 +274,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
286
274
|
* @param hash - Hash of the values.
|
|
287
275
|
* @returns The values.
|
|
288
276
|
*/
|
|
289
|
-
public
|
|
277
|
+
public loadFromExecutionCache(hash: Fr): Promise<Fr[]> {
|
|
290
278
|
const preimage = this.executionCache.getPreimage(hash);
|
|
291
279
|
if (!preimage) {
|
|
292
280
|
throw new Error(`Preimage for hash ${hash.toString()} not found in cache`);
|
|
@@ -294,12 +282,12 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
294
282
|
return Promise.resolve(preimage);
|
|
295
283
|
}
|
|
296
284
|
|
|
297
|
-
override async
|
|
285
|
+
override async checkNullifierExists(innerNullifier: Fr): Promise<boolean> {
|
|
298
286
|
// This oracle must be overridden because while utility execution can only meaningfully check if a nullifier exists
|
|
299
287
|
// in the synched block, during private execution there's also the possibility of it being pending, i.e. created
|
|
300
288
|
// in the current transaction.
|
|
301
289
|
|
|
302
|
-
this.
|
|
290
|
+
this.logger.debug(`Checking existence of inner nullifier ${innerNullifier}`, {
|
|
303
291
|
contractAddress: this.contractAddress,
|
|
304
292
|
});
|
|
305
293
|
|
|
@@ -307,7 +295,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
307
295
|
|
|
308
296
|
return (
|
|
309
297
|
this.noteCache.getNullifiers(this.contractAddress).has(nullifier) ||
|
|
310
|
-
(await super.
|
|
298
|
+
(await super.checkNullifierExists(innerNullifier))
|
|
311
299
|
);
|
|
312
300
|
}
|
|
313
301
|
|
|
@@ -332,7 +320,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
332
320
|
* @param status - The status of notes to fetch.
|
|
333
321
|
* @returns Array of note data.
|
|
334
322
|
*/
|
|
335
|
-
public override async
|
|
323
|
+
public override async getNotes(
|
|
336
324
|
owner: AztecAddress | undefined,
|
|
337
325
|
storageSlot: Fr,
|
|
338
326
|
numSelects: number,
|
|
@@ -378,7 +366,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
378
366
|
offset,
|
|
379
367
|
});
|
|
380
368
|
|
|
381
|
-
this.
|
|
369
|
+
this.logger.debug(
|
|
382
370
|
`Returning ${notes.length} notes for ${this.callContext.contractAddress} at ${storageSlot}: ${notes
|
|
383
371
|
.map(n => `${n.noteNonce.toString()}:[${n.note.items.map(i => i.toString()).join(',')}]`)
|
|
384
372
|
.join(', ')}`,
|
|
@@ -398,7 +386,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
398
386
|
* @param noteHash - A hash of the new note.
|
|
399
387
|
* @returns
|
|
400
388
|
*/
|
|
401
|
-
public
|
|
389
|
+
public notifyCreatedNote(
|
|
402
390
|
owner: AztecAddress,
|
|
403
391
|
storageSlot: Fr,
|
|
404
392
|
randomness: Fr,
|
|
@@ -407,7 +395,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
407
395
|
noteHash: Fr,
|
|
408
396
|
counter: number,
|
|
409
397
|
) {
|
|
410
|
-
this.
|
|
398
|
+
this.logger.debug(`Notified of new note with inner hash ${noteHash}`, {
|
|
411
399
|
contractAddress: this.callContext.contractAddress,
|
|
412
400
|
storageSlot,
|
|
413
401
|
randomness,
|
|
@@ -439,7 +427,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
439
427
|
* @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
|
|
440
428
|
* @param noteHash - A hash of the new note.
|
|
441
429
|
*/
|
|
442
|
-
public async
|
|
430
|
+
public async notifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number) {
|
|
443
431
|
const nullifiedNoteHashCounter = await this.noteCache.nullifyNote(
|
|
444
432
|
this.callContext.contractAddress,
|
|
445
433
|
innerNullifier,
|
|
@@ -456,19 +444,19 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
456
444
|
* @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
|
|
457
445
|
* @param noteHash - A hash of the new note.
|
|
458
446
|
*/
|
|
459
|
-
public
|
|
460
|
-
this.
|
|
447
|
+
public notifyCreatedNullifier(innerNullifier: Fr) {
|
|
448
|
+
this.logger.debug(`Notified of new inner nullifier ${innerNullifier}`, { contractAddress: this.contractAddress });
|
|
461
449
|
return this.noteCache.nullifierCreated(this.callContext.contractAddress, innerNullifier);
|
|
462
450
|
}
|
|
463
451
|
|
|
464
452
|
/**
|
|
465
|
-
* Check if a nullifier has been emitted in the same transaction, i.e. if
|
|
453
|
+
* Check if a nullifier has been emitted in the same transaction, i.e. if notifyCreatedNullifier has been
|
|
466
454
|
* called for this inner nullifier from the contract with the specified address.
|
|
467
455
|
* @param innerNullifier - The inner nullifier to check.
|
|
468
456
|
* @param contractAddress - Address of the contract that emitted the nullifier.
|
|
469
457
|
* @returns A boolean indicating whether the nullifier is pending or not.
|
|
470
458
|
*/
|
|
471
|
-
public async
|
|
459
|
+
public async isNullifierPending(innerNullifier: Fr, contractAddress: AztecAddress): Promise<boolean> {
|
|
472
460
|
const siloedNullifier = await siloNullifier(contractAddress, innerNullifier);
|
|
473
461
|
const isNullifierPending = this.noteCache.getNullifiers(contractAddress).has(siloedNullifier.toBigInt());
|
|
474
462
|
return Promise.resolve(isNullifierPending);
|
|
@@ -481,10 +469,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
481
469
|
* @param log - The contract class log to be emitted.
|
|
482
470
|
* @param counter - The contract class log's counter.
|
|
483
471
|
*/
|
|
484
|
-
public
|
|
472
|
+
public notifyCreatedContractClassLog(log: ContractClassLog, counter: number) {
|
|
485
473
|
this.contractClassLogs.push(new CountedContractClassLog(log, counter));
|
|
486
474
|
const text = log.toBuffer().toString('hex');
|
|
487
|
-
this.
|
|
475
|
+
this.logger.verbose(
|
|
488
476
|
`Emitted log from ContractClassRegistry: "${text.length > 100 ? text.slice(0, 100) + '...' : text}"`,
|
|
489
477
|
);
|
|
490
478
|
}
|
|
@@ -510,7 +498,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
510
498
|
* @param isStaticCall - Whether the call is a static call.
|
|
511
499
|
* @returns The execution result.
|
|
512
500
|
*/
|
|
513
|
-
async
|
|
501
|
+
async callPrivateFunction(
|
|
514
502
|
targetContractAddress: AztecAddress,
|
|
515
503
|
functionSelector: FunctionSelector,
|
|
516
504
|
argsHash: Fr,
|
|
@@ -524,7 +512,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
524
512
|
}
|
|
525
513
|
|
|
526
514
|
const simulatorSetupTimer = new Timer();
|
|
527
|
-
this.
|
|
515
|
+
this.logger.debug(
|
|
528
516
|
`Calling private function ${targetContractAddress}:${functionSelector} from ${this.callContext.contractAddress}`,
|
|
529
517
|
);
|
|
530
518
|
|
|
@@ -569,11 +557,12 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
569
557
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
570
558
|
capsuleStore: this.capsuleStore,
|
|
571
559
|
privateEventStore: this.privateEventStore,
|
|
560
|
+
messageContextService: this.messageContextService,
|
|
572
561
|
contractSyncService: this.contractSyncService,
|
|
573
562
|
jobId: this.jobId,
|
|
574
563
|
totalPublicCalldataCount: this.totalPublicCalldataCount,
|
|
575
564
|
sideEffectCounter,
|
|
576
|
-
log: this.
|
|
565
|
+
log: this.logger,
|
|
577
566
|
scopes: this.scopes,
|
|
578
567
|
senderForTags: this.senderForTags,
|
|
579
568
|
simulator: this.simulator!,
|
|
@@ -608,7 +597,8 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
608
597
|
};
|
|
609
598
|
}
|
|
610
599
|
|
|
611
|
-
|
|
600
|
+
/** Validates the calldata preimage exists in the cache and checks cumulative calldata size is within limits. */
|
|
601
|
+
public validatePublicCalldata(calldataHash: Fr) {
|
|
612
602
|
const calldata = this.executionCache.getPreimage(calldataHash);
|
|
613
603
|
if (!calldata) {
|
|
614
604
|
throw new Error('Calldata for public call not found in cache');
|
|
@@ -618,47 +608,14 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
618
608
|
if (this.totalPublicCalldataCount > MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS) {
|
|
619
609
|
throw new Error(`Too many total args to all enqueued public calls! (> ${MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS})`);
|
|
620
610
|
}
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Verify relevant information when a public function is enqueued.
|
|
625
|
-
* @param targetContractAddress - The address of the contract to call.
|
|
626
|
-
* @param calldataHash - The hash of the function selector and arguments.
|
|
627
|
-
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
628
|
-
* @param isStaticCall - Whether the call is a static call.
|
|
629
|
-
*/
|
|
630
|
-
public privateNotifyEnqueuedPublicFunctionCall(
|
|
631
|
-
_targetContractAddress: AztecAddress,
|
|
632
|
-
calldataHash: Fr,
|
|
633
|
-
_sideEffectCounter: number,
|
|
634
|
-
_isStaticCall: boolean,
|
|
635
|
-
) {
|
|
636
|
-
this.#onNewPublicFunctionCall(calldataHash);
|
|
637
611
|
return Promise.resolve();
|
|
638
612
|
}
|
|
639
613
|
|
|
640
|
-
|
|
641
|
-
* Verify relevant information when a public teardown function is set.
|
|
642
|
-
* @param targetContractAddress - The address of the contract to call.
|
|
643
|
-
* @param argsHash - The arguments hash to pass to the function.
|
|
644
|
-
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
645
|
-
* @param isStaticCall - Whether the call is a static call.
|
|
646
|
-
*/
|
|
647
|
-
public privateNotifySetPublicTeardownFunctionCall(
|
|
648
|
-
_targetContractAddress: AztecAddress,
|
|
649
|
-
calldataHash: Fr,
|
|
650
|
-
_sideEffectCounter: number,
|
|
651
|
-
_isStaticCall: boolean,
|
|
652
|
-
) {
|
|
653
|
-
this.#onNewPublicFunctionCall(calldataHash);
|
|
654
|
-
return Promise.resolve();
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
public privateNotifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void> {
|
|
614
|
+
public notifyRevertiblePhaseStart(minRevertibleSideEffectCounter: number): Promise<void> {
|
|
658
615
|
return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
|
|
659
616
|
}
|
|
660
617
|
|
|
661
|
-
public
|
|
618
|
+
public inRevertiblePhase(sideEffectCounter: number): Promise<boolean> {
|
|
662
619
|
return Promise.resolve(this.noteCache.isSideEffectCounterRevertible(sideEffectCounter));
|
|
663
620
|
}
|
|
664
621
|
|
|
@@ -685,9 +642,4 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle implements IP
|
|
|
685
642
|
public getDebugFunctionName() {
|
|
686
643
|
return this.contractStore.getDebugFunctionName(this.contractAddress, this.callContext.functionSelector);
|
|
687
644
|
}
|
|
688
|
-
|
|
689
|
-
public utilityEmitOffchainEffect(data: Fr[]): Promise<void> {
|
|
690
|
-
this.offchainEffects.push({ data });
|
|
691
|
-
return Promise.resolve();
|
|
692
|
-
}
|
|
693
645
|
}
|