@aztec/simulator 0.0.1-commit.b655e406 → 0.0.1-commit.fce3e4f

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 (219) hide show
  1. package/dest/client.d.ts +1 -1
  2. package/dest/common/errors.d.ts +1 -7
  3. package/dest/common/errors.d.ts.map +1 -1
  4. package/dest/common/index.d.ts +1 -1
  5. package/dest/common/stats/index.d.ts +1 -1
  6. package/dest/common/stats/stats.d.ts +1 -1
  7. package/dest/private/acvm/acvm.d.ts +1 -1
  8. package/dest/private/acvm/acvm_types.d.ts +1 -1
  9. package/dest/private/acvm/deserialize.d.ts +1 -1
  10. package/dest/private/acvm/index.d.ts +1 -1
  11. package/dest/private/acvm/serialize.d.ts +1 -1
  12. package/dest/private/acvm_native.d.ts +1 -1
  13. package/dest/private/acvm_native.d.ts.map +1 -1
  14. package/dest/private/acvm_wasm.d.ts +1 -1
  15. package/dest/private/acvm_wasm.d.ts.map +1 -1
  16. package/dest/private/acvm_wasm_with_blobs.d.ts +1 -1
  17. package/dest/private/acvm_wasm_with_blobs.d.ts.map +1 -1
  18. package/dest/private/circuit_recording/circuit_recorder.d.ts +1 -1
  19. package/dest/private/circuit_recording/circuit_recorder.d.ts.map +1 -1
  20. package/dest/private/circuit_recording/file_circuit_recorder.d.ts +1 -1
  21. package/dest/private/circuit_recording/file_circuit_recorder.d.ts.map +1 -1
  22. package/dest/private/circuit_recording/memory_circuit_recorder.d.ts +1 -1
  23. package/dest/private/circuit_recording/memory_circuit_recorder.d.ts.map +1 -1
  24. package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts +1 -1
  25. package/dest/private/circuit_recording/simulator_recorder_wrapper.d.ts.map +1 -1
  26. package/dest/private/circuit_simulator.d.ts +1 -1
  27. package/dest/private/factory.d.ts +1 -1
  28. package/dest/public/avm/avm_context.d.ts +1 -1
  29. package/dest/public/avm/avm_context.d.ts.map +1 -1
  30. package/dest/public/avm/avm_contract_call_result.d.ts +1 -1
  31. package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -1
  32. package/dest/public/avm/avm_execution_environment.d.ts +4 -4
  33. package/dest/public/avm/avm_execution_environment.d.ts.map +1 -1
  34. package/dest/public/avm/avm_execution_environment.js +4 -7
  35. package/dest/public/avm/avm_gas.d.ts +2 -2
  36. package/dest/public/avm/avm_gas.d.ts.map +1 -1
  37. package/dest/public/avm/avm_machine_state.d.ts +1 -1
  38. package/dest/public/avm/avm_machine_state.d.ts.map +1 -1
  39. package/dest/public/avm/avm_memory_types.d.ts +13 -13
  40. package/dest/public/avm/avm_memory_types.d.ts.map +1 -1
  41. package/dest/public/avm/avm_simulator.d.ts +3 -2
  42. package/dest/public/avm/avm_simulator.d.ts.map +1 -1
  43. package/dest/public/avm/avm_simulator.js +2 -2
  44. package/dest/public/avm/avm_simulator_interface.d.ts +1 -1
  45. package/dest/public/avm/errors.d.ts +1 -1
  46. package/dest/public/avm/errors.d.ts.map +1 -1
  47. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts +1 -1
  48. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -1
  49. package/dest/public/avm/fixtures/avm_simulation_tester.js +11 -2
  50. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +1 -1
  51. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
  52. package/dest/public/avm/fixtures/initializers.d.ts +1 -2
  53. package/dest/public/avm/fixtures/initializers.d.ts.map +1 -1
  54. package/dest/public/avm/fixtures/initializers.js +6 -4
  55. package/dest/public/avm/fixtures/utils.d.ts +1 -1
  56. package/dest/public/avm/index.d.ts +1 -1
  57. package/dest/public/avm/opcodes/accrued_substate.d.ts +1 -1
  58. package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -1
  59. package/dest/public/avm/opcodes/addressing_mode.d.ts +1 -1
  60. package/dest/public/avm/opcodes/addressing_mode.d.ts.map +1 -1
  61. package/dest/public/avm/opcodes/arithmetic.d.ts +8 -8
  62. package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -1
  63. package/dest/public/avm/opcodes/bitwise.d.ts +5 -5
  64. package/dest/public/avm/opcodes/bitwise.d.ts.map +1 -1
  65. package/dest/public/avm/opcodes/comparators.d.ts +4 -4
  66. package/dest/public/avm/opcodes/comparators.d.ts.map +1 -1
  67. package/dest/public/avm/opcodes/contract.d.ts +1 -1
  68. package/dest/public/avm/opcodes/contract.d.ts.map +1 -1
  69. package/dest/public/avm/opcodes/control_flow.d.ts +1 -1
  70. package/dest/public/avm/opcodes/control_flow.d.ts.map +1 -1
  71. package/dest/public/avm/opcodes/conversion.d.ts +1 -1
  72. package/dest/public/avm/opcodes/conversion.d.ts.map +1 -1
  73. package/dest/public/avm/opcodes/ec_add.d.ts +2 -2
  74. package/dest/public/avm/opcodes/ec_add.d.ts.map +1 -1
  75. package/dest/public/avm/opcodes/environment_getters.d.ts +1 -1
  76. package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -1
  77. package/dest/public/avm/opcodes/external_calls.d.ts +1 -1
  78. package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -1
  79. package/dest/public/avm/opcodes/hashing.d.ts +2 -2
  80. package/dest/public/avm/opcodes/hashing.d.ts.map +1 -1
  81. package/dest/public/avm/opcodes/index.d.ts +1 -1
  82. package/dest/public/avm/opcodes/instruction.d.ts +2 -2
  83. package/dest/public/avm/opcodes/instruction.d.ts.map +1 -1
  84. package/dest/public/avm/opcodes/instruction_impl.d.ts +1 -1
  85. package/dest/public/avm/opcodes/instruction_impl.d.ts.map +1 -1
  86. package/dest/public/avm/opcodes/memory.d.ts +2 -2
  87. package/dest/public/avm/opcodes/memory.d.ts.map +1 -1
  88. package/dest/public/avm/opcodes/misc.d.ts +1 -1
  89. package/dest/public/avm/opcodes/misc.d.ts.map +1 -1
  90. package/dest/public/avm/opcodes/misc.js +4 -4
  91. package/dest/public/avm/opcodes/storage.d.ts +3 -3
  92. package/dest/public/avm/opcodes/storage.d.ts.map +1 -1
  93. package/dest/public/avm/revert_reason.d.ts +1 -1
  94. package/dest/public/avm/serialization/buffer_cursor.d.ts +1 -1
  95. package/dest/public/avm/serialization/buffer_cursor.d.ts.map +1 -1
  96. package/dest/public/avm/serialization/bytecode_serialization.d.ts +1 -1
  97. package/dest/public/avm/serialization/instruction_serialization.d.ts +1 -1
  98. package/dest/public/avm/test_utils.d.ts +1 -1
  99. package/dest/public/contracts_db_checkpoint.d.ts +16 -0
  100. package/dest/public/contracts_db_checkpoint.d.ts.map +1 -0
  101. package/dest/public/contracts_db_checkpoint.js +30 -0
  102. package/dest/public/db_interfaces.d.ts +13 -1
  103. package/dest/public/db_interfaces.d.ts.map +1 -1
  104. package/dest/public/debug_fn_name.d.ts +1 -1
  105. package/dest/public/executor_metrics.d.ts +3 -2
  106. package/dest/public/executor_metrics.d.ts.map +1 -1
  107. package/dest/public/executor_metrics.js +1 -1
  108. package/dest/public/executor_metrics_interface.d.ts +3 -2
  109. package/dest/public/executor_metrics_interface.d.ts.map +1 -1
  110. package/dest/public/fixtures/amm_test.d.ts +1 -1
  111. package/dest/public/fixtures/bulk_test.d.ts +1 -1
  112. package/dest/public/fixtures/custom_bytecode_tester.d.ts +2 -2
  113. package/dest/public/fixtures/custom_bytecode_tester.d.ts.map +1 -1
  114. package/dest/public/fixtures/custom_bytecode_tests.d.ts +1 -1
  115. package/dest/public/fixtures/index.d.ts +1 -1
  116. package/dest/public/fixtures/minimal_public_tx.d.ts +2 -3
  117. package/dest/public/fixtures/minimal_public_tx.d.ts.map +1 -1
  118. package/dest/public/fixtures/minimal_public_tx.js +2 -2
  119. package/dest/public/fixtures/public_tx_simulation_tester.d.ts +4 -5
  120. package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
  121. package/dest/public/fixtures/public_tx_simulation_tester.js +15 -11
  122. package/dest/public/fixtures/simple_contract_data_source.d.ts +1 -1
  123. package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
  124. package/dest/public/fixtures/token_test.d.ts +1 -1
  125. package/dest/public/fixtures/token_test.js +3 -4
  126. package/dest/public/fixtures/utils.d.ts +1 -1
  127. package/dest/public/hinting_db_sources.d.ts +10 -2
  128. package/dest/public/hinting_db_sources.d.ts.map +1 -1
  129. package/dest/public/hinting_db_sources.js +64 -11
  130. package/dest/public/index.d.ts +3 -2
  131. package/dest/public/index.d.ts.map +1 -1
  132. package/dest/public/public_db_sources.d.ts +21 -62
  133. package/dest/public/public_db_sources.d.ts.map +1 -1
  134. package/dest/public/public_db_sources.js +73 -130
  135. package/dest/public/public_errors.d.ts +1 -1
  136. package/dest/public/public_errors.d.ts.map +1 -1
  137. package/dest/public/public_processor/guarded_merkle_tree.d.ts +3 -3
  138. package/dest/public/public_processor/guarded_merkle_tree.d.ts.map +1 -1
  139. package/dest/public/public_processor/public_processor.d.ts +7 -14
  140. package/dest/public/public_processor/public_processor.d.ts.map +1 -1
  141. package/dest/public/public_processor/public_processor.js +27 -29
  142. package/dest/public/public_processor/public_processor_metrics.d.ts +1 -1
  143. package/dest/public/public_processor/public_processor_metrics.d.ts.map +1 -1
  144. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +30 -0
  145. package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +1 -0
  146. package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +133 -0
  147. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts +29 -4
  148. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.d.ts.map +1 -1
  149. package/dest/public/public_tx_simulator/cpp_public_tx_simulator.js +138 -17
  150. package/dest/public/public_tx_simulator/index.d.ts +2 -1
  151. package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
  152. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +13 -6
  153. package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -1
  154. package/dest/public/public_tx_simulator/measured_public_tx_simulator.js +5 -5
  155. package/dest/public/public_tx_simulator/public_tx_context.d.ts +5 -2
  156. package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
  157. package/dest/public/public_tx_simulator/public_tx_context.js +12 -4
  158. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +10 -30
  159. package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
  160. package/dest/public/public_tx_simulator/public_tx_simulator.js +102 -125
  161. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts +2 -2
  162. package/dest/public/public_tx_simulator/public_tx_simulator_interface.d.ts.map +1 -1
  163. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +3 -3
  164. package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -1
  165. package/dest/public/side_effect_errors.d.ts +1 -1
  166. package/dest/public/side_effect_errors.d.ts.map +1 -1
  167. package/dest/public/side_effect_trace.d.ts +1 -2
  168. package/dest/public/side_effect_trace.d.ts.map +1 -1
  169. package/dest/public/side_effect_trace_interface.d.ts +2 -3
  170. package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
  171. package/dest/public/state_manager/index.d.ts +1 -1
  172. package/dest/public/state_manager/nullifiers.d.ts +1 -1
  173. package/dest/public/state_manager/nullifiers.d.ts.map +1 -1
  174. package/dest/public/state_manager/public_storage.d.ts +1 -1
  175. package/dest/public/state_manager/public_storage.d.ts.map +1 -1
  176. package/dest/public/state_manager/state_manager.d.ts +3 -10
  177. package/dest/public/state_manager/state_manager.d.ts.map +1 -1
  178. package/dest/public/state_manager/state_manager.js +5 -4
  179. package/dest/public/test_executor_metrics.d.ts +4 -3
  180. package/dest/public/test_executor_metrics.d.ts.map +1 -1
  181. package/dest/public/test_executor_metrics.js +5 -4
  182. package/dest/public/unique_class_ids.d.ts +1 -1
  183. package/dest/public/unique_class_ids.d.ts.map +1 -1
  184. package/dest/public/utils.d.ts +1 -1
  185. package/dest/server.d.ts +1 -1
  186. package/dest/testing.d.ts +1 -1
  187. package/package.json +21 -20
  188. package/src/public/avm/avm_execution_environment.ts +3 -5
  189. package/src/public/avm/avm_simulator.ts +3 -4
  190. package/src/public/avm/fixtures/avm_simulation_tester.ts +9 -1
  191. package/src/public/avm/fixtures/initializers.ts +6 -8
  192. package/src/public/avm/opcodes/misc.ts +4 -4
  193. package/src/public/contracts_db_checkpoint.ts +41 -0
  194. package/src/public/db_interfaces.ts +15 -0
  195. package/src/public/executor_metrics.ts +2 -1
  196. package/src/public/executor_metrics_interface.ts +2 -1
  197. package/src/public/fixtures/custom_bytecode_tester.ts +1 -1
  198. package/src/public/fixtures/minimal_public_tx.ts +3 -4
  199. package/src/public/fixtures/public_tx_simulation_tester.ts +18 -10
  200. package/src/public/fixtures/token_test.ts +3 -4
  201. package/src/public/hinting_db_sources.ts +104 -7
  202. package/src/public/index.ts +2 -6
  203. package/src/public/public_db_sources.ts +92 -171
  204. package/src/public/public_processor/guarded_merkle_tree.ts +2 -2
  205. package/src/public/public_processor/public_processor.ts +46 -36
  206. package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +162 -0
  207. package/src/public/public_tx_simulator/cpp_public_tx_simulator.ts +199 -21
  208. package/src/public/public_tx_simulator/index.ts +1 -0
  209. package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +9 -13
  210. package/src/public/public_tx_simulator/public_tx_context.ts +8 -2
  211. package/src/public/public_tx_simulator/public_tx_simulator.ts +145 -192
  212. package/src/public/public_tx_simulator/public_tx_simulator_interface.ts +1 -2
  213. package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +2 -2
  214. package/src/public/state_manager/state_manager.ts +4 -11
  215. package/src/public/test_executor_metrics.ts +7 -5
  216. package/dest/public/tx_contract_cache.d.ts +0 -41
  217. package/dest/public/tx_contract_cache.d.ts.map +0 -1
  218. package/dest/public/tx_contract_cache.js +0 -49
  219. package/src/public/tx_contract_cache.ts +0 -69
@@ -1,5 +1,6 @@
1
1
  import type { Fr } from '@aztec/foundation/fields';
2
2
  import { Timer } from '@aztec/foundation/timer';
3
+ import type { PublicSimulatorConfig, PublicTxResult } from '@aztec/stdlib/avm';
3
4
  import type { Gas } from '@aztec/stdlib/gas';
4
5
  import type { AvmSimulationStats } from '@aztec/stdlib/stats';
5
6
  import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
@@ -10,12 +11,7 @@ import type { ExecutorMetricsInterface } from '../executor_metrics_interface.js'
10
11
  import type { PublicContractsDB } from '../public_db_sources.js';
11
12
  import type { PublicPersistableStateManager } from '../state_manager/state_manager.js';
12
13
  import { PublicTxContext } from './public_tx_context.js';
13
- import {
14
- type ProcessedPhase,
15
- type PublicTxResult,
16
- PublicTxSimulator,
17
- type PublicTxSimulatorConfig,
18
- } from './public_tx_simulator.js';
14
+ import { PublicTxSimulator } from './public_tx_simulator.js';
19
15
  import type { MeasuredPublicTxSimulatorInterface } from './public_tx_simulator_interface.js';
20
16
 
21
17
  /**
@@ -27,7 +23,7 @@ export class MeasuredPublicTxSimulator extends PublicTxSimulator implements Meas
27
23
  contractsDB: PublicContractsDB,
28
24
  globalVariables: GlobalVariables,
29
25
  protected readonly metrics: ExecutorMetricsInterface,
30
- config?: Partial<PublicTxSimulatorConfig>,
26
+ config?: Partial<PublicSimulatorConfig>,
31
27
  ) {
32
28
  super(merkleTree, contractsDB, globalVariables, config);
33
29
  }
@@ -38,24 +34,24 @@ export class MeasuredPublicTxSimulator extends PublicTxSimulator implements Meas
38
34
  try {
39
35
  avmResult = await super.simulate(tx);
40
36
  } finally {
41
- this.metrics.stopRecordingTxSimulation(txLabel, avmResult?.revertCode);
37
+ this.metrics.stopRecordingTxSimulation(txLabel, avmResult?.gasUsed, avmResult?.revertCode);
42
38
  }
43
39
  return avmResult;
44
40
  }
45
41
 
46
- protected override async insertNonRevertiblesFromPrivate(context: PublicTxContext, tx: Tx) {
42
+ protected override async insertNonRevertiblesFromPrivate(context: PublicTxContext) {
47
43
  const timer = new Timer();
48
- await super.insertNonRevertiblesFromPrivate(context, tx);
44
+ await super.insertNonRevertiblesFromPrivate(context);
49
45
  this.metrics.recordPrivateEffectsInsertion(timer.us(), 'non-revertible');
50
46
  }
51
47
 
52
- protected override async insertRevertiblesFromPrivate(context: PublicTxContext, tx: Tx) {
48
+ protected override async insertRevertiblesFromPrivate(context: PublicTxContext) {
53
49
  const timer = new Timer();
54
- await super.insertRevertiblesFromPrivate(context, tx);
50
+ await super.insertRevertiblesFromPrivate(context);
55
51
  this.metrics.recordPrivateEffectsInsertion(timer.us(), 'revertible');
56
52
  }
57
53
 
58
- protected override async simulatePhase(phase: TxExecutionPhase, context: PublicTxContext): Promise<ProcessedPhase> {
54
+ protected override async simulatePhase(phase: TxExecutionPhase, context: PublicTxContext) {
59
55
  const timer = new Timer();
60
56
  const result = await super.simulatePhase(phase, context);
61
57
  result.durationMs = timer.ms();
@@ -16,6 +16,7 @@ import {
16
16
  RevertCode,
17
17
  } from '@aztec/stdlib/avm';
18
18
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
19
+ import { AllContractDeploymentData, type ContractDeploymentData } from '@aztec/stdlib/contract';
19
20
  import type { SimulationError } from '@aztec/stdlib/errors';
20
21
  import { computeEffectiveGasFees, computeTransactionFee } from '@aztec/stdlib/fees';
21
22
  import { Gas, GasSettings } from '@aztec/stdlib/gas';
@@ -80,6 +81,8 @@ export class PublicTxContext {
80
81
  private readonly setupCallRequests: PublicCallRequestWithCalldata[],
81
82
  private readonly appLogicCallRequests: PublicCallRequestWithCalldata[],
82
83
  private readonly teardownCallRequests: PublicCallRequestWithCalldata[],
84
+ public readonly nonRevertibleContractDeploymentData: ContractDeploymentData,
85
+ public readonly revertibleContractDeploymentData: ContractDeploymentData,
83
86
  public readonly nonRevertibleAccumulatedDataFromPrivate: PrivateToPublicAccumulatedData,
84
87
  public readonly revertibleAccumulatedDataFromPrivate: PrivateToPublicAccumulatedData,
85
88
  public readonly feePayer: AztecAddress,
@@ -94,9 +97,11 @@ export class PublicTxContext {
94
97
  tx: Tx,
95
98
  globalVariables: GlobalVariables,
96
99
  protocolContracts: ProtocolContracts,
97
- doMerkleOperations: boolean,
98
100
  proverId: Fr,
99
101
  ) {
102
+ const contractDeploymentData = AllContractDeploymentData.fromTx(tx);
103
+ const nonRevertibleContractDeploymentData = contractDeploymentData.getNonRevertibleContractDeploymentData();
104
+ const revertibleContractDeploymentData = contractDeploymentData.getRevertibleContractDeploymentData();
100
105
  const nonRevertibleAccumulatedDataFromPrivate = tx.data.forPublic!.nonRevertibleAccumulatedData;
101
106
 
102
107
  const trace = new SideEffectTrace();
@@ -108,7 +113,6 @@ export class PublicTxContext {
108
113
  treesDB,
109
114
  contractsDB,
110
115
  trace,
111
- doMerkleOperations,
112
116
  firstNullifier,
113
117
  globalVariables.timestamp,
114
118
  );
@@ -132,6 +136,8 @@ export class PublicTxContext {
132
136
  getCallRequestsWithCalldataByPhase(tx, TxExecutionPhase.SETUP),
133
137
  getCallRequestsWithCalldataByPhase(tx, TxExecutionPhase.APP_LOGIC),
134
138
  getCallRequestsWithCalldataByPhase(tx, TxExecutionPhase.TEARDOWN),
139
+ nonRevertibleContractDeploymentData,
140
+ revertibleContractDeploymentData,
135
141
  tx.data.forPublic!.nonRevertibleAccumulatedData,
136
142
  tx.data.forPublic!.revertibleAccumulatedData,
137
143
  tx.data.feePayer,
@@ -1,20 +1,11 @@
1
- import { AVM_MAX_PROCESSABLE_L2_GAS, DEFAULT_MAX_DEBUG_LOG_MEMORY_READS } from '@aztec/constants';
1
+ import { AVM_MAX_PROCESSABLE_L2_GAS } from '@aztec/constants';
2
2
  import { Fr } from '@aztec/foundation/fields';
3
3
  import { type Logger, createLogger } from '@aztec/foundation/log';
4
4
  import { ProtocolContractAddress, ProtocolContractsList } from '@aztec/protocol-contracts';
5
5
  import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
6
- import {
7
- AvmCircuitInputs,
8
- AvmCircuitPublicInputs,
9
- AvmExecutionHints,
10
- type AvmProvingRequest,
11
- AvmTxHint,
12
- type RevertCode,
13
- } from '@aztec/stdlib/avm';
6
+ import { AvmExecutionHints, AvmTxHint, PublicSimulatorConfig, PublicTxResult } from '@aztec/stdlib/avm';
14
7
  import { SimulationError } from '@aztec/stdlib/errors';
15
- import type { Gas, GasUsed } from '@aztec/stdlib/gas';
16
- import type { DebugLog } from '@aztec/stdlib/logs';
17
- import { ProvingRequestType } from '@aztec/stdlib/proofs';
8
+ import type { Gas } from '@aztec/stdlib/gas';
18
9
  import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
19
10
  import {
20
11
  type GlobalVariables,
@@ -41,33 +32,6 @@ import type { PublicPersistableStateManager } from '../state_manager/state_manag
41
32
  import { PublicTxContext } from './public_tx_context.js';
42
33
  import type { PublicTxSimulatorInterface } from './public_tx_simulator_interface.js';
43
34
 
44
- export type ProcessedPhase = {
45
- phase: TxExecutionPhase;
46
- durationMs?: number;
47
- returnValues: NestedProcessReturnValues[];
48
- reverted: boolean;
49
- revertReason?: SimulationError;
50
- };
51
-
52
- export type PublicTxResult = {
53
- avmProvingRequest: AvmProvingRequest;
54
- /** Gas used during the execution of this tx */
55
- gasUsed: GasUsed;
56
- revertCode: RevertCode;
57
- /** Revert reason, if any */
58
- revertReason?: SimulationError;
59
- processedPhases: ProcessedPhase[];
60
- logs: DebugLog[];
61
- };
62
-
63
- export type PublicTxSimulatorConfig = {
64
- proverId: Fr;
65
- doMerkleOperations: boolean;
66
- skipFeeEnforcement: boolean;
67
- clientInitiatedSimulation: boolean;
68
- maxDebugLogMemoryReads: number;
69
- };
70
-
71
35
  // The errors below are only thrown here in the public tx simulator,
72
36
  // and only during revertible phases (revertible insertions, app logic and teardown).
73
37
  // These are strictly "checked" errors (not exported and never propagated).
@@ -103,23 +67,26 @@ class TxSimTeardownRevert extends Error {
103
67
  }
104
68
  }
105
69
 
70
+ /** Only used internally. */
71
+ type ProcessedPhase = {
72
+ phase: TxExecutionPhase;
73
+ durationMs?: number;
74
+ returnValues: NestedProcessReturnValues[];
75
+ reverted: boolean;
76
+ revertReason?: SimulationError;
77
+ };
78
+
106
79
  export class PublicTxSimulator implements PublicTxSimulatorInterface {
107
80
  protected log: Logger;
108
- private config: PublicTxSimulatorConfig;
81
+ protected readonly config: PublicSimulatorConfig;
109
82
 
110
83
  constructor(
111
84
  protected merkleTree: MerkleTreeWriteOperations,
112
85
  protected contractsDB: PublicContractsDB,
113
86
  protected globalVariables: GlobalVariables,
114
- config?: Partial<PublicTxSimulatorConfig>,
87
+ config?: Partial<PublicSimulatorConfig>,
115
88
  ) {
116
- this.config = {
117
- proverId: config?.proverId ?? Fr.ZERO,
118
- doMerkleOperations: config?.doMerkleOperations ?? false,
119
- skipFeeEnforcement: config?.skipFeeEnforcement ?? false,
120
- clientInitiatedSimulation: config?.clientInitiatedSimulation ?? false,
121
- maxDebugLogMemoryReads: config?.maxDebugLogMemoryReads ?? DEFAULT_MAX_DEBUG_LOG_MEMORY_READS,
122
- };
89
+ this.config = PublicSimulatorConfig.from(config ?? {});
123
90
  this.log = createLogger(`simulator:public_tx_simulator`);
124
91
  }
125
92
 
@@ -129,136 +96,128 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
129
96
  * @returns The result of the transaction's public execution.
130
97
  */
131
98
  public async simulate(tx: Tx): Promise<PublicTxResult> {
132
- try {
133
- const txHash = this.computeTxHash(tx);
134
- this.log.debug(`Simulating ${tx.publicFunctionCalldata.length} public calls for tx ${txHash}`, { txHash });
135
-
136
- // Create hinting DBs.
137
- const hints = new AvmExecutionHints(
138
- this.globalVariables,
139
- AvmTxHint.fromTx(tx, this.globalVariables.gasFees),
140
- ProtocolContractsList, // imported from file
141
- );
142
- const hintingMerkleTree = await HintingMerkleWriteOperations.create(this.merkleTree, hints);
143
- const hintingTreesDB = new PublicTreesDB(hintingMerkleTree);
144
- const hintingContractsDB = new HintingPublicContractsDB(this.contractsDB, hints);
145
-
146
- const context = await PublicTxContext.create(
147
- hintingTreesDB,
148
- hintingContractsDB,
149
- tx,
150
- this.globalVariables,
151
- ProtocolContractsList, // imported from file
152
- this.config.doMerkleOperations,
153
- this.config.proverId,
154
- );
99
+ const txHash = this.computeTxHash(tx);
100
+ this.log.debug(`Simulating ${tx.publicFunctionCalldata.length} public calls for tx ${txHash}`, { txHash });
155
101
 
156
- // This will throw if there is a nullifier collision.
102
+ // Create hinting DBs.
103
+ const hints = new AvmExecutionHints(
104
+ this.globalVariables,
105
+ AvmTxHint.fromTx(tx, this.globalVariables.gasFees),
106
+ ProtocolContractsList, // imported from file
107
+ );
108
+ const hintingMerkleTree = await HintingMerkleWriteOperations.create(this.merkleTree, hints);
109
+ const hintingTreesDB = new PublicTreesDB(hintingMerkleTree);
110
+ const hintingContractsDB = new HintingPublicContractsDB(this.contractsDB, hints);
111
+
112
+ const context = await PublicTxContext.create(
113
+ hintingTreesDB,
114
+ hintingContractsDB,
115
+ tx,
116
+ this.globalVariables,
117
+ ProtocolContractsList, // imported from file
118
+ this.config.proverId,
119
+ );
120
+
121
+ // This will throw if there is a nullifier collision.
122
+ // In that case the transaction will be thrown out.
123
+ await this.insertNonRevertiblesFromPrivate(context);
124
+
125
+ const processedPhases: ProcessedPhase[] = [];
126
+ if (context.hasPhase(TxExecutionPhase.SETUP)) {
127
+ // This will throw if the setup phase reverts.
157
128
  // In that case the transaction will be thrown out.
158
- await this.insertNonRevertiblesFromPrivate(context, tx);
159
-
160
- const processedPhases: ProcessedPhase[] = [];
161
- if (context.hasPhase(TxExecutionPhase.SETUP)) {
162
- // This will throw if the setup phase reverts.
163
- // In that case the transaction will be thrown out.
164
- const setupResult = await this.simulatePhase(TxExecutionPhase.SETUP, context);
165
- if (setupResult.reverted) {
166
- throw new Error(
167
- `Setup phase reverted! The transaction will be thrown out. ${setupResult.revertReason?.message}`,
168
- );
169
- }
170
- processedPhases.push(setupResult);
129
+ const setupResult = await this.simulatePhase(TxExecutionPhase.SETUP, context);
130
+ if (setupResult.reverted) {
131
+ throw new Error(
132
+ `Setup phase reverted! The transaction will be thrown out. ${setupResult.revertReason?.message}`,
133
+ );
171
134
  }
135
+ processedPhases.push(setupResult);
136
+ }
172
137
 
173
- // The checkpoint we should go back to if anything from now on reverts.
174
- await context.state.fork();
175
-
176
- try {
177
- // This will throw if there is a nullifier collision or other insertion error (limit reached).
178
- await this.insertRevertiblesFromPrivate(context, tx);
138
+ // The checkpoint we should go back to if anything from now on reverts.
139
+ await context.state.fork();
140
+ hintingContractsDB.createCheckpoint();
179
141
 
180
- // Only proceed with app logic if there was no revert during revertible insertion.
181
- if (context.hasPhase(TxExecutionPhase.APP_LOGIC)) {
182
- const appLogicResult = await this.simulatePhase(TxExecutionPhase.APP_LOGIC, context);
183
- processedPhases.push(appLogicResult);
184
- if (appLogicResult.reverted) {
185
- throw new TxSimAppLogicRevert();
186
- }
187
- }
188
- } catch (e: any) {
189
- if (e instanceof TxSimRevertibleInsertionsRevert || e instanceof TxSimAppLogicRevert) {
190
- // We revert to the post-setup state.
191
- await context.state.discardForkedState();
192
- // But we also create a new fork so that the teardown phase can transparently
193
- // commit or rollback at the end of teardown.
194
- await context.state.fork();
195
- } else {
196
- // Unchecked/unknown error - re-throw as-is
197
- throw e;
142
+ try {
143
+ // This will throw if there is a nullifier collision or other insertion error (limit reached).
144
+ await this.insertRevertiblesFromPrivate(context);
145
+
146
+ // Only proceed with app logic if there was no revert during revertible insertion.
147
+ if (context.hasPhase(TxExecutionPhase.APP_LOGIC)) {
148
+ const appLogicResult = await this.simulatePhase(TxExecutionPhase.APP_LOGIC, context);
149
+ processedPhases.push(appLogicResult);
150
+ if (appLogicResult.reverted) {
151
+ throw new TxSimAppLogicRevert();
198
152
  }
199
153
  }
154
+ } catch (e: any) {
155
+ if (e instanceof TxSimRevertibleInsertionsRevert || e instanceof TxSimAppLogicRevert) {
156
+ // We revert to the post-setup state.
157
+ await context.state.discardForkedState();
158
+ hintingContractsDB.revertCheckpoint();
159
+ // But we also create a new fork so that the teardown phase can transparently
160
+ // commit or rollback at the end of teardown.
161
+ await context.state.fork();
162
+ hintingContractsDB.createCheckpoint();
163
+ } else {
164
+ // Unchecked/unknown error - re-throw as-is
165
+ throw e;
166
+ }
167
+ }
200
168
 
201
- try {
202
- if (context.hasPhase(TxExecutionPhase.TEARDOWN)) {
203
- const teardownResult = await this.simulatePhase(TxExecutionPhase.TEARDOWN, context);
204
- processedPhases.push(teardownResult);
205
- if (teardownResult.reverted) {
206
- throw new TxSimTeardownRevert();
207
- }
208
- }
209
- // We commit the forked state and we are done.
210
- await context.state.mergeForkedState();
211
- } catch (e: any) {
212
- if (e instanceof TxSimTeardownRevert) {
213
- // We revert to the post-setup state and we are done.
214
- await context.state.discardForkedState();
215
- } else {
216
- // Unchecked/unknown error - re-throw as-is
217
- throw e;
169
+ try {
170
+ if (context.hasPhase(TxExecutionPhase.TEARDOWN)) {
171
+ const teardownResult = await this.simulatePhase(TxExecutionPhase.TEARDOWN, context);
172
+ processedPhases.push(teardownResult);
173
+ if (teardownResult.reverted) {
174
+ throw new TxSimTeardownRevert();
218
175
  }
219
176
  }
177
+ // We commit the forked state and we are done.
178
+ await context.state.mergeForkedState();
179
+ hintingContractsDB.commitCheckpoint();
180
+ } catch (e: any) {
181
+ if (e instanceof TxSimTeardownRevert) {
182
+ // We revert to the post-setup state and we are done.
183
+ await context.state.discardForkedState();
184
+ hintingContractsDB.revertCheckpoint();
185
+ } else {
186
+ // Unchecked/unknown error - re-throw as-is
187
+ throw e;
188
+ }
189
+ }
220
190
 
221
- context.halt();
191
+ context.halt();
222
192
 
223
- // Such transactions should be filtered by GasTxValidator.
224
- assert(
225
- context.getActualGasUsed().l2Gas <= AVM_MAX_PROCESSABLE_L2_GAS,
226
- `Transaction consumes ${context.getActualGasUsed().l2Gas} L2 gas, which exceeds the AVM maximum processable gas of ${AVM_MAX_PROCESSABLE_L2_GAS}`,
227
- );
228
- await this.payFee(context);
229
-
230
- const publicInputs = await context.generateAvmCircuitPublicInputs();
231
- const avmProvingRequest = PublicTxSimulator.generateProvingRequest(publicInputs, hints);
232
-
233
- const revertCode = context.getFinalRevertCode();
234
-
235
- // Commit contracts from this TX to the block-level cache and clear tx cache
236
- // If the tx reverted, only commit non-revertible contracts
237
- // NOTE: You can't create contracts in public, so this is only relevant for private-created contracts
238
- // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
239
- // However things should work as they are now because the hinted db would still pick up the new contracts.
240
- this.contractsDB.commitContractsForTx(/*onlyNonRevertibles=*/ !revertCode.isOK());
241
-
242
- return {
243
- avmProvingRequest,
244
- gasUsed: {
245
- totalGas: context.getActualGasUsed(),
246
- teardownGas: context.teardownGasUsed,
247
- publicGas: context.getActualPublicGasUsed(),
248
- billedGas: context.getTotalGasUsed(),
249
- },
250
- revertCode,
251
- revertReason: context.revertReason,
252
- processedPhases: processedPhases,
253
- logs: context.state.getActiveStateManager().getLogs(),
254
- };
255
- } finally {
256
- // Make sure there are no new contracts in the tx-level cache.
257
- // They should either be committed to block-level cache or cleared.
258
- // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
259
- // However things should work as they are now because the hinted db would still pick up the new contracts.
260
- this.contractsDB.clearContractsForTx();
261
- }
193
+ // Such transactions should be filtered by GasTxValidator.
194
+ assert(
195
+ context.getActualGasUsed().l2Gas <= AVM_MAX_PROCESSABLE_L2_GAS,
196
+ `Transaction consumes ${context.getActualGasUsed().l2Gas} L2 gas, which exceeds the AVM maximum processable gas of ${AVM_MAX_PROCESSABLE_L2_GAS}`,
197
+ );
198
+ await this.payFee(context);
199
+
200
+ const publicInputs = await context.generateAvmCircuitPublicInputs();
201
+ const revertCode = context.getFinalRevertCode();
202
+
203
+ // We only return the app logic phase information.
204
+ const appLogicReturnValues =
205
+ processedPhases.find(({ phase }) => phase === TxExecutionPhase.APP_LOGIC)?.returnValues ?? [];
206
+
207
+ return new PublicTxResult(
208
+ /*gasUsed=*/ {
209
+ totalGas: context.getActualGasUsed(),
210
+ teardownGas: context.teardownGasUsed,
211
+ publicGas: context.getActualPublicGasUsed(),
212
+ billedGas: context.getTotalGasUsed(),
213
+ },
214
+ /*revertCode=*/ revertCode,
215
+ /*revertReason=*/ context.revertReason,
216
+ /*appLogicReturnValues=*/ appLogicReturnValues,
217
+ /*logs=*/ context.state.getActiveStateManager().getLogs(),
218
+ /*hints=*/ hints,
219
+ /*publicInputs=*/ publicInputs,
220
+ );
262
221
  }
263
222
 
264
223
  protected computeTxHash(tx: Tx) {
@@ -383,8 +342,7 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
383
342
  request.isStaticCall,
384
343
  calldata,
385
344
  allocatedGas,
386
- this.config.clientInitiatedSimulation,
387
- this.config.maxDebugLogMemoryReads,
345
+ this.config,
388
346
  );
389
347
  const avmCallResult = await simulator.execute();
390
348
  return avmCallResult.finalize();
@@ -393,7 +351,7 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
393
351
  /**
394
352
  * Insert the non-revertible accumulated data from private into the public state.
395
353
  */
396
- protected async insertNonRevertiblesFromPrivate(context: PublicTxContext, tx: Tx) {
354
+ protected async insertNonRevertiblesFromPrivate(context: PublicTxContext) {
397
355
  const stateManager = context.state.getActiveStateManager();
398
356
 
399
357
  for (const siloedNullifier of context.nonRevertibleAccumulatedDataFromPrivate.nullifiers.filter(
@@ -412,11 +370,12 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
412
370
  }
413
371
  }
414
372
 
415
- // add new contracts to the contracts db so that their functions may be found and called
416
- // TODO(#6464): Should we allow emitting contracts in the private setup phase?
417
- // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
418
- // However things should work as they are now because the hinted db would still pick up the new contracts.
419
- await this.contractsDB.addNewNonRevertibleContracts(tx);
373
+ // add new contracts to the contracts db so that their code may be found and called
374
+ // FIXME(fcarreiro): this should conceptually use the hinting contracts db.
375
+ // However, things work as expected because later calls to getters on the hintingContractsDB
376
+ // will pick up the new contracts and will generate the necessary hints.
377
+ // So, a consumer of the hints will always see the new contracts.
378
+ await this.contractsDB.addContracts(context.nonRevertibleContractDeploymentData);
420
379
  }
421
380
 
422
381
  /**
@@ -428,7 +387,7 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
428
387
  * - NoteHashLimitReachedError
429
388
  * - L2ToL1MessageLimitReachedError
430
389
  */
431
- protected async insertRevertiblesFromPrivate(context: PublicTxContext, tx: Tx) {
390
+ protected async insertRevertiblesFromPrivate(context: PublicTxContext) {
432
391
  const stateManager = context.state.getActiveStateManager();
433
392
 
434
393
  try {
@@ -497,16 +456,21 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
497
456
  }
498
457
 
499
458
  // add new contracts to the contracts db so that their functions may be found and called
500
- // FIXME(fcarreiro): this should conceptually use the hinted contracts db.
501
- // However things should work as they are now because the hinted db would still pick up the new contracts.
502
- await this.contractsDB.addNewRevertibleContracts(tx);
459
+ // FIXME(fcarreiro): this should conceptually use the hinting contracts db.
460
+ // However, things work as expected because later calls to getters on the hintingContractsDB
461
+ // will pick up the new contracts and will generate the necessary hints.
462
+ // So, a consumer of the hints will always see the new contracts.
463
+ await this.contractsDB.addContracts(context.revertibleContractDeploymentData);
503
464
  }
504
465
 
505
466
  private async payFee(context: PublicTxContext) {
506
467
  const txFee = context.getTransactionFee(TxExecutionPhase.TEARDOWN);
507
468
 
508
469
  if (context.feePayer.isZero()) {
509
- this.log.debug(`No one is paying the fee of ${txFee.toBigInt()}`);
470
+ // Real transactions are enforced by private kernel to have nonzero fee payer.
471
+ // Real transactions cannot skip fee enforcement (skipping fee enforcement makes them unprovable).
472
+ assert(this.config.skipFeeEnforcement, 'Fee payer cannot be 0 unless skipping fee enforcement for simulation');
473
+ this.log.debug(`Fee payer is 0. Skipping fee enforcement. No one is paying the fee of ${txFee.toBigInt()}`);
510
474
  return;
511
475
  }
512
476
 
@@ -526,23 +490,12 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
526
490
  this.config.skipFeeEnforcement,
527
491
  `Not enough balance for fee payer to pay for transaction (got ${currentBalance.toBigInt()} needs ${txFee.toBigInt()})`,
528
492
  );
493
+ this.log.debug(`Fee payer balance insufficient, but we're skipping fee enforcement`);
494
+ // We still proceed and perform the storage write to minimize deviation from normal execution.
529
495
  currentBalance = txFee;
530
496
  }
531
497
 
532
498
  const updatedBalance = currentBalance.sub(txFee);
533
499
  await stateManager.writeStorage(feeJuiceAddress, balanceSlot, updatedBalance, true);
534
500
  }
535
-
536
- /**
537
- * Generate the proving request for the AVM circuit.
538
- */
539
- private static generateProvingRequest(
540
- publicInputs: AvmCircuitPublicInputs,
541
- hints: AvmExecutionHints,
542
- ): AvmProvingRequest {
543
- return {
544
- type: ProvingRequestType.PUBLIC_VM,
545
- inputs: new AvmCircuitInputs(hints, publicInputs),
546
- };
547
- }
548
501
  }
@@ -1,7 +1,6 @@
1
+ import type { PublicTxResult } from '@aztec/stdlib/avm';
1
2
  import type { Tx } from '@aztec/stdlib/tx';
2
3
 
3
- import type { PublicTxResult } from './public_tx_simulator.js';
4
-
5
4
  export interface PublicTxSimulatorInterface {
6
5
  simulate(tx: Tx): Promise<PublicTxResult>;
7
6
  }
@@ -1,4 +1,5 @@
1
1
  import type { Fr } from '@aztec/foundation/fields';
2
+ import type { PublicSimulatorConfig } from '@aztec/stdlib/avm';
2
3
  import type { Gas } from '@aztec/stdlib/gas';
3
4
  import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
4
5
  import { type GlobalVariables, PublicCallRequestWithCalldata, TxExecutionPhase } from '@aztec/stdlib/tx';
@@ -10,7 +11,6 @@ import type { PublicContractsDB } from '../public_db_sources.js';
10
11
  import type { PublicPersistableStateManager } from '../state_manager/state_manager.js';
11
12
  import { MeasuredPublicTxSimulator } from './measured_public_tx_simulator.js';
12
13
  import { PublicTxContext } from './public_tx_context.js';
13
- import type { PublicTxSimulatorConfig } from './public_tx_simulator.js';
14
14
 
15
15
  /**
16
16
  * A public tx simulator that tracks runtime/production metrics with telemetry.
@@ -24,7 +24,7 @@ export class TelemetryPublicTxSimulator extends MeasuredPublicTxSimulator {
24
24
  contractsDB: PublicContractsDB,
25
25
  globalVariables: GlobalVariables,
26
26
  telemetryClient: TelemetryClient = getTelemetryClient(),
27
- config?: Partial<PublicTxSimulatorConfig>,
27
+ config?: Partial<PublicSimulatorConfig>,
28
28
  ) {
29
29
  const metrics = new ExecutorMetrics(telemetryClient, 'PublicTxSimulator');
30
30
  super(merkleTree, contractsDB, globalVariables, metrics, config);
@@ -59,7 +59,7 @@ export class PublicPersistableStateManager {
59
59
  private readonly trace: PublicSideEffectTraceInterface,
60
60
  private readonly firstNullifier: Fr, // Needed for note hashes.
61
61
  private readonly timestamp: UInt64, // Needed for contract updates.
62
- private readonly doMerkleOperations: boolean = false,
62
+ private readonly doMerkleOperations: boolean = true,
63
63
  private readonly publicStorage: PublicStorage = new PublicStorage(treesDB),
64
64
  private readonly nullifiers: NullifierManager = new NullifierManager(treesDB),
65
65
  ) {}
@@ -71,18 +71,10 @@ export class PublicPersistableStateManager {
71
71
  treesDB: PublicTreesDB,
72
72
  contractsDB: PublicContractsDBInterface,
73
73
  trace: PublicSideEffectTraceInterface,
74
- doMerkleOperations: boolean = false,
75
74
  firstNullifier: Fr,
76
75
  timestamp: UInt64,
77
76
  ): PublicPersistableStateManager {
78
- return new PublicPersistableStateManager(
79
- treesDB,
80
- contractsDB,
81
- trace,
82
- firstNullifier,
83
- timestamp,
84
- doMerkleOperations,
85
- );
77
+ return new PublicPersistableStateManager(treesDB, contractsDB, trace, firstNullifier, timestamp);
86
78
  }
87
79
 
88
80
  /**
@@ -171,7 +163,6 @@ export class PublicPersistableStateManager {
171
163
  if (this.doMerkleOperations) {
172
164
  return await this.treesDB.storageRead(contractAddress, slot);
173
165
  } else {
174
- // TODO(fcarreiro): I don't get this. PublicStorage CAN end up reading the tree. Why is it in the "dont do merkle operations" branch?
175
166
  const read = await this.publicStorage.read(contractAddress, slot);
176
167
  this.log.trace(
177
168
  `Storage read results (address=${contractAddress}, slot=${slot}): value=${read.value}, cached=${read.cached}`,
@@ -437,6 +428,8 @@ export class PublicPersistableStateManager {
437
428
  await this.readStorage(ProtocolContractAddress.ContractInstanceRegistry, storageSlot);
438
429
 
439
430
  const hash = await readDeployerStorage(delayedPublicMutableHashSlot);
431
+ // NOTE: The below reads are either not performed (if hash.isZero()) or only performed in unconstrained in c++ simulation.
432
+ // See UpdateCheck::check_current_class_id documentation - this means if we generate hints from the merkle db, they are unused:
440
433
  const delayedPublicMutableValues = await DelayedPublicMutableValues.readFromTree(
441
434
  delayedPublicMutableSlot,
442
435
  readDeployerStorage,