@aztec/simulator 0.82.2 → 0.82.3-nightly.20250403

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 (155) hide show
  1. package/README.md +6 -0
  2. package/dest/private/acvm/oracle/oracle.d.ts +3 -2
  3. package/dest/private/acvm/oracle/oracle.d.ts.map +1 -1
  4. package/dest/private/acvm/oracle/oracle.js +9 -6
  5. package/dest/private/acvm/oracle/typed_oracle.d.ts +4 -3
  6. package/dest/private/acvm/oracle/typed_oracle.d.ts.map +1 -1
  7. package/dest/private/acvm/oracle/typed_oracle.js +4 -1
  8. package/dest/private/execution_data_provider.d.ts +20 -16
  9. package/dest/private/execution_data_provider.d.ts.map +1 -1
  10. package/dest/private/private_execution_oracle.d.ts +1 -1
  11. package/dest/private/private_execution_oracle.d.ts.map +1 -1
  12. package/dest/private/private_execution_oracle.js +2 -6
  13. package/dest/private/unconstrained_execution_oracle.d.ts +4 -2
  14. package/dest/private/unconstrained_execution_oracle.d.ts.map +1 -1
  15. package/dest/private/unconstrained_execution_oracle.js +5 -6
  16. package/dest/public/avm/avm_context.d.ts +3 -3
  17. package/dest/public/avm/avm_context.d.ts.map +1 -1
  18. package/dest/public/avm/avm_contract_call_result.d.ts +4 -2
  19. package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -1
  20. package/dest/public/avm/avm_contract_call_result.js +9 -5
  21. package/dest/public/avm/avm_machine_state.d.ts +2 -0
  22. package/dest/public/avm/avm_machine_state.d.ts.map +1 -1
  23. package/dest/public/avm/avm_machine_state.js +2 -0
  24. package/dest/public/avm/avm_simulator.d.ts +2 -2
  25. package/dest/public/avm/avm_simulator.d.ts.map +1 -1
  26. package/dest/public/avm/avm_simulator.js +5 -6
  27. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +2 -2
  28. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -1
  29. package/dest/public/avm/fixtures/avm_simulation_tester.js +3 -4
  30. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +1 -2
  31. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
  32. package/dest/public/avm/fixtures/base_avm_simulation_tester.js +0 -5
  33. package/dest/public/avm/fixtures/index.d.ts +6 -5
  34. package/dest/public/avm/fixtures/index.d.ts.map +1 -1
  35. package/dest/public/avm/fixtures/index.js +3 -3
  36. package/dest/public/avm/fixtures/simple_contract_data_source.d.ts +3 -2
  37. package/dest/public/avm/fixtures/simple_contract_data_source.d.ts.map +1 -1
  38. package/dest/public/avm/fixtures/simple_contract_data_source.js +30 -6
  39. package/dest/public/avm/index.d.ts +0 -1
  40. package/dest/public/avm/index.d.ts.map +1 -1
  41. package/dest/public/avm/index.js +0 -1
  42. package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
  43. package/dest/public/avm/opcodes/accrued_substate.js +1 -1
  44. package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
  45. package/dest/public/avm/opcodes/external_calls.js +2 -0
  46. package/dest/public/avm/opcodes/memory.d.ts.map +1 -1
  47. package/dest/public/avm/opcodes/memory.js +8 -10
  48. package/dest/public/avm/serialization/instruction_serialization.d.ts +5 -2
  49. package/dest/public/avm/serialization/instruction_serialization.d.ts.map +1 -1
  50. package/dest/public/avm/serialization/instruction_serialization.js +25 -7
  51. package/dest/public/avm/test_utils.d.ts +1 -1
  52. package/dest/public/avm/test_utils.d.ts.map +1 -1
  53. package/dest/public/executor_metrics.d.ts +11 -3
  54. package/dest/public/executor_metrics.d.ts.map +1 -1
  55. package/dest/public/executor_metrics.js +40 -6
  56. package/dest/public/executor_metrics_interface.d.ts +10 -0
  57. package/dest/public/executor_metrics_interface.d.ts.map +1 -0
  58. package/dest/public/executor_metrics_interface.js +1 -0
  59. package/dest/public/fixtures/public_tx_simulation_tester.d.ts +12 -6
  60. package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
  61. package/dest/public/fixtures/public_tx_simulation_tester.js +39 -19
  62. package/dest/public/hinting_db_sources.d.ts +26 -3
  63. package/dest/public/hinting_db_sources.d.ts.map +1 -1
  64. package/dest/public/hinting_db_sources.js +134 -1
  65. package/dest/public/index.d.ts +1 -1
  66. package/dest/public/index.d.ts.map +1 -1
  67. package/dest/public/index.js +1 -1
  68. package/dest/public/public_db_sources.d.ts +2 -3
  69. package/dest/public/public_db_sources.d.ts.map +1 -1
  70. package/dest/public/public_db_sources.js +26 -16
  71. package/dest/public/public_processor/public_processor.d.ts +4 -4
  72. package/dest/public/public_processor/public_processor.d.ts.map +1 -1
  73. package/dest/public/public_processor/public_processor.js +7 -28
  74. package/dest/public/public_tx_simulator/apps_tests/amm_test.d.ts +9 -0
  75. package/dest/public/public_tx_simulator/apps_tests/amm_test.d.ts.map +1 -0
  76. package/dest/public/public_tx_simulator/apps_tests/amm_test.js +237 -0
  77. package/dest/public/public_tx_simulator/apps_tests/token_test.d.ts +7 -0
  78. package/dest/public/public_tx_simulator/apps_tests/token_test.d.ts.map +1 -0
  79. package/dest/public/public_tx_simulator/apps_tests/token_test.js +109 -0
  80. package/dest/public/public_tx_simulator/index.d.ts +3 -0
  81. package/dest/public/public_tx_simulator/index.d.ts.map +1 -0
  82. package/dest/public/public_tx_simulator/index.js +2 -0
  83. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +23 -0
  84. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -0
  85. package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +58 -0
  86. package/dest/public/public_tx_simulator/public_tx_context.d.ts +5 -5
  87. package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
  88. package/dest/public/public_tx_simulator/public_tx_context.js +10 -8
  89. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +16 -16
  90. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
  91. package/dest/public/public_tx_simulator/public_tx_simulator.js +25 -65
  92. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +19 -0
  93. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -0
  94. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.js +39 -0
  95. package/dest/public/state_manager/index.d.ts +2 -0
  96. package/dest/public/state_manager/index.d.ts.map +1 -0
  97. package/dest/public/state_manager/index.js +1 -0
  98. package/dest/public/{avm/journal → state_manager}/nullifiers.d.ts +1 -1
  99. package/dest/public/state_manager/nullifiers.d.ts.map +1 -0
  100. package/dest/public/{avm/journal → state_manager}/public_storage.d.ts +1 -1
  101. package/dest/public/state_manager/public_storage.d.ts.map +1 -0
  102. package/dest/public/{avm/journal/journal.d.ts → state_manager/state_manager.d.ts} +10 -10
  103. package/dest/public/state_manager/state_manager.d.ts.map +1 -0
  104. package/dest/public/{avm/journal/journal.js → state_manager/state_manager.js} +5 -5
  105. package/dest/public/test_executor_metrics.d.ts +43 -0
  106. package/dest/public/test_executor_metrics.d.ts.map +1 -0
  107. package/dest/public/test_executor_metrics.js +158 -0
  108. package/package.json +14 -14
  109. package/src/private/acvm/oracle/oracle.ts +26 -5
  110. package/src/private/acvm/oracle/typed_oracle.ts +14 -3
  111. package/src/private/execution_data_provider.ts +34 -18
  112. package/src/private/private_execution_oracle.ts +2 -13
  113. package/src/private/unconstrained_execution_oracle.ts +22 -15
  114. package/src/public/avm/avm_context.ts +2 -2
  115. package/src/public/avm/avm_contract_call_result.ts +15 -3
  116. package/src/public/avm/avm_machine_state.ts +5 -0
  117. package/src/public/avm/avm_simulator.ts +20 -9
  118. package/src/public/avm/fixtures/avm_simulation_tester.ts +4 -4
  119. package/src/public/avm/fixtures/base_avm_simulation_tester.ts +1 -7
  120. package/src/public/avm/fixtures/index.ts +7 -7
  121. package/src/public/avm/fixtures/simple_contract_data_source.ts +33 -6
  122. package/src/public/avm/index.ts +0 -1
  123. package/src/public/avm/opcodes/accrued_substate.ts +1 -1
  124. package/src/public/avm/opcodes/external_calls.ts +3 -0
  125. package/src/public/avm/opcodes/memory.ts +8 -10
  126. package/src/public/avm/serialization/instruction_serialization.ts +24 -9
  127. package/src/public/avm/test_utils.ts +1 -1
  128. package/src/public/executor_metrics.ts +54 -6
  129. package/src/public/executor_metrics_interface.ts +15 -0
  130. package/src/public/fixtures/public_tx_simulation_tester.ts +74 -18
  131. package/src/public/hinting_db_sources.ts +228 -3
  132. package/src/public/index.ts +1 -1
  133. package/src/public/public_db_sources.ts +36 -23
  134. package/src/public/public_processor/public_processor.ts +8 -28
  135. package/src/public/public_tx_simulator/apps_tests/amm_test.ts +316 -0
  136. package/src/public/public_tx_simulator/apps_tests/token_test.ts +138 -0
  137. package/src/public/public_tx_simulator/index.ts +2 -0
  138. package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +111 -0
  139. package/src/public/public_tx_simulator/public_tx_context.ts +13 -17
  140. package/src/public/public_tx_simulator/public_tx_simulator.ts +35 -79
  141. package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +62 -0
  142. package/src/public/state_manager/index.ts +1 -0
  143. package/src/public/{avm/journal → state_manager}/nullifiers.ts +1 -1
  144. package/src/public/{avm/journal → state_manager}/public_storage.ts +1 -1
  145. package/src/public/{avm/journal/journal.ts → state_manager/state_manager.ts} +20 -13
  146. package/src/public/test_executor_metrics.ts +222 -0
  147. package/dest/public/avm/journal/index.d.ts +0 -2
  148. package/dest/public/avm/journal/index.d.ts.map +0 -1
  149. package/dest/public/avm/journal/index.js +0 -1
  150. package/dest/public/avm/journal/journal.d.ts.map +0 -1
  151. package/dest/public/avm/journal/nullifiers.d.ts.map +0 -1
  152. package/dest/public/avm/journal/public_storage.d.ts.map +0 -1
  153. package/src/public/avm/journal/index.ts +0 -1
  154. /package/dest/public/{avm/journal → state_manager}/nullifiers.js +0 -0
  155. /package/dest/public/{avm/journal → state_manager}/public_storage.js +0 -0
@@ -11,9 +11,9 @@ import { MerkleTreeId } from '@aztec/stdlib/trees';
11
11
  import { TreeSnapshots, TxExecutionPhase } from '@aztec/stdlib/tx';
12
12
  import { strict as assert } from 'assert';
13
13
  import { inspect } from 'util';
14
- import { AvmPersistableStateManager } from '../avm/index.js';
15
- import { HintingPublicContractsDB } from '../hinting_db_sources.js';
14
+ import { HintingPublicContractsDB, HintingPublicTreesDB } from '../hinting_db_sources.js';
16
15
  import { SideEffectArrayLengths, SideEffectTrace } from '../side_effect_trace.js';
16
+ import { PublicPersistableStateManager } from '../state_manager/state_manager.js';
17
17
  import { getCallRequestsWithCalldataByPhase } from '../utils.js';
18
18
  /**
19
19
  * The transaction-level context for public execution.
@@ -69,9 +69,9 @@ import { getCallRequestsWithCalldataByPhase } from '../utils.js';
69
69
  // We wrap the DB to collect AVM hints.
70
70
  const hints = new AvmExecutionHints();
71
71
  const hintingContractsDB = new HintingPublicContractsDB(contractsDB, hints);
72
- // TODO: Wrap merkle db.
72
+ const hintingTreesDB = new HintingPublicTreesDB(treesDB, hints);
73
73
  // Transaction level state manager that will be forked for revertible phases.
74
- const txStateManager = AvmPersistableStateManager.create(treesDB, hintingContractsDB, trace, doMerkleOperations, firstNullifier, globalVariables.blockNumber.toNumber());
74
+ const txStateManager = PublicPersistableStateManager.create(hintingTreesDB, hintingContractsDB, trace, doMerkleOperations, firstNullifier, globalVariables.blockNumber.toNumber());
75
75
  const gasSettings = tx.data.constants.txContext.gasSettings;
76
76
  const gasUsedByPrivate = tx.data.gasUsed;
77
77
  // Gas allocated to public is "whatever's left" after private, but with some max applied.
@@ -215,13 +215,15 @@ import { getCallRequestsWithCalldataByPhase } from '../utils.js';
215
215
  }
216
216
  /**
217
217
  * Generate the public inputs for the AVM circuit.
218
- */ async generateAvmCircuitPublicInputs(endStateReference) {
218
+ */ async generateAvmCircuitPublicInputs() {
219
219
  assert(this.halted, 'Can only get AvmCircuitPublicInputs after tx execution ends');
220
220
  const stateManager = this.state.getActiveStateManager();
221
221
  const startTreeSnapshots = new TreeSnapshots(this.startStateReference.l1ToL2MessageTree, this.startStateReference.partial.noteHashTree, this.startStateReference.partial.nullifierTree, this.startStateReference.partial.publicDataTree);
222
- // Will be patched/padded at the end of this fn
223
- const endTreeSnapshots = new TreeSnapshots(endStateReference.l1ToL2MessageTree, endStateReference.partial.noteHashTree, endStateReference.partial.nullifierTree, endStateReference.partial.publicDataTree);
224
- const avmCircuitPublicInputs = this.trace.toAvmCircuitPublicInputs(this.globalVariables, startTreeSnapshots, /*startGasUsed=*/ this.gasUsedByPrivate, this.gasSettings, this.feePayer, this.setupCallRequests.map((r)=>r.request), this.appLogicCallRequests.map((r)=>r.request), /*teardownCallRequest=*/ this.teardownCallRequests.length ? this.teardownCallRequests[0].request : PublicCallRequest.empty(), endTreeSnapshots, /*endGasUsed=*/ this.getTotalGasUsed(), /*transactionFee=*/ this.getTransactionFeeUnsafe(), /*reverted=*/ !this.revertCode.isOK());
222
+ // FIXME: We are first creating the PIs with the wrong endTreeSnapshots, then patching them.
223
+ // This is because we need to know the lengths of the accumulated data arrays to pad them.
224
+ // We should refactor this to avoid this hack.
225
+ // We should just get the info we need from the trace, and create the rest of the PIs here.
226
+ const avmCircuitPublicInputs = this.trace.toAvmCircuitPublicInputs(this.globalVariables, startTreeSnapshots, /*startGasUsed=*/ this.gasUsedByPrivate, this.gasSettings, this.feePayer, this.setupCallRequests.map((r)=>r.request), this.appLogicCallRequests.map((r)=>r.request), /*teardownCallRequest=*/ this.teardownCallRequests.length ? this.teardownCallRequests[0].request : PublicCallRequest.empty(), /*endTreeSnapshots=*/ TreeSnapshots.empty(), /*endGasUsed=*/ this.getTotalGasUsed(), /*transactionFee=*/ this.getTransactionFeeUnsafe(), /*reverted=*/ !this.revertCode.isOK());
225
227
  const getArrayLengths = (from)=>new PrivateToAvmAccumulatedDataArrayLengths(countAccumulatedItems(from.noteHashes), countAccumulatedItems(from.nullifiers), countAccumulatedItems(from.l2ToL1Msgs));
226
228
  const convertAccumulatedData = (from)=>new PrivateToAvmAccumulatedData(from.noteHashes, from.nullifiers, from.l2ToL1Msgs);
227
229
  // Temporary overrides as these entries aren't yet populated in trace
@@ -1,14 +1,16 @@
1
+ import type { Fr } from '@aztec/foundation/fields';
2
+ import { type Logger } from '@aztec/foundation/log';
1
3
  import { type AvmProvingRequest, type RevertCode } from '@aztec/stdlib/avm';
2
4
  import { SimulationError } from '@aztec/stdlib/errors';
3
- import type { GasUsed } from '@aztec/stdlib/gas';
4
- import { type GlobalVariables, NestedProcessReturnValues, Tx, TxExecutionPhase } from '@aztec/stdlib/tx';
5
- import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
6
- import { ExecutorMetrics } from '../executor_metrics.js';
5
+ import type { Gas, GasUsed } from '@aztec/stdlib/gas';
6
+ import { type GlobalVariables, NestedProcessReturnValues, PublicCallRequestWithCalldata, Tx, TxExecutionPhase } from '@aztec/stdlib/tx';
7
+ import type { AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
7
8
  import type { PublicContractsDB, PublicTreesDB } from '../public_db_sources.js';
9
+ import type { PublicPersistableStateManager } from '../state_manager/state_manager.js';
8
10
  import { PublicTxContext } from './public_tx_context.js';
9
11
  export type ProcessedPhase = {
10
12
  phase: TxExecutionPhase;
11
- durationMs: number;
13
+ durationMs?: number;
12
14
  returnValues: NestedProcessReturnValues[];
13
15
  reverted: boolean;
14
16
  revertReason?: SimulationError;
@@ -24,20 +26,19 @@ export type PublicTxResult = {
24
26
  };
25
27
  export declare class PublicTxSimulator {
26
28
  private treesDB;
27
- private contractsDB;
29
+ protected contractsDB: PublicContractsDB;
28
30
  private globalVariables;
29
31
  private doMerkleOperations;
30
32
  private skipFeeEnforcement;
31
- metrics: ExecutorMetrics;
32
- private log;
33
- constructor(treesDB: PublicTreesDB, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, doMerkleOperations?: boolean, skipFeeEnforcement?: boolean, telemetryClient?: TelemetryClient);
34
- get tracer(): Tracer;
33
+ protected log: Logger;
34
+ constructor(treesDB: PublicTreesDB, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, doMerkleOperations?: boolean, skipFeeEnforcement?: boolean);
35
35
  /**
36
36
  * Simulate a transaction's public portion including all of its phases.
37
37
  * @param tx - The transaction to simulate.
38
38
  * @returns The result of the transaction's public execution.
39
39
  */
40
40
  simulate(tx: Tx): Promise<PublicTxResult>;
41
+ protected computeTxHash(tx: Tx): Promise<import("@aztec/stdlib/tx").TxHash>;
41
42
  /**
42
43
  * Simulate the setup phase of a transaction's public execution.
43
44
  * @param context - WILL BE MUTATED. The context of the currently executing public transaction portion
@@ -62,7 +63,7 @@ export declare class PublicTxSimulator {
62
63
  * @param context - WILL BE MUTATED. The context of the currently executing public transaction portion
63
64
  * @returns The phase result.
64
65
  */
65
- private simulatePhase;
66
+ protected simulatePhase(phase: TxExecutionPhase, context: PublicTxContext): Promise<ProcessedPhase>;
66
67
  /**
67
68
  * Simulate an enqueued public call.
68
69
  * @param phase - The current phase of public execution
@@ -70,7 +71,7 @@ export declare class PublicTxSimulator {
70
71
  * @param callRequest - The public function call request, including the calldata.
71
72
  * @returns The result of execution.
72
73
  */
73
- private simulateEnqueuedCall;
74
+ protected simulateEnqueuedCall(phase: TxExecutionPhase, context: PublicTxContext, callRequest: PublicCallRequestWithCalldata): Promise<AvmFinalizedCallResult>;
74
75
  /**
75
76
  * Simulate an enqueued public call, without modifying the context (PublicTxContext).
76
77
  * Resulting modifications to the context can be applied by the caller.
@@ -79,22 +80,21 @@ export declare class PublicTxSimulator {
79
80
  * while still simulating phases and generating a proving request.
80
81
  *
81
82
  * @param stateManager - The state manager for AvmSimulation
82
- * @param context - The context of the currently executing public transaction portion
83
83
  * @param callRequest - The public function call request, including the calldata.
84
84
  * @param allocatedGas - The gas allocated to the enqueued call
85
85
  * @param fnName - The name of the function
86
86
  * @returns The result of execution.
87
87
  */
88
- private simulateEnqueuedCallInternal;
88
+ protected simulateEnqueuedCallInternal(stateManager: PublicPersistableStateManager, { request, calldata }: PublicCallRequestWithCalldata, allocatedGas: Gas, transactionFee: Fr, fnName: string): Promise<AvmFinalizedCallResult>;
89
89
  /**
90
90
  * Insert the non-revertible accumulated data from private into the public state.
91
91
  */
92
- insertNonRevertiblesFromPrivate(context: PublicTxContext): Promise<void>;
92
+ protected insertNonRevertiblesFromPrivate(context: PublicTxContext, tx: Tx): Promise<void>;
93
93
  /**
94
94
  * Insert the revertible accumulated data from private into the public state.
95
95
  * Start by forking state so we can rollback to the end of setup if app logic or teardown reverts.
96
96
  */
97
- insertRevertiblesFromPrivate(context: PublicTxContext): Promise<boolean>;
97
+ protected insertRevertiblesFromPrivate(context: PublicTxContext, tx: Tx): Promise<boolean>;
98
98
  private payFee;
99
99
  /**
100
100
  * Generate the proving request for the AVM circuit.
@@ -1 +1 @@
1
- {"version":3,"file":"public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/public_tx_simulator.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAO,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EACL,KAAK,eAAe,EACpB,yBAAyB,EAEzB,EAAE,EACF,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,MAAM,EAAiC,MAAM,yBAAyB,CAAC;AAQvH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,gBAAgB,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,yBAAyB,EAAE,CAAC;IAC1C,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,eAAe,CAAC;CAChC,CAAC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(decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- }
7
1
  import { createLogger } from '@aztec/foundation/log';
8
- import { Timer } from '@aztec/foundation/timer';
9
2
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
10
3
  import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
11
4
  import { AvmCircuitInputs, AvmEnqueuedCallHint } from '@aztec/stdlib/avm';
12
5
  import { SimulationError } from '@aztec/stdlib/errors';
13
6
  import { ProvingRequestType } from '@aztec/stdlib/proofs';
14
7
  import { NestedProcessReturnValues, TxExecutionPhase } from '@aztec/stdlib/tx';
15
- import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
16
8
  import { strict as assert } from 'assert';
17
9
  import { getPublicFunctionDebugName } from '../../common/debug_fn_name.js';
18
10
  import { AvmSimulator } from '../avm/index.js';
19
- import { NullifierCollisionError } from '../avm/journal/nullifiers.js';
20
- import { ExecutorMetrics } from '../executor_metrics.js';
11
+ import { NullifierCollisionError } from '../state_manager/nullifiers.js';
21
12
  import { PublicTxContext } from './public_tx_context.js';
22
13
  export class PublicTxSimulator {
23
14
  treesDB;
@@ -25,19 +16,14 @@ export class PublicTxSimulator {
25
16
  globalVariables;
26
17
  doMerkleOperations;
27
18
  skipFeeEnforcement;
28
- metrics;
29
19
  log;
30
- constructor(treesDB, contractsDB, globalVariables, doMerkleOperations = false, skipFeeEnforcement = false, telemetryClient = getTelemetryClient()){
20
+ constructor(treesDB, contractsDB, globalVariables, doMerkleOperations = false, skipFeeEnforcement = false){
31
21
  this.treesDB = treesDB;
32
22
  this.contractsDB = contractsDB;
33
23
  this.globalVariables = globalVariables;
34
24
  this.doMerkleOperations = doMerkleOperations;
35
25
  this.skipFeeEnforcement = skipFeeEnforcement;
36
26
  this.log = createLogger(`simulator:public_tx_simulator`);
37
- this.metrics = new ExecutorMetrics(telemetryClient, 'PublicTxSimulator');
38
- }
39
- get tracer() {
40
- return this.metrics.tracer;
41
27
  }
42
28
  /**
43
29
  * Simulate a transaction's public portion including all of its phases.
@@ -45,31 +31,19 @@ export class PublicTxSimulator {
45
31
  * @returns The result of the transaction's public execution.
46
32
  */ async simulate(tx) {
47
33
  try {
48
- const startTime = process.hrtime.bigint();
49
- const txHash = await tx.getTxHash();
34
+ const txHash = await this.computeTxHash(tx);
50
35
  this.log.debug(`Simulating ${tx.publicFunctionCalldata.length} public calls for tx ${txHash}`, {
51
36
  txHash
52
37
  });
53
38
  const context = await PublicTxContext.create(this.treesDB, this.contractsDB, tx, this.globalVariables, this.doMerkleOperations);
54
- const nonRevertStart = process.hrtime.bigint();
55
- await this.insertNonRevertiblesFromPrivate(context);
56
- // add new contracts to the contracts db so that their functions may be found and called
57
- // TODO(#6464): Should we allow emitting contracts in the private setup phase?
58
- await this.contractsDB.addNewNonRevertibleContracts(tx);
59
- const nonRevertEnd = process.hrtime.bigint();
60
- this.metrics.recordPrivateEffectsInsertion(Number(nonRevertEnd - nonRevertStart) / 1_000, 'non-revertible');
39
+ await this.insertNonRevertiblesFromPrivate(context, tx);
61
40
  const processedPhases = [];
62
41
  if (context.hasPhase(TxExecutionPhase.SETUP)) {
63
42
  const setupResult = await this.simulateSetupPhase(context);
64
43
  processedPhases.push(setupResult);
65
44
  }
66
- const revertStart = process.hrtime.bigint();
67
- const success = await this.insertRevertiblesFromPrivate(context);
45
+ const success = await this.insertRevertiblesFromPrivate(context, tx);
68
46
  if (success) {
69
- // add new contracts to the contracts db so that their functions may be found and called
70
- await this.contractsDB.addNewRevertibleContracts(tx);
71
- const revertEnd = process.hrtime.bigint();
72
- this.metrics.recordPrivateEffectsInsertion(Number(revertEnd - revertStart) / 1_000, 'revertible');
73
47
  // Only proceed with app logic if there was no revert during revertible insertion
74
48
  if (context.hasPhase(TxExecutionPhase.APP_LOGIC)) {
75
49
  const appLogicResult = await this.simulateAppLogicPhase(context);
@@ -84,7 +58,7 @@ export class PublicTxSimulator {
84
58
  }
85
59
  await context.halt();
86
60
  await this.payFee(context);
87
- const publicInputs = await context.generateAvmCircuitPublicInputs(await this.treesDB.getStateReference());
61
+ const publicInputs = await context.generateAvmCircuitPublicInputs();
88
62
  const avmProvingRequest = PublicTxSimulator.generateProvingRequest(publicInputs, context.hints);
89
63
  const revertCode = context.getFinalRevertCode();
90
64
  if (!revertCode.isOK()) {
@@ -93,9 +67,9 @@ export class PublicTxSimulator {
93
67
  // Commit contracts from this TX to the block-level cache and clear tx cache
94
68
  // If the tx reverted, only commit non-revertible contracts
95
69
  // NOTE: You can't create contracts in public, so this is only relevant for private-created contracts
70
+ // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
71
+ // However things should work as they are now because the hinted db would still pick up the new contracts.
96
72
  this.contractsDB.commitContractsForTx(/*onlyNonRevertibles=*/ !revertCode.isOK());
97
- const endTime = process.hrtime.bigint();
98
- this.log.debug(`Public TX simulator took ${Number(endTime - startTime) / 1_000_000} ms\n`);
99
73
  return {
100
74
  avmProvingRequest,
101
75
  gasUsed: {
@@ -111,9 +85,14 @@ export class PublicTxSimulator {
111
85
  } finally{
112
86
  // Make sure there are no new contracts in the tx-level cache.
113
87
  // They should either be committed to block-level cache or cleared.
88
+ // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
89
+ // However things should work as they are now because the hinted db would still pick up the new contracts.
114
90
  this.contractsDB.clearContractsForTx();
115
91
  }
116
92
  }
93
+ async computeTxHash(tx) {
94
+ return await tx.getTxHash();
95
+ }
117
96
  /**
118
97
  * Simulate the setup phase of a transaction's public execution.
119
98
  * @param context - WILL BE MUTATED. The context of the currently executing public transaction portion
@@ -174,7 +153,6 @@ export class PublicTxSimulator {
174
153
  const returnValues = [];
175
154
  let reverted = false;
176
155
  let revertReason;
177
- const phaseTimer = new Timer();
178
156
  for(let i = callRequests.length - 1; i >= 0; i--){
179
157
  if (reverted) {
180
158
  break;
@@ -189,7 +167,6 @@ export class PublicTxSimulator {
189
167
  }
190
168
  return {
191
169
  phase,
192
- durationMs: phaseTimer.ms(),
193
170
  returnValues,
194
171
  reverted,
195
172
  revertReason
@@ -229,7 +206,6 @@ export class PublicTxSimulator {
229
206
  * while still simulating phases and generating a proving request.
230
207
  *
231
208
  * @param stateManager - The state manager for AvmSimulation
232
- * @param context - The context of the currently executing public transaction portion
233
209
  * @param callRequest - The public function call request, including the calldata.
234
210
  * @param allocatedGas - The gas allocated to the enqueued call
235
211
  * @param fnName - The name of the function
@@ -238,25 +214,13 @@ export class PublicTxSimulator {
238
214
  const address = request.contractAddress;
239
215
  const sender = request.msgSender;
240
216
  this.log.debug(`Executing enqueued public call to external function ${fnName}@${address} with ${allocatedGas.l2Gas} allocated L2 gas.`);
241
- const timer = new Timer();
242
217
  const simulator = await AvmSimulator.create(stateManager, address, sender, transactionFee, this.globalVariables, request.isStaticCall, calldata, allocatedGas);
243
218
  const avmCallResult = await simulator.execute();
244
- const result = avmCallResult.finalize();
245
- this.log.verbose(result.reverted ? `Simulation of enqueued public call ${fnName} reverted with reason ${result.revertReason}.` : `Simulation of enqueued public call ${fnName} completed successfully.`, {
246
- eventName: 'avm-simulation',
247
- appCircuitName: fnName,
248
- duration: timer.ms()
249
- });
250
- if (result.reverted) {
251
- this.metrics.recordFunctionSimulationFailure();
252
- } else {
253
- this.metrics.recordFunctionSimulation(timer.ms(), allocatedGas.sub(result.gasLeft).l2Gas, fnName);
254
- }
255
- return result;
219
+ return avmCallResult.finalize();
256
220
  }
257
221
  /**
258
222
  * Insert the non-revertible accumulated data from private into the public state.
259
- */ async insertNonRevertiblesFromPrivate(context) {
223
+ */ async insertNonRevertiblesFromPrivate(context, tx) {
260
224
  const stateManager = context.state.getActiveStateManager();
261
225
  try {
262
226
  await stateManager.writeSiloedNullifiersFromPrivate(context.nonRevertibleAccumulatedDataFromPrivate.nullifiers);
@@ -270,11 +234,16 @@ export class PublicTxSimulator {
270
234
  await stateManager.writeUniqueNoteHash(noteHash);
271
235
  }
272
236
  }
237
+ // add new contracts to the contracts db so that their functions may be found and called
238
+ // TODO(#6464): Should we allow emitting contracts in the private setup phase?
239
+ // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
240
+ // However things should work as they are now because the hinted db would still pick up the new contracts.
241
+ await this.contractsDB.addNewNonRevertibleContracts(tx);
273
242
  }
274
243
  /**
275
244
  * Insert the revertible accumulated data from private into the public state.
276
245
  * Start by forking state so we can rollback to the end of setup if app logic or teardown reverts.
277
- */ async insertRevertiblesFromPrivate(context) {
246
+ */ async insertRevertiblesFromPrivate(context, tx) {
278
247
  // Fork the state manager so we can rollback to end of setup if app logic reverts.
279
248
  await context.state.fork();
280
249
  const stateManager = context.state.getActiveStateManager();
@@ -295,6 +264,10 @@ export class PublicTxSimulator {
295
264
  await stateManager.writeSiloedNoteHash(noteHash);
296
265
  }
297
266
  }
267
+ // add new contracts to the contracts db so that their functions may be found and called
268
+ // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
269
+ // However things should work as they are now because the hinted db would still pick up the new contracts.
270
+ await this.contractsDB.addNewRevertibleContracts(tx);
298
271
  return /*success=*/ true;
299
272
  }
300
273
  async payFee(context) {
@@ -329,16 +302,3 @@ export class PublicTxSimulator {
329
302
  };
330
303
  }
331
304
  }
332
- _ts_decorate([
333
- trackSpan('PublicTxSimulator.simulateEnqueuedCall', (phase, context, callRequest)=>({
334
- [Attributes.TX_HASH]: context.txHash.toString(),
335
- [Attributes.TARGET_ADDRESS]: callRequest.request.contractAddress.toString(),
336
- [Attributes.SENDER_ADDRESS]: callRequest.request.msgSender.toString(),
337
- [Attributes.SIMULATOR_PHASE]: TxExecutionPhase[phase].toString()
338
- }))
339
- ], PublicTxSimulator.prototype, "simulateEnqueuedCall", null);
340
- _ts_decorate([
341
- trackSpan('PublicTxSimulator.simulateEnqueuedCallInternal', (_stateManager, _callRequest, _allocatedGas, _transactionFee, fnName)=>({
342
- [Attributes.APP_CIRCUIT_NAME]: fnName
343
- }))
344
- ], PublicTxSimulator.prototype, "simulateEnqueuedCallInternal", null);
@@ -0,0 +1,19 @@
1
+ import type { Fr } from '@aztec/foundation/fields';
2
+ import type { Gas } from '@aztec/stdlib/gas';
3
+ import { type GlobalVariables, PublicCallRequestWithCalldata, TxExecutionPhase } from '@aztec/stdlib/tx';
4
+ import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
5
+ import type { AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
6
+ import type { PublicContractsDB, PublicTreesDB } from '../public_db_sources.js';
7
+ import type { PublicPersistableStateManager } from '../state_manager/state_manager.js';
8
+ import { MeasuredPublicTxSimulator } from './measured_public_tx_simulator.js';
9
+ import { PublicTxContext } from './public_tx_context.js';
10
+ /**
11
+ * A public tx simulator that tracks runtime/production metrics with telemetry.
12
+ */
13
+ export declare class TelemetryPublicTxSimulator extends MeasuredPublicTxSimulator {
14
+ readonly tracer: Tracer;
15
+ constructor(treesDB: PublicTreesDB, contractsDB: PublicContractsDB, globalVariables: GlobalVariables, doMerkleOperations?: boolean, skipFeeEnforcement?: boolean, telemetryClient?: TelemetryClient);
16
+ protected simulateEnqueuedCall(phase: TxExecutionPhase, context: PublicTxContext, callRequest: PublicCallRequestWithCalldata): Promise<AvmFinalizedCallResult>;
17
+ protected simulateEnqueuedCallInternal(stateManager: PublicPersistableStateManager, callRequest: PublicCallRequestWithCalldata, allocatedGas: Gas, transactionFee: Fr, fnName: string): Promise<AvmFinalizedCallResult>;
18
+ }
19
+ //# sourceMappingURL=telemetry_public_tx_simulator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry_public_tx_simulator.d.ts","sourceRoot":"","sources":["../../../src/public/public_tx_simulator/telemetry_public_tx_simulator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c = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ }
7
+ import { TxExecutionPhase } from '@aztec/stdlib/tx';
8
+ import { Attributes, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
9
+ import { ExecutorMetrics } from '../executor_metrics.js';
10
+ import { MeasuredPublicTxSimulator } from './measured_public_tx_simulator.js';
11
+ /**
12
+ * A public tx simulator that tracks runtime/production metrics with telemetry.
13
+ */ export class TelemetryPublicTxSimulator extends MeasuredPublicTxSimulator {
14
+ /* tracer needed by trackSpans */ tracer;
15
+ constructor(treesDB, contractsDB, globalVariables, doMerkleOperations = false, skipFeeEnforcement = false, telemetryClient = getTelemetryClient()){
16
+ const metrics = new ExecutorMetrics(telemetryClient, 'PublicTxSimulator');
17
+ super(treesDB, contractsDB, globalVariables, doMerkleOperations, skipFeeEnforcement, metrics);
18
+ this.tracer = metrics.tracer;
19
+ }
20
+ async simulateEnqueuedCall(phase, context, callRequest) {
21
+ return await super.simulateEnqueuedCall(phase, context, callRequest);
22
+ }
23
+ async simulateEnqueuedCallInternal(stateManager, callRequest, allocatedGas, transactionFee, fnName) {
24
+ return await super.simulateEnqueuedCallInternal(stateManager, callRequest, allocatedGas, transactionFee, fnName);
25
+ }
26
+ }
27
+ _ts_decorate([
28
+ trackSpan('PublicTxSimulator.simulateEnqueuedCall', (phase, context, callRequest)=>({
29
+ [Attributes.TX_HASH]: context.txHash.toString(),
30
+ [Attributes.TARGET_ADDRESS]: callRequest.request.contractAddress.toString(),
31
+ [Attributes.SENDER_ADDRESS]: callRequest.request.msgSender.toString(),
32
+ [Attributes.SIMULATOR_PHASE]: TxExecutionPhase[phase].toString()
33
+ }))
34
+ ], TelemetryPublicTxSimulator.prototype, "simulateEnqueuedCall", null);
35
+ _ts_decorate([
36
+ trackSpan('PublicTxSimulator.simulateEnqueuedCallInternal', (_stateManager, _callRequest, _allocatedGas, _transactionFee, fnName)=>({
37
+ [Attributes.APP_CIRCUIT_NAME]: fnName
38
+ }))
39
+ ], TelemetryPublicTxSimulator.prototype, "simulateEnqueuedCallInternal", null);
@@ -0,0 +1,2 @@
1
+ export * from './state_manager.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/public/state_manager/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './state_manager.js';
@@ -1,5 +1,5 @@
1
1
  import type { Fr } from '@aztec/foundation/fields';
2
- import type { PublicTreesDB } from '../../public_db_sources.js';
2
+ import type { PublicTreesDB } from '../public_db_sources.js';
3
3
  /**
4
4
  * A class to manage new nullifier staging and existence checks during a contract call's AVM simulation.
5
5
  * Maintains a siloed nullifier cache, and ensures that existence checks fall back to the correct source.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nullifiers.d.ts","sourceRoot":"","sources":["../../../src/public/state_manager/nullifiers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;GAIG;AACH,qBAAa,gBAAgB;IAEzB,+DAA+D;IAC/D,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,kCAAkC;IAClC,OAAO,CAAC,KAAK;IACb,+CAA+C;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;;IALxB,+DAA+D;IAC9C,cAAc,EAAE,aAAa;IAC9C,kCAAkC;IAC1B,KAAK,GAAE,GAAG,CAAC,MAAM,CAAa;IACtC,+CAA+C;IAC9B,MAAM,CAAC,8BAAkB;IAG5C;;OAEG;IACI,IAAI;IAIX;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IAW/B;;;;;;;;;;OAUG;IACU,WAAW,CAAC,eAAe,EAAE,EAAE,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IAmB9F;;;;OAIG;IACU,MAAM,CAAC,eAAe,EAAE,EAAE;IAQvC;;;;OAIG;IACI,cAAc,CAAC,kBAAkB,EAAE,gBAAgB;CAU3D;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;CAI5C"}
@@ -1,6 +1,6 @@
1
1
  import { Fr } from '@aztec/foundation/fields';
2
2
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- import type { PublicStateDBInterface } from '../../../common/db_interfaces.js';
3
+ import type { PublicStateDBInterface } from '../../common/db_interfaces.js';
4
4
  type PublicStorageReadResult = {
5
5
  value: Fr;
6
6
  cached: boolean;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public_storage.d.ts","sourceRoot":"","sources":["../../../src/public/state_manager/public_storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,KAAK,uBAAuB,GAAG;IAC7B,KAAK,EAAE,EAAE,CAAC;IACV,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,aAAa;IAKtB,+DAA+D;IAC/D,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,qDAAqD;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAP1B,6BAA6B;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;;IAGzC,+DAA+D;IAC9C,iBAAiB,EAAE,sBAAsB;IAC1D,qDAAqD;IACpC,MAAM,CAAC,2BAAe;IAKzC;;OAEG;IACI,IAAI;IAIX;;;;;;;OAOG;IACI,gBAAgB,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,SAAS;IAWhF;;;;;;;;;;OAUG;IACU,IAAI,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAmB5F;;;;;;OAMG;IACI,KAAK,CAAC,eAAe,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE;IAI/D;;;;OAIG;IACI,cAAc,CAAC,qBAAqB,EAAE,aAAa;CAG3D"}
@@ -5,10 +5,10 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
5
  import type { ContractClassPublicWithCommitment } from '@aztec/stdlib/contract';
6
6
  import { SerializableContractInstance } from '@aztec/stdlib/contract';
7
7
  import type { PublicCallRequest } from '@aztec/stdlib/kernel';
8
- import type { PublicTreesDB } from '../../../public/public_db_sources.js';
9
- import type { PublicContractsDBInterface } from '../../../server.js';
10
- import type { PublicSideEffectTraceInterface } from '../../side_effect_trace_interface.js';
11
- import type { AvmExecutionEnvironment } from '../avm_execution_environment.js';
8
+ import type { PublicContractsDBInterface } from '../../server.js';
9
+ import type { AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
10
+ import type { PublicTreesDB } from '../public_db_sources.js';
11
+ import type { PublicSideEffectTraceInterface } from '../side_effect_trace_interface.js';
12
12
  import { NullifierManager } from './nullifiers.js';
13
13
  import { PublicStorage } from './public_storage.js';
14
14
  /**
@@ -20,7 +20,7 @@ import { PublicStorage } from './public_storage.js';
20
20
  *
21
21
  * Manages merging of successful/reverted child state into current state.
22
22
  */
23
- export declare class AvmPersistableStateManager {
23
+ export declare class PublicPersistableStateManager {
24
24
  private readonly treesDB;
25
25
  private readonly contractsDB;
26
26
  private readonly trace;
@@ -38,20 +38,20 @@ export declare class AvmPersistableStateManager {
38
38
  /**
39
39
  * Create a new state manager
40
40
  */
41
- static create(treesDB: PublicTreesDB, contractsDB: PublicContractsDBInterface, trace: PublicSideEffectTraceInterface, doMerkleOperations: boolean | undefined, firstNullifier: Fr, blockNumber: number): AvmPersistableStateManager;
41
+ static create(treesDB: PublicTreesDB, contractsDB: PublicContractsDBInterface, trace: PublicSideEffectTraceInterface, doMerkleOperations: boolean | undefined, firstNullifier: Fr, blockNumber: number): PublicPersistableStateManager;
42
42
  deprecatedGetTreesForPIGeneration(): PublicTreesDB;
43
43
  /**
44
44
  * Create a new state manager forked from this one
45
45
  */
46
- fork(): Promise<AvmPersistableStateManager>;
46
+ fork(): Promise<PublicPersistableStateManager>;
47
47
  /**
48
48
  * Accept forked world state modifications & traced side effects / hints
49
49
  */
50
- merge(forkedState: AvmPersistableStateManager): Promise<void>;
50
+ merge(forkedState: PublicPersistableStateManager): Promise<void>;
51
51
  /**
52
52
  * Reject forked world state modifications & traced side effects, keep traced hints
53
53
  */
54
- reject(forkedState: AvmPersistableStateManager): Promise<void>;
54
+ reject(forkedState: PublicPersistableStateManager): Promise<void>;
55
55
  private _merge;
56
56
  /**
57
57
  * Write to public storage, journal/trace the write.
@@ -152,4 +152,4 @@ export declare class AvmPersistableStateManager {
152
152
  traceEnqueuedCall(publicCallRequest: PublicCallRequest): void;
153
153
  getPublicFunctionDebugName(avmEnvironment: AvmExecutionEnvironment): Promise<string>;
154
154
  }
155
- //# sourceMappingURL=journal.d.ts.map
155
+ //# sourceMappingURL=state_manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state_manager.d.ts","sourceRoot":"","sources":["../../../src/public/state_manager/state_manager.ts"],"names":[],"mappings":";;AASA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAK9C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,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,gCAAgC,CAAC,gBAAgB,EAAE,EAAE,EAAE;IAMpE;;;;;OAKG;IACU,wBAAwB,CACnC,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,EAAE,EACX,YAAY,EAAE,EAAE,GACf,OAAO,CAAC,OAAO,CAAC;IASnB;;;;;OAKG;IACI,kBAAkB,CAAC,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE;IAKnF;;;;OAIG;IACI,cAAc,CAAC,eAAe,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE;IAK9D;;;;OAIG;IACU,mBAAmB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,4BAA4B,GAAG,SAAS,CAAC;YAkCpG,8BAA8B;IAwD5C;;;;OAIG;IACU,gBAAgB,CAAC,OAAO,EAAE,EAAE,GAAG,OAAO,CAAC,iCAAiC,GAAG,SAAS,CAAC;IA4BlG;;OAEG;IACU,WAAW,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAiB7E,iBAAiB,CAAC,iBAAiB,EAAE,iBAAiB;IAIhD,0BAA0B,CAAC,cAAc,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;CAGlG"}
@@ -11,7 +11,7 @@ import { computeNoteHashNonce, computePublicDataTreeLeafSlot, computeUniqueNoteH
11
11
  import { SharedMutableValues, SharedMutableValuesWithHash } from '@aztec/stdlib/shared-mutable';
12
12
  import { MerkleTreeId } from '@aztec/stdlib/trees';
13
13
  import { strict as assert } from 'assert';
14
- import { getPublicFunctionDebugName } from '../../../common/debug_fn_name.js';
14
+ import { getPublicFunctionDebugName } from '../../common/debug_fn_name.js';
15
15
  import { NullifierCollisionError, NullifierManager } from './nullifiers.js';
16
16
  import { PublicStorage } from './public_storage.js';
17
17
  /**
@@ -22,7 +22,7 @@ import { PublicStorage } from './public_storage.js';
22
22
  * The simulator should make any world state / tree queries through this object.
23
23
  *
24
24
  * Manages merging of successful/reverted child state into current state.
25
- */ export class AvmPersistableStateManager {
25
+ */ export class PublicPersistableStateManager {
26
26
  treesDB;
27
27
  contractsDB;
28
28
  trace;
@@ -42,13 +42,13 @@ import { PublicStorage } from './public_storage.js';
42
42
  this.doMerkleOperations = doMerkleOperations;
43
43
  this.publicStorage = publicStorage;
44
44
  this.nullifiers = nullifiers;
45
- this.log = createLogger('simulator:avm:state_manager');
45
+ this.log = createLogger('simulator:state_manager');
46
46
  this.alreadyMergedIntoParent = false;
47
47
  }
48
48
  /**
49
49
  * Create a new state manager
50
50
  */ static create(treesDB, contractsDB, trace, doMerkleOperations = false, firstNullifier, blockNumber) {
51
- return new AvmPersistableStateManager(treesDB, contractsDB, trace, firstNullifier, blockNumber, doMerkleOperations);
51
+ return new PublicPersistableStateManager(treesDB, contractsDB, trace, firstNullifier, blockNumber, doMerkleOperations);
52
52
  }
53
53
  // DO NOT USE!
54
54
  // FIXME(fcarreiro): refactor and remove this.
@@ -59,7 +59,7 @@ import { PublicStorage } from './public_storage.js';
59
59
  * Create a new state manager forked from this one
60
60
  */ async fork() {
61
61
  await this.treesDB.createCheckpoint();
62
- return new AvmPersistableStateManager(this.treesDB, this.contractsDB, this.trace.fork(), this.firstNullifier, this.blockNumber, this.doMerkleOperations, this.publicStorage.fork(), this.nullifiers.fork());
62
+ return new PublicPersistableStateManager(this.treesDB, this.contractsDB, this.trace.fork(), this.firstNullifier, this.blockNumber, this.doMerkleOperations, this.publicStorage.fork(), this.nullifiers.fork());
63
63
  }
64
64
  /**
65
65
  * Accept forked world state modifications & traced side effects / hints
@@ -0,0 +1,43 @@
1
+ import type { RevertCode } from '@aztec/stdlib/avm';
2
+ import type { ExecutorMetricsInterface } from './executor_metrics_interface.js';
3
+ export interface PublicEnqueuedCallMetrics {
4
+ fnName: string;
5
+ durationMs: number;
6
+ manaUsed: number;
7
+ totalInstructions: number;
8
+ reverted: boolean;
9
+ }
10
+ export interface PublicTxMetrics {
11
+ totalDurationMs: number;
12
+ manaUsed: number;
13
+ totalInstructions: number;
14
+ txHashMs: number | undefined;
15
+ nonRevertiblePrivateInsertionsUs: number | undefined;
16
+ revertiblePrivateInsertionsUs: number | undefined;
17
+ enqueuedCalls: PublicEnqueuedCallMetrics[];
18
+ revertedCode: RevertCode | undefined;
19
+ }
20
+ export declare enum PublicTxMetricsFilter {
21
+ ALL = 0,
22
+ TOTALS = 1,
23
+ DURATIONS = 2,
24
+ INSTRUCTIONS = 3
25
+ }
26
+ export declare class TestExecutorMetrics implements ExecutorMetricsInterface {
27
+ #private;
28
+ private logger;
29
+ private txMetrics;
30
+ private currentTxLabel;
31
+ private txTimer;
32
+ constructor();
33
+ startRecordingTxSimulation(txLabel: string): void;
34
+ stopRecordingTxSimulation(txLabel: string, revertedCode?: RevertCode): void;
35
+ recordEnqueuedCallSimulation(fnName: string, durationMs: number, manaUsed: number, totalInstructions: number): void;
36
+ recordEnqueuedCallSimulationFailure(fnName: string, durationMs: number, manaUsed: number, totalInstructions: number): void;
37
+ recordTxHashComputation(durationMs: number): void;
38
+ recordPrivateEffectsInsertion(durationUs: number, type: 'revertible' | 'non-revertible'): void;
39
+ prettyPrint(filter?: PublicTxMetricsFilter): void;
40
+ toPrettyString(filter?: PublicTxMetricsFilter): string;
41
+ toJSON(indent?: number): string;
42
+ }
43
+ //# sourceMappingURL=test_executor_metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test_executor_metrics.d.ts","sourceRoot":"","sources":["../../src/public/test_executor_metrics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,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