@aztec/pxe 1.2.1 → 2.0.0-nightly.20250813
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/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +5 -2
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +48 -29
- package/dest/contract_function_simulator/index.d.ts +1 -0
- 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 +1 -1
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts +22 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.d.ts.map +1 -0
- package/dest/contract_function_simulator/oracle/note_packing_utils.js +49 -0
- package/dest/contract_function_simulator/oracle/oracle.d.ts +44 -43
- package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/oracle.js +127 -106
- package/dest/contract_function_simulator/oracle/private_execution.d.ts +7 -2
- package/dest/contract_function_simulator/oracle/private_execution.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution.js +16 -11
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +41 -17
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +51 -23
- package/dest/contract_function_simulator/oracle/typed_oracle.d.ts +48 -47
- package/dest/contract_function_simulator/oracle/typed_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/typed_oracle.js +89 -87
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +31 -30
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +33 -30
- package/dest/contract_function_simulator/pxe_oracle_interface.d.ts.map +1 -1
- package/dest/contract_function_simulator/pxe_oracle_interface.js +6 -7
- package/dest/entrypoints/server/utils.d.ts +4 -2
- package/dest/entrypoints/server/utils.d.ts.map +1 -1
- package/dest/entrypoints/server/utils.js +4 -2
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts +4 -4
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.d.ts.map +1 -1
- package/dest/private_kernel/hints/build_private_kernel_reset_private_inputs.js +58 -59
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts +4 -0
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.d.ts.map +1 -0
- package/dest/private_kernel/hints/compute_tx_include_by_timestamp.js +41 -0
- package/dest/private_kernel/hints/index.d.ts +1 -0
- package/dest/private_kernel/hints/index.d.ts.map +1 -1
- package/dest/private_kernel/hints/index.js +1 -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 +13 -4
- package/dest/private_kernel/private_kernel_oracle.d.ts +1 -1
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle_impl.js +6 -6
- package/dest/pxe_service/error_enriching.d.ts.map +1 -1
- package/dest/pxe_service/error_enriching.js +1 -0
- package/dest/pxe_service/pxe_service.d.ts +3 -2
- package/dest/pxe_service/pxe_service.d.ts.map +1 -1
- package/dest/pxe_service/pxe_service.js +28 -19
- package/dest/storage/capsule_data_provider/capsule_data_provider.js +1 -1
- package/dest/storage/note_data_provider/note_data_provider.d.ts.map +1 -1
- package/dest/storage/note_data_provider/note_data_provider.js +16 -4
- package/package.json +16 -16
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +67 -37
- package/src/contract_function_simulator/index.ts +1 -0
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/note_packing_utils.ts +52 -0
- package/src/contract_function_simulator/oracle/oracle.ts +149 -111
- package/src/contract_function_simulator/oracle/private_execution.ts +17 -12
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +60 -24
- package/src/contract_function_simulator/oracle/typed_oracle.ts +108 -92
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +34 -30
- package/src/contract_function_simulator/pxe_oracle_interface.ts +6 -8
- package/src/entrypoints/server/utils.ts +17 -6
- package/src/private_kernel/hints/build_private_kernel_reset_private_inputs.ts +106 -104
- package/src/private_kernel/hints/compute_tx_include_by_timestamp.ts +58 -0
- package/src/private_kernel/hints/index.ts +1 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +21 -4
- package/src/private_kernel/private_kernel_oracle.ts +1 -1
- package/src/private_kernel/private_kernel_oracle_impl.ts +12 -9
- package/src/pxe_service/error_enriching.ts +1 -0
- package/src/pxe_service/pxe_service.ts +30 -32
- package/src/storage/capsule_data_provider/capsule_data_provider.ts +1 -1
- package/src/storage/note_data_provider/note_data_provider.ts +27 -16
|
@@ -19,9 +19,9 @@ import {
|
|
|
19
19
|
} from '@aztec/stdlib/abi';
|
|
20
20
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
21
21
|
import type { ContractInstance } from '@aztec/stdlib/contract';
|
|
22
|
+
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
22
23
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
23
24
|
import { PrivateCircuitPublicInputs } from '@aztec/stdlib/kernel';
|
|
24
|
-
import { SharedMutableValues, SharedMutableValuesWithHash } from '@aztec/stdlib/shared-mutable';
|
|
25
25
|
import type { CircuitWitnessGenerationStats } from '@aztec/stdlib/stats';
|
|
26
26
|
import { BlockHeader, PrivateCallExecutionResult } from '@aztec/stdlib/tx';
|
|
27
27
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
@@ -32,6 +32,11 @@ import type { PrivateExecutionOracle } from './private_execution_oracle.js';
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Execute a private function and return the execution result.
|
|
35
|
+
* This does not execute any kernel circuits; only the user functions.
|
|
36
|
+
*
|
|
37
|
+
* If this private function execution results in any nested private function calls,
|
|
38
|
+
* those nested calls are made via oracle calls to the `privateCallPrivateFunction` oracle,
|
|
39
|
+
* which in turn makes corresponding further calls to this function.
|
|
35
40
|
*/
|
|
36
41
|
export async function executePrivateFunction(
|
|
37
42
|
simulator: CircuitSimulator,
|
|
@@ -77,21 +82,21 @@ export async function executePrivateFunction(
|
|
|
77
82
|
|
|
78
83
|
const contractClassLogs = privateExecutionOracle.getContractClassLogs();
|
|
79
84
|
|
|
80
|
-
const rawReturnValues = await privateExecutionOracle.
|
|
85
|
+
const rawReturnValues = await privateExecutionOracle.privateLoadFromExecutionCache(publicInputs.returnsHash);
|
|
81
86
|
|
|
82
87
|
const noteHashLeafIndexMap = privateExecutionOracle.getNoteHashLeafIndexMap();
|
|
83
88
|
const newNotes = privateExecutionOracle.getNewNotes();
|
|
84
89
|
const noteHashNullifierCounterMap = privateExecutionOracle.getNoteHashNullifierCounterMap();
|
|
85
90
|
const offchainEffects = privateExecutionOracle.getOffchainEffects();
|
|
86
|
-
const
|
|
91
|
+
const nestedExecutionResults = privateExecutionOracle.getNestedExecutionResults();
|
|
87
92
|
|
|
88
|
-
let timerSubtractionList =
|
|
93
|
+
let timerSubtractionList = nestedExecutionResults;
|
|
89
94
|
let witgenTime = duration;
|
|
90
95
|
|
|
91
96
|
// Due to the recursive nature of execution, we have to subtract the time taken by nested calls
|
|
92
97
|
while (timerSubtractionList.length > 0) {
|
|
93
98
|
witgenTime -= timerSubtractionList.reduce((acc, nested) => acc + (nested.profileResult?.timings.witgen ?? 0), 0);
|
|
94
|
-
timerSubtractionList = timerSubtractionList.flatMap(nested => nested.
|
|
99
|
+
timerSubtractionList = timerSubtractionList.flatMap(nested => nested.nestedExecutionResults ?? []);
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
log.debug(`Returning from call to ${contractAddress.toString()}:${functionSelector}`);
|
|
@@ -106,7 +111,7 @@ export async function executePrivateFunction(
|
|
|
106
111
|
noteHashNullifierCounterMap,
|
|
107
112
|
rawReturnValues,
|
|
108
113
|
offchainEffects,
|
|
109
|
-
|
|
114
|
+
nestedExecutionResults,
|
|
110
115
|
contractClassLogs,
|
|
111
116
|
{
|
|
112
117
|
timings: {
|
|
@@ -147,8 +152,8 @@ export function extractPrivateCircuitPublicInputs(
|
|
|
147
152
|
* @param contractAddress - The address of the contract to read the class id for.
|
|
148
153
|
* @param instance - The instance of the contract.
|
|
149
154
|
* @param executionDataProvider - The execution data provider.
|
|
150
|
-
* @param blockNumber - The block number at which to load the
|
|
151
|
-
* @param timestamp - The timestamp at which to obtain the class id from the
|
|
155
|
+
* @param blockNumber - The block number at which to load the DelayedPublicMutable storing the class id.
|
|
156
|
+
* @param timestamp - The timestamp at which to obtain the class id from the DelayedPublicMutable.
|
|
152
157
|
* @returns The current class id.
|
|
153
158
|
*/
|
|
154
159
|
export async function readCurrentClassId(
|
|
@@ -158,11 +163,11 @@ export async function readCurrentClassId(
|
|
|
158
163
|
blockNumber: number,
|
|
159
164
|
timestamp: UInt64,
|
|
160
165
|
) {
|
|
161
|
-
const {
|
|
162
|
-
const
|
|
163
|
-
executionDataProvider.getPublicStorageAt(blockNumber, ProtocolContractAddress.
|
|
166
|
+
const { delayedPublicMutableSlot } = await DelayedPublicMutableValuesWithHash.getContractUpdateSlots(contractAddress);
|
|
167
|
+
const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(delayedPublicMutableSlot, slot =>
|
|
168
|
+
executionDataProvider.getPublicStorageAt(blockNumber, ProtocolContractAddress.ContractInstanceRegistry, slot),
|
|
164
169
|
);
|
|
165
|
-
let currentClassId =
|
|
170
|
+
let currentClassId = delayedPublicMutableValues.svc.getCurrentAt(timestamp)[0];
|
|
166
171
|
if (currentClassId.isZero()) {
|
|
167
172
|
currentClassId = instance.originalContractClassId;
|
|
168
173
|
}
|
|
@@ -60,7 +60,8 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
60
60
|
private noteHashNullifierCounterMap: Map<number, number> = new Map();
|
|
61
61
|
private contractClassLogs: CountedContractClassLog[] = [];
|
|
62
62
|
private offchainEffects: { data: Fr[] }[] = [];
|
|
63
|
-
private
|
|
63
|
+
private nestedExecutionResults: PrivateCallExecutionResult[] = [];
|
|
64
|
+
private senderForTags?: AztecAddress;
|
|
64
65
|
|
|
65
66
|
constructor(
|
|
66
67
|
private readonly argsHash: Fr,
|
|
@@ -79,8 +80,10 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
79
80
|
protected sideEffectCounter: number = 0,
|
|
80
81
|
log = createLogger('simulator:client_execution_context'),
|
|
81
82
|
scopes?: AztecAddress[],
|
|
83
|
+
senderForTags?: AztecAddress,
|
|
82
84
|
) {
|
|
83
85
|
super(callContext.contractAddress, authWitnesses, capsules, executionDataProvider, log, scopes);
|
|
86
|
+
this.senderForTags = senderForTags;
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
// We still need this function until we can get user-defined ordering of structs for fn arguments
|
|
@@ -150,8 +153,38 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
150
153
|
/**
|
|
151
154
|
* Return the nested execution results during this execution.
|
|
152
155
|
*/
|
|
153
|
-
public
|
|
154
|
-
return this.
|
|
156
|
+
public getNestedExecutionResults() {
|
|
157
|
+
return this.nestedExecutionResults;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Get the sender for tags.
|
|
162
|
+
*
|
|
163
|
+
* This unconstrained value is used as the sender when computing an unconstrained shared secret
|
|
164
|
+
* for a tag in order to emit a log. Constrained tagging should not use this as there is no
|
|
165
|
+
* guarantee that the recipient knows about the sender, and hence about the shared secret.
|
|
166
|
+
*
|
|
167
|
+
* The value persists through nested calls, meaning all calls down the stack will use the same
|
|
168
|
+
* 'senderForTags' value (unless it is replaced).
|
|
169
|
+
*/
|
|
170
|
+
public override privateGetSenderForTags(): Promise<AztecAddress | undefined> {
|
|
171
|
+
return Promise.resolve(this.senderForTags);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Set the sender for tags.
|
|
176
|
+
*
|
|
177
|
+
* This unconstrained value is used as the sender when computing an unconstrained shared secret
|
|
178
|
+
* for a tag in order to emit a log. Constrained tagging should not use this as there is no
|
|
179
|
+
* guarantee that the recipient knows about the sender, and hence about the shared secret.
|
|
180
|
+
*
|
|
181
|
+
* Account contracts typically set this value before calling other contracts. The value persists
|
|
182
|
+
* through nested calls, meaning all calls down the stack will use the same 'senderForTags'
|
|
183
|
+
* value (unless it is replaced by another call to this setter).
|
|
184
|
+
*/
|
|
185
|
+
public override privateSetSenderForTags(senderForTags: AztecAddress): Promise<void> {
|
|
186
|
+
this.senderForTags = senderForTags;
|
|
187
|
+
return Promise.resolve();
|
|
155
188
|
}
|
|
156
189
|
|
|
157
190
|
/**
|
|
@@ -159,7 +192,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
159
192
|
* @param values - Values to store.
|
|
160
193
|
* @returns The hash of the values.
|
|
161
194
|
*/
|
|
162
|
-
public override
|
|
195
|
+
public override privateStoreInExecutionCache(values: Fr[], hash: Fr) {
|
|
163
196
|
return this.executionCache.store(values, hash);
|
|
164
197
|
}
|
|
165
198
|
|
|
@@ -168,7 +201,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
168
201
|
* @param hash - Hash of the values.
|
|
169
202
|
* @returns The values.
|
|
170
203
|
*/
|
|
171
|
-
public override
|
|
204
|
+
public override privateLoadFromExecutionCache(hash: Fr): Promise<Fr[]> {
|
|
172
205
|
const preimage = this.executionCache.getPreimage(hash);
|
|
173
206
|
if (!preimage) {
|
|
174
207
|
throw new Error(`Preimage for hash ${hash.toString()} not found in cache`);
|
|
@@ -196,7 +229,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
196
229
|
* @param status - The status of notes to fetch.
|
|
197
230
|
* @returns Array of note data.
|
|
198
231
|
*/
|
|
199
|
-
public override async
|
|
232
|
+
public override async utilityGetNotes(
|
|
200
233
|
storageSlot: Fr,
|
|
201
234
|
numSelects: number,
|
|
202
235
|
selectByIndexes: number[],
|
|
@@ -274,7 +307,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
274
307
|
* @param noteHash - A hash of the new note.
|
|
275
308
|
* @returns
|
|
276
309
|
*/
|
|
277
|
-
public override
|
|
310
|
+
public override privateNotifyCreatedNote(
|
|
278
311
|
storageSlot: Fr,
|
|
279
312
|
noteTypeId: NoteSelector,
|
|
280
313
|
noteItems: Fr[],
|
|
@@ -309,7 +342,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
309
342
|
* @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
|
|
310
343
|
* @param noteHash - A hash of the new note.
|
|
311
344
|
*/
|
|
312
|
-
public override async
|
|
345
|
+
public override async privateNotifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number) {
|
|
313
346
|
const nullifiedNoteHashCounter = await this.noteCache.nullifyNote(
|
|
314
347
|
this.callContext.contractAddress,
|
|
315
348
|
innerNullifier,
|
|
@@ -326,7 +359,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
326
359
|
* @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
|
|
327
360
|
* @param noteHash - A hash of the new note.
|
|
328
361
|
*/
|
|
329
|
-
public override
|
|
362
|
+
public override privateNotifyCreatedNullifier(innerNullifier: Fr) {
|
|
330
363
|
return this.noteCache.nullifierCreated(this.callContext.contractAddress, innerNullifier);
|
|
331
364
|
}
|
|
332
365
|
|
|
@@ -337,21 +370,21 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
337
370
|
* @param log - The contract class log to be emitted.
|
|
338
371
|
* @param counter - The contract class log's counter.
|
|
339
372
|
*/
|
|
340
|
-
public override
|
|
373
|
+
public override privateNotifyCreatedContractClassLog(log: ContractClassLog, counter: number) {
|
|
341
374
|
this.contractClassLogs.push(new CountedContractClassLog(log, counter));
|
|
342
375
|
const text = log.toBuffer().toString('hex');
|
|
343
376
|
this.log.verbose(
|
|
344
|
-
`Emitted log from
|
|
377
|
+
`Emitted log from ContractClassRegistry: "${text.length > 100 ? text.slice(0, 100) + '...' : text}"`,
|
|
345
378
|
);
|
|
346
379
|
}
|
|
347
380
|
|
|
348
381
|
#checkValidStaticCall(childExecutionResult: PrivateCallExecutionResult) {
|
|
349
382
|
if (
|
|
350
|
-
childExecutionResult.publicInputs.noteHashes.
|
|
351
|
-
childExecutionResult.publicInputs.nullifiers.
|
|
352
|
-
childExecutionResult.publicInputs.l2ToL1Msgs.
|
|
353
|
-
childExecutionResult.publicInputs.privateLogs.
|
|
354
|
-
childExecutionResult.publicInputs.contractClassLogsHashes.
|
|
383
|
+
childExecutionResult.publicInputs.noteHashes.claimedLength > 0 ||
|
|
384
|
+
childExecutionResult.publicInputs.nullifiers.claimedLength > 0 ||
|
|
385
|
+
childExecutionResult.publicInputs.l2ToL1Msgs.claimedLength > 0 ||
|
|
386
|
+
childExecutionResult.publicInputs.privateLogs.claimedLength > 0 ||
|
|
387
|
+
childExecutionResult.publicInputs.contractClassLogsHashes.claimedLength > 0
|
|
355
388
|
) {
|
|
356
389
|
throw new Error(`Static call cannot update the state, emit L2->L1 messages or generate logs`);
|
|
357
390
|
}
|
|
@@ -366,7 +399,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
366
399
|
* @param isStaticCall - Whether the call is a static call.
|
|
367
400
|
* @returns The execution result.
|
|
368
401
|
*/
|
|
369
|
-
override async
|
|
402
|
+
override async privateCallPrivateFunction(
|
|
370
403
|
targetContractAddress: AztecAddress,
|
|
371
404
|
functionSelector: FunctionSelector,
|
|
372
405
|
argsHash: Fr,
|
|
@@ -406,6 +439,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
406
439
|
sideEffectCounter,
|
|
407
440
|
this.log,
|
|
408
441
|
this.scopes,
|
|
442
|
+
this.senderForTags,
|
|
409
443
|
);
|
|
410
444
|
|
|
411
445
|
const setupTime = simulatorSetupTimer.ms();
|
|
@@ -422,7 +456,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
422
456
|
this.#checkValidStaticCall(childExecutionResult);
|
|
423
457
|
}
|
|
424
458
|
|
|
425
|
-
this.
|
|
459
|
+
this.nestedExecutionResults.push(childExecutionResult);
|
|
426
460
|
|
|
427
461
|
const publicInputs = childExecutionResult.publicInputs;
|
|
428
462
|
|
|
@@ -456,7 +490,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
456
490
|
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
457
491
|
* @param isStaticCall - Whether the call is a static call.
|
|
458
492
|
*/
|
|
459
|
-
public override
|
|
493
|
+
public override privateNotifyEnqueuedPublicFunctionCall(
|
|
460
494
|
_targetContractAddress: AztecAddress,
|
|
461
495
|
calldataHash: Fr,
|
|
462
496
|
_sideEffectCounter: number,
|
|
@@ -473,7 +507,7 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
473
507
|
* @param sideEffectCounter - The side effect counter at the start of the call.
|
|
474
508
|
* @param isStaticCall - Whether the call is a static call.
|
|
475
509
|
*/
|
|
476
|
-
public override
|
|
510
|
+
public override privateNotifySetPublicTeardownFunctionCall(
|
|
477
511
|
_targetContractAddress: AztecAddress,
|
|
478
512
|
calldataHash: Fr,
|
|
479
513
|
_sideEffectCounter: number,
|
|
@@ -483,7 +517,9 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
483
517
|
return Promise.resolve();
|
|
484
518
|
}
|
|
485
519
|
|
|
486
|
-
public override
|
|
520
|
+
public override privateNotifySetMinRevertibleSideEffectCounter(
|
|
521
|
+
minRevertibleSideEffectCounter: number,
|
|
522
|
+
): Promise<void> {
|
|
487
523
|
return this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
|
|
488
524
|
}
|
|
489
525
|
|
|
@@ -511,17 +547,17 @@ export class PrivateExecutionOracle extends UtilityExecutionOracle {
|
|
|
511
547
|
return this.executionDataProvider.getDebugFunctionName(this.contractAddress, this.callContext.functionSelector);
|
|
512
548
|
}
|
|
513
549
|
|
|
514
|
-
public override async
|
|
550
|
+
public override async privateIncrementAppTaggingSecretIndexAsSender(sender: AztecAddress, recipient: AztecAddress) {
|
|
515
551
|
await this.executionDataProvider.incrementAppTaggingSecretIndexAsSender(this.contractAddress, sender, recipient);
|
|
516
552
|
}
|
|
517
553
|
|
|
518
|
-
public override async
|
|
554
|
+
public override async utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr) {
|
|
519
555
|
await this.executionDataProvider.syncTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes);
|
|
520
556
|
|
|
521
557
|
await this.executionDataProvider.removeNullifiedNotes(this.contractAddress);
|
|
522
558
|
}
|
|
523
559
|
|
|
524
|
-
public override
|
|
560
|
+
public override utilityEmitOffchainEffect(data: Fr[]): Promise<void> {
|
|
525
561
|
this.offchainEffects.push({ data });
|
|
526
562
|
return Promise.resolve();
|
|
527
563
|
}
|
|
@@ -16,15 +16,15 @@ import type { MessageLoadOracleInputs } from './message_load_oracle_inputs.js';
|
|
|
16
16
|
* Information about a note needed during execution.
|
|
17
17
|
*/
|
|
18
18
|
export interface NoteData {
|
|
19
|
-
/** The note. */
|
|
19
|
+
/** The actual note content (the fields of the Noir #[note] struct). */
|
|
20
20
|
note: Note;
|
|
21
|
-
/** The
|
|
21
|
+
/** The address of the contract that owns the note. */
|
|
22
22
|
contractAddress: AztecAddress;
|
|
23
23
|
/** The storage slot of the note. */
|
|
24
24
|
storageSlot: Fr;
|
|
25
|
-
/** The nonce
|
|
25
|
+
/** The nonce injected into the note hash preimage by kernels. */
|
|
26
26
|
noteNonce: Fr;
|
|
27
|
-
/** A hash of the note. */
|
|
27
|
+
/** A hash of the note as it gets stored in the note hash tree. */
|
|
28
28
|
noteHash: Fr;
|
|
29
29
|
/** The corresponding nullifier of the note. Undefined for pending notes. */
|
|
30
30
|
siloedNullifier?: Fr;
|
|
@@ -44,78 +44,81 @@ class OracleMethodNotAvailableError extends Error {
|
|
|
44
44
|
* and are unavailable by default.
|
|
45
45
|
*/
|
|
46
46
|
export abstract class TypedOracle {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
utilityGetRandomField(): Fr {
|
|
48
|
+
throw new OracleMethodNotAvailableError('utilityGetRandomField');
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
throw new OracleMethodNotAvailableError('
|
|
51
|
+
privateStoreInExecutionCache(_values: Fr[], _hash: Fr): void {
|
|
52
|
+
throw new OracleMethodNotAvailableError('privateStoreInExecutionCache');
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
55
|
+
privateLoadFromExecutionCache(_hash: Fr): Promise<Fr[]> {
|
|
56
|
+
return Promise.reject(new OracleMethodNotAvailableError('privateLoadFromExecutionCache'));
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
59
|
+
utilityGetBlockNumber(): Promise<number> {
|
|
60
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetBlockNumber'));
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
63
|
+
utilityGetTimestamp(): Promise<UInt64> {
|
|
64
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetTimestamp'));
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
67
|
+
utilityGetContractAddress(): Promise<AztecAddress> {
|
|
68
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetContractAddress'));
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
71
|
+
utilityGetChainId(): Promise<Fr> {
|
|
72
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetChainId'));
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
75
|
+
utilityGetVersion(): Promise<Fr> {
|
|
76
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetVersion'));
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
79
|
+
utilityGetKeyValidationRequest(_pkMHash: Fr): Promise<KeyValidationRequest> {
|
|
80
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetKeyValidationRequest'));
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
83
|
+
utilityGetContractInstance(_address: AztecAddress): Promise<ContractInstance> {
|
|
84
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetContractInstance'));
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
87
|
+
utilityGetMembershipWitness(_blockNumber: number, _treeId: MerkleTreeId, _leafValue: Fr): Promise<Fr[] | undefined> {
|
|
88
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetMembershipWitness'));
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
utilityGetNullifierMembershipWitness(
|
|
92
|
+
_blockNumber: number,
|
|
93
|
+
_nullifier: Fr,
|
|
94
|
+
): Promise<NullifierMembershipWitness | undefined> {
|
|
95
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetNullifierMembershipWitness'));
|
|
93
96
|
}
|
|
94
97
|
|
|
95
|
-
|
|
96
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
98
|
+
utilityGetPublicDataWitness(_blockNumber: number, _leafSlot: Fr): Promise<PublicDataWitness | undefined> {
|
|
99
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetPublicDataWitness'));
|
|
97
100
|
}
|
|
98
101
|
|
|
99
|
-
|
|
102
|
+
utilityGetLowNullifierMembershipWitness(
|
|
100
103
|
_blockNumber: number,
|
|
101
104
|
_nullifier: Fr,
|
|
102
105
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
103
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
106
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetLowNullifierMembershipWitness'));
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
|
|
107
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
109
|
+
utilityGetBlockHeader(_blockNumber: number): Promise<BlockHeader | undefined> {
|
|
110
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetBlockHeader'));
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
|
|
111
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
113
|
+
utilityGetCompleteAddress(_account: AztecAddress): Promise<CompleteAddress> {
|
|
114
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetCompleteAddress'));
|
|
112
115
|
}
|
|
113
116
|
|
|
114
|
-
|
|
115
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
117
|
+
utilityGetAuthWitness(_messageHash: Fr): Promise<Fr[] | undefined> {
|
|
118
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetAuthWitness'));
|
|
116
119
|
}
|
|
117
120
|
|
|
118
|
-
|
|
121
|
+
utilityGetNotes(
|
|
119
122
|
_storageSlot: Fr,
|
|
120
123
|
_numSelects: number,
|
|
121
124
|
_selectByIndexes: number[],
|
|
@@ -131,139 +134,152 @@ export abstract class TypedOracle {
|
|
|
131
134
|
_offset: number,
|
|
132
135
|
_status: NoteStatus,
|
|
133
136
|
): Promise<NoteData[]> {
|
|
134
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
137
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetNotes'));
|
|
135
138
|
}
|
|
136
139
|
|
|
137
|
-
|
|
138
|
-
|
|
140
|
+
privateNotifyCreatedNote(
|
|
141
|
+
_storageSlot: Fr,
|
|
142
|
+
_noteTypeId: NoteSelector,
|
|
143
|
+
_note: Fr[],
|
|
144
|
+
_noteHash: Fr,
|
|
145
|
+
_counter: number,
|
|
146
|
+
): void {
|
|
147
|
+
throw new OracleMethodNotAvailableError('privateNotifyCreatedNote');
|
|
139
148
|
}
|
|
140
149
|
|
|
141
|
-
|
|
142
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
150
|
+
privateNotifyNullifiedNote(_innerNullifier: Fr, _noteHash: Fr, _counter: number): Promise<void> {
|
|
151
|
+
return Promise.reject(new OracleMethodNotAvailableError('privateNotifyNullifiedNote'));
|
|
143
152
|
}
|
|
144
153
|
|
|
145
|
-
|
|
146
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
154
|
+
privateNotifyCreatedNullifier(_innerNullifier: Fr): Promise<void> {
|
|
155
|
+
return Promise.reject(new OracleMethodNotAvailableError('privateNotifyCreatedNullifier'));
|
|
147
156
|
}
|
|
148
157
|
|
|
149
|
-
|
|
150
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
158
|
+
utilityCheckNullifierExists(_innerNullifier: Fr): Promise<boolean> {
|
|
159
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityCheckNullifierExists'));
|
|
151
160
|
}
|
|
152
161
|
|
|
153
|
-
|
|
162
|
+
utilityGetL1ToL2MembershipWitness(
|
|
154
163
|
_contractAddress: AztecAddress,
|
|
155
164
|
_messageHash: Fr,
|
|
156
165
|
_secret: Fr,
|
|
157
166
|
): Promise<MessageLoadOracleInputs<typeof L1_TO_L2_MSG_TREE_HEIGHT>> {
|
|
158
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
167
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetL1ToL2MembershipWitness'));
|
|
159
168
|
}
|
|
160
169
|
|
|
161
|
-
|
|
170
|
+
utilityStorageRead(
|
|
162
171
|
_contractAddress: AztecAddress,
|
|
163
172
|
_startStorageSlot: Fr,
|
|
164
173
|
_blockNumber: number,
|
|
165
174
|
_numberOfElements: number,
|
|
166
175
|
): Promise<Fr[]> {
|
|
167
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
storageWrite(_startStorageSlot: Fr, _values: Fr[]): Promise<Fr[]> {
|
|
171
|
-
return Promise.reject(new OracleMethodNotAvailableError('storageWrite'));
|
|
176
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityStorageRead'));
|
|
172
177
|
}
|
|
173
178
|
|
|
174
|
-
|
|
175
|
-
throw new OracleMethodNotAvailableError('
|
|
179
|
+
privateNotifyCreatedContractClassLog(_log: ContractClassLog, _counter: number): void {
|
|
180
|
+
throw new OracleMethodNotAvailableError('privateNotifyCreatedContractClassLog');
|
|
176
181
|
}
|
|
177
182
|
|
|
178
|
-
|
|
183
|
+
privateCallPrivateFunction(
|
|
179
184
|
_targetContractAddress: AztecAddress,
|
|
180
185
|
_functionSelector: FunctionSelector,
|
|
181
186
|
_argsHash: Fr,
|
|
182
187
|
_sideEffectCounter: number,
|
|
183
188
|
_isStaticCall: boolean,
|
|
184
189
|
): Promise<{ endSideEffectCounter: Fr; returnsHash: Fr }> {
|
|
185
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
190
|
+
return Promise.reject(new OracleMethodNotAvailableError('privateCallPrivateFunction'));
|
|
186
191
|
}
|
|
187
192
|
|
|
188
|
-
|
|
193
|
+
privateNotifyEnqueuedPublicFunctionCall(
|
|
189
194
|
_targetContractAddress: AztecAddress,
|
|
190
195
|
_calldataHash: Fr,
|
|
191
196
|
_sideEffectCounter: number,
|
|
192
197
|
_isStaticCall: boolean,
|
|
193
198
|
): Promise<void> {
|
|
194
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
199
|
+
return Promise.reject(new OracleMethodNotAvailableError('privateNotifyEnqueuedPublicFunctionCall'));
|
|
195
200
|
}
|
|
196
201
|
|
|
197
|
-
|
|
202
|
+
privateNotifySetPublicTeardownFunctionCall(
|
|
198
203
|
_targetContractAddress: AztecAddress,
|
|
199
204
|
_calldataHash: Fr,
|
|
200
205
|
_sideEffectCounter: number,
|
|
201
206
|
_isStaticCall: boolean,
|
|
202
207
|
): Promise<void> {
|
|
203
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
208
|
+
return Promise.reject(new OracleMethodNotAvailableError('privateNotifySetPublicTeardownFunctionCall'));
|
|
204
209
|
}
|
|
205
210
|
|
|
206
|
-
|
|
207
|
-
throw new OracleMethodNotAvailableError('
|
|
211
|
+
privateNotifySetMinRevertibleSideEffectCounter(_minRevertibleSideEffectCounter: number): Promise<void> {
|
|
212
|
+
throw new OracleMethodNotAvailableError('privateNotifySetMinRevertibleSideEffectCounter');
|
|
208
213
|
}
|
|
209
214
|
|
|
210
|
-
|
|
211
|
-
throw new OracleMethodNotAvailableError('
|
|
215
|
+
utilityDebugLog(_message: string, _fields: Fr[]): void {
|
|
216
|
+
throw new OracleMethodNotAvailableError('utilityDebugLog');
|
|
212
217
|
}
|
|
213
218
|
|
|
214
|
-
|
|
215
|
-
|
|
219
|
+
utilityGetIndexedTaggingSecretAsSender(
|
|
220
|
+
_sender: AztecAddress,
|
|
221
|
+
_recipient: AztecAddress,
|
|
222
|
+
): Promise<IndexedTaggingSecret> {
|
|
223
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetIndexedTaggingSecretAsSender'));
|
|
216
224
|
}
|
|
217
225
|
|
|
218
|
-
|
|
219
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
226
|
+
privateIncrementAppTaggingSecretIndexAsSender(_sender: AztecAddress, _recipient: AztecAddress): Promise<void> {
|
|
227
|
+
return Promise.reject(new OracleMethodNotAvailableError('privateIncrementAppTaggingSecretIndexAsSender'));
|
|
220
228
|
}
|
|
221
229
|
|
|
222
|
-
|
|
223
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
230
|
+
utilityFetchTaggedLogs(_pendingTaggedLogArrayBaseSlot: Fr): Promise<void> {
|
|
231
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityFetchTaggedLogs'));
|
|
224
232
|
}
|
|
225
233
|
|
|
226
|
-
|
|
234
|
+
utilityValidateEnqueuedNotesAndEvents(
|
|
227
235
|
_contractAddress: AztecAddress,
|
|
228
236
|
_noteValidationRequestsArrayBaseSlot: Fr,
|
|
229
237
|
_eventValidationRequestsArrayBaseSlot: Fr,
|
|
230
238
|
): Promise<void> {
|
|
231
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
239
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityValidateEnqueuedNotesAndEvents'));
|
|
232
240
|
}
|
|
233
241
|
|
|
234
|
-
|
|
242
|
+
utilityBulkRetrieveLogs(
|
|
235
243
|
_contractAddress: AztecAddress,
|
|
236
244
|
_logRetrievalRequestsArrayBaseSlot: Fr,
|
|
237
245
|
_logRetrievalResponsesArrayBaseSlot: Fr,
|
|
238
246
|
): Promise<void> {
|
|
239
|
-
throw new OracleMethodNotAvailableError('
|
|
247
|
+
throw new OracleMethodNotAvailableError('utilityBulkRetrieveLogs');
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
utilityStoreCapsule(_contractAddress: AztecAddress, _key: Fr, _capsule: Fr[]): Promise<void> {
|
|
251
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityStoreCapsule'));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
utilityLoadCapsule(_contractAddress: AztecAddress, _key: Fr): Promise<Fr[] | null> {
|
|
255
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityLoadCapsule'));
|
|
240
256
|
}
|
|
241
257
|
|
|
242
|
-
|
|
243
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
258
|
+
utilityDeleteCapsule(_contractAddress: AztecAddress, _key: Fr): Promise<void> {
|
|
259
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityDeleteCapsule'));
|
|
244
260
|
}
|
|
245
261
|
|
|
246
|
-
|
|
247
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
262
|
+
utilityCopyCapsule(_contractAddress: AztecAddress, _srcKey: Fr, _dstKey: Fr, _numEntries: number): Promise<void> {
|
|
263
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityCopyCapsule'));
|
|
248
264
|
}
|
|
249
265
|
|
|
250
|
-
|
|
251
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
266
|
+
utilityAes128Decrypt(_ciphertext: Buffer, _iv: Buffer, _symKey: Buffer): Promise<Buffer> {
|
|
267
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityAes128Decrypt'));
|
|
252
268
|
}
|
|
253
269
|
|
|
254
|
-
|
|
255
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
270
|
+
utilityGetSharedSecret(_address: AztecAddress, _ephPk: Point): Promise<Point> {
|
|
271
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityGetSharedSecret'));
|
|
256
272
|
}
|
|
257
273
|
|
|
258
|
-
|
|
259
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
274
|
+
utilityEmitOffchainEffect(_data: Fr[]): Promise<void> {
|
|
275
|
+
return Promise.reject(new OracleMethodNotAvailableError('utilityEmitOffchainEffect'));
|
|
260
276
|
}
|
|
261
277
|
|
|
262
|
-
|
|
263
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
278
|
+
privateGetSenderForTags(): Promise<AztecAddress | undefined> {
|
|
279
|
+
return Promise.reject(new OracleMethodNotAvailableError('privateGetSenderForTags'));
|
|
264
280
|
}
|
|
265
281
|
|
|
266
|
-
|
|
267
|
-
return Promise.reject(new OracleMethodNotAvailableError('
|
|
282
|
+
privateSetSenderForTags(_senderForTags: AztecAddress): Promise<void> {
|
|
283
|
+
return Promise.reject(new OracleMethodNotAvailableError('privateSetSenderForTags'));
|
|
268
284
|
}
|
|
269
285
|
}
|