@aztec/simulator 0.66.0 → 0.67.1-devnet

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.
Files changed (158) hide show
  1. package/dest/acvm/acvm.js +3 -3
  2. package/dest/acvm/oracle/oracle.d.ts +2 -2
  3. package/dest/acvm/oracle/oracle.d.ts.map +1 -1
  4. package/dest/acvm/oracle/oracle.js +5 -5
  5. package/dest/acvm/oracle/typed_oracle.d.ts +3 -3
  6. package/dest/acvm/oracle/typed_oracle.d.ts.map +1 -1
  7. package/dest/acvm/oracle/typed_oracle.js +5 -5
  8. package/dest/acvm/serialize.js +2 -2
  9. package/dest/avm/avm_context.d.ts +2 -2
  10. package/dest/avm/avm_context.d.ts.map +1 -1
  11. package/dest/avm/avm_context.js +3 -4
  12. package/dest/avm/avm_execution_environment.d.ts +4 -6
  13. package/dest/avm/avm_execution_environment.d.ts.map +1 -1
  14. package/dest/avm/avm_execution_environment.js +8 -13
  15. package/dest/avm/avm_memory_types.d.ts +3 -3
  16. package/dest/avm/avm_memory_types.d.ts.map +1 -1
  17. package/dest/avm/avm_memory_types.js +29 -29
  18. package/dest/avm/avm_simulator.d.ts +3 -3
  19. package/dest/avm/avm_simulator.d.ts.map +1 -1
  20. package/dest/avm/avm_simulator.js +27 -15
  21. package/dest/avm/avm_tree.d.ts +2 -1
  22. package/dest/avm/avm_tree.d.ts.map +1 -1
  23. package/dest/avm/avm_tree.js +6 -2
  24. package/dest/avm/errors.d.ts +3 -3
  25. package/dest/avm/errors.d.ts.map +1 -1
  26. package/dest/avm/errors.js +8 -15
  27. package/dest/avm/fixtures/index.d.ts +2 -0
  28. package/dest/avm/fixtures/index.d.ts.map +1 -1
  29. package/dest/avm/fixtures/index.js +7 -7
  30. package/dest/avm/journal/journal.d.ts +31 -8
  31. package/dest/avm/journal/journal.d.ts.map +1 -1
  32. package/dest/avm/journal/journal.js +139 -42
  33. package/dest/avm/opcodes/conversion.d.ts +4 -4
  34. package/dest/avm/opcodes/conversion.d.ts.map +1 -1
  35. package/dest/avm/opcodes/conversion.js +22 -18
  36. package/dest/avm/opcodes/external_calls.d.ts.map +1 -1
  37. package/dest/avm/opcodes/external_calls.js +4 -11
  38. package/dest/avm/opcodes/misc.d.ts.map +1 -1
  39. package/dest/avm/opcodes/misc.js +3 -3
  40. package/dest/avm/test_utils.d.ts +1 -0
  41. package/dest/avm/test_utils.d.ts.map +1 -1
  42. package/dest/avm/test_utils.js +4 -1
  43. package/dest/client/client_execution_context.d.ts +3 -3
  44. package/dest/client/client_execution_context.d.ts.map +1 -1
  45. package/dest/client/client_execution_context.js +15 -8
  46. package/dest/client/db_oracle.d.ts +9 -5
  47. package/dest/client/db_oracle.d.ts.map +1 -1
  48. package/dest/client/execution_note_cache.d.ts +9 -1
  49. package/dest/client/execution_note_cache.d.ts.map +1 -1
  50. package/dest/client/execution_note_cache.js +10 -3
  51. package/dest/client/index.d.ts +1 -0
  52. package/dest/client/index.d.ts.map +1 -1
  53. package/dest/client/index.js +2 -1
  54. package/dest/client/private_execution.d.ts.map +1 -1
  55. package/dest/client/private_execution.js +4 -4
  56. package/dest/client/simulator.d.ts.map +1 -1
  57. package/dest/client/simulator.js +4 -4
  58. package/dest/client/unconstrained_execution.d.ts.map +1 -1
  59. package/dest/client/unconstrained_execution.js +3 -3
  60. package/dest/client/view_data_oracle.d.ts +4 -4
  61. package/dest/client/view_data_oracle.d.ts.map +1 -1
  62. package/dest/client/view_data_oracle.js +9 -9
  63. package/dest/common/debug_fn_name.d.ts +2 -2
  64. package/dest/common/debug_fn_name.d.ts.map +1 -1
  65. package/dest/common/debug_fn_name.js +8 -14
  66. package/dest/providers/acvm_native.js +4 -4
  67. package/dest/providers/acvm_wasm.js +2 -2
  68. package/dest/providers/factory.d.ts +2 -2
  69. package/dest/providers/factory.d.ts.map +1 -1
  70. package/dest/providers/factory.js +4 -4
  71. package/dest/providers/index.d.ts +0 -1
  72. package/dest/providers/index.d.ts.map +1 -1
  73. package/dest/providers/index.js +1 -2
  74. package/dest/public/enqueued_call_side_effect_trace.d.ts +15 -26
  75. package/dest/public/enqueued_call_side_effect_trace.d.ts.map +1 -1
  76. package/dest/public/enqueued_call_side_effect_trace.js +42 -62
  77. package/dest/public/execution.d.ts +2 -2
  78. package/dest/public/execution.d.ts.map +1 -1
  79. package/dest/public/execution.js +1 -1
  80. package/dest/public/executor_metrics.d.ts.map +1 -1
  81. package/dest/public/executor_metrics.js +2 -5
  82. package/dest/public/fee_payment.d.ts.map +1 -1
  83. package/dest/public/fee_payment.js +4 -3
  84. package/dest/public/fixtures/index.d.ts +24 -1
  85. package/dest/public/fixtures/index.d.ts.map +1 -1
  86. package/dest/public/fixtures/index.js +17 -11
  87. package/dest/public/index.d.ts +0 -1
  88. package/dest/public/index.d.ts.map +1 -1
  89. package/dest/public/index.js +1 -2
  90. package/dest/public/public_db_sources.d.ts.map +1 -1
  91. package/dest/public/public_db_sources.js +10 -9
  92. package/dest/public/public_processor.d.ts +12 -12
  93. package/dest/public/public_processor.d.ts.map +1 -1
  94. package/dest/public/public_processor.js +80 -68
  95. package/dest/public/public_processor_metrics.d.ts +1 -1
  96. package/dest/public/public_processor_metrics.d.ts.map +1 -1
  97. package/dest/public/public_tx_context.d.ts +13 -10
  98. package/dest/public/public_tx_context.d.ts.map +1 -1
  99. package/dest/public/public_tx_context.js +72 -45
  100. package/dest/public/public_tx_simulator.d.ts +2 -2
  101. package/dest/public/public_tx_simulator.d.ts.map +1 -1
  102. package/dest/public/public_tx_simulator.js +54 -23
  103. package/dest/public/side_effect_trace_interface.d.ts +6 -18
  104. package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
  105. package/dest/public/transitional_adapters.d.ts +2 -2
  106. package/dest/public/transitional_adapters.d.ts.map +1 -1
  107. package/dest/public/transitional_adapters.js +10 -39
  108. package/package.json +16 -9
  109. package/src/acvm/acvm.ts +2 -2
  110. package/src/acvm/oracle/oracle.ts +4 -4
  111. package/src/acvm/oracle/typed_oracle.ts +5 -5
  112. package/src/acvm/serialize.ts +1 -1
  113. package/src/avm/avm_context.ts +2 -3
  114. package/src/avm/avm_execution_environment.ts +6 -31
  115. package/src/avm/avm_memory_types.ts +31 -29
  116. package/src/avm/avm_simulator.ts +28 -22
  117. package/src/avm/avm_tree.ts +6 -1
  118. package/src/avm/errors.ts +12 -14
  119. package/src/avm/fixtures/index.ts +6 -5
  120. package/src/avm/journal/journal.ts +230 -71
  121. package/src/avm/opcodes/conversion.ts +21 -16
  122. package/src/avm/opcodes/external_calls.ts +3 -19
  123. package/src/avm/opcodes/misc.ts +2 -2
  124. package/src/avm/test_utils.ts +4 -0
  125. package/src/client/client_execution_context.ts +19 -9
  126. package/src/client/db_oracle.ts +10 -5
  127. package/src/client/execution_note_cache.ts +13 -3
  128. package/src/client/index.ts +1 -0
  129. package/src/client/private_execution.ts +3 -3
  130. package/src/client/simulator.ts +4 -4
  131. package/src/client/unconstrained_execution.ts +2 -2
  132. package/src/client/view_data_oracle.ts +11 -9
  133. package/src/common/debug_fn_name.ts +7 -13
  134. package/src/providers/acvm_native.ts +3 -3
  135. package/src/providers/acvm_wasm.ts +2 -2
  136. package/src/providers/factory.ts +3 -3
  137. package/src/providers/index.ts +0 -1
  138. package/src/public/enqueued_call_side_effect_trace.ts +62 -86
  139. package/src/public/execution.ts +1 -2
  140. package/src/public/executor_metrics.ts +0 -4
  141. package/src/public/fee_payment.ts +3 -2
  142. package/src/public/fixtures/index.ts +25 -12
  143. package/src/public/index.ts +0 -1
  144. package/src/public/public_db_sources.ts +9 -8
  145. package/src/public/public_processor.ts +109 -105
  146. package/src/public/public_processor_metrics.ts +1 -1
  147. package/src/public/public_tx_context.ts +97 -50
  148. package/src/public/public_tx_simulator.ts +69 -38
  149. package/src/public/side_effect_trace_interface.ts +10 -16
  150. package/src/public/transitional_adapters.ts +12 -48
  151. package/dest/public/dual_side_effect_trace.d.ts +0 -77
  152. package/dest/public/dual_side_effect_trace.d.ts.map +0 -1
  153. package/dest/public/dual_side_effect_trace.js +0 -119
  154. package/dest/public/side_effect_trace.d.ts +0 -96
  155. package/dest/public/side_effect_trace.d.ts.map +0 -1
  156. package/dest/public/side_effect_trace.js +0 -309
  157. package/src/public/dual_side_effect_trace.ts +0 -242
  158. 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
- type Fr,
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: DebugLogger;
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 = createDebugLogger(`aztec:public_tx_simulator`);
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
- this.log.verbose(`Processing tx ${tx.getTxHash()}`);
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(`Beginning processing in phase ${TxExecutionPhase[phase]} for tx ${context.getTxHash()}`);
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,29 +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 selector = executionRequest.callContext.functionSelector;
269
- const fnName = await getPublicFunctionDebugName(this.worldStateDB, address, selector, executionRequest.args);
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.verbose(
290
- `[AVM] Enqueued public call consumed ${gasUsed.l2Gas} L2 gas ending with ${result.gasLeft.l2Gas} L2 gas left.`,
285
+ this.log.debug(
286
+ `Simulated enqueued public call consumed ${gasUsed.l2Gas} L2 gas ending with ${result.gasLeft.l2Gas} L2 gas left.`,
291
287
  );
292
288
 
293
289
  stateManager.traceEnqueuedCall(callRequest, executionRequest.args, result.reverted);
@@ -329,18 +325,16 @@ export class PublicTxSimulator {
329
325
  ): Promise<AvmFinalizedCallResult> {
330
326
  const address = executionRequest.callContext.contractAddress;
331
327
  const sender = executionRequest.callContext.msgSender;
332
- const selector = executionRequest.callContext.functionSelector;
333
328
 
334
- this.log.verbose(
335
- `[AVM] Executing enqueued public call to external function ${fnName}@${address} with ${allocatedGas.l2Gas} allocated L2 gas.`,
329
+ this.log.debug(
330
+ `Executing enqueued public call to external function ${fnName}@${address} with ${allocatedGas.l2Gas} allocated L2 gas.`,
336
331
  );
337
332
  const timer = new Timer();
338
333
 
339
- const simulator = AvmSimulator.create(
334
+ const simulator = await AvmSimulator.create(
340
335
  stateManager,
341
336
  address,
342
337
  sender,
343
- selector,
344
338
  transactionFee,
345
339
  this.globalVariables,
346
340
  executionRequest.callContext.isStaticCall,
@@ -350,10 +344,10 @@ export class PublicTxSimulator {
350
344
  const avmCallResult = await simulator.execute();
351
345
  const result = avmCallResult.finalize();
352
346
 
353
- this.log.verbose(
354
- `[AVM] Simulation of enqueued public call ${fnName} completed. reverted: ${result.reverted}${
355
- result.reverted ? ', reason: ' + result.revertReason : ''
356
- }.`,
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.`,
357
351
  {
358
352
  eventName: 'avm-simulation',
359
353
  appCircuitName: fnName,
@@ -384,6 +378,11 @@ export class PublicTxSimulator {
384
378
  );
385
379
  }
386
380
  }
381
+ for (const noteHash of context.nonRevertibleAccumulatedDataFromPrivate.noteHashes) {
382
+ if (!noteHash.isEmpty()) {
383
+ stateManager.writeUniqueNoteHash(noteHash);
384
+ }
385
+ }
387
386
  }
388
387
 
389
388
  /**
@@ -403,5 +402,37 @@ export class PublicTxSimulator {
403
402
  );
404
403
  }
405
404
  }
405
+ for (const noteHash of context.revertibleAccumulatedDataFromPrivate.noteHashes) {
406
+ if (!noteHash.isEmpty()) {
407
+ // Revertible note hashes from private are not hashed with nonce, since private can't know their final position, only we can.
408
+ stateManager.writeSiloedNoteHash(noteHash);
409
+ }
410
+ }
411
+ }
412
+
413
+ private async payFee(context: PublicTxContext) {
414
+ const txFee = context.getTransactionFee(TxExecutionPhase.TEARDOWN);
415
+
416
+ if (context.feePayer.isZero()) {
417
+ this.log.debug(`No one is paying the fee of ${txFee.toBigInt()}`);
418
+ return;
419
+ }
420
+
421
+ const feeJuiceAddress = ProtocolContractAddress.FeeJuice;
422
+ const balanceSlot = computeFeePayerBalanceStorageSlot(context.feePayer);
423
+
424
+ this.log.debug(`Deducting ${txFee.toBigInt()} balance in Fee Juice for ${context.feePayer}`);
425
+ const stateManager = context.state.getActiveStateManager();
426
+
427
+ const currentBalance = await stateManager.readStorage(feeJuiceAddress, balanceSlot);
428
+
429
+ if (currentBalance.lt(txFee)) {
430
+ throw new Error(
431
+ `Not enough balance for fee payer to pay for transaction (got ${currentBalance.toBigInt()} needs ${txFee.toBigInt()})`,
432
+ );
433
+ }
434
+
435
+ const updatedBalance = currentBalance.sub(txFee);
436
+ await stateManager.writeStorage(feeJuiceAddress, balanceSlot, updatedBalance, true);
406
437
  }
407
438
  }
@@ -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 AvmContractCallResult, type AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
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[],
@@ -38,7 +39,8 @@ export interface PublicSideEffectTraceInterface {
38
39
  insertionPath?: Fr[],
39
40
  ): void;
40
41
  traceNoteHashCheck(contractAddress: AztecAddress, noteHash: Fr, leafIndex: Fr, exists: boolean, path?: Fr[]): void;
41
- traceNewNoteHash(contractAddress: AztecAddress, noteHash: Fr, leafIndex?: Fr, path?: Fr[]): void;
42
+ traceNewNoteHash(uniqueNoteHash: Fr, leafIndex?: Fr, path?: Fr[]): void;
43
+ getNoteHashCount(): number;
42
44
  traceNullifierCheck(
43
45
  siloedNullifier: Fr,
44
46
  exists: boolean,
@@ -66,6 +68,9 @@ export interface PublicSideEffectTraceInterface {
66
68
  contractAddress: AztecAddress,
67
69
  exists: boolean,
68
70
  instance?: SerializableContractInstance,
71
+ lowLeafPreimage?: NullifierLeafPreimage,
72
+ lowLeafIndex?: Fr,
73
+ lowLeafPath?: Fr[],
69
74
  ): void;
70
75
  traceGetBytecode(
71
76
  contractAddress: AztecAddress,
@@ -73,20 +78,9 @@ export interface PublicSideEffectTraceInterface {
73
78
  bytecode?: Buffer,
74
79
  contractInstance?: SerializableContractInstance,
75
80
  contractClass?: ContractClassIdPreimage,
76
- ): void;
77
- traceNestedCall(
78
- /** The trace of the nested call. */
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,
81
+ lowLeafPreimage?: NullifierLeafPreimage,
82
+ lowLeafIndex?: Fr,
83
+ lowLeafPath?: Fr[],
90
84
  ): void;
91
85
  traceEnqueuedCall(
92
86
  /** The call request from private that enqueued this call. */
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  type AvmCircuitPublicInputs,
3
- type Fr,
3
+ type AztecAddress,
4
+ Fr,
4
5
  type Gas,
5
6
  type GasSettings,
6
7
  type GlobalVariables,
7
8
  MAX_L2_TO_L1_MSGS_PER_TX,
8
- MAX_NOTE_HASHES_PER_TX,
9
- MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
9
+ MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
10
10
  PrivateToAvmAccumulatedData,
11
11
  PrivateToAvmAccumulatedDataArrayLengths,
12
12
  type PrivateToPublicAccumulatedData,
@@ -18,7 +18,6 @@ import {
18
18
  countAccumulatedItems,
19
19
  mergeAccumulatedData,
20
20
  } from '@aztec/circuits.js';
21
- import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash } from '@aztec/circuits.js/hash';
22
21
  import { padArrayEnd } from '@aztec/foundation/collection';
23
22
  import { assertLength } from '@aztec/foundation/serialize';
24
23
 
@@ -30,6 +29,7 @@ export function generateAvmCircuitPublicInputs(
30
29
  startStateReference: StateReference,
31
30
  startGasUsed: Gas,
32
31
  gasSettings: GasSettings,
32
+ feePayer: AztecAddress,
33
33
  setupCallRequests: PublicCallRequest[],
34
34
  appLogicCallRequests: PublicCallRequest[],
35
35
  teardownCallRequests: PublicCallRequest[],
@@ -52,6 +52,7 @@ export function generateAvmCircuitPublicInputs(
52
52
  startTreeSnapshots,
53
53
  startGasUsed,
54
54
  gasSettings,
55
+ feePayer,
55
56
  setupCallRequests,
56
57
  appLogicCallRequests,
57
58
  teardownCallRequests.length ? teardownCallRequests[0] : PublicCallRequest.empty(),
@@ -83,33 +84,6 @@ export function generateAvmCircuitPublicInputs(
83
84
  revertibleAccumulatedDataFromPrivate,
84
85
  );
85
86
 
86
- // merge all revertible & non-revertible side effects into output accumulated data
87
- const noteHashesFromPrivate = revertCode.isOK()
88
- ? mergeAccumulatedData(
89
- avmCircuitPublicInputs.previousNonRevertibleAccumulatedData.noteHashes,
90
- avmCircuitPublicInputs.previousRevertibleAccumulatedData.noteHashes,
91
- )
92
- : avmCircuitPublicInputs.previousNonRevertibleAccumulatedData.noteHashes;
93
- avmCircuitPublicInputs.accumulatedData.noteHashes = assertLength(
94
- mergeAccumulatedData(noteHashesFromPrivate, avmCircuitPublicInputs.accumulatedData.noteHashes),
95
- MAX_NOTE_HASHES_PER_TX,
96
- );
97
-
98
- const txHash = avmCircuitPublicInputs.previousNonRevertibleAccumulatedData.nullifiers[0];
99
-
100
- const scopedNoteHashesFromPublic = trace.getSideEffects().noteHashes;
101
- for (let i = 0; i < scopedNoteHashesFromPublic.length; i++) {
102
- const scopedNoteHash = scopedNoteHashesFromPublic[i];
103
- const noteHash = scopedNoteHash.value;
104
- if (!noteHash.isZero()) {
105
- const noteHashIndexInTx = i + countAccumulatedItems(noteHashesFromPrivate);
106
- const nonce = computeNoteHashNonce(txHash, noteHashIndexInTx);
107
- const uniqueNoteHash = computeUniqueNoteHash(nonce, noteHash);
108
- const siloedNoteHash = siloNoteHash(scopedNoteHash.contractAddress, uniqueNoteHash);
109
- avmCircuitPublicInputs.accumulatedData.noteHashes[noteHashIndexInTx] = siloedNoteHash;
110
- }
111
- }
112
-
113
87
  const msgsFromPrivate = revertCode.isOK()
114
88
  ? mergeAccumulatedData(
115
89
  avmCircuitPublicInputs.previousNonRevertibleAccumulatedData.l2ToL1Msgs,
@@ -121,28 +95,18 @@ export function generateAvmCircuitPublicInputs(
121
95
  MAX_L2_TO_L1_MSGS_PER_TX,
122
96
  );
123
97
 
124
- const dedupedPublicDataWrites: Array<PublicDataWrite> = [];
125
- const leafSlotOccurences: Map<bigint, number> = new Map();
126
- for (const publicDataWrite of avmCircuitPublicInputs.accumulatedData.publicDataWrites) {
127
- const slot = publicDataWrite.leafSlot.toBigInt();
128
- const prevOccurrences = leafSlotOccurences.get(slot) || 0;
129
- leafSlotOccurences.set(slot, prevOccurrences + 1);
130
- }
131
-
98
+ // Maps slot to value. Maps in TS are iterable in insertion order, which is exactly what we want for
99
+ // squashing "to the left", where the first occurrence of a slot uses the value of the last write to it,
100
+ // and the rest occurrences are omitted
101
+ const squashedPublicDataWrites: Map<bigint, Fr> = new Map();
132
102
  for (const publicDataWrite of avmCircuitPublicInputs.accumulatedData.publicDataWrites) {
133
- const slot = publicDataWrite.leafSlot.toBigInt();
134
- const prevOccurrences = leafSlotOccurences.get(slot) || 0;
135
- if (prevOccurrences === 1) {
136
- dedupedPublicDataWrites.push(publicDataWrite);
137
- } else {
138
- leafSlotOccurences.set(slot, prevOccurrences - 1);
139
- }
103
+ squashedPublicDataWrites.set(publicDataWrite.leafSlot.toBigInt(), publicDataWrite.value);
140
104
  }
141
105
 
142
106
  avmCircuitPublicInputs.accumulatedData.publicDataWrites = padArrayEnd(
143
- dedupedPublicDataWrites,
107
+ Array.from(squashedPublicDataWrites.entries()).map(([slot, value]) => new PublicDataWrite(new Fr(slot), value)),
144
108
  PublicDataWrite.empty(),
145
- MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
109
+ MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
146
110
  );
147
111
  //console.log(`AvmCircuitPublicInputs:\n${inspect(avmCircuitPublicInputs)}`);
148
112
  return avmCircuitPublicInputs;
@@ -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,0BAA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E,GAAG;IACjB,wCAAwC;IACxC,QAAQ,EAAE,MAAM;IAChB,yBAAyB;IACzB,cAAc,EAAE,qBAAqB;IACrC,gCAAgC;IAChC,YAAY,GAAE,MAAkB;IAoB3B,iBAAiB;IACtB,6DAA6D;IAC7D,iBAAiB,EAAE,iBAAiB;IACpC,0BAA0B;IAC1B,QAAQ,EAAE,EAAE,EAAE;IACd,2BAA2B;IAC3B,QAAQ,EAAE,OAAO;IAKnB;;OAEG;IACI,mCAAmC;IACxC,yBAAyB;IACzB,cAAc,EAAE,sBAAsB,GACrC,gDAAgD;IAGnD;;OAEG;IACI,0BAA0B;IAC/B,oDAAoD;IACpD,cAAc,EAAE,uBAAuB;IACvC,4DAA4D;IAC5D,YAAY,EAAE,GAAG;IACjB,wCAAwC;IACxC,QAAQ,EAAE,MAAM;IAChB,yBAAyB;IACzB,cAAc,EAAE,sBAAsB;IACtC,gCAAgC;IAChC,YAAY,GAAE,MAAkB,GAC/B,wBAAwB;IAUpB,kBAAkB,IAAI,gBAAgB,EAAE;CAGhD"}
@@ -1,119 +0,0 @@
1
- import { assert } from 'console';
2
- export class DualSideEffectTrace {
3
- constructor(innerCallTrace, enqueuedCallTrace) {
4
- this.innerCallTrace = innerCallTrace;
5
- this.enqueuedCallTrace = enqueuedCallTrace;
6
- }
7
- fork() {
8
- return new DualSideEffectTrace(this.innerCallTrace.fork(), this.enqueuedCallTrace.fork());
9
- }
10
- merge(nestedTrace, reverted = false) {
11
- this.enqueuedCallTrace.merge(nestedTrace.enqueuedCallTrace, reverted);
12
- }
13
- getCounter() {
14
- assert(this.innerCallTrace.getCounter() == this.enqueuedCallTrace.getCounter());
15
- return this.innerCallTrace.getCounter();
16
- }
17
- tracePublicStorageRead(contractAddress, slot, value, leafPreimage, leafIndex, path) {
18
- this.innerCallTrace.tracePublicStorageRead(contractAddress, slot, value, leafPreimage, leafIndex, path);
19
- this.enqueuedCallTrace.tracePublicStorageRead(contractAddress, slot, value, leafPreimage, leafIndex, path);
20
- }
21
- tracePublicStorageWrite(contractAddress, slot, value, lowLeafPreimage, lowLeafIndex, lowLeafPath, newLeafPreimage, insertionPath) {
22
- this.innerCallTrace.tracePublicStorageWrite(contractAddress, slot, value, lowLeafPreimage, lowLeafIndex, lowLeafPath, newLeafPreimage, insertionPath);
23
- this.enqueuedCallTrace.tracePublicStorageWrite(contractAddress, slot, value, lowLeafPreimage, lowLeafIndex, lowLeafPath, newLeafPreimage, insertionPath);
24
- }
25
- // TODO(8287): _exists can be removed once we have the vm properly handling the equality check
26
- traceNoteHashCheck(contractAddress, noteHash, leafIndex, exists, path) {
27
- this.innerCallTrace.traceNoteHashCheck(contractAddress, noteHash, leafIndex, exists, path);
28
- this.enqueuedCallTrace.traceNoteHashCheck(contractAddress, noteHash, leafIndex, exists, path);
29
- }
30
- traceNewNoteHash(contractAddress, noteHash, leafIndex, path) {
31
- this.innerCallTrace.traceNewNoteHash(contractAddress, noteHash, leafIndex, path);
32
- this.enqueuedCallTrace.traceNewNoteHash(contractAddress, noteHash, leafIndex, path);
33
- }
34
- traceNullifierCheck(siloedNullifier, exists, lowLeafPreimage, lowLeafIndex, lowLeafPath) {
35
- this.innerCallTrace.traceNullifierCheck(siloedNullifier, exists, lowLeafPreimage, lowLeafIndex, lowLeafPath);
36
- this.enqueuedCallTrace.traceNullifierCheck(siloedNullifier, exists, lowLeafPreimage, lowLeafIndex, lowLeafPath);
37
- }
38
- traceNewNullifier(siloedNullifier, lowLeafPreimage, lowLeafIndex, lowLeafPath, insertionPath) {
39
- this.innerCallTrace.traceNewNullifier(siloedNullifier, lowLeafPreimage, lowLeafIndex, lowLeafPath, insertionPath);
40
- this.enqueuedCallTrace.traceNewNullifier(siloedNullifier, lowLeafPreimage, lowLeafIndex, lowLeafPath, insertionPath);
41
- }
42
- traceL1ToL2MessageCheck(contractAddress, msgHash, msgLeafIndex, exists, path) {
43
- this.innerCallTrace.traceL1ToL2MessageCheck(contractAddress, msgHash, msgLeafIndex, exists, path);
44
- this.enqueuedCallTrace.traceL1ToL2MessageCheck(contractAddress, msgHash, msgLeafIndex, exists, path);
45
- }
46
- traceNewL2ToL1Message(contractAddress, recipient, content) {
47
- this.innerCallTrace.traceNewL2ToL1Message(contractAddress, recipient, content);
48
- this.enqueuedCallTrace.traceNewL2ToL1Message(contractAddress, recipient, content);
49
- }
50
- traceUnencryptedLog(contractAddress, log) {
51
- this.innerCallTrace.traceUnencryptedLog(contractAddress, log);
52
- this.enqueuedCallTrace.traceUnencryptedLog(contractAddress, log);
53
- }
54
- traceGetContractInstance(contractAddress, exists, instance) {
55
- this.innerCallTrace.traceGetContractInstance(contractAddress, exists, instance);
56
- this.enqueuedCallTrace.traceGetContractInstance(contractAddress, exists, instance);
57
- }
58
- traceGetBytecode(contractAddress, exists, bytecode, contractInstance, contractClass) {
59
- this.innerCallTrace.traceGetBytecode(contractAddress, exists, bytecode, contractInstance, contractClass);
60
- this.enqueuedCallTrace.traceGetBytecode(contractAddress, exists, bytecode, contractInstance, contractClass);
61
- }
62
- /**
63
- * Trace a nested call.
64
- * Accept some results from a finished nested call's trace into this one.
65
- */
66
- traceNestedCall(
67
- /** The trace of the nested call. */
68
- nestedCallTrace,
69
- /** The execution environment of the nested call. */
70
- nestedEnvironment,
71
- /** How much gas was available for this public execution. */
72
- startGasLeft,
73
- /** Bytecode used for this execution. */
74
- bytecode,
75
- /** The call's results */
76
- avmCallResults,
77
- /** Function name for logging */
78
- functionName = 'unknown') {
79
- this.innerCallTrace.traceNestedCall(nestedCallTrace.innerCallTrace, nestedEnvironment, startGasLeft, bytecode, avmCallResults, functionName);
80
- this.enqueuedCallTrace.traceNestedCall(nestedCallTrace.enqueuedCallTrace, nestedEnvironment, startGasLeft, bytecode, avmCallResults, functionName);
81
- }
82
- traceEnqueuedCall(
83
- /** The call request from private that enqueued this call. */
84
- publicCallRequest,
85
- /** The call's calldata */
86
- calldata,
87
- /** Did the call revert? */
88
- reverted) {
89
- this.enqueuedCallTrace.traceEnqueuedCall(publicCallRequest, calldata, reverted);
90
- }
91
- /**
92
- * Convert this trace to a PublicExecutionResult for use externally to the simulator.
93
- */
94
- toPublicEnqueuedCallExecutionResult(
95
- /** The call's results */
96
- avmCallResults) {
97
- return this.enqueuedCallTrace.toPublicEnqueuedCallExecutionResult(avmCallResults);
98
- }
99
- /**
100
- * Convert this trace to a PublicExecutionResult for use externally to the simulator.
101
- */
102
- toPublicFunctionCallResult(
103
- /** The execution environment of the nested call. */
104
- avmEnvironment,
105
- /** How much gas was available for this public execution. */
106
- startGasLeft,
107
- /** Bytecode used for this execution. */
108
- bytecode,
109
- /** The call's results */
110
- avmCallResults,
111
- /** Function name for logging */
112
- functionName = 'unknown') {
113
- return this.innerCallTrace.toPublicFunctionCallResult(avmEnvironment, startGasLeft, bytecode, avmCallResults, functionName);
114
- }
115
- getUnencryptedLogs() {
116
- return this.enqueuedCallTrace.getUnencryptedLogs();
117
- }
118
- }
119
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHVhbF9zaWRlX2VmZmVjdF90cmFjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWMvZHVhbF9zaWRlX2VmZmVjdF90cmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFZQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sU0FBUyxDQUFDO0FBU2pDLE1BQU0sT0FBTyxtQkFBbUI7SUFDOUIsWUFDa0IsY0FBcUMsRUFDckMsaUJBQW9EO1FBRHBELG1CQUFjLEdBQWQsY0FBYyxDQUF1QjtRQUNyQyxzQkFBaUIsR0FBakIsaUJBQWlCLENBQW1DO0lBQ25FLENBQUM7SUFFRyxJQUFJO1FBQ1QsT0FBTyxJQUFJLG1CQUFtQixDQUFDLElBQUksQ0FBQyxjQUFjLENBQUMsSUFBSSxFQUFFLEVBQUUsSUFBSSxDQUFDLGlCQUFpQixDQUFDLElBQUksRUFB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