@aztec/simulator 0.55.1 → 0.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/dest/acvm/oracle/oracle.d.ts +2 -5
  2. package/dest/acvm/oracle/oracle.d.ts.map +1 -1
  3. package/dest/acvm/oracle/oracle.js +6 -37
  4. package/dest/acvm/oracle/typed_oracle.d.ts +3 -6
  5. package/dest/acvm/oracle/typed_oracle.d.ts.map +1 -1
  6. package/dest/acvm/oracle/typed_oracle.js +1 -10
  7. package/dest/avm/avm_execution_environment.d.ts +2 -11
  8. package/dest/avm/avm_execution_environment.d.ts.map +1 -1
  9. package/dest/avm/avm_execution_environment.js +3 -22
  10. package/dest/avm/avm_gas.d.ts +2 -2
  11. package/dest/avm/avm_gas.d.ts.map +1 -1
  12. package/dest/avm/avm_gas.js +31 -116
  13. package/dest/avm/avm_machine_state.d.ts.map +1 -1
  14. package/dest/avm/avm_machine_state.js +6 -6
  15. package/dest/avm/avm_memory_types.d.ts +38 -9
  16. package/dest/avm/avm_memory_types.d.ts.map +1 -1
  17. package/dest/avm/avm_memory_types.js +27 -13
  18. package/dest/avm/avm_simulator.d.ts.map +1 -1
  19. package/dest/avm/avm_simulator.js +5 -6
  20. package/dest/avm/bytecode_utils.d.ts +1 -2
  21. package/dest/avm/bytecode_utils.d.ts.map +1 -1
  22. package/dest/avm/bytecode_utils.js +3 -17
  23. package/dest/avm/errors.d.ts +1 -1
  24. package/dest/avm/errors.d.ts.map +1 -1
  25. package/dest/avm/errors.js +12 -3
  26. package/dest/avm/fixtures/index.d.ts +4 -16
  27. package/dest/avm/fixtures/index.d.ts.map +1 -1
  28. package/dest/avm/fixtures/index.js +11 -27
  29. package/dest/avm/journal/index.d.ts +0 -1
  30. package/dest/avm/journal/index.d.ts.map +1 -1
  31. package/dest/avm/journal/index.js +1 -2
  32. package/dest/avm/journal/journal.d.ts +6 -5
  33. package/dest/avm/journal/journal.d.ts.map +1 -1
  34. package/dest/avm/journal/journal.js +18 -16
  35. package/dest/avm/opcodes/accrued_substate.d.ts.map +1 -1
  36. package/dest/avm/opcodes/accrued_substate.js +37 -30
  37. package/dest/avm/opcodes/addressing_mode.d.ts +3 -2
  38. package/dest/avm/opcodes/addressing_mode.d.ts.map +1 -1
  39. package/dest/avm/opcodes/addressing_mode.js +25 -21
  40. package/dest/avm/opcodes/arithmetic.d.ts.map +1 -1
  41. package/dest/avm/opcodes/arithmetic.js +6 -5
  42. package/dest/avm/opcodes/bitwise.d.ts +10 -4
  43. package/dest/avm/opcodes/bitwise.d.ts.map +1 -1
  44. package/dest/avm/opcodes/bitwise.js +26 -18
  45. package/dest/avm/opcodes/commitment.d.ts.map +1 -1
  46. package/dest/avm/opcodes/commitment.js +6 -5
  47. package/dest/avm/opcodes/comparators.d.ts.map +1 -1
  48. package/dest/avm/opcodes/comparators.js +8 -7
  49. package/dest/avm/opcodes/contract.d.ts.map +1 -1
  50. package/dest/avm/opcodes/contract.js +6 -5
  51. package/dest/avm/opcodes/control_flow.js +6 -6
  52. package/dest/avm/opcodes/conversion.d.ts +3 -2
  53. package/dest/avm/opcodes/conversion.d.ts.map +1 -1
  54. package/dest/avm/opcodes/conversion.js +21 -13
  55. package/dest/avm/opcodes/ec_add.d.ts.map +1 -1
  56. package/dest/avm/opcodes/ec_add.js +8 -7
  57. package/dest/avm/opcodes/environment_getters.d.ts +27 -63
  58. package/dest/avm/opcodes/environment_getters.d.ts.map +1 -1
  59. package/dest/avm/opcodes/environment_getters.js +76 -80
  60. package/dest/avm/opcodes/external_calls.d.ts.map +1 -1
  61. package/dest/avm/opcodes/external_calls.js +27 -16
  62. package/dest/avm/opcodes/hashing.d.ts +5 -5
  63. package/dest/avm/opcodes/hashing.d.ts.map +1 -1
  64. package/dest/avm/opcodes/hashing.js +47 -40
  65. package/dest/avm/opcodes/index.d.ts +3 -0
  66. package/dest/avm/opcodes/index.d.ts.map +1 -1
  67. package/dest/avm/opcodes/index.js +4 -1
  68. package/dest/avm/opcodes/instruction.d.ts +2 -6
  69. package/dest/avm/opcodes/instruction.d.ts.map +1 -1
  70. package/dest/avm/opcodes/instruction.js +3 -9
  71. package/dest/avm/opcodes/instruction_impl.d.ts +0 -26
  72. package/dest/avm/opcodes/instruction_impl.d.ts.map +1 -1
  73. package/dest/avm/opcodes/instruction_impl.js +1 -51
  74. package/dest/avm/opcodes/memory.d.ts +5 -12
  75. package/dest/avm/opcodes/memory.d.ts.map +1 -1
  76. package/dest/avm/opcodes/memory.js +40 -53
  77. package/dest/avm/opcodes/misc.d.ts.map +1 -1
  78. package/dest/avm/opcodes/misc.js +6 -5
  79. package/dest/avm/opcodes/multi_scalar_mul.d.ts.map +1 -1
  80. package/dest/avm/opcodes/multi_scalar_mul.js +17 -16
  81. package/dest/avm/opcodes/storage.d.ts.map +1 -1
  82. package/dest/avm/opcodes/storage.js +11 -9
  83. package/dest/avm/serialization/bytecode_serialization.d.ts.map +1 -1
  84. package/dest/avm/serialization/bytecode_serialization.js +5 -25
  85. package/dest/avm/serialization/instruction_serialization.d.ts +40 -54
  86. package/dest/avm/serialization/instruction_serialization.d.ts.map +1 -1
  87. package/dest/avm/serialization/instruction_serialization.js +41 -57
  88. package/dest/avm/test_utils.d.ts +8 -8
  89. package/dest/avm/test_utils.d.ts.map +1 -1
  90. package/dest/avm/test_utils.js +15 -15
  91. package/dest/client/client_execution_context.d.ts +6 -30
  92. package/dest/client/client_execution_context.d.ts.map +1 -1
  93. package/dest/client/client_execution_context.js +31 -53
  94. package/dest/client/index.d.ts +0 -1
  95. package/dest/client/index.d.ts.map +1 -1
  96. package/dest/client/index.js +1 -2
  97. package/dest/client/private_execution.d.ts +2 -2
  98. package/dest/client/private_execution.d.ts.map +1 -1
  99. package/dest/client/private_execution.js +5 -19
  100. package/dest/client/simulator.d.ts +3 -4
  101. package/dest/client/simulator.d.ts.map +1 -1
  102. package/dest/client/simulator.js +1 -1
  103. package/dest/client/test_utils.d.ts.map +1 -1
  104. package/dest/client/test_utils.js +12 -6
  105. package/dest/client/unconstrained_execution.d.ts +2 -2
  106. package/dest/client/unconstrained_execution.d.ts.map +1 -1
  107. package/dest/client/unconstrained_execution.js +3 -3
  108. package/dest/common/debug_fn_name.d.ts +4 -0
  109. package/dest/common/debug_fn_name.d.ts.map +1 -0
  110. package/dest/common/debug_fn_name.js +15 -0
  111. package/dest/common/index.d.ts +0 -1
  112. package/dest/common/index.d.ts.map +1 -1
  113. package/dest/common/index.js +1 -2
  114. package/dest/public/enqueued_call_simulator.d.ts +43 -0
  115. package/dest/public/enqueued_call_simulator.d.ts.map +1 -0
  116. package/dest/public/enqueued_call_simulator.js +154 -0
  117. package/dest/public/enqueued_calls_processor.d.ts +44 -0
  118. package/dest/public/enqueued_calls_processor.d.ts.map +1 -0
  119. package/dest/public/enqueued_calls_processor.js +218 -0
  120. package/dest/public/execution.d.ts +10 -8
  121. package/dest/public/execution.d.ts.map +1 -1
  122. package/dest/public/execution.js +15 -8
  123. package/dest/public/executor.d.ts +4 -7
  124. package/dest/public/executor.d.ts.map +1 -1
  125. package/dest/public/executor.js +10 -14
  126. package/dest/public/hints_builder.d.ts +4 -3
  127. package/dest/public/hints_builder.d.ts.map +1 -1
  128. package/dest/public/hints_builder.js +5 -5
  129. package/dest/public/index.d.ts +3 -2
  130. package/dest/public/index.d.ts.map +1 -1
  131. package/dest/public/index.js +3 -3
  132. package/dest/public/public_db_sources.d.ts +17 -24
  133. package/dest/public/public_db_sources.d.ts.map +1 -1
  134. package/dest/public/public_db_sources.js +58 -65
  135. package/dest/public/public_kernel.d.ts +3 -9
  136. package/dest/public/public_kernel.d.ts.map +1 -1
  137. package/dest/public/public_kernel.js +13 -40
  138. package/dest/public/public_kernel_circuit_simulator.d.ts +5 -11
  139. package/dest/public/public_kernel_circuit_simulator.d.ts.map +1 -1
  140. package/dest/public/public_kernel_tail_simulator.d.ts +19 -0
  141. package/dest/public/public_kernel_tail_simulator.d.ts.map +1 -0
  142. package/dest/public/public_kernel_tail_simulator.js +45 -0
  143. package/dest/public/public_processor.d.ts +9 -5
  144. package/dest/public/public_processor.d.ts.map +1 -1
  145. package/dest/public/public_processor.js +34 -48
  146. package/dest/public/public_processor_metrics.d.ts +3 -3
  147. package/dest/public/public_processor_metrics.d.ts.map +1 -1
  148. package/dest/public/public_processor_metrics.js +1 -1
  149. package/dest/public/side_effect_errors.d.ts +4 -0
  150. package/dest/public/side_effect_errors.d.ts.map +1 -0
  151. package/dest/public/side_effect_errors.js +7 -0
  152. package/dest/public/side_effect_trace.d.ts +2 -2
  153. package/dest/public/side_effect_trace.d.ts.map +1 -1
  154. package/dest/public/side_effect_trace.js +56 -35
  155. package/dest/public/side_effect_trace_interface.d.ts +1 -1
  156. package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
  157. package/package.json +12 -9
  158. package/src/acvm/oracle/oracle.ts +7 -85
  159. package/src/acvm/oracle/typed_oracle.ts +2 -31
  160. package/src/avm/avm_execution_environment.ts +2 -24
  161. package/src/avm/avm_gas.ts +30 -115
  162. package/src/avm/avm_machine_state.ts +5 -5
  163. package/src/avm/avm_memory_types.ts +41 -14
  164. package/src/avm/avm_simulator.ts +4 -5
  165. package/src/avm/bytecode_utils.ts +2 -17
  166. package/src/avm/errors.ts +11 -3
  167. package/src/avm/fixtures/index.ts +13 -46
  168. package/src/avm/journal/index.ts +0 -1
  169. package/src/avm/journal/journal.ts +22 -22
  170. package/src/avm/opcodes/accrued_substate.ts +36 -44
  171. package/src/avm/opcodes/addressing_mode.ts +27 -24
  172. package/src/avm/opcodes/arithmetic.ts +5 -7
  173. package/src/avm/opcodes/bitwise.ts +23 -20
  174. package/src/avm/opcodes/commitment.ts +6 -7
  175. package/src/avm/opcodes/comparators.ts +7 -9
  176. package/src/avm/opcodes/contract.ts +5 -7
  177. package/src/avm/opcodes/control_flow.ts +5 -5
  178. package/src/avm/opcodes/conversion.ts +19 -12
  179. package/src/avm/opcodes/ec_add.ts +14 -16
  180. package/src/avm/opcodes/environment_getters.ts +73 -99
  181. package/src/avm/opcodes/external_calls.ts +27 -20
  182. package/src/avm/opcodes/hashing.ts +52 -52
  183. package/src/avm/opcodes/index.ts +3 -0
  184. package/src/avm/opcodes/instruction.ts +3 -10
  185. package/src/avm/opcodes/instruction_impl.ts +0 -62
  186. package/src/avm/opcodes/memory.ts +37 -67
  187. package/src/avm/opcodes/misc.ts +5 -7
  188. package/src/avm/opcodes/multi_scalar_mul.ts +16 -19
  189. package/src/avm/opcodes/storage.ts +10 -8
  190. package/src/avm/serialization/bytecode_serialization.ts +11 -35
  191. package/src/avm/serialization/instruction_serialization.ts +3 -19
  192. package/src/avm/test_utils.ts +20 -16
  193. package/src/client/client_execution_context.ts +40 -96
  194. package/src/client/index.ts +0 -1
  195. package/src/client/private_execution.ts +9 -9
  196. package/src/client/simulator.ts +2 -3
  197. package/src/client/test_utils.ts +36 -9
  198. package/src/client/unconstrained_execution.ts +3 -8
  199. package/src/common/debug_fn_name.ts +22 -0
  200. package/src/common/index.ts +0 -1
  201. package/src/public/enqueued_call_simulator.ts +335 -0
  202. package/src/public/enqueued_calls_processor.ts +388 -0
  203. package/src/public/execution.ts +16 -12
  204. package/src/public/executor.ts +8 -22
  205. package/src/public/hints_builder.ts +21 -21
  206. package/src/public/index.ts +3 -2
  207. package/src/public/public_db_sources.ts +62 -67
  208. package/src/public/public_kernel.ts +15 -49
  209. package/src/public/public_kernel_circuit_simulator.ts +6 -10
  210. package/src/public/public_kernel_tail_simulator.ts +106 -0
  211. package/src/public/public_processor.ts +65 -86
  212. package/src/public/public_processor_metrics.ts +3 -3
  213. package/src/public/side_effect_errors.ts +6 -0
  214. package/src/public/side_effect_trace.ts +77 -39
  215. package/src/public/side_effect_trace_interface.ts +2 -2
  216. package/dest/avm/journal/host_storage.d.ts +0 -13
  217. package/dest/avm/journal/host_storage.d.ts.map +0 -1
  218. package/dest/avm/journal/host_storage.js +0 -13
  219. package/dest/avm/opcodes/context_getters.d.ts +0 -15
  220. package/dest/avm/opcodes/context_getters.d.ts.map +0 -1
  221. package/dest/avm/opcodes/context_getters.js +0 -19
  222. package/dest/client/execution_result.d.ts +0 -104
  223. package/dest/client/execution_result.d.ts.map +0 -1
  224. package/dest/client/execution_result.js +0 -136
  225. package/dest/common/return_values.d.ts +0 -11
  226. package/dest/common/return_values.d.ts.map +0 -1
  227. package/dest/common/return_values.js +0 -13
  228. package/dest/public/abstract_phase_manager.d.ts +0 -93
  229. package/dest/public/abstract_phase_manager.d.ts.map +0 -1
  230. package/dest/public/abstract_phase_manager.js +0 -285
  231. package/dest/public/app_logic_phase_manager.d.ts +0 -25
  232. package/dest/public/app_logic_phase_manager.d.ts.map +0 -1
  233. package/dest/public/app_logic_phase_manager.js +0 -52
  234. package/dest/public/phase_manager_factory.d.ts +0 -18
  235. package/dest/public/phase_manager_factory.d.ts.map +0 -1
  236. package/dest/public/phase_manager_factory.js +0 -56
  237. package/dest/public/setup_phase_manager.d.ts +0 -25
  238. package/dest/public/setup_phase_manager.d.ts.map +0 -1
  239. package/dest/public/setup_phase_manager.js +0 -39
  240. package/dest/public/tail_phase_manager.d.ts +0 -23
  241. package/dest/public/tail_phase_manager.d.ts.map +0 -1
  242. package/dest/public/tail_phase_manager.js +0 -50
  243. package/dest/public/teardown_phase_manager.d.ts +0 -27
  244. package/dest/public/teardown_phase_manager.d.ts.map +0 -1
  245. package/dest/public/teardown_phase_manager.js +0 -56
  246. package/src/avm/journal/host_storage.ts +0 -14
  247. package/src/avm/opcodes/context_getters.ts +0 -23
  248. package/src/client/execution_result.ts +0 -228
  249. package/src/common/return_values.ts +0 -18
  250. package/src/public/abstract_phase_manager.ts +0 -522
  251. package/src/public/app_logic_phase_manager.ts +0 -81
  252. package/src/public/phase_manager_factory.ts +0 -126
  253. package/src/public/setup_phase_manager.ts +0 -61
  254. package/src/public/tail_phase_manager.ts +0 -127
  255. package/src/public/teardown_phase_manager.ts +0 -86
@@ -3,9 +3,6 @@ import {
3
3
  NestedProcessReturnValues,
4
4
  type ProcessedTx,
5
5
  type ProcessedTxHandler,
6
- PublicKernelType,
7
- type PublicProvingRequest,
8
- type SimulationError,
9
6
  Tx,
10
7
  type TxValidator,
11
8
  makeProcessedTx,
@@ -17,7 +14,6 @@ import {
17
14
  FEE_JUICE_ADDRESS,
18
15
  type GlobalVariables,
19
16
  type Header,
20
- type KernelCircuitPublicInputs,
21
17
  MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
22
18
  PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
23
19
  PublicDataUpdateRequest,
@@ -25,22 +21,16 @@ import {
25
21
  import { times } from '@aztec/foundation/collection';
26
22
  import { createDebugLogger } from '@aztec/foundation/log';
27
23
  import { Timer } from '@aztec/foundation/timer';
28
- import { type ProtocolArtifact } from '@aztec/noir-protocol-circuits-types';
29
24
  import { ClassRegistererAddress } from '@aztec/protocol-contracts/class-registerer';
30
- import {
31
- PublicExecutor,
32
- type PublicStateDB,
33
- type SimulationProvider,
34
- computeFeePayerBalanceLeafSlot,
35
- computeFeePayerBalanceStorageSlot,
36
- } from '@aztec/simulator';
37
25
  import { Attributes, type TelemetryClient, type Tracer, trackSpan } from '@aztec/telemetry-client';
38
26
  import { type ContractDataSource } from '@aztec/types/contracts';
39
27
  import { type MerkleTreeOperations } from '@aztec/world-state';
40
28
 
41
- import { type AbstractPhaseManager } from './abstract_phase_manager.js';
42
- import { PhaseManagerFactory } from './phase_manager_factory.js';
43
- import { ContractsDataSourcePublicDB, WorldStateDB, WorldStatePublicDB } from './public_db_sources.js';
29
+ import { type SimulationProvider } from '../providers/index.js';
30
+ import { EnqueuedCallsProcessor } from './enqueued_calls_processor.js';
31
+ import { PublicExecutor } from './executor.js';
32
+ import { computeFeePayerBalanceLeafSlot, computeFeePayerBalanceStorageSlot } from './fee_payment.js';
33
+ import { WorldStateDB } from './public_db_sources.js';
44
34
  import { RealPublicKernelCircuitSimulator } from './public_kernel.js';
45
35
  import { type PublicKernelCircuitSimulator } from './public_kernel_circuit_simulator.js';
46
36
  import { PublicProcessorMetrics } from './public_processor_metrics.js';
@@ -65,28 +55,25 @@ export class PublicProcessorFactory {
65
55
  public create(maybeHistoricalHeader: Header | undefined, globalVariables: GlobalVariables): PublicProcessor {
66
56
  const { merkleTree, telemetryClient } = this;
67
57
  const historicalHeader = maybeHistoricalHeader ?? merkleTree.getInitialHeader();
68
- const publicContractsDB = new ContractsDataSourcePublicDB(this.contractDataSource);
69
58
 
70
- const worldStatePublicDB = new WorldStatePublicDB(merkleTree);
71
- const worldStateDB = new WorldStateDB(merkleTree);
72
- const publicExecutor = new PublicExecutor(
73
- worldStatePublicDB,
74
- publicContractsDB,
75
- worldStateDB,
76
- historicalHeader,
77
- telemetryClient,
78
- );
79
- return new PublicProcessor(
59
+ const worldStateDB = new WorldStateDB(merkleTree, this.contractDataSource);
60
+ const publicExecutor = new PublicExecutor(worldStateDB, telemetryClient);
61
+ const publicKernelSimulator = new RealPublicKernelCircuitSimulator(this.simulator);
62
+
63
+ return PublicProcessor.create(
80
64
  merkleTree,
81
65
  publicExecutor,
82
- new RealPublicKernelCircuitSimulator(this.simulator),
66
+ publicKernelSimulator,
83
67
  globalVariables,
84
68
  historicalHeader,
85
- publicContractsDB,
86
- worldStatePublicDB,
69
+ worldStateDB,
87
70
  this.telemetryClient,
88
71
  );
89
72
  }
73
+
74
+ public getInitialHeader() {
75
+ return this.merkleTree.getInitialHeader();
76
+ }
90
77
  }
91
78
 
92
79
  /**
@@ -101,14 +88,44 @@ export class PublicProcessor {
101
88
  protected publicKernel: PublicKernelCircuitSimulator,
102
89
  protected globalVariables: GlobalVariables,
103
90
  protected historicalHeader: Header,
104
- protected publicContractsDB: ContractsDataSourcePublicDB,
105
- protected publicStateDB: PublicStateDB,
91
+ protected worldStateDB: WorldStateDB,
92
+ protected enqueuedCallsProcessor: EnqueuedCallsProcessor,
106
93
  telemetryClient: TelemetryClient,
107
94
  private log = createDebugLogger('aztec:sequencer:public-processor'),
108
95
  ) {
109
96
  this.metrics = new PublicProcessorMetrics(telemetryClient, 'PublicProcessor');
110
97
  }
111
98
 
99
+ static create(
100
+ db: MerkleTreeOperations,
101
+ publicExecutor: PublicExecutor,
102
+ publicKernelSimulator: PublicKernelCircuitSimulator,
103
+ globalVariables: GlobalVariables,
104
+ historicalHeader: Header,
105
+ worldStateDB: WorldStateDB,
106
+ telemetryClient: TelemetryClient,
107
+ ) {
108
+ const enqueuedCallsProcessor = EnqueuedCallsProcessor.create(
109
+ db,
110
+ publicExecutor,
111
+ publicKernelSimulator,
112
+ globalVariables,
113
+ historicalHeader,
114
+ worldStateDB,
115
+ );
116
+
117
+ return new PublicProcessor(
118
+ db,
119
+ publicExecutor,
120
+ publicKernelSimulator,
121
+ globalVariables,
122
+ historicalHeader,
123
+ worldStateDB,
124
+ enqueuedCallsProcessor,
125
+ telemetryClient,
126
+ );
127
+ }
128
+
112
129
  get tracer(): Tracer {
113
130
  return this.metrics.tracer;
114
131
  }
@@ -151,7 +168,7 @@ export class PublicProcessor {
151
168
  processedTx.finalPublicDataUpdateRequests = await this.createFinalDataUpdateRequests(processedTx);
152
169
 
153
170
  // Commit the state updates from this transaction
154
- await this.publicStateDB.commit();
171
+ await this.worldStateDB.commit();
155
172
  validateProcessedTx(processedTx);
156
173
 
157
174
  // Re-validate the transaction
@@ -217,14 +234,14 @@ export class PublicProcessor {
217
234
  const balance =
218
235
  existingBalanceWriteIndex > -1
219
236
  ? finalPublicDataUpdateRequests[existingBalanceWriteIndex].newValue
220
- : await this.publicStateDB.storageRead(feeJuiceAddress, balanceSlot);
237
+ : await this.worldStateDB.storageRead(feeJuiceAddress, balanceSlot);
221
238
 
222
239
  if (balance.lt(txFee)) {
223
240
  throw new Error(`Not enough balance for fee payer to pay for transaction (got ${balance} needs ${txFee})`);
224
241
  }
225
242
 
226
243
  const updatedBalance = balance.sub(txFee);
227
- await this.publicStateDB.storageWrite(feeJuiceAddress, balanceSlot, updatedBalance);
244
+ await this.worldStateDB.storageWrite(feeJuiceAddress, balanceSlot, updatedBalance);
228
245
 
229
246
  finalPublicDataUpdateRequests[
230
247
  existingBalanceWriteIndex > -1 ? existingBalanceWriteIndex : MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX
@@ -238,69 +255,31 @@ export class PublicProcessor {
238
255
  }))
239
256
  private async processTxWithPublicCalls(tx: Tx): Promise<[ProcessedTx, NestedProcessReturnValues[]]> {
240
257
  const timer = new Timer();
241
- let returnValues: NestedProcessReturnValues[] = [];
242
- const publicProvingRequests: PublicProvingRequest[] = [];
243
- let phase: AbstractPhaseManager | undefined = PhaseManagerFactory.phaseFromTx(
244
- tx,
245
- this.db,
246
- this.publicExecutor,
247
- this.publicKernel,
248
- this.globalVariables,
249
- this.historicalHeader,
250
- this.publicContractsDB,
251
- this.publicStateDB,
252
- );
253
- this.log.debug(`Beginning processing in phase ${phase?.phase} for tx ${tx.getTxHash()}`);
254
- let publicKernelPublicInput = tx.data.toPublicKernelCircuitPublicInputs();
255
- let lastKernelArtifact: ProtocolArtifact = 'PrivateKernelTailToPublicArtifact'; // All txs with public calls must carry tail to public proofs
256
- let finalKernelOutput: KernelCircuitPublicInputs | undefined;
257
- let revertReason: SimulationError | undefined;
258
- const gasUsed: ProcessedTx['gasUsed'] = {};
259
- let phaseCount = 0;
260
- while (phase) {
261
- phaseCount++;
262
- const phaseTimer = new Timer();
263
- const output = await phase.handle(tx, publicKernelPublicInput, lastKernelArtifact);
264
-
265
- if (output.revertReason) {
266
- this.metrics.recordRevertedPhase(phase.phase);
267
- } else {
268
- this.metrics.recordPhaseDuration(phase.phase, phaseTimer.ms());
269
- }
270
258
 
271
- gasUsed[phase.phase] = output.gasUsed;
272
- if (phase.phase === PublicKernelType.APP_LOGIC) {
273
- returnValues = output.returnValues;
274
- }
275
- publicProvingRequests.push(...output.publicProvingRequests);
276
- publicKernelPublicInput = output.publicKernelOutput;
277
- lastKernelArtifact = output.lastKernelArtifact;
278
- finalKernelOutput = output.finalKernelOutput;
279
- revertReason ??= output.revertReason;
280
- phase = PhaseManagerFactory.phaseFromOutput(
281
- publicKernelPublicInput,
282
- phase,
283
- this.db,
284
- this.publicExecutor,
285
- this.publicKernel,
286
- this.globalVariables,
287
- this.historicalHeader,
288
- this.publicContractsDB,
289
- this.publicStateDB,
290
- );
291
- }
259
+ const { tailKernelOutput, returnValues, revertReason, provingRequests, gasUsed, processedPhases } =
260
+ await this.enqueuedCallsProcessor.process(tx);
292
261
 
293
- if (!finalKernelOutput) {
262
+ if (!tailKernelOutput) {
294
263
  this.metrics.recordFailedTx();
295
264
  throw new Error('Final public kernel was not executed.');
296
265
  }
297
266
 
267
+ processedPhases.forEach(phase => {
268
+ if (phase.revertReason) {
269
+ this.metrics.recordRevertedPhase(phase.phase);
270
+ } else {
271
+ this.metrics.recordPhaseDuration(phase.phase, phase.durationMs);
272
+ }
273
+ });
274
+
298
275
  this.metrics.recordClassRegistration(
299
276
  ...ContractClassRegisteredEvent.fromLogs(tx.unencryptedLogs.unrollLogs(), ClassRegistererAddress),
300
277
  );
301
278
 
279
+ const phaseCount = processedPhases.length;
302
280
  this.metrics.recordTx(phaseCount, timer.ms());
303
- const processedTx = makeProcessedTx(tx, finalKernelOutput, publicProvingRequests, revertReason, gasUsed);
281
+
282
+ const processedTx = makeProcessedTx(tx, tailKernelOutput, provingRequests, revertReason, gasUsed);
304
283
  return [processedTx, returnValues];
305
284
  }
306
285
  }
@@ -1,4 +1,4 @@
1
- import { type PublicKernelType } from '@aztec/circuit-types';
1
+ import { type PublicKernelPhase } from '@aztec/circuit-types';
2
2
  import { type ContractClassRegisteredEvent } from '@aztec/circuits.js';
3
3
  import {
4
4
  Attributes,
@@ -56,7 +56,7 @@ export class PublicProcessorMetrics {
56
56
  });
57
57
  }
58
58
 
59
- recordPhaseDuration(phaseName: PublicKernelType, durationMs: number) {
59
+ recordPhaseDuration(phaseName: PublicKernelPhase, durationMs: number) {
60
60
  this.phaseCount.add(1, { [Attributes.TX_PHASE_NAME]: phaseName, [Attributes.OK]: true });
61
61
  this.phaseDuration.record(Math.ceil(durationMs), { [Attributes.TX_PHASE_NAME]: phaseName });
62
62
  }
@@ -75,7 +75,7 @@ export class PublicProcessorMetrics {
75
75
  });
76
76
  }
77
77
 
78
- recordRevertedPhase(phaseName: PublicKernelType) {
78
+ recordRevertedPhase(phaseName: PublicKernelPhase) {
79
79
  this.phaseCount.add(1, { [Attributes.TX_PHASE_NAME]: phaseName, [Attributes.OK]: false });
80
80
  }
81
81
 
@@ -0,0 +1,6 @@
1
+ export class SideEffectLimitReachedError extends Error {
2
+ constructor(sideEffectType: string, limit: number) {
3
+ super(`Reached the limit on number of '${sideEffectType}' side effects: ${limit}`);
4
+ this.name = 'SideEffectLimitReachedError';
5
+ }
6
+ }
@@ -12,9 +12,19 @@ import {
12
12
  Gas,
13
13
  L2ToL1Message,
14
14
  LogHash,
15
+ MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_TX,
16
+ MAX_L2_TO_L1_MSGS_PER_TX,
17
+ MAX_NOTE_HASHES_PER_TX,
18
+ MAX_NOTE_HASH_READ_REQUESTS_PER_TX,
19
+ MAX_NULLIFIERS_PER_TX,
20
+ MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX,
21
+ MAX_NULLIFIER_READ_REQUESTS_PER_TX,
22
+ MAX_PUBLIC_DATA_READS_PER_TX,
23
+ MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
24
+ MAX_UNENCRYPTED_LOGS_PER_TX,
15
25
  NoteHash,
16
26
  Nullifier,
17
- type PublicCallRequest,
27
+ type PublicInnerCallRequest,
18
28
  ReadRequest,
19
29
  TreeLeafReadRequest,
20
30
  } from '@aztec/circuits.js';
@@ -26,6 +36,7 @@ import { type AvmContractCallResult } from '../avm/avm_contract_call_result.js';
26
36
  import { type AvmExecutionEnvironment } from '../avm/avm_execution_environment.js';
27
37
  import { createSimulationError } from '../common/errors.js';
28
38
  import { type PublicExecutionResult, resultToPublicCallRequest } from './execution.js';
39
+ import { SideEffectLimitReachedError } from './side_effect_errors.js';
29
40
  import { type PublicSideEffectTraceInterface } from './side_effect_trace_interface.js';
30
41
 
31
42
  export type TracedContractInstance = { exists: boolean } & ContractInstanceWithAddress;
@@ -53,9 +64,7 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
53
64
  private allUnencryptedLogs: UnencryptedL2Log[] = [];
54
65
  private unencryptedLogsHashes: LogHash[] = [];
55
66
 
56
- private publicCallRequests: PublicCallRequest[] = [];
57
-
58
- private gotContractInstances: ContractInstanceWithAddress[] = [];
67
+ private publicCallRequests: PublicInnerCallRequest[] = [];
59
68
 
60
69
  private nestedExecutions: PublicExecutionResult[] = [];
61
70
 
@@ -81,10 +90,13 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
81
90
  this.sideEffectCounter++;
82
91
  }
83
92
 
93
+ // TODO(dbanks12): checks against tx-wide limit need access to parent trace's length
94
+
84
95
  public tracePublicStorageRead(storageAddress: Fr, slot: Fr, value: Fr, _exists: boolean, _cached: boolean) {
85
- // TODO(4805): check if some threshold is reached for max storage reads
86
- // (need access to parent length, or trace needs to be initialized with parent's contents)
87
96
  // NOTE: exists and cached are unused for now but may be used for optimizations or kernel hints later
97
+ if (this.contractStorageReads.length >= MAX_PUBLIC_DATA_READS_PER_TX) {
98
+ throw new SideEffectLimitReachedError('contract storage read', MAX_PUBLIC_DATA_READS_PER_TX);
99
+ }
88
100
  this.contractStorageReads.push(
89
101
  new ContractStorageRead(slot, value, this.sideEffectCounter, AztecAddress.fromField(storageAddress)),
90
102
  );
@@ -96,8 +108,9 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
96
108
  }
97
109
 
98
110
  public tracePublicStorageWrite(storageAddress: Fr, slot: Fr, value: Fr) {
99
- // TODO(4805): check if some threshold is reached for max storage writes
100
- // (need access to parent length, or trace needs to be initialized with parent's contents)
111
+ if (this.contractStorageUpdateRequests.length >= MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX) {
112
+ throw new SideEffectLimitReachedError('contract storage write', MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX);
113
+ }
101
114
  this.contractStorageUpdateRequests.push(
102
115
  new ContractStorageUpdateRequest(slot, value, this.sideEffectCounter, storageAddress),
103
116
  );
@@ -107,32 +120,32 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
107
120
 
108
121
  // TODO(8287): _exists can be removed once we have the vm properly handling the equality check
109
122
  public traceNoteHashCheck(_storageAddress: Fr, noteHash: Fr, leafIndex: Fr, exists: boolean) {
110
- // TODO(4805): check if some threshold is reached for max note hash checks
111
123
  // NOTE: storageAddress is unused but will be important when an AVM circuit processes an entire enqueued call
112
- // TODO(dbanks12): leafIndex is unused for now but later must be used by kernel to constrain that the kernel
113
- // is in fact checking the leaf indicated by the user
124
+ if (this.noteHashReadRequests.length >= MAX_NOTE_HASH_READ_REQUESTS_PER_TX) {
125
+ throw new SideEffectLimitReachedError('note hash read request', MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
126
+ }
114
127
  this.noteHashReadRequests.push(new TreeLeafReadRequest(noteHash, leafIndex));
115
128
  this.avmCircuitHints.noteHashExists.items.push(
116
129
  new AvmKeyValueHint(/*key=*/ new Fr(leafIndex), /*value=*/ exists ? Fr.ONE : Fr.ZERO),
117
130
  );
131
+ // NOTE: counter does not increment for note hash checks (because it doesn't rely on pending note hashes)
118
132
  }
119
133
 
120
134
  public traceNewNoteHash(_storageAddress: Fr, noteHash: Fr) {
121
- // TODO(4805): check if some threshold is reached for max new note hash
122
- // NOTE: storageAddress is unused but will be important when an AVM circuit processes an entire enqueued call
123
- // TODO(dbanks12): non-existent note hashes should emit a read request of the note hash that actually
124
- // IS there, and the AVM circuit should accept THAT noteHash as a hint. The circuit will then compare
125
- // the noteHash against the one provided by the user code to determine what to return to the user (exists or not),
126
- // and will then propagate the actually-present noteHash to its public inputs.
135
+ if (this.noteHashes.length >= MAX_NOTE_HASHES_PER_TX) {
136
+ throw new SideEffectLimitReachedError('note hash', MAX_NOTE_HASHES_PER_TX);
137
+ }
127
138
  this.noteHashes.push(new NoteHash(noteHash, this.sideEffectCounter));
128
139
  this.logger.debug(`NEW_NOTE_HASH cnt: ${this.sideEffectCounter}`);
129
140
  this.incrementSideEffectCounter();
130
141
  }
131
142
 
132
143
  public traceNullifierCheck(_storageAddress: Fr, nullifier: Fr, _leafIndex: Fr, exists: boolean, _isPending: boolean) {
133
- // TODO(4805): check if some threshold is reached for max new nullifier
134
144
  // NOTE: storageAddress is unused but will be important when an AVM circuit processes an entire enqueued call
135
145
  // NOTE: isPending and leafIndex are unused for now but may be used for optimizations or kernel hints later
146
+
147
+ this.enforceLimitOnNullifierChecks();
148
+
136
149
  const readRequest = new ReadRequest(nullifier, this.sideEffectCounter);
137
150
  if (exists) {
138
151
  this.nullifierReadRequests.push(readRequest);
@@ -147,8 +160,10 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
147
160
  }
148
161
 
149
162
  public traceNewNullifier(_storageAddress: Fr, nullifier: Fr) {
150
- // TODO(4805): check if some threshold is reached for max new nullifier
151
163
  // NOTE: storageAddress is unused but will be important when an AVM circuit processes an entire enqueued call
164
+ if (this.nullifiers.length >= MAX_NULLIFIERS_PER_TX) {
165
+ throw new SideEffectLimitReachedError('nullifier', MAX_NULLIFIERS_PER_TX);
166
+ }
152
167
  this.nullifiers.push(new Nullifier(nullifier, this.sideEffectCounter, /*noteHash=*/ Fr.ZERO));
153
168
  this.logger.debug(`NEW_NULLIFIER cnt: ${this.sideEffectCounter}`);
154
169
  this.incrementSideEffectCounter();
@@ -156,18 +171,21 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
156
171
 
157
172
  // TODO(8287): _exists can be removed once we have the vm properly handling the equality check
158
173
  public traceL1ToL2MessageCheck(_contractAddress: Fr, msgHash: Fr, msgLeafIndex: Fr, exists: boolean) {
159
- // TODO(4805): check if some threshold is reached for max message reads
160
174
  // NOTE: contractAddress is unused but will be important when an AVM circuit processes an entire enqueued call
161
- // TODO(dbanks12): leafIndex is unused for now but later must be used by kernel to constrain that the kernel
162
- // is in fact checking the leaf indicated by the user
175
+ if (this.l1ToL2MsgReadRequests.length >= MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_TX) {
176
+ throw new SideEffectLimitReachedError('l1 to l2 message read request', MAX_L1_TO_L2_MSG_READ_REQUESTS_PER_TX);
177
+ }
163
178
  this.l1ToL2MsgReadRequests.push(new TreeLeafReadRequest(msgHash, msgLeafIndex));
164
179
  this.avmCircuitHints.l1ToL2MessageExists.items.push(
165
180
  new AvmKeyValueHint(/*key=*/ new Fr(msgLeafIndex), /*value=*/ exists ? Fr.ONE : Fr.ZERO),
166
181
  );
182
+ // NOTE: counter does not increment for l1tol2 message checks (because it doesn't rely on pending messages)
167
183
  }
168
184
 
169
- public traceNewL2ToL1Message(recipient: Fr, content: Fr) {
170
- // TODO(4805): check if some threshold is reached for max messages
185
+ public traceNewL2ToL1Message(_contractAddress: Fr, recipient: Fr, content: Fr) {
186
+ if (this.newL2ToL1Messages.length >= MAX_L2_TO_L1_MSGS_PER_TX) {
187
+ throw new SideEffectLimitReachedError('l2 to l1 message', MAX_L2_TO_L1_MSGS_PER_TX);
188
+ }
171
189
  const recipientAddress = EthAddress.fromField(recipient);
172
190
  this.newL2ToL1Messages.push(new L2ToL1Message(recipientAddress, content, this.sideEffectCounter));
173
191
  this.logger.debug(`NEW_L2_TO_L1_MSG cnt: ${this.sideEffectCounter}`);
@@ -175,7 +193,9 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
175
193
  }
176
194
 
177
195
  public traceUnencryptedLog(contractAddress: Fr, log: Fr[]) {
178
- // TODO(4805): check if some threshold is reached for max logs
196
+ if (this.unencryptedLogs.length >= MAX_UNENCRYPTED_LOGS_PER_TX) {
197
+ throw new SideEffectLimitReachedError('unencrypted log', MAX_UNENCRYPTED_LOGS_PER_TX);
198
+ }
179
199
  const ulog = new UnencryptedL2Log(
180
200
  AztecAddress.fromField(contractAddress),
181
201
  Buffer.concat(log.map(f => f.toBuffer())),
@@ -183,18 +203,17 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
183
203
  const basicLogHash = Fr.fromBuffer(ulog.hash());
184
204
  this.unencryptedLogs.push(ulog);
185
205
  this.allUnencryptedLogs.push(ulog);
186
- // We want the length of the buffer output from function_l2_logs -> toBuffer to equal the stored log length in the kernels.
187
- // The kernels store the length of the processed log as 4 bytes; thus for this length value to match the log length stored in the kernels,
188
- // we need to add four to the length here.
189
- // https://github.com/AztecProtocol/aztec-packages/issues/6578#issuecomment-2125003435
206
+ // This length is for charging DA and is checked on-chain - has to be length of log preimage + 4 bytes.
207
+ // The .length call also has a +4 but that is unrelated
190
208
  this.unencryptedLogsHashes.push(new LogHash(basicLogHash, this.sideEffectCounter, new Fr(ulog.length + 4)));
191
209
  this.logger.debug(`NEW_UNENCRYPTED_LOG cnt: ${this.sideEffectCounter}`);
192
210
  this.incrementSideEffectCounter();
193
211
  }
194
212
 
195
213
  public traceGetContractInstance(instance: TracedContractInstance) {
196
- // TODO(4805): check if some threshold is reached for max contract instance retrievals
197
- this.gotContractInstances.push(instance);
214
+ this.enforceLimitOnNullifierChecks('(contract address nullifier from GETCONTRACTINSTANCE)');
215
+ // TODO(dbanks12): should emit a nullifier read request
216
+
198
217
  this.avmCircuitHints.contractInstances.items.push(
199
218
  new AvmContractInstanceHint(
200
219
  instance.address,
@@ -230,6 +249,11 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
230
249
  /** Function name for logging */
231
250
  functionName: string = 'unknown',
232
251
  ) {
252
+ // TODO(4805): check if some threshold is reached for max nested calls (to unique contracts?)
253
+ // TODO(dbanks12): should emit a nullifier read request. There should be two thresholds.
254
+ // one for max unique contract calls, and another based on max nullifier reads.
255
+ // Since this trace function happens _after_ a nested call, such threshold limits must take
256
+ // place in another trace function that occurs _before_ a nested call.
233
257
  const result = nestedCallTrace.toPublicExecutionResult(
234
258
  nestedEnvironment,
235
259
  startGasLeft,
@@ -307,8 +331,6 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
307
331
  unencryptedLogs: new UnencryptedFunctionL2Logs(this.unencryptedLogs),
308
332
  allUnencryptedLogs: new UnencryptedFunctionL2Logs(this.allUnencryptedLogs),
309
333
  unencryptedLogsHashes: this.unencryptedLogsHashes,
310
- // TODO(dbanks12): process contract instance read requests in public kernel
311
- //gotContractInstances: this.gotContractInstances,
312
334
 
313
335
  publicCallRequests: this.publicCallRequests,
314
336
  nestedExecutions: this.nestedExecutions,
@@ -318,6 +340,27 @@ export class PublicSideEffectTrace implements PublicSideEffectTraceInterface {
318
340
  functionName,
319
341
  };
320
342
  }
343
+
344
+ private enforceLimitOnNullifierChecks(errorMsgOrigin: string = '') {
345
+ // NOTE: Why error if _either_ limit was reached? If user code emits either an existent or non-existent
346
+ // nullifier read request (NULLIFIEREXISTS, GETCONTRACTINSTANCE, *CALL), and one of the limits has been
347
+ // reached (MAX_NULLIFIER_NON_EXISTENT_RRS vs MAX_NULLIFIER_RRS), but not the other, we must prevent the
348
+ // sequencer from lying and saying "this nullifier exists, but MAX_NULLIFIER_RRS has been reached, so I'm
349
+ // going to skip the read request and just revert instead" when the nullifier actually doesn't exist
350
+ // (or vice versa). So, if either maximum has been reached, any nullifier-reading operation must error.
351
+ if (this.nullifierReadRequests.length >= MAX_NULLIFIER_READ_REQUESTS_PER_TX) {
352
+ throw new SideEffectLimitReachedError(
353
+ `nullifier read request ${errorMsgOrigin}`,
354
+ MAX_NULLIFIER_READ_REQUESTS_PER_TX,
355
+ );
356
+ }
357
+ if (this.nullifierNonExistentReadRequests.length >= MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX) {
358
+ throw new SideEffectLimitReachedError(
359
+ `nullifier non-existent read request ${errorMsgOrigin}`,
360
+ MAX_NULLIFIER_NON_EXISTENT_READ_REQUESTS_PER_TX,
361
+ );
362
+ }
363
+ }
321
364
  }
322
365
 
323
366
  /**
@@ -331,10 +374,5 @@ function createPublicExecutionRequest(avmEnvironment: AvmExecutionEnvironment):
331
374
  isDelegateCall: avmEnvironment.isDelegateCall,
332
375
  isStaticCall: avmEnvironment.isStaticCall,
333
376
  });
334
- return new PublicExecutionRequest(
335
- avmEnvironment.address,
336
- callContext,
337
- // execution request does not contain AvmContextInputs prefix
338
- avmEnvironment.getCalldataWithoutPrefix(),
339
- );
377
+ return new PublicExecutionRequest(avmEnvironment.address, callContext, avmEnvironment.calldata);
340
378
  }
@@ -8,6 +8,7 @@ import { type TracedContractInstance } from './side_effect_trace.js';
8
8
  export interface PublicSideEffectTraceInterface {
9
9
  fork(): PublicSideEffectTraceInterface;
10
10
  getCounter(): number;
11
+ // all "trace*" functions can throw SideEffectLimitReachedError
11
12
  tracePublicStorageRead(storageAddress: Fr, slot: Fr, value: Fr, exists: boolean, cached: boolean): void;
12
13
  tracePublicStorageWrite(storageAddress: Fr, slot: Fr, value: Fr): void;
13
14
  traceNoteHashCheck(storageAddress: Fr, noteHash: Fr, leafIndex: Fr, exists: boolean): void;
@@ -15,8 +16,7 @@ export interface PublicSideEffectTraceInterface {
15
16
  traceNullifierCheck(storageAddress: Fr, nullifier: Fr, leafIndex: Fr, exists: boolean, isPending: boolean): void;
16
17
  traceNewNullifier(storageAddress: Fr, nullifier: Fr): void;
17
18
  traceL1ToL2MessageCheck(contractAddress: Fr, msgHash: Fr, msgLeafIndex: Fr, exists: boolean): void;
18
- // TODO(dbanks12): should new message accept contract address as arg?
19
- traceNewL2ToL1Message(recipient: Fr, content: Fr): void;
19
+ traceNewL2ToL1Message(contractAddress: Fr, recipient: Fr, content: Fr): void;
20
20
  traceUnencryptedLog(contractAddress: Fr, log: Fr[]): void;
21
21
  // TODO(dbanks12): odd that getContractInstance is a one-off in that it accepts an entire object instead of components
22
22
  traceGetContractInstance(instance: TracedContractInstance): void;
@@ -1,13 +0,0 @@
1
- import { type CommitmentsDB, type PublicContractsDB, type PublicStateDB } from '../../public/db_interfaces.js';
2
- /**
3
- * Host storage
4
- *
5
- * A wrapper around the node dbs
6
- */
7
- export declare class HostStorage {
8
- readonly publicStateDb: PublicStateDB;
9
- readonly contractsDb: PublicContractsDB;
10
- readonly commitmentsDb: CommitmentsDB;
11
- constructor(publicStateDb: PublicStateDB, contractsDb: PublicContractsDB, commitmentsDb: CommitmentsDB);
12
- }
13
- //# sourceMappingURL=host_storage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"host_storage.d.ts","sourceRoot":"","sources":["../../../src/avm/journal/host_storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE/G;;;;GAIG;AACH,qBAAa,WAAW;aAEJ,aAAa,EAAE,aAAa;aAC5B,WAAW,EAAE,iBAAiB;aAC9B,aAAa,EAAE,aAAa;gBAF5B,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,iBAAiB,EAC9B,aAAa,EAAE,aAAa;CAE/C"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Host storage
3
- *
4
- * A wrapper around the node dbs
5
- */
6
- export class HostStorage {
7
- constructor(publicStateDb, contractsDb, commitmentsDb) {
8
- this.publicStateDb = publicStateDb;
9
- this.contractsDb = contractsDb;
10
- this.commitmentsDb = commitmentsDb;
11
- }
12
- }
13
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaG9zdF9zdG9yYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2F2bS9qb3VybmFsL2hvc3Rfc3RvcmFnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQTs7OztHQUlHO0FBQ0gsTUFBTSxPQUFPLFdBQVc7SUFDdEIsWUFDa0IsYUFBNEIsRUFDNUIsV0FBOEIsRUFDOUIsYUFBNEI7UUFGNUIsa0JBQWEsR0FBYixhQUFhLENBQWU7UUFDNUIsZ0JBQVcsR0FBWCxXQUFXLENBQW1CO1FBQzlCLGtCQUFhLEdBQWIsYUFBYSxDQUFlO0lBQzNDLENBQUM7Q0FDTCJ9
@@ -1,15 +0,0 @@
1
- import type { AvmContext } from '../avm_context.js';
2
- import { type MemoryValue } from '../avm_memory_types.js';
3
- import { Opcode } from '../serialization/instruction_serialization.js';
4
- import { GetterInstruction } from './instruction_impl.js';
5
- export declare class L2GasLeft extends GetterInstruction {
6
- static type: string;
7
- static readonly opcode: Opcode;
8
- protected getValue(context: AvmContext): MemoryValue;
9
- }
10
- export declare class DAGasLeft extends GetterInstruction {
11
- static type: string;
12
- static readonly opcode: Opcode;
13
- protected getValue(context: AvmContext): MemoryValue;
14
- }
15
- //# sourceMappingURL=context_getters.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context_getters.d.ts","sourceRoot":"","sources":["../../../src/avm/opcodes/context_getters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAS,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,+CAA+C,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C,MAAM,CAAC,IAAI,EAAE,MAAM,CAAe;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAoB;IAGlD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,WAAW;CAGrD;AAED,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C,MAAM,CAAC,IAAI,EAAE,MAAM,CAAe;IAClC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAoB;IAElD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,WAAW;CAGrD"}
@@ -1,19 +0,0 @@
1
- import { Field } from '../avm_memory_types.js';
2
- import { Opcode } from '../serialization/instruction_serialization.js';
3
- import { GetterInstruction } from './instruction_impl.js';
4
- export class L2GasLeft extends GetterInstruction {
5
- // TODO(@spalladino) Protocol specs specifies that the value should be an Uint32, not a Field.
6
- getValue(context) {
7
- return new Field(context.machineState.l2GasLeft);
8
- }
9
- }
10
- L2GasLeft.type = 'L2GASLEFT';
11
- L2GasLeft.opcode = Opcode.L2GASLEFT;
12
- export class DAGasLeft extends GetterInstruction {
13
- getValue(context) {
14
- return new Field(context.machineState.daGasLeft);
15
- }
16
- }
17
- DAGasLeft.type = 'DAGASLEFT';
18
- DAGasLeft.opcode = Opcode.DAGASLEFT;
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udGV4dF9nZXR0ZXJzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2F2bS9vcGNvZGVzL2NvbnRleHRfZ2V0dGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsS0FBSyxFQUFvQixNQUFNLHdCQUF3QixDQUFDO0FBQ2pFLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSwrQ0FBK0MsQ0FBQztBQUN2RSxPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUUxRCxNQUFNLE9BQU8sU0FBVSxTQUFRLGlCQUFpQjtJQUk5Qyw4RkFBOEY7SUFDcEYsUUFBUSxDQUFDLE9BQW1CO1FBQ3BDLE9BQU8sSUFBSSxLQUFLLENBQUMsT0FBTyxDQUFDLFlBQVksQ0FBQyxTQUFTLENBQUMsQ0FBQztJQUNuRCxDQUFDOztBQU5NLGNBQUksR0FBVyxXQUFXLENBQUM7QUFDbEIsZ0JBQU0sR0FBVyxNQUFNLENBQUMsU0FBUyxDQUFDO0FBUXBELE1BQU0sT0FBTyxTQUFVLFNBQVEsaUJBQWlCO0lBSXBDLFFBQVEsQ0FBQyxPQUFtQjtRQUNwQyxPQUFPLElBQUksS0FBSyxDQUFDLE9BQU8sQ0FBQyxZQUFZLENBQUMsU0FBUyxDQUFDLENBQUM7SUFDbkQsQ0FBQzs7QUFMTSxjQUFJLEdBQVcsV0FBVyxDQUFDO0FBQ2xCLGdCQUFNLEdBQVcsTUFBTSxDQUFDLFNBQVMsQ0FBQyJ9