@aztec/simulator 0.65.2 → 0.67.0
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/acvm/acvm.js +3 -3
- package/dest/acvm/oracle/oracle.d.ts +1 -4
- package/dest/acvm/oracle/oracle.d.ts.map +1 -1
- package/dest/acvm/oracle/oracle.js +3 -19
- package/dest/acvm/oracle/typed_oracle.d.ts +2 -7
- package/dest/acvm/oracle/typed_oracle.d.ts.map +1 -1
- package/dest/acvm/oracle/typed_oracle.js +3 -12
- package/dest/acvm/serialize.js +2 -2
- package/dest/avm/avm_context.d.ts +2 -2
- package/dest/avm/avm_context.d.ts.map +1 -1
- package/dest/avm/avm_context.js +3 -4
- package/dest/avm/avm_execution_environment.d.ts +4 -6
- package/dest/avm/avm_execution_environment.d.ts.map +1 -1
- package/dest/avm/avm_execution_environment.js +8 -13
- package/dest/avm/avm_memory_types.d.ts +2 -2
- package/dest/avm/avm_memory_types.d.ts.map +1 -1
- package/dest/avm/avm_memory_types.js +7 -7
- package/dest/avm/avm_simulator.d.ts +3 -3
- package/dest/avm/avm_simulator.d.ts.map +1 -1
- package/dest/avm/avm_simulator.js +26 -16
- package/dest/avm/avm_tree.d.ts +31 -14
- package/dest/avm/avm_tree.d.ts.map +1 -1
- package/dest/avm/avm_tree.js +34 -40
- package/dest/avm/errors.d.ts +3 -3
- package/dest/avm/errors.d.ts.map +1 -1
- package/dest/avm/errors.js +8 -15
- package/dest/avm/fixtures/index.d.ts.map +1 -1
- package/dest/avm/fixtures/index.js +4 -4
- package/dest/avm/journal/journal.d.ts +15 -4
- package/dest/avm/journal/journal.d.ts.map +1 -1
- package/dest/avm/journal/journal.js +121 -36
- package/dest/avm/opcodes/environment_getters.d.ts +10 -11
- package/dest/avm/opcodes/environment_getters.d.ts.map +1 -1
- package/dest/avm/opcodes/environment_getters.js +12 -15
- package/dest/avm/opcodes/external_calls.d.ts.map +1 -1
- package/dest/avm/opcodes/external_calls.js +4 -11
- package/dest/avm/opcodes/misc.d.ts.map +1 -1
- package/dest/avm/opcodes/misc.js +3 -3
- package/dest/client/client_execution_context.d.ts +6 -33
- package/dest/client/client_execution_context.d.ts.map +1 -1
- package/dest/client/client_execution_context.js +18 -54
- package/dest/client/db_oracle.d.ts +2 -2
- package/dest/client/db_oracle.d.ts.map +1 -1
- package/dest/client/execution_note_cache.d.ts +9 -1
- package/dest/client/execution_note_cache.d.ts.map +1 -1
- package/dest/client/execution_note_cache.js +10 -3
- package/dest/client/private_execution.d.ts.map +1 -1
- package/dest/client/private_execution.js +5 -7
- package/dest/client/simulator.d.ts.map +1 -1
- package/dest/client/simulator.js +4 -4
- package/dest/client/unconstrained_execution.d.ts.map +1 -1
- package/dest/client/unconstrained_execution.js +3 -3
- package/dest/client/view_data_oracle.d.ts +2 -2
- package/dest/client/view_data_oracle.d.ts.map +1 -1
- package/dest/client/view_data_oracle.js +5 -6
- package/dest/common/debug_fn_name.d.ts +2 -2
- package/dest/common/debug_fn_name.d.ts.map +1 -1
- package/dest/common/debug_fn_name.js +8 -14
- package/dest/providers/acvm_native.js +4 -4
- package/dest/providers/factory.d.ts +2 -2
- package/dest/providers/factory.d.ts.map +1 -1
- package/dest/providers/factory.js +4 -4
- package/dest/public/enqueued_call_side_effect_trace.d.ts +11 -23
- package/dest/public/enqueued_call_side_effect_trace.d.ts.map +1 -1
- package/dest/public/enqueued_call_side_effect_trace.js +51 -72
- package/dest/public/executor_metrics.d.ts.map +1 -1
- package/dest/public/executor_metrics.js +2 -5
- package/dest/public/fixtures/index.d.ts +25 -7
- package/dest/public/fixtures/index.d.ts.map +1 -1
- package/dest/public/fixtures/index.js +20 -17
- package/dest/public/index.d.ts +0 -1
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +1 -2
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +30 -16
- package/dest/public/public_processor.d.ts +7 -8
- package/dest/public/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor.js +37 -26
- package/dest/public/public_processor_metrics.d.ts +1 -1
- package/dest/public/public_processor_metrics.d.ts.map +1 -1
- package/dest/public/public_tx_context.d.ts +13 -14
- package/dest/public/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_context.js +63 -54
- package/dest/public/public_tx_simulator.d.ts +2 -2
- package/dest/public/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator.js +43 -25
- package/dest/public/side_effect_trace_interface.d.ts +4 -17
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
- package/dest/public/transitional_adapters.d.ts +2 -6
- package/dest/public/transitional_adapters.d.ts.map +1 -1
- package/dest/public/transitional_adapters.js +29 -88
- package/package.json +16 -9
- package/src/acvm/acvm.ts +2 -2
- package/src/acvm/oracle/oracle.ts +2 -32
- package/src/acvm/oracle/typed_oracle.ts +3 -20
- package/src/acvm/serialize.ts +1 -1
- package/src/avm/avm_context.ts +2 -3
- package/src/avm/avm_execution_environment.ts +6 -31
- package/src/avm/avm_memory_types.ts +6 -6
- package/src/avm/avm_simulator.ts +28 -23
- package/src/avm/avm_tree.ts +67 -53
- package/src/avm/errors.ts +12 -14
- package/src/avm/fixtures/index.ts +2 -3
- package/src/avm/journal/journal.ts +206 -68
- package/src/avm/opcodes/environment_getters.ts +1 -4
- package/src/avm/opcodes/external_calls.ts +3 -19
- package/src/avm/opcodes/misc.ts +2 -2
- package/src/client/client_execution_context.ts +22 -68
- package/src/client/db_oracle.ts +2 -2
- package/src/client/execution_note_cache.ts +13 -3
- package/src/client/private_execution.ts +3 -7
- package/src/client/simulator.ts +4 -4
- package/src/client/unconstrained_execution.ts +2 -2
- package/src/client/view_data_oracle.ts +5 -6
- package/src/common/debug_fn_name.ts +7 -13
- package/src/providers/acvm_native.ts +3 -3
- package/src/providers/factory.ts +3 -3
- package/src/public/enqueued_call_side_effect_trace.ts +68 -90
- package/src/public/executor_metrics.ts +0 -4
- package/src/public/fixtures/index.ts +28 -17
- package/src/public/index.ts +0 -1
- package/src/public/public_db_sources.ts +32 -19
- package/src/public/public_processor.ts +52 -55
- package/src/public/public_processor_metrics.ts +1 -1
- package/src/public/public_tx_context.ts +89 -76
- package/src/public/public_tx_simulator.ts +58 -49
- package/src/public/side_effect_trace_interface.ts +8 -15
- package/src/public/transitional_adapters.ts +43 -215
- package/dest/public/dual_side_effect_trace.d.ts +0 -77
- package/dest/public/dual_side_effect_trace.d.ts.map +0 -1
- package/dest/public/dual_side_effect_trace.js +0 -119
- package/dest/public/side_effect_trace.d.ts +0 -96
- package/dest/public/side_effect_trace.d.ts.map +0 -1
- package/dest/public/side_effect_trace.js +0 -309
- package/src/public/dual_side_effect_trace.ts +0 -242
- package/src/public/side_effect_trace.ts +0 -536
|
@@ -10,16 +10,10 @@ import {
|
|
|
10
10
|
UnencryptedFunctionL2Logs,
|
|
11
11
|
} from '@aztec/circuit-types';
|
|
12
12
|
import { type AvmSimulationStats } from '@aztec/circuit-types/stats';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
Gas,
|
|
16
|
-
type GlobalVariables,
|
|
17
|
-
MAX_L2_GAS_PER_ENQUEUED_CALL,
|
|
18
|
-
type PublicCallRequest,
|
|
19
|
-
type RevertCode,
|
|
20
|
-
} from '@aztec/circuits.js';
|
|
21
|
-
import { type DebugLogger, createDebugLogger } from '@aztec/foundation/log';
|
|
13
|
+
import { type Fr, type Gas, type GlobalVariables, type PublicCallRequest, type RevertCode } from '@aztec/circuits.js';
|
|
14
|
+
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
22
15
|
import { Timer } from '@aztec/foundation/timer';
|
|
16
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
23
17
|
import { Attributes, type TelemetryClient, type Tracer, trackSpan } from '@aztec/telemetry-client';
|
|
24
18
|
|
|
25
19
|
import { strict as assert } from 'assert';
|
|
@@ -29,6 +23,7 @@ import { type AvmPersistableStateManager, AvmSimulator } from '../avm/index.js';
|
|
|
29
23
|
import { NullifierCollisionError } from '../avm/journal/nullifiers.js';
|
|
30
24
|
import { getPublicFunctionDebugName } from '../common/debug_fn_name.js';
|
|
31
25
|
import { ExecutorMetrics } from './executor_metrics.js';
|
|
26
|
+
import { computeFeePayerBalanceStorageSlot } from './fee_payment.js';
|
|
32
27
|
import { type WorldStateDB } from './public_db_sources.js';
|
|
33
28
|
import { PublicTxContext } from './public_tx_context.js';
|
|
34
29
|
|
|
@@ -53,17 +48,16 @@ export type PublicTxResult = {
|
|
|
53
48
|
export class PublicTxSimulator {
|
|
54
49
|
metrics: ExecutorMetrics;
|
|
55
50
|
|
|
56
|
-
private log:
|
|
51
|
+
private log: Logger;
|
|
57
52
|
|
|
58
53
|
constructor(
|
|
59
54
|
private db: MerkleTreeReadOperations,
|
|
60
55
|
private worldStateDB: WorldStateDB,
|
|
61
56
|
telemetryClient: TelemetryClient,
|
|
62
57
|
private globalVariables: GlobalVariables,
|
|
63
|
-
private realAvmProvingRequests: boolean = true,
|
|
64
58
|
private doMerkleOperations: boolean = false,
|
|
65
59
|
) {
|
|
66
|
-
this.log =
|
|
60
|
+
this.log = createLogger(`simulator:public_tx_simulator`);
|
|
67
61
|
this.metrics = new ExecutorMetrics(telemetryClient, 'PublicTxSimulator');
|
|
68
62
|
}
|
|
69
63
|
|
|
@@ -75,8 +69,9 @@ export class PublicTxSimulator {
|
|
|
75
69
|
* @param tx - The transaction to simulate.
|
|
76
70
|
* @returns The result of the transaction's public execution.
|
|
77
71
|
*/
|
|
78
|
-
async simulate(tx: Tx): Promise<PublicTxResult> {
|
|
79
|
-
|
|
72
|
+
public async simulate(tx: Tx): Promise<PublicTxResult> {
|
|
73
|
+
const txHash = tx.getTxHash();
|
|
74
|
+
this.log.debug(`Simulating ${tx.enqueuedPublicFunctionCalls.length} public calls for tx ${txHash}`, { txHash });
|
|
80
75
|
|
|
81
76
|
const context = await PublicTxContext.create(
|
|
82
77
|
this.db,
|
|
@@ -107,11 +102,14 @@ export class PublicTxSimulator {
|
|
|
107
102
|
const appLogicResult: ProcessedPhase = await this.simulateAppLogicPhase(context);
|
|
108
103
|
processedPhases.push(appLogicResult);
|
|
109
104
|
}
|
|
105
|
+
|
|
110
106
|
if (context.hasPhase(TxExecutionPhase.TEARDOWN)) {
|
|
111
107
|
const teardownResult: ProcessedPhase = await this.simulateTeardownPhase(context);
|
|
112
108
|
processedPhases.push(teardownResult);
|
|
113
109
|
}
|
|
110
|
+
|
|
114
111
|
context.halt();
|
|
112
|
+
await this.payFee(context);
|
|
115
113
|
|
|
116
114
|
const endStateReference = await this.db.getStateReference();
|
|
117
115
|
|
|
@@ -210,7 +208,12 @@ export class PublicTxSimulator {
|
|
|
210
208
|
const callRequests = context.getCallRequestsForPhase(phase);
|
|
211
209
|
const executionRequests = context.getExecutionRequestsForPhase(phase);
|
|
212
210
|
|
|
213
|
-
this.log.debug(`
|
|
211
|
+
this.log.debug(`Processing phase ${TxExecutionPhase[phase]} for tx ${context.getTxHash()}`, {
|
|
212
|
+
txHash: context.getTxHash().toString(),
|
|
213
|
+
phase: TxExecutionPhase[phase],
|
|
214
|
+
callRequests: callRequests.length,
|
|
215
|
+
executionRequests: executionRequests.length,
|
|
216
|
+
});
|
|
214
217
|
|
|
215
218
|
const returnValues: NestedProcessReturnValues[] = [];
|
|
216
219
|
let reverted = false;
|
|
@@ -265,40 +268,22 @@ export class PublicTxSimulator {
|
|
|
265
268
|
): Promise<AvmFinalizedCallResult> {
|
|
266
269
|
const stateManager = context.state.getActiveStateManager();
|
|
267
270
|
const address = executionRequest.callContext.contractAddress;
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const availableGas = context.getGasLeftForPhase(phase);
|
|
272
|
-
// Gas allocated to an enqueued call can be different from the available gas
|
|
273
|
-
// if there is more gas available than the max allocation per enqueued call.
|
|
274
|
-
const allocatedGas = new Gas(
|
|
275
|
-
/*daGas=*/ availableGas.daGas,
|
|
276
|
-
/*l2Gas=*/ Math.min(availableGas.l2Gas, MAX_L2_GAS_PER_ENQUEUED_CALL),
|
|
277
|
-
);
|
|
271
|
+
const fnName = await getPublicFunctionDebugName(this.worldStateDB, address, executionRequest.args);
|
|
272
|
+
|
|
273
|
+
const allocatedGas = context.getGasLeftAtPhase(phase);
|
|
278
274
|
|
|
279
275
|
const result = await this.simulateEnqueuedCallInternal(
|
|
280
276
|
context.state.getActiveStateManager(),
|
|
281
277
|
executionRequest,
|
|
282
278
|
allocatedGas,
|
|
283
|
-
context.getTransactionFee(phase),
|
|
279
|
+
/*transactionFee=*/ context.getTransactionFee(phase),
|
|
284
280
|
fnName,
|
|
285
281
|
);
|
|
286
282
|
|
|
287
|
-
const gasUsed = allocatedGas.sub(result.gasLeft);
|
|
283
|
+
const gasUsed = allocatedGas.sub(result.gasLeft); // by enqueued call
|
|
288
284
|
context.consumeGas(phase, gasUsed);
|
|
289
|
-
this.log.
|
|
290
|
-
`
|
|
291
|
-
);
|
|
292
|
-
|
|
293
|
-
// TODO(dbanks12): remove once AVM proves entire public tx
|
|
294
|
-
context.updateProvingRequest(
|
|
295
|
-
this.realAvmProvingRequests,
|
|
296
|
-
phase,
|
|
297
|
-
fnName,
|
|
298
|
-
stateManager,
|
|
299
|
-
executionRequest,
|
|
300
|
-
result,
|
|
301
|
-
allocatedGas,
|
|
285
|
+
this.log.debug(
|
|
286
|
+
`Simulated enqueued public call consumed ${gasUsed.l2Gas} L2 gas ending with ${result.gasLeft.l2Gas} L2 gas left.`,
|
|
302
287
|
);
|
|
303
288
|
|
|
304
289
|
stateManager.traceEnqueuedCall(callRequest, executionRequest.args, result.reverted);
|
|
@@ -340,18 +325,16 @@ export class PublicTxSimulator {
|
|
|
340
325
|
): Promise<AvmFinalizedCallResult> {
|
|
341
326
|
const address = executionRequest.callContext.contractAddress;
|
|
342
327
|
const sender = executionRequest.callContext.msgSender;
|
|
343
|
-
const selector = executionRequest.callContext.functionSelector;
|
|
344
328
|
|
|
345
|
-
this.log.
|
|
346
|
-
`
|
|
329
|
+
this.log.debug(
|
|
330
|
+
`Executing enqueued public call to external function ${fnName}@${address} with ${allocatedGas.l2Gas} allocated L2 gas.`,
|
|
347
331
|
);
|
|
348
332
|
const timer = new Timer();
|
|
349
333
|
|
|
350
|
-
const simulator = AvmSimulator.create(
|
|
334
|
+
const simulator = await AvmSimulator.create(
|
|
351
335
|
stateManager,
|
|
352
336
|
address,
|
|
353
337
|
sender,
|
|
354
|
-
selector,
|
|
355
338
|
transactionFee,
|
|
356
339
|
this.globalVariables,
|
|
357
340
|
executionRequest.callContext.isStaticCall,
|
|
@@ -361,10 +344,10 @@ export class PublicTxSimulator {
|
|
|
361
344
|
const avmCallResult = await simulator.execute();
|
|
362
345
|
const result = avmCallResult.finalize();
|
|
363
346
|
|
|
364
|
-
this.log.
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
347
|
+
this.log.debug(
|
|
348
|
+
result.reverted
|
|
349
|
+
? `Simulation of enqueued public call ${fnName} reverted with reason ${result.revertReason}.`
|
|
350
|
+
: `Simulation of enqueued public call ${fnName} completed successfully.`,
|
|
368
351
|
{
|
|
369
352
|
eventName: 'avm-simulation',
|
|
370
353
|
appCircuitName: fnName,
|
|
@@ -415,4 +398,30 @@ export class PublicTxSimulator {
|
|
|
415
398
|
}
|
|
416
399
|
}
|
|
417
400
|
}
|
|
401
|
+
|
|
402
|
+
private async payFee(context: PublicTxContext) {
|
|
403
|
+
const txFee = context.getTransactionFee(TxExecutionPhase.TEARDOWN);
|
|
404
|
+
|
|
405
|
+
if (context.feePayer.isZero()) {
|
|
406
|
+
this.log.debug(`No one is paying the fee of ${txFee.toBigInt()}`);
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
const feeJuiceAddress = ProtocolContractAddress.FeeJuice;
|
|
411
|
+
const balanceSlot = computeFeePayerBalanceStorageSlot(context.feePayer);
|
|
412
|
+
|
|
413
|
+
this.log.debug(`Deducting ${txFee.toBigInt()} balance in Fee Juice for ${context.feePayer}`);
|
|
414
|
+
const stateManager = context.state.getActiveStateManager();
|
|
415
|
+
|
|
416
|
+
const currentBalance = await stateManager.readStorage(feeJuiceAddress, balanceSlot);
|
|
417
|
+
|
|
418
|
+
if (currentBalance.lt(txFee)) {
|
|
419
|
+
throw new Error(
|
|
420
|
+
`Not enough balance for fee payer to pay for transaction (got ${currentBalance.toBigInt()} needs ${txFee.toBigInt()})`,
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const updatedBalance = currentBalance.sub(txFee);
|
|
425
|
+
await stateManager.writeStorage(feeJuiceAddress, balanceSlot, updatedBalance, true);
|
|
426
|
+
}
|
|
418
427
|
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
11
11
|
import { type Fr } from '@aztec/foundation/fields';
|
|
12
12
|
|
|
13
|
-
import { type
|
|
13
|
+
import { type AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
|
|
14
14
|
import { type AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
|
|
15
15
|
import { type EnqueuedPublicCallExecutionResultWithSideEffects, type PublicFunctionCallResult } from './execution.js';
|
|
16
16
|
|
|
@@ -31,6 +31,7 @@ export interface PublicSideEffectTraceInterface {
|
|
|
31
31
|
contractAddress: AztecAddress,
|
|
32
32
|
slot: Fr, // This is the storage slot not the computed leaf slot
|
|
33
33
|
value: Fr,
|
|
34
|
+
protocolWrite: boolean,
|
|
34
35
|
lowLeafPreimage?: PublicDataTreeLeafPreimage,
|
|
35
36
|
lowLeafIndex?: Fr,
|
|
36
37
|
lowLeafPath?: Fr[],
|
|
@@ -66,6 +67,9 @@ export interface PublicSideEffectTraceInterface {
|
|
|
66
67
|
contractAddress: AztecAddress,
|
|
67
68
|
exists: boolean,
|
|
68
69
|
instance?: SerializableContractInstance,
|
|
70
|
+
lowLeafPreimage?: NullifierLeafPreimage,
|
|
71
|
+
lowLeafIndex?: Fr,
|
|
72
|
+
lowLeafPath?: Fr[],
|
|
69
73
|
): void;
|
|
70
74
|
traceGetBytecode(
|
|
71
75
|
contractAddress: AztecAddress,
|
|
@@ -73,20 +77,9 @@ export interface PublicSideEffectTraceInterface {
|
|
|
73
77
|
bytecode?: Buffer,
|
|
74
78
|
contractInstance?: SerializableContractInstance,
|
|
75
79
|
contractClass?: ContractClassIdPreimage,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
nestedCallTrace: PublicSideEffectTraceInterface,
|
|
80
|
-
/** The execution environment of the nested call. */
|
|
81
|
-
nestedEnvironment: AvmExecutionEnvironment,
|
|
82
|
-
/** How much gas was available for this public execution. */
|
|
83
|
-
startGasLeft: Gas,
|
|
84
|
-
/** Bytecode used for this execution. */
|
|
85
|
-
bytecode: Buffer,
|
|
86
|
-
/** The call's results */
|
|
87
|
-
avmCallResults: AvmContractCallResult,
|
|
88
|
-
/** Function name */
|
|
89
|
-
functionName: string,
|
|
80
|
+
lowLeafPreimage?: NullifierLeafPreimage,
|
|
81
|
+
lowLeafIndex?: Fr,
|
|
82
|
+
lowLeafPath?: Fr[],
|
|
90
83
|
): void;
|
|
91
84
|
traceEnqueuedCall(
|
|
92
85
|
/** The call request from private that enqueued this call. */
|
|
@@ -1,57 +1,29 @@
|
|
|
1
|
-
import { type AvmProvingRequest, ProvingRequestType, type PublicExecutionRequest } from '@aztec/circuit-types';
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
AztecAddress,
|
|
6
|
-
ContractStorageRead,
|
|
7
|
-
ContractStorageUpdateRequest,
|
|
2
|
+
type AvmCircuitPublicInputs,
|
|
3
|
+
type AztecAddress,
|
|
8
4
|
Fr,
|
|
9
|
-
Gas,
|
|
5
|
+
type Gas,
|
|
10
6
|
type GasSettings,
|
|
11
7
|
type GlobalVariables,
|
|
12
|
-
type Header,
|
|
13
|
-
L2ToL1Message,
|
|
14
|
-
LogHash,
|
|
15
|
-
MAX_ENQUEUED_CALLS_PER_CALL,
|
|
16
|
-
MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL,
|
|
17
|
-
MAX_L2_TO_L1_MSGS_PER_CALL,
|
|
18
8
|
MAX_L2_TO_L1_MSGS_PER_TX,
|
|
19
|
-
MAX_NOTE_HASHES_PER_CALL,
|
|
20
9
|
MAX_NOTE_HASHES_PER_TX,
|
|
21
|
-
|
|
22
|
-
MAX_NULLIFIERS_PER_CALL,
|
|
23
|
-
MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL,
|
|
24
|
-
MAX_NULLIFIER_READ_REQUESTS_PER_CALL,
|
|
25
|
-
MAX_PUBLIC_DATA_READS_PER_CALL,
|
|
26
|
-
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL,
|
|
27
|
-
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
|
|
28
|
-
MAX_UNENCRYPTED_LOGS_PER_CALL,
|
|
29
|
-
NoteHash,
|
|
30
|
-
Nullifier,
|
|
10
|
+
MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
|
|
31
11
|
PrivateToAvmAccumulatedData,
|
|
32
12
|
PrivateToAvmAccumulatedDataArrayLengths,
|
|
33
13
|
type PrivateToPublicAccumulatedData,
|
|
34
14
|
PublicCallRequest,
|
|
35
|
-
PublicCircuitPublicInputs,
|
|
36
15
|
PublicDataWrite,
|
|
37
|
-
|
|
38
|
-
ReadRequest,
|
|
39
|
-
RevertCode,
|
|
16
|
+
type RevertCode,
|
|
40
17
|
type StateReference,
|
|
41
|
-
TreeLeafReadRequest,
|
|
42
18
|
TreeSnapshots,
|
|
43
19
|
countAccumulatedItems,
|
|
44
20
|
mergeAccumulatedData,
|
|
45
21
|
} from '@aztec/circuits.js';
|
|
46
|
-
import { computeNoteHashNonce, computeUniqueNoteHash,
|
|
22
|
+
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash } from '@aztec/circuits.js/hash';
|
|
47
23
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
48
24
|
import { assertLength } from '@aztec/foundation/serialize';
|
|
49
25
|
|
|
50
|
-
import { AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
|
|
51
|
-
import { AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
|
|
52
|
-
import { type AvmPersistableStateManager } from '../avm/journal/journal.js';
|
|
53
26
|
import { type PublicEnqueuedCallSideEffectTrace } from './enqueued_call_side_effect_trace.js';
|
|
54
|
-
import { type EnqueuedPublicCallExecutionResult, type PublicFunctionCallResult } from './execution.js';
|
|
55
27
|
|
|
56
28
|
export function generateAvmCircuitPublicInputs(
|
|
57
29
|
trace: PublicEnqueuedCallSideEffectTrace,
|
|
@@ -59,12 +31,13 @@ export function generateAvmCircuitPublicInputs(
|
|
|
59
31
|
startStateReference: StateReference,
|
|
60
32
|
startGasUsed: Gas,
|
|
61
33
|
gasSettings: GasSettings,
|
|
34
|
+
feePayer: AztecAddress,
|
|
62
35
|
setupCallRequests: PublicCallRequest[],
|
|
63
36
|
appLogicCallRequests: PublicCallRequest[],
|
|
64
37
|
teardownCallRequests: PublicCallRequest[],
|
|
65
38
|
nonRevertibleAccumulatedDataFromPrivate: PrivateToPublicAccumulatedData,
|
|
66
39
|
revertibleAccumulatedDataFromPrivate: PrivateToPublicAccumulatedData,
|
|
67
|
-
|
|
40
|
+
endTreeSnapshots: TreeSnapshots,
|
|
68
41
|
endGasUsed: Gas,
|
|
69
42
|
transactionFee: Fr,
|
|
70
43
|
revertCode: RevertCode,
|
|
@@ -75,18 +48,13 @@ export function generateAvmCircuitPublicInputs(
|
|
|
75
48
|
startStateReference.partial.nullifierTree,
|
|
76
49
|
startStateReference.partial.publicDataTree,
|
|
77
50
|
);
|
|
78
|
-
const endTreeSnapshots = new TreeSnapshots(
|
|
79
|
-
endStateReference.l1ToL2MessageTree,
|
|
80
|
-
endStateReference.partial.noteHashTree,
|
|
81
|
-
endStateReference.partial.nullifierTree,
|
|
82
|
-
endStateReference.partial.publicDataTree,
|
|
83
|
-
);
|
|
84
51
|
|
|
85
52
|
const avmCircuitPublicInputs = trace.toAvmCircuitPublicInputs(
|
|
86
53
|
globalVariables,
|
|
87
54
|
startTreeSnapshots,
|
|
88
55
|
startGasUsed,
|
|
89
56
|
gasSettings,
|
|
57
|
+
feePayer,
|
|
90
58
|
setupCallRequests,
|
|
91
59
|
appLogicCallRequests,
|
|
92
60
|
teardownCallRequests.length ? teardownCallRequests[0] : PublicCallRequest.empty(),
|
|
@@ -118,6 +86,28 @@ export function generateAvmCircuitPublicInputs(
|
|
|
118
86
|
revertibleAccumulatedDataFromPrivate,
|
|
119
87
|
);
|
|
120
88
|
|
|
89
|
+
const txHash = avmCircuitPublicInputs.previousNonRevertibleAccumulatedData.nullifiers[0];
|
|
90
|
+
|
|
91
|
+
// Add nonces to revertible note hashes from private. These don't have nonces since we don't know
|
|
92
|
+
// the final position in the tx until the AVM has executed.
|
|
93
|
+
// TODO: Use the final position in the tx
|
|
94
|
+
for (
|
|
95
|
+
let revertibleIndex = 0;
|
|
96
|
+
revertibleIndex < avmCircuitPublicInputs.previousRevertibleAccumulatedData.noteHashes.length;
|
|
97
|
+
revertibleIndex++
|
|
98
|
+
) {
|
|
99
|
+
const noteHash = avmCircuitPublicInputs.previousRevertibleAccumulatedData.noteHashes[revertibleIndex];
|
|
100
|
+
if (noteHash.isZero()) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const indexInTx =
|
|
104
|
+
revertibleIndex + avmCircuitPublicInputs.previousNonRevertibleAccumulatedDataArrayLengths.noteHashes;
|
|
105
|
+
|
|
106
|
+
const nonce = computeNoteHashNonce(txHash, indexInTx);
|
|
107
|
+
const uniqueNoteHash = computeUniqueNoteHash(nonce, noteHash);
|
|
108
|
+
avmCircuitPublicInputs.previousRevertibleAccumulatedData.noteHashes[revertibleIndex] = uniqueNoteHash;
|
|
109
|
+
}
|
|
110
|
+
|
|
121
111
|
// merge all revertible & non-revertible side effects into output accumulated data
|
|
122
112
|
const noteHashesFromPrivate = revertCode.isOK()
|
|
123
113
|
? mergeAccumulatedData(
|
|
@@ -130,8 +120,7 @@ export function generateAvmCircuitPublicInputs(
|
|
|
130
120
|
MAX_NOTE_HASHES_PER_TX,
|
|
131
121
|
);
|
|
132
122
|
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
// Silo and add nonces for note hashes emitted by the AVM
|
|
135
124
|
const scopedNoteHashesFromPublic = trace.getSideEffects().noteHashes;
|
|
136
125
|
for (let i = 0; i < scopedNoteHashesFromPublic.length; i++) {
|
|
137
126
|
const scopedNoteHash = scopedNoteHashesFromPublic[i];
|
|
@@ -139,9 +128,10 @@ export function generateAvmCircuitPublicInputs(
|
|
|
139
128
|
if (!noteHash.isZero()) {
|
|
140
129
|
const noteHashIndexInTx = i + countAccumulatedItems(noteHashesFromPrivate);
|
|
141
130
|
const nonce = computeNoteHashNonce(txHash, noteHashIndexInTx);
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
|
|
131
|
+
const siloedNoteHash = siloNoteHash(scopedNoteHash.contractAddress, noteHash);
|
|
132
|
+
const uniqueNoteHash = computeUniqueNoteHash(nonce, siloedNoteHash);
|
|
133
|
+
|
|
134
|
+
avmCircuitPublicInputs.accumulatedData.noteHashes[noteHashIndexInTx] = uniqueNoteHash;
|
|
145
135
|
}
|
|
146
136
|
}
|
|
147
137
|
|
|
@@ -156,181 +146,19 @@ export function generateAvmCircuitPublicInputs(
|
|
|
156
146
|
MAX_L2_TO_L1_MSGS_PER_TX,
|
|
157
147
|
);
|
|
158
148
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const prevOccurrences = leafSlotOccurences.get(slot) || 0;
|
|
164
|
-
leafSlotOccurences.set(slot, prevOccurrences + 1);
|
|
165
|
-
}
|
|
166
|
-
|
|
149
|
+
// Maps slot to value. Maps in TS are iterable in insertion order, which is exactly what we want for
|
|
150
|
+
// squashing "to the left", where the first occurrence of a slot uses the value of the last write to it,
|
|
151
|
+
// and the rest occurrences are omitted
|
|
152
|
+
const squashedPublicDataWrites: Map<bigint, Fr> = new Map();
|
|
167
153
|
for (const publicDataWrite of avmCircuitPublicInputs.accumulatedData.publicDataWrites) {
|
|
168
|
-
|
|
169
|
-
const prevOccurrences = leafSlotOccurences.get(slot) || 0;
|
|
170
|
-
if (prevOccurrences === 1) {
|
|
171
|
-
dedupedPublicDataWrites.push(publicDataWrite);
|
|
172
|
-
} else {
|
|
173
|
-
leafSlotOccurences.set(slot, prevOccurrences - 1);
|
|
174
|
-
}
|
|
154
|
+
squashedPublicDataWrites.set(publicDataWrite.leafSlot.toBigInt(), publicDataWrite.value);
|
|
175
155
|
}
|
|
176
156
|
|
|
177
157
|
avmCircuitPublicInputs.accumulatedData.publicDataWrites = padArrayEnd(
|
|
178
|
-
|
|
158
|
+
Array.from(squashedPublicDataWrites.entries()).map(([slot, value]) => new PublicDataWrite(new Fr(slot), value)),
|
|
179
159
|
PublicDataWrite.empty(),
|
|
180
|
-
|
|
160
|
+
MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
|
|
181
161
|
);
|
|
182
162
|
//console.log(`AvmCircuitPublicInputs:\n${inspect(avmCircuitPublicInputs)}`);
|
|
183
163
|
return avmCircuitPublicInputs;
|
|
184
164
|
}
|
|
185
|
-
|
|
186
|
-
export function generateAvmProvingRequest(
|
|
187
|
-
real: boolean,
|
|
188
|
-
fnName: string,
|
|
189
|
-
stateManager: AvmPersistableStateManager,
|
|
190
|
-
historicalHeader: Header,
|
|
191
|
-
globalVariables: GlobalVariables,
|
|
192
|
-
executionRequest: PublicExecutionRequest,
|
|
193
|
-
result: EnqueuedPublicCallExecutionResult,
|
|
194
|
-
allocatedGas: Gas,
|
|
195
|
-
transactionFee: Fr,
|
|
196
|
-
): AvmProvingRequest {
|
|
197
|
-
const avmExecutionEnv = new AvmExecutionEnvironment(
|
|
198
|
-
executionRequest.callContext.contractAddress,
|
|
199
|
-
executionRequest.callContext.msgSender,
|
|
200
|
-
executionRequest.callContext.functionSelector,
|
|
201
|
-
/*contractCallDepth=*/ Fr.zero(),
|
|
202
|
-
transactionFee,
|
|
203
|
-
globalVariables,
|
|
204
|
-
executionRequest.callContext.isStaticCall,
|
|
205
|
-
executionRequest.args,
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
const avmCallResult = new AvmFinalizedCallResult(result.reverted, result.returnValues, result.endGasLeft);
|
|
209
|
-
|
|
210
|
-
// Generate an AVM proving request
|
|
211
|
-
let avmProvingRequest: AvmProvingRequest;
|
|
212
|
-
if (real) {
|
|
213
|
-
const deprecatedFunctionCallResult = stateManager.trace.toPublicFunctionCallResult(
|
|
214
|
-
avmExecutionEnv,
|
|
215
|
-
/*startGasLeft=*/ allocatedGas,
|
|
216
|
-
Buffer.alloc(0),
|
|
217
|
-
avmCallResult,
|
|
218
|
-
fnName,
|
|
219
|
-
);
|
|
220
|
-
const publicInputs = getPublicCircuitPublicInputs(historicalHeader, globalVariables, deprecatedFunctionCallResult);
|
|
221
|
-
avmProvingRequest = makeAvmProvingRequest(publicInputs, deprecatedFunctionCallResult);
|
|
222
|
-
} else {
|
|
223
|
-
avmProvingRequest = emptyAvmProvingRequest();
|
|
224
|
-
}
|
|
225
|
-
return avmProvingRequest;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
function emptyAvmProvingRequest(): AvmProvingRequest {
|
|
229
|
-
return {
|
|
230
|
-
type: ProvingRequestType.PUBLIC_VM,
|
|
231
|
-
inputs: AvmCircuitInputs.empty(),
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
function makeAvmProvingRequest(inputs: PublicCircuitPublicInputs, result: PublicFunctionCallResult): AvmProvingRequest {
|
|
235
|
-
return {
|
|
236
|
-
type: ProvingRequestType.PUBLIC_VM,
|
|
237
|
-
inputs: new AvmCircuitInputs(
|
|
238
|
-
result.functionName,
|
|
239
|
-
result.calldata,
|
|
240
|
-
inputs,
|
|
241
|
-
result.avmCircuitHints,
|
|
242
|
-
AvmCircuitPublicInputs.empty(),
|
|
243
|
-
),
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function getPublicCircuitPublicInputs(
|
|
248
|
-
historicalHeader: Header,
|
|
249
|
-
globalVariables: GlobalVariables,
|
|
250
|
-
result: PublicFunctionCallResult,
|
|
251
|
-
) {
|
|
252
|
-
const header = historicalHeader.clone(); // don't modify the original
|
|
253
|
-
header.state.partial.publicDataTree.root = Fr.zero(); // AVM doesn't check this yet
|
|
254
|
-
|
|
255
|
-
return PublicCircuitPublicInputs.from({
|
|
256
|
-
callContext: result.executionRequest.callContext,
|
|
257
|
-
proverAddress: AztecAddress.ZERO,
|
|
258
|
-
argsHash: computeVarArgsHash(result.executionRequest.args),
|
|
259
|
-
noteHashes: padArrayEnd(
|
|
260
|
-
result.noteHashes,
|
|
261
|
-
NoteHash.empty(),
|
|
262
|
-
MAX_NOTE_HASHES_PER_CALL,
|
|
263
|
-
`Too many note hashes. Got ${result.noteHashes.length} with max being ${MAX_NOTE_HASHES_PER_CALL}`,
|
|
264
|
-
),
|
|
265
|
-
nullifiers: padArrayEnd(
|
|
266
|
-
result.nullifiers,
|
|
267
|
-
Nullifier.empty(),
|
|
268
|
-
MAX_NULLIFIERS_PER_CALL,
|
|
269
|
-
`Too many nullifiers. Got ${result.nullifiers.length} with max being ${MAX_NULLIFIERS_PER_CALL}`,
|
|
270
|
-
),
|
|
271
|
-
l2ToL1Msgs: padArrayEnd(
|
|
272
|
-
result.l2ToL1Messages,
|
|
273
|
-
L2ToL1Message.empty(),
|
|
274
|
-
MAX_L2_TO_L1_MSGS_PER_CALL,
|
|
275
|
-
`Too many L2 to L1 messages. Got ${result.l2ToL1Messages.length} with max being ${MAX_L2_TO_L1_MSGS_PER_CALL}`,
|
|
276
|
-
),
|
|
277
|
-
startSideEffectCounter: result.startSideEffectCounter,
|
|
278
|
-
endSideEffectCounter: result.endSideEffectCounter,
|
|
279
|
-
returnsHash: computeVarArgsHash(result.returnValues),
|
|
280
|
-
noteHashReadRequests: padArrayEnd(
|
|
281
|
-
result.noteHashReadRequests,
|
|
282
|
-
TreeLeafReadRequest.empty(),
|
|
283
|
-
MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
|
|
284
|
-
`Too many note hash read requests. Got ${result.noteHashReadRequests.length} with max being ${MAX_NOTE_HASH_READ_REQUESTS_PER_CALL}`,
|
|
285
|
-
),
|
|
286
|
-
nullifierReadRequests: padArrayEnd(
|
|
287
|
-
result.nullifierReadRequests,
|
|
288
|
-
ReadRequest.empty(),
|
|
289
|
-
MAX_NULLIFIER_READ_REQUESTS_PER_CALL,
|
|
290
|
-
`Too many nullifier read requests. Got ${result.nullifierReadRequests.length} with max being ${MAX_NULLIFIER_READ_REQUESTS_PER_CALL}`,
|
|
291
|
-
),
|
|
292
|
-
nullifierNonExistentReadRequests: padArrayEnd(
|
|
293
|
-
result.nullifierNonExistentReadRequests,
|
|
294
|
-
ReadRequest.empty(),
|
|
295
|
-
MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL,
|
|
296
|
-
`Too many nullifier non-existent read requests. Got ${result.nullifierNonExistentReadRequests.length} with max being ${MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_CALL}`,
|
|
297
|
-
),
|
|
298
|
-
l1ToL2MsgReadRequests: padArrayEnd(
|
|
299
|
-
result.l1ToL2MsgReadRequests,
|
|
300
|
-
TreeLeafReadRequest.empty(),
|
|
301
|
-
MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL,
|
|
302
|
-
`Too many L1 to L2 message read requests. Got ${result.l1ToL2MsgReadRequests.length} with max being ${MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_CALL}`,
|
|
303
|
-
),
|
|
304
|
-
contractStorageReads: padArrayEnd(
|
|
305
|
-
result.contractStorageReads,
|
|
306
|
-
ContractStorageRead.empty(),
|
|
307
|
-
MAX_PUBLIC_DATA_READS_PER_CALL,
|
|
308
|
-
`Too many public data reads. Got ${result.contractStorageReads.length} with max being ${MAX_PUBLIC_DATA_READS_PER_CALL}`,
|
|
309
|
-
),
|
|
310
|
-
contractStorageUpdateRequests: padArrayEnd(
|
|
311
|
-
result.contractStorageUpdateRequests,
|
|
312
|
-
ContractStorageUpdateRequest.empty(),
|
|
313
|
-
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL,
|
|
314
|
-
`Too many public data update requests. Got ${result.contractStorageUpdateRequests.length} with max being ${MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_CALL}`,
|
|
315
|
-
),
|
|
316
|
-
publicCallRequests: padArrayEnd(
|
|
317
|
-
result.publicCallRequests,
|
|
318
|
-
PublicInnerCallRequest.empty(),
|
|
319
|
-
MAX_ENQUEUED_CALLS_PER_CALL,
|
|
320
|
-
`Too many public call requests. Got ${result.publicCallRequests.length} with max being ${MAX_ENQUEUED_CALLS_PER_CALL}`,
|
|
321
|
-
),
|
|
322
|
-
unencryptedLogsHashes: padArrayEnd(
|
|
323
|
-
result.unencryptedLogsHashes,
|
|
324
|
-
LogHash.empty(),
|
|
325
|
-
MAX_UNENCRYPTED_LOGS_PER_CALL,
|
|
326
|
-
`Too many unencrypted logs. Got ${result.unencryptedLogsHashes.length} with max being ${MAX_UNENCRYPTED_LOGS_PER_CALL}`,
|
|
327
|
-
),
|
|
328
|
-
historicalHeader: header,
|
|
329
|
-
globalVariables: globalVariables,
|
|
330
|
-
startGasLeft: Gas.from(result.startGasLeft),
|
|
331
|
-
endGasLeft: Gas.from(result.endGasLeft),
|
|
332
|
-
transactionFee: result.transactionFee,
|
|
333
|
-
// TODO(@just-mitch): need better mapping from simulator to revert code.
|
|
334
|
-
revertCode: result.reverted ? RevertCode.APP_LOGIC_REVERTED : RevertCode.OK,
|
|
335
|
-
});
|
|
336
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { type UnencryptedL2Log } from '@aztec/circuit-types';
|
|
4
|
-
import { type ContractClassIdPreimage, type Gas, type NullifierLeafPreimage, type PublicCallRequest, type PublicDataTreeLeafPreimage, type SerializableContractInstance } from '@aztec/circuits.js';
|
|
5
|
-
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
6
|
-
import { type Fr } from '@aztec/foundation/fields';
|
|
7
|
-
import { type AvmContractCallResult, type AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
|
|
8
|
-
import { type AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
|
|
9
|
-
import { type PublicEnqueuedCallSideEffectTrace } from './enqueued_call_side_effect_trace.js';
|
|
10
|
-
import { type EnqueuedPublicCallExecutionResultWithSideEffects, type PublicFunctionCallResult } from './execution.js';
|
|
11
|
-
import { type PublicSideEffectTrace } from './side_effect_trace.js';
|
|
12
|
-
import { type PublicSideEffectTraceInterface } from './side_effect_trace_interface.js';
|
|
13
|
-
export declare class DualSideEffectTrace implements PublicSideEffectTraceInterface {
|
|
14
|
-
readonly innerCallTrace: PublicSideEffectTrace;
|
|
15
|
-
readonly enqueuedCallTrace: PublicEnqueuedCallSideEffectTrace;
|
|
16
|
-
constructor(innerCallTrace: PublicSideEffectTrace, enqueuedCallTrace: PublicEnqueuedCallSideEffectTrace);
|
|
17
|
-
fork(): DualSideEffectTrace;
|
|
18
|
-
merge(nestedTrace: this, reverted?: boolean): void;
|
|
19
|
-
getCounter(): number;
|
|
20
|
-
tracePublicStorageRead(contractAddress: AztecAddress, slot: Fr, value: Fr, leafPreimage: PublicDataTreeLeafPreimage, leafIndex: Fr, path: Fr[]): void;
|
|
21
|
-
tracePublicStorageWrite(contractAddress: AztecAddress, slot: Fr, value: Fr, lowLeafPreimage: PublicDataTreeLeafPreimage, lowLeafIndex: Fr, lowLeafPath: Fr[], newLeafPreimage: PublicDataTreeLeafPreimage, insertionPath: Fr[]): void;
|
|
22
|
-
traceNoteHashCheck(contractAddress: AztecAddress, noteHash: Fr, leafIndex: Fr, exists: boolean, path: Fr[]): void;
|
|
23
|
-
traceNewNoteHash(contractAddress: AztecAddress, noteHash: Fr, leafIndex: Fr, path: Fr[]): void;
|
|
24
|
-
traceNullifierCheck(siloedNullifier: Fr, exists: boolean, lowLeafPreimage: NullifierLeafPreimage, lowLeafIndex: Fr, lowLeafPath: Fr[]): void;
|
|
25
|
-
traceNewNullifier(siloedNullifier: Fr, lowLeafPreimage: NullifierLeafPreimage, lowLeafIndex: Fr, lowLeafPath: Fr[], insertionPath: Fr[]): void;
|
|
26
|
-
traceL1ToL2MessageCheck(contractAddress: AztecAddress, msgHash: Fr, msgLeafIndex: Fr, exists: boolean, path: Fr[]): void;
|
|
27
|
-
traceNewL2ToL1Message(contractAddress: AztecAddress, recipient: Fr, content: Fr): void;
|
|
28
|
-
traceUnencryptedLog(contractAddress: AztecAddress, log: Fr[]): void;
|
|
29
|
-
traceGetContractInstance(contractAddress: AztecAddress, exists: boolean, instance: SerializableContractInstance | undefined): void;
|
|
30
|
-
traceGetBytecode(contractAddress: AztecAddress, exists: boolean, bytecode: Buffer, contractInstance: SerializableContractInstance | undefined, contractClass: ContractClassIdPreimage | undefined): void;
|
|
31
|
-
/**
|
|
32
|
-
* Trace a nested call.
|
|
33
|
-
* Accept some results from a finished nested call's trace into this one.
|
|
34
|
-
*/
|
|
35
|
-
traceNestedCall(
|
|
36
|
-
/** The trace of the nested call. */
|
|
37
|
-
nestedCallTrace: this,
|
|
38
|
-
/** The execution environment of the nested call. */
|
|
39
|
-
nestedEnvironment: AvmExecutionEnvironment,
|
|
40
|
-
/** How much gas was available for this public execution. */
|
|
41
|
-
startGasLeft: Gas,
|
|
42
|
-
/** Bytecode used for this execution. */
|
|
43
|
-
bytecode: Buffer,
|
|
44
|
-
/** The call's results */
|
|
45
|
-
avmCallResults: AvmContractCallResult,
|
|
46
|
-
/** Function name for logging */
|
|
47
|
-
functionName?: string): void;
|
|
48
|
-
traceEnqueuedCall(
|
|
49
|
-
/** The call request from private that enqueued this call. */
|
|
50
|
-
publicCallRequest: PublicCallRequest,
|
|
51
|
-
/** The call's calldata */
|
|
52
|
-
calldata: Fr[],
|
|
53
|
-
/** Did the call revert? */
|
|
54
|
-
reverted: boolean): void;
|
|
55
|
-
/**
|
|
56
|
-
* Convert this trace to a PublicExecutionResult for use externally to the simulator.
|
|
57
|
-
*/
|
|
58
|
-
toPublicEnqueuedCallExecutionResult(
|
|
59
|
-
/** The call's results */
|
|
60
|
-
avmCallResults: AvmFinalizedCallResult): EnqueuedPublicCallExecutionResultWithSideEffects;
|
|
61
|
-
/**
|
|
62
|
-
* Convert this trace to a PublicExecutionResult for use externally to the simulator.
|
|
63
|
-
*/
|
|
64
|
-
toPublicFunctionCallResult(
|
|
65
|
-
/** The execution environment of the nested call. */
|
|
66
|
-
avmEnvironment: AvmExecutionEnvironment,
|
|
67
|
-
/** How much gas was available for this public execution. */
|
|
68
|
-
startGasLeft: Gas,
|
|
69
|
-
/** Bytecode used for this execution. */
|
|
70
|
-
bytecode: Buffer,
|
|
71
|
-
/** The call's results */
|
|
72
|
-
avmCallResults: AvmFinalizedCallResult,
|
|
73
|
-
/** Function name for logging */
|
|
74
|
-
functionName?: string): PublicFunctionCallResult;
|
|
75
|
-
getUnencryptedLogs(): UnencryptedL2Log[];
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=dual_side_effect_trace.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dual_side_effect_trace.d.ts","sourceRoot":"","sources":["../../src/public/dual_side_effect_trace.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EACR,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EAClC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAA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