@aztec/simulator 0.76.4 → 0.77.0-testnet-ignition.17

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 (505) hide show
  1. package/README.md +3 -3
  2. package/dest/client.d.ts +5 -0
  3. package/dest/client.d.ts.map +1 -0
  4. package/dest/client.js +3 -0
  5. package/dest/{public → common}/db_interfaces.d.ts +8 -33
  6. package/dest/common/db_interfaces.d.ts.map +1 -0
  7. package/dest/common/db_interfaces.js +1 -0
  8. package/dest/common/debug_fn_name.d.ts +3 -2
  9. package/dest/common/debug_fn_name.d.ts.map +1 -1
  10. package/dest/common/debug_fn_name.js +2 -5
  11. package/dest/common/errors.d.ts +4 -4
  12. package/dest/common/errors.d.ts.map +1 -1
  13. package/dest/common/errors.js +30 -39
  14. package/dest/common/index.d.ts +2 -1
  15. package/dest/common/index.d.ts.map +1 -1
  16. package/dest/common/index.js +2 -2
  17. package/dest/common/message_load_oracle_inputs.d.ts +2 -2
  18. package/dest/common/message_load_oracle_inputs.d.ts.map +1 -1
  19. package/dest/common/message_load_oracle_inputs.js +8 -8
  20. package/dest/common/stats/index.d.ts.map +1 -0
  21. package/dest/{stats → common/stats}/stats.d.ts +2 -2
  22. package/dest/common/stats/stats.d.ts.map +1 -0
  23. package/dest/common/stats/stats.js +10 -0
  24. package/dest/{acvm → private/acvm}/acvm.d.ts +4 -4
  25. package/dest/private/acvm/acvm.d.ts.map +1 -0
  26. package/dest/private/acvm/acvm.js +70 -0
  27. package/dest/{acvm → private/acvm}/acvm_types.d.ts +1 -1
  28. package/dest/private/acvm/acvm_types.d.ts.map +1 -0
  29. package/dest/private/acvm/acvm_types.js +3 -0
  30. package/dest/{acvm → private/acvm}/deserialize.d.ts +2 -2
  31. package/dest/private/acvm/deserialize.d.ts.map +1 -0
  32. package/dest/private/acvm/deserialize.js +42 -0
  33. package/dest/private/acvm/index.d.ts.map +1 -0
  34. package/dest/private/acvm/index.js +5 -0
  35. package/dest/{acvm → private/acvm}/oracle/index.d.ts +1 -1
  36. package/dest/private/acvm/oracle/index.d.ts.map +1 -0
  37. package/dest/private/acvm/oracle/index.js +2 -0
  38. package/dest/{acvm → private/acvm}/oracle/oracle.d.ts +4 -3
  39. package/dest/private/acvm/oracle/oracle.d.ts.map +1 -0
  40. package/dest/private/acvm/oracle/oracle.js +263 -0
  41. package/dest/{acvm → private/acvm}/oracle/typed_oracle.d.ts +12 -6
  42. package/dest/private/acvm/oracle/typed_oracle.d.ts.map +1 -0
  43. package/dest/private/acvm/oracle/typed_oracle.js +132 -0
  44. package/dest/{acvm → private/acvm}/serialize.d.ts +7 -3
  45. package/dest/private/acvm/serialize.d.ts.map +1 -0
  46. package/dest/private/acvm/serialize.js +46 -0
  47. package/dest/{client → private}/client_execution_context.d.ts +20 -17
  48. package/dest/private/client_execution_context.d.ts.map +1 -0
  49. package/dest/private/client_execution_context.js +378 -0
  50. package/dest/{client → private}/db_oracle.d.ts +19 -7
  51. package/dest/private/db_oracle.d.ts.map +1 -0
  52. package/dest/private/db_oracle.js +14 -0
  53. package/dest/{client → private}/execution_note_cache.d.ts +2 -2
  54. package/dest/private/execution_note_cache.d.ts.map +1 -0
  55. package/dest/private/execution_note_cache.js +180 -0
  56. package/dest/{common → private}/hashed_values_cache.d.ts +2 -2
  57. package/dest/private/hashed_values_cache.d.ts.map +1 -0
  58. package/dest/private/hashed_values_cache.js +46 -0
  59. package/dest/private/index.d.ts +13 -0
  60. package/dest/private/index.d.ts.map +1 -0
  61. package/dest/private/index.js +12 -0
  62. package/dest/{client → private}/pick_notes.d.ts +1 -1
  63. package/dest/private/pick_notes.d.ts.map +1 -0
  64. package/dest/private/pick_notes.js +51 -0
  65. package/dest/private/private_execution.d.ts +24 -0
  66. package/dest/private/private_execution.d.ts.map +1 -0
  67. package/dest/private/private_execution.js +90 -0
  68. package/dest/{providers → private/providers}/acvm_native.d.ts +5 -5
  69. package/dest/private/providers/acvm_native.d.ts.map +1 -0
  70. package/dest/private/providers/acvm_native.js +139 -0
  71. package/dest/{providers → private/providers}/acvm_wasm.d.ts +4 -4
  72. package/dest/private/providers/acvm_wasm.d.ts.map +1 -0
  73. package/dest/private/providers/acvm_wasm.js +62 -0
  74. package/dest/{providers → private/providers}/acvm_wasm_with_blobs.d.ts +5 -5
  75. package/dest/private/providers/acvm_wasm_with_blobs.d.ts.map +1 -0
  76. package/dest/{providers → private/providers}/acvm_wasm_with_blobs.js +3 -6
  77. package/dest/{providers → private/providers}/factory.d.ts +1 -1
  78. package/dest/private/providers/factory.d.ts.map +1 -0
  79. package/dest/private/providers/factory.js +27 -0
  80. package/dest/{common → private/providers}/simulation_provider.d.ts +5 -5
  81. package/dest/private/providers/simulation_provider.d.ts.map +1 -0
  82. package/dest/private/providers/simulation_provider.js +24 -0
  83. package/dest/private/simulator.d.ts +36 -0
  84. package/dest/private/simulator.d.ts.map +1 -0
  85. package/dest/private/simulator.js +78 -0
  86. package/dest/{client → private}/unconstrained_execution.d.ts +5 -5
  87. package/dest/private/unconstrained_execution.d.ts.map +1 -0
  88. package/dest/private/unconstrained_execution.js +27 -0
  89. package/dest/{client → private}/view_data_oracle.d.ts +15 -7
  90. package/dest/private/view_data_oracle.d.ts.map +1 -0
  91. package/dest/private/view_data_oracle.js +260 -0
  92. package/dest/{avm → public/avm}/avm_context.d.ts +7 -5
  93. package/dest/public/avm/avm_context.d.ts.map +1 -0
  94. package/dest/public/avm/avm_context.js +44 -0
  95. package/dest/{avm → public/avm}/avm_contract_call_result.d.ts +5 -5
  96. package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -0
  97. package/dest/public/avm/avm_contract_call_result.js +50 -0
  98. package/dest/{avm → public/avm}/avm_execution_environment.d.ts +2 -2
  99. package/dest/public/avm/avm_execution_environment.d.ts.map +1 -0
  100. package/dest/public/avm/avm_execution_environment.js +31 -0
  101. package/dest/public/avm/avm_gas.d.ts.map +1 -0
  102. package/dest/public/avm/avm_gas.js +202 -0
  103. package/dest/{avm → public/avm}/avm_machine_state.d.ts +2 -2
  104. package/dest/public/avm/avm_machine_state.d.ts.map +1 -0
  105. package/dest/public/avm/avm_machine_state.js +106 -0
  106. package/dest/{avm → public/avm}/avm_memory_types.d.ts +2 -2
  107. package/dest/public/avm/avm_memory_types.d.ts.map +1 -0
  108. package/dest/public/avm/avm_memory_types.js +340 -0
  109. package/dest/{avm → public/avm}/avm_simulator.d.ts +5 -3
  110. package/dest/public/avm/avm_simulator.d.ts.map +1 -0
  111. package/dest/public/avm/avm_simulator.js +202 -0
  112. package/dest/public/avm/bytecode_utils.d.ts.map +1 -0
  113. package/dest/public/avm/bytecode_utils.js +17 -0
  114. package/dest/{avm → public/avm}/errors.d.ts +5 -4
  115. package/dest/public/avm/errors.d.ts.map +1 -0
  116. package/dest/public/avm/errors.js +179 -0
  117. package/dest/{avm → public/avm}/fixtures/avm_simulation_tester.d.ts +6 -6
  118. package/dest/public/avm/fixtures/avm_simulation_tester.d.ts.map +1 -0
  119. package/dest/public/avm/fixtures/avm_simulation_tester.js +76 -0
  120. package/dest/{avm → public/avm}/fixtures/base_avm_simulation_tester.d.ts +13 -11
  121. package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -0
  122. package/dest/public/avm/fixtures/base_avm_simulation_tester.js +77 -0
  123. package/dest/{avm → public/avm}/fixtures/index.d.ts +7 -7
  124. package/dest/public/avm/fixtures/index.d.ts.map +1 -0
  125. package/dest/public/avm/fixtures/index.js +140 -0
  126. package/dest/{avm → public/avm}/fixtures/simple_contract_data_source.d.ts +10 -4
  127. package/dest/public/avm/fixtures/simple_contract_data_source.d.ts.map +1 -0
  128. package/dest/public/avm/fixtures/simple_contract_data_source.js +112 -0
  129. package/dest/public/avm/index.d.ts +4 -0
  130. package/dest/public/avm/index.d.ts.map +1 -0
  131. package/dest/{avm/index.d.ts → public/avm/index.js} +1 -2
  132. package/dest/public/avm/journal/index.d.ts.map +1 -0
  133. package/dest/{avm → public/avm}/journal/journal.d.ts +51 -18
  134. package/dest/public/avm/journal/journal.d.ts.map +1 -0
  135. package/dest/public/avm/journal/journal.js +488 -0
  136. package/dest/{avm → public/avm}/journal/nullifiers.d.ts +8 -6
  137. package/dest/public/avm/journal/nullifiers.d.ts.map +1 -0
  138. package/dest/public/avm/journal/nullifiers.js +97 -0
  139. package/dest/{avm → public/avm}/journal/public_storage.d.ts +2 -2
  140. package/dest/public/avm/journal/public_storage.d.ts.map +1 -0
  141. package/dest/public/avm/journal/public_storage.js +145 -0
  142. package/dest/public/avm/opcodes/accrued_substate.d.ts.map +1 -0
  143. package/dest/public/avm/opcodes/accrued_substate.js +252 -0
  144. package/dest/public/avm/opcodes/addressing_mode.d.ts.map +1 -0
  145. package/dest/public/avm/opcodes/addressing_mode.js +74 -0
  146. package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -0
  147. package/dest/public/avm/opcodes/arithmetic.js +73 -0
  148. package/dest/public/avm/opcodes/bitwise.d.ts.map +1 -0
  149. package/dest/public/avm/opcodes/bitwise.js +106 -0
  150. package/dest/public/avm/opcodes/comparators.d.ts.map +1 -0
  151. package/dest/public/avm/opcodes/comparators.js +43 -0
  152. package/dest/public/avm/opcodes/contract.d.ts.map +1 -0
  153. package/dest/public/avm/opcodes/contract.js +66 -0
  154. package/dest/public/avm/opcodes/control_flow.d.ts.map +1 -0
  155. package/dest/public/avm/opcodes/control_flow.js +105 -0
  156. package/dest/{avm → public/avm}/opcodes/conversion.d.ts +1 -1
  157. package/dest/public/avm/opcodes/conversion.d.ts.map +1 -0
  158. package/dest/public/avm/opcodes/conversion.js +69 -0
  159. package/dest/{avm → public/avm}/opcodes/ec_add.d.ts +1 -1
  160. package/dest/public/avm/opcodes/ec_add.d.ts.map +1 -0
  161. package/dest/public/avm/opcodes/ec_add.js +84 -0
  162. package/dest/public/avm/opcodes/environment_getters.d.ts.map +1 -0
  163. package/dest/public/avm/opcodes/environment_getters.js +79 -0
  164. package/dest/public/avm/opcodes/external_calls.d.ts.map +1 -0
  165. package/dest/public/avm/opcodes/external_calls.js +180 -0
  166. package/dest/{avm → public/avm}/opcodes/hashing.d.ts +1 -1
  167. package/dest/public/avm/opcodes/hashing.d.ts.map +1 -0
  168. package/dest/public/avm/opcodes/hashing.js +114 -0
  169. package/dest/public/avm/opcodes/index.d.ts.map +1 -0
  170. package/dest/{avm → public/avm}/opcodes/instruction.d.ts +2 -2
  171. package/dest/public/avm/opcodes/instruction.d.ts.map +1 -0
  172. package/dest/public/avm/opcodes/instruction.js +91 -0
  173. package/dest/public/avm/opcodes/instruction_impl.d.ts.map +1 -0
  174. package/dest/public/avm/opcodes/instruction_impl.js +30 -0
  175. package/dest/public/avm/opcodes/memory.d.ts.map +1 -0
  176. package/dest/public/avm/opcodes/memory.js +253 -0
  177. package/dest/{avm → public/avm}/opcodes/misc.d.ts +1 -1
  178. package/dest/public/avm/opcodes/misc.d.ts.map +1 -0
  179. package/dest/public/avm/opcodes/misc.js +48 -0
  180. package/dest/public/avm/opcodes/storage.d.ts.map +1 -0
  181. package/dest/public/avm/opcodes/storage.js +66 -0
  182. package/dest/public/avm/serialization/buffer_cursor.d.ts.map +1 -0
  183. package/dest/public/avm/serialization/buffer_cursor.js +99 -0
  184. package/dest/{avm → public/avm}/serialization/bytecode_serialization.d.ts +1 -1
  185. package/dest/public/avm/serialization/bytecode_serialization.d.ts.map +1 -0
  186. package/dest/public/avm/serialization/bytecode_serialization.js +328 -0
  187. package/dest/{avm → public/avm}/serialization/instruction_serialization.d.ts +1 -2
  188. package/dest/public/avm/serialization/instruction_serialization.d.ts.map +1 -0
  189. package/dest/public/avm/serialization/instruction_serialization.js +225 -0
  190. package/dest/{avm → public/avm}/test_utils.d.ts +6 -4
  191. package/dest/public/avm/test_utils.d.ts.map +1 -0
  192. package/dest/public/avm/test_utils.js +52 -0
  193. package/dest/public/bytecode_errors.js +1 -2
  194. package/dest/public/execution.d.ts +8 -2
  195. package/dest/public/execution.d.ts.map +1 -1
  196. package/dest/public/execution.js +4 -5
  197. package/dest/public/executor_metrics.js +16 -12
  198. package/dest/public/fixtures/index.js +0 -1
  199. package/dest/public/fixtures/public_tx_simulation_tester.d.ts +12 -8
  200. package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
  201. package/dest/public/fixtures/public_tx_simulation_tester.js +37 -44
  202. package/dest/public/fixtures/utils.d.ts +3 -11
  203. package/dest/public/fixtures/utils.d.ts.map +1 -1
  204. package/dest/public/fixtures/utils.js +15 -35
  205. package/dest/public/index.d.ts +3 -2
  206. package/dest/public/index.d.ts.map +1 -1
  207. package/dest/public/index.js +3 -3
  208. package/dest/public/public_db_sources.d.ts +22 -28
  209. package/dest/public/public_db_sources.d.ts.map +1 -1
  210. package/dest/public/public_db_sources.js +75 -181
  211. package/dest/public/public_processor.d.ts +8 -6
  212. package/dest/public/public_processor.d.ts.map +1 -1
  213. package/dest/public/public_processor.js +329 -308
  214. package/dest/public/public_processor_metrics.d.ts +3 -3
  215. package/dest/public/public_processor_metrics.d.ts.map +1 -1
  216. package/dest/public/public_processor_metrics.js +46 -27
  217. package/dest/public/public_tx_context.d.ts +14 -8
  218. package/dest/public/public_tx_context.d.ts.map +1 -1
  219. package/dest/public/public_tx_context.js +122 -143
  220. package/dest/public/public_tx_simulator.d.ts +8 -5
  221. package/dest/public/public_tx_simulator.d.ts.map +1 -1
  222. package/dest/public/public_tx_simulator.js +306 -317
  223. package/dest/public/side_effect_errors.js +1 -2
  224. package/dest/public/side_effect_trace.d.ts +16 -10
  225. package/dest/public/side_effect_trace.d.ts.map +1 -1
  226. package/dest/public/side_effect_trace.js +65 -132
  227. package/dest/public/side_effect_trace_interface.d.ts +9 -7
  228. package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
  229. package/dest/public/side_effect_trace_interface.js +1 -2
  230. package/dest/public/unique_class_ids.js +23 -28
  231. package/dest/public/utils.d.ts +2 -2
  232. package/dest/public/utils.d.ts.map +1 -1
  233. package/dest/public/utils.js +17 -12
  234. package/dest/server.d.ts +4 -4
  235. package/dest/server.d.ts.map +1 -1
  236. package/dest/server.js +3 -5
  237. package/dest/test/utils.d.ts +3 -2
  238. package/dest/test/utils.d.ts.map +1 -1
  239. package/dest/test/utils.js +9 -7
  240. package/package.json +16 -18
  241. package/src/client.ts +4 -0
  242. package/src/{public → common}/db_interfaces.ts +8 -40
  243. package/src/common/debug_fn_name.ts +4 -2
  244. package/src/common/errors.ts +5 -5
  245. package/src/common/index.ts +2 -1
  246. package/src/common/message_load_oracle_inputs.ts +2 -2
  247. package/src/common/stats/index.ts +1 -0
  248. package/src/{stats → common/stats}/stats.ts +2 -2
  249. package/src/{acvm → private/acvm}/acvm.ts +5 -5
  250. package/src/{acvm → private/acvm}/acvm_types.ts +1 -1
  251. package/src/{acvm → private/acvm}/deserialize.ts +2 -2
  252. package/src/{acvm → private/acvm}/oracle/index.ts +1 -1
  253. package/src/{acvm → private/acvm}/oracle/oracle.ts +22 -12
  254. package/src/{acvm → private/acvm}/oracle/typed_oracle.ts +50 -55
  255. package/src/{acvm → private/acvm}/serialize.ts +10 -3
  256. package/src/{client → private}/client_execution_context.ts +54 -37
  257. package/src/{client → private}/db_oracle.ts +20 -20
  258. package/src/{client → private}/execution_note_cache.ts +3 -3
  259. package/src/{common → private}/hashed_values_cache.ts +2 -2
  260. package/src/private/index.ts +12 -0
  261. package/src/{client → private}/pick_notes.ts +1 -1
  262. package/src/{client → private}/private_execution.ts +46 -14
  263. package/src/{providers → private/providers}/acvm_native.ts +6 -6
  264. package/src/{providers → private/providers}/acvm_wasm.ts +4 -4
  265. package/src/{providers → private/providers}/acvm_wasm_with_blobs.ts +5 -5
  266. package/src/{providers → private/providers}/factory.ts +1 -1
  267. package/src/{common → private/providers}/simulation_provider.ts +5 -5
  268. package/src/{client → private}/simulator.ts +31 -123
  269. package/src/{client → private}/unconstrained_execution.ts +7 -7
  270. package/src/{client → private}/view_data_oracle.ts +25 -28
  271. package/src/{avm → public/avm}/avm_context.ts +12 -7
  272. package/src/{avm → public/avm}/avm_contract_call_result.ts +6 -6
  273. package/src/{avm → public/avm}/avm_execution_environment.ts +2 -2
  274. package/src/{avm → public/avm}/avm_gas.ts +1 -3
  275. package/src/{avm → public/avm}/avm_machine_state.ts +2 -2
  276. package/src/{avm → public/avm}/avm_memory_types.ts +4 -4
  277. package/src/{avm → public/avm}/avm_simulator.ts +12 -6
  278. package/src/{avm → public/avm}/errors.ts +5 -4
  279. package/src/{avm → public/avm}/fixtures/avm_simulation_tester.ts +16 -15
  280. package/src/{avm → public/avm}/fixtures/base_avm_simulation_tester.ts +38 -40
  281. package/src/{avm → public/avm}/fixtures/index.ts +17 -12
  282. package/src/{avm → public/avm}/fixtures/simple_contract_data_source.ts +64 -9
  283. package/src/{avm → public/avm}/index.ts +1 -1
  284. package/src/public/avm/journal/index.ts +1 -0
  285. package/src/{avm → public/avm}/journal/journal.ts +332 -305
  286. package/src/{avm → public/avm}/journal/nullifiers.ts +20 -19
  287. package/src/{avm → public/avm}/journal/public_storage.ts +2 -2
  288. package/src/{avm → public/avm}/opcodes/contract.ts +1 -1
  289. package/src/{avm → public/avm}/opcodes/control_flow.ts +1 -1
  290. package/src/{avm → public/avm}/opcodes/conversion.ts +1 -1
  291. package/src/{avm → public/avm}/opcodes/ec_add.ts +2 -2
  292. package/src/{avm → public/avm}/opcodes/external_calls.ts +5 -6
  293. package/src/{avm → public/avm}/opcodes/hashing.ts +1 -1
  294. package/src/public/avm/opcodes/index.ts +15 -0
  295. package/src/{avm → public/avm}/opcodes/instruction.ts +2 -2
  296. package/src/{avm → public/avm}/opcodes/misc.ts +1 -1
  297. package/src/public/avm/serialization/bytecode_serialization.ts +204 -0
  298. package/src/{avm → public/avm}/serialization/instruction_serialization.ts +0 -1
  299. package/src/{avm → public/avm}/test_utils.ts +10 -7
  300. package/src/public/execution.ts +9 -12
  301. package/src/public/fixtures/public_tx_simulation_tester.ts +45 -63
  302. package/src/public/fixtures/utils.ts +8 -43
  303. package/src/public/index.ts +3 -2
  304. package/src/public/public_db_sources.ts +55 -188
  305. package/src/public/public_processor.ts +66 -47
  306. package/src/public/public_processor_metrics.ts +3 -3
  307. package/src/public/public_tx_context.ts +69 -74
  308. package/src/public/public_tx_simulator.ts +35 -27
  309. package/src/public/side_effect_trace.ts +67 -140
  310. package/src/public/side_effect_trace_interface.ts +10 -23
  311. package/src/public/unique_class_ids.ts +1 -1
  312. package/src/public/utils.ts +2 -2
  313. package/src/server.ts +4 -4
  314. package/src/test/utils.ts +5 -3
  315. package/dest/acvm/acvm.d.ts.map +0 -1
  316. package/dest/acvm/acvm.js +0 -73
  317. package/dest/acvm/acvm_types.d.ts.map +0 -1
  318. package/dest/acvm/acvm_types.js +0 -2
  319. package/dest/acvm/deserialize.d.ts.map +0 -1
  320. package/dest/acvm/deserialize.js +0 -46
  321. package/dest/acvm/index.d.ts.map +0 -1
  322. package/dest/acvm/index.js +0 -6
  323. package/dest/acvm/oracle/index.d.ts.map +0 -1
  324. package/dest/acvm/oracle/index.js +0 -3
  325. package/dest/acvm/oracle/oracle.d.ts.map +0 -1
  326. package/dest/acvm/oracle/oracle.js +0 -230
  327. package/dest/acvm/oracle/typed_oracle.d.ts.map +0 -1
  328. package/dest/acvm/oracle/typed_oracle.js +0 -131
  329. package/dest/acvm/serialize.d.ts.map +0 -1
  330. package/dest/acvm/serialize.js +0 -48
  331. package/dest/avm/avm_context.d.ts.map +0 -1
  332. package/dest/avm/avm_context.js +0 -44
  333. package/dest/avm/avm_contract_call_result.d.ts.map +0 -1
  334. package/dest/avm/avm_contract_call_result.js +0 -45
  335. package/dest/avm/avm_execution_environment.d.ts.map +0 -1
  336. package/dest/avm/avm_execution_environment.js +0 -28
  337. package/dest/avm/avm_gas.d.ts.map +0 -1
  338. package/dest/avm/avm_gas.js +0 -170
  339. package/dest/avm/avm_machine_state.d.ts.map +0 -1
  340. package/dest/avm/avm_machine_state.js +0 -112
  341. package/dest/avm/avm_memory_types.d.ts.map +0 -1
  342. package/dest/avm/avm_memory_types.js +0 -327
  343. package/dest/avm/avm_simulator.d.ts.map +0 -1
  344. package/dest/avm/avm_simulator.js +0 -193
  345. package/dest/avm/avm_tree.d.ts +0 -282
  346. package/dest/avm/avm_tree.d.ts.map +0 -1
  347. package/dest/avm/avm_tree.js +0 -684
  348. package/dest/avm/bytecode_utils.d.ts.map +0 -1
  349. package/dest/avm/bytecode_utils.js +0 -15
  350. package/dest/avm/errors.d.ts.map +0 -1
  351. package/dest/avm/errors.js +0 -196
  352. package/dest/avm/fixtures/avm_simulation_tester.d.ts.map +0 -1
  353. package/dest/avm/fixtures/avm_simulation_tester.js +0 -73
  354. package/dest/avm/fixtures/base_avm_simulation_tester.d.ts.map +0 -1
  355. package/dest/avm/fixtures/base_avm_simulation_tester.js +0 -76
  356. package/dest/avm/fixtures/index.d.ts.map +0 -1
  357. package/dest/avm/fixtures/index.js +0 -134
  358. package/dest/avm/fixtures/simple_contract_data_source.d.ts.map +0 -1
  359. package/dest/avm/fixtures/simple_contract_data_source.js +0 -75
  360. package/dest/avm/index.d.ts.map +0 -1
  361. package/dest/avm/index.js +0 -4
  362. package/dest/avm/journal/index.d.ts.map +0 -1
  363. package/dest/avm/journal/index.js +0 -2
  364. package/dest/avm/journal/journal.d.ts.map +0 -1
  365. package/dest/avm/journal/journal.js +0 -499
  366. package/dest/avm/journal/nullifiers.d.ts.map +0 -1
  367. package/dest/avm/journal/nullifiers.js +0 -99
  368. package/dest/avm/journal/public_storage.d.ts.map +0 -1
  369. package/dest/avm/journal/public_storage.js +0 -159
  370. package/dest/avm/opcodes/accrued_substate.d.ts.map +0 -1
  371. package/dest/avm/opcodes/accrued_substate.js +0 -215
  372. package/dest/avm/opcodes/addressing_mode.d.ts.map +0 -1
  373. package/dest/avm/opcodes/addressing_mode.js +0 -81
  374. package/dest/avm/opcodes/arithmetic.d.ts.map +0 -1
  375. package/dest/avm/opcodes/arithmetic.js +0 -70
  376. package/dest/avm/opcodes/bitwise.d.ts.map +0 -1
  377. package/dest/avm/opcodes/bitwise.js +0 -90
  378. package/dest/avm/opcodes/comparators.d.ts.map +0 -1
  379. package/dest/avm/opcodes/comparators.js +0 -40
  380. package/dest/avm/opcodes/contract.d.ts.map +0 -1
  381. package/dest/avm/opcodes/contract.js +0 -63
  382. package/dest/avm/opcodes/control_flow.d.ts.map +0 -1
  383. package/dest/avm/opcodes/control_flow.js +0 -97
  384. package/dest/avm/opcodes/conversion.d.ts.map +0 -1
  385. package/dest/avm/opcodes/conversion.js +0 -64
  386. package/dest/avm/opcodes/ec_add.d.ts.map +0 -1
  387. package/dest/avm/opcodes/ec_add.js +0 -82
  388. package/dest/avm/opcodes/environment_getters.d.ts.map +0 -1
  389. package/dest/avm/opcodes/environment_getters.js +0 -78
  390. package/dest/avm/opcodes/external_calls.d.ts.map +0 -1
  391. package/dest/avm/opcodes/external_calls.js +0 -169
  392. package/dest/avm/opcodes/hashing.d.ts.map +0 -1
  393. package/dest/avm/opcodes/hashing.js +0 -103
  394. package/dest/avm/opcodes/index.d.ts.map +0 -1
  395. package/dest/avm/opcodes/index.js +0 -16
  396. package/dest/avm/opcodes/instruction.d.ts.map +0 -1
  397. package/dest/avm/opcodes/instruction.js +0 -100
  398. package/dest/avm/opcodes/instruction_impl.d.ts.map +0 -1
  399. package/dest/avm/opcodes/instruction_impl.js +0 -33
  400. package/dest/avm/opcodes/memory.d.ts.map +0 -1
  401. package/dest/avm/opcodes/memory.js +0 -226
  402. package/dest/avm/opcodes/misc.d.ts.map +0 -1
  403. package/dest/avm/opcodes/misc.js +0 -45
  404. package/dest/avm/opcodes/multi_scalar_mul.d.ts +0 -16
  405. package/dest/avm/opcodes/multi_scalar_mul.d.ts.map +0 -1
  406. package/dest/avm/opcodes/multi_scalar_mul.js +0 -112
  407. package/dest/avm/opcodes/storage.d.ts.map +0 -1
  408. package/dest/avm/opcodes/storage.js +0 -61
  409. package/dest/avm/serialization/buffer_cursor.d.ts.map +0 -1
  410. package/dest/avm/serialization/buffer_cursor.js +0 -99
  411. package/dest/avm/serialization/bytecode_serialization.d.ts.map +0 -1
  412. package/dest/avm/serialization/bytecode_serialization.js +0 -132
  413. package/dest/avm/serialization/instruction_serialization.d.ts.map +0 -1
  414. package/dest/avm/serialization/instruction_serialization.js +0 -187
  415. package/dest/avm/test_utils.d.ts.map +0 -1
  416. package/dest/avm/test_utils.js +0 -52
  417. package/dest/client/client_execution_context.d.ts.map +0 -1
  418. package/dest/client/client_execution_context.js +0 -392
  419. package/dest/client/db_oracle.d.ts.map +0 -1
  420. package/dest/client/db_oracle.js +0 -17
  421. package/dest/client/execution_note_cache.d.ts.map +0 -1
  422. package/dest/client/execution_note_cache.js +0 -181
  423. package/dest/client/index.d.ts +0 -16
  424. package/dest/client/index.d.ts.map +0 -1
  425. package/dest/client/index.js +0 -15
  426. package/dest/client/pick_notes.d.ts.map +0 -1
  427. package/dest/client/pick_notes.js +0 -54
  428. package/dest/client/private_execution.d.ts +0 -19
  429. package/dest/client/private_execution.d.ts.map +0 -1
  430. package/dest/client/private_execution.js +0 -72
  431. package/dest/client/simulator.d.ts +0 -60
  432. package/dest/client/simulator.d.ts.map +0 -1
  433. package/dest/client/simulator.js +0 -136
  434. package/dest/client/unconstrained_execution.d.ts.map +0 -1
  435. package/dest/client/unconstrained_execution.js +0 -30
  436. package/dest/client/view_data_oracle.d.ts.map +0 -1
  437. package/dest/client/view_data_oracle.js +0 -268
  438. package/dest/common/hashed_values_cache.d.ts.map +0 -1
  439. package/dest/common/hashed_values_cache.js +0 -50
  440. package/dest/common/simulation_provider.d.ts.map +0 -1
  441. package/dest/common/simulation_provider.js +0 -27
  442. package/dest/common.d.ts +0 -2
  443. package/dest/common.d.ts.map +0 -1
  444. package/dest/common.js +0 -2
  445. package/dest/providers/acvm_native.d.ts.map +0 -1
  446. package/dest/providers/acvm_native.js +0 -125
  447. package/dest/providers/acvm_wasm.d.ts.map +0 -1
  448. package/dest/providers/acvm_wasm.js +0 -54
  449. package/dest/providers/acvm_wasm_with_blobs.d.ts.map +0 -1
  450. package/dest/providers/factory.d.ts.map +0 -1
  451. package/dest/providers/factory.js +0 -27
  452. package/dest/providers/index.d.ts +0 -5
  453. package/dest/providers/index.d.ts.map +0 -1
  454. package/dest/providers/index.js +0 -5
  455. package/dest/public/db_interfaces.d.ts.map +0 -1
  456. package/dest/public/db_interfaces.js +0 -2
  457. package/dest/public/fee_payment.d.ts +0 -11
  458. package/dest/public/fee_payment.d.ts.map +0 -1
  459. package/dest/public/fee_payment.js +0 -21
  460. package/dest/stats/index.d.ts.map +0 -1
  461. package/dest/stats/index.js +0 -2
  462. package/dest/stats/stats.d.ts.map +0 -1
  463. package/dest/stats/stats.js +0 -11
  464. package/src/avm/avm_tree.ts +0 -887
  465. package/src/avm/opcodes/multi_scalar_mul.ts +0 -121
  466. package/src/avm/serialization/bytecode_serialization.ts +0 -212
  467. package/src/client/index.ts +0 -15
  468. package/src/common.ts +0 -1
  469. package/src/providers/index.ts +0 -4
  470. package/src/public/fee_payment.ts +0 -23
  471. /package/dest/{stats → common/stats}/index.d.ts +0 -0
  472. /package/{src/stats/index.ts → dest/common/stats/index.js} +0 -0
  473. /package/dest/{acvm → private/acvm}/index.d.ts +0 -0
  474. /package/dest/{avm → public/avm}/avm_gas.d.ts +0 -0
  475. /package/dest/{avm → public/avm}/bytecode_utils.d.ts +0 -0
  476. /package/dest/{avm → public/avm}/journal/index.d.ts +0 -0
  477. /package/{src/avm/journal/index.ts → dest/public/avm/journal/index.js} +0 -0
  478. /package/dest/{avm → public/avm}/opcodes/accrued_substate.d.ts +0 -0
  479. /package/dest/{avm → public/avm}/opcodes/addressing_mode.d.ts +0 -0
  480. /package/dest/{avm → public/avm}/opcodes/arithmetic.d.ts +0 -0
  481. /package/dest/{avm → public/avm}/opcodes/bitwise.d.ts +0 -0
  482. /package/dest/{avm → public/avm}/opcodes/comparators.d.ts +0 -0
  483. /package/dest/{avm → public/avm}/opcodes/contract.d.ts +0 -0
  484. /package/dest/{avm → public/avm}/opcodes/control_flow.d.ts +0 -0
  485. /package/dest/{avm → public/avm}/opcodes/environment_getters.d.ts +0 -0
  486. /package/dest/{avm → public/avm}/opcodes/external_calls.d.ts +0 -0
  487. /package/dest/{avm → public/avm}/opcodes/index.d.ts +0 -0
  488. /package/{src/avm/opcodes/index.ts → dest/public/avm/opcodes/index.js} +0 -0
  489. /package/dest/{avm → public/avm}/opcodes/instruction_impl.d.ts +0 -0
  490. /package/dest/{avm → public/avm}/opcodes/memory.d.ts +0 -0
  491. /package/dest/{avm → public/avm}/opcodes/storage.d.ts +0 -0
  492. /package/dest/{avm → public/avm}/serialization/buffer_cursor.d.ts +0 -0
  493. /package/src/{acvm → private/acvm}/index.ts +0 -0
  494. /package/src/{avm → public/avm}/bytecode_utils.ts +0 -0
  495. /package/src/{avm → public/avm}/opcodes/.eslintrc.cjs +0 -0
  496. /package/src/{avm → public/avm}/opcodes/accrued_substate.ts +0 -0
  497. /package/src/{avm → public/avm}/opcodes/addressing_mode.ts +0 -0
  498. /package/src/{avm → public/avm}/opcodes/arithmetic.ts +0 -0
  499. /package/src/{avm → public/avm}/opcodes/bitwise.ts +0 -0
  500. /package/src/{avm → public/avm}/opcodes/comparators.ts +0 -0
  501. /package/src/{avm → public/avm}/opcodes/environment_getters.ts +0 -0
  502. /package/src/{avm → public/avm}/opcodes/instruction_impl.ts +0 -0
  503. /package/src/{avm → public/avm}/opcodes/memory.ts +0 -0
  504. /package/src/{avm → public/avm}/opcodes/storage.ts +0 -0
  505. /package/src/{avm → public/avm}/serialization/buffer_cursor.ts +0 -0
@@ -1,121 +0,0 @@
1
- import { Fq, Point } from '@aztec/circuits.js';
2
- import { Grumpkin } from '@aztec/circuits.js/barretenberg';
3
-
4
- import { type AvmContext } from '../avm_context.js';
5
- import { Field, TypeTag, Uint1 } from '../avm_memory_types.js';
6
- import { MSMPointNotOnCurveError, MSMPointsLengthError } from '../errors.js';
7
- import { Opcode, OperandType } from '../serialization/instruction_serialization.js';
8
- import { Addressing } from './addressing_mode.js';
9
- import { Instruction } from './instruction.js';
10
-
11
- export class MultiScalarMul extends Instruction {
12
- static type: string = 'MultiScalarMul';
13
- static readonly opcode: Opcode = Opcode.MSM;
14
-
15
- // Informs (de)serialization. See Instruction.deserialize.
16
- static readonly wireFormat: OperandType[] = [
17
- OperandType.UINT8 /* opcode */,
18
- OperandType.UINT8 /* indirect */,
19
- OperandType.UINT16 /* points vector offset */,
20
- OperandType.UINT16 /* scalars vector offset */,
21
- OperandType.UINT16 /* output offset (fixed triplet) */,
22
- OperandType.UINT16 /* points length offset */,
23
- ];
24
-
25
- constructor(
26
- private indirect: number,
27
- private pointsOffset: number,
28
- private scalarsOffset: number,
29
- private outputOffset: number,
30
- private pointsLengthOffset: number,
31
- ) {
32
- super();
33
- }
34
-
35
- public async execute(context: AvmContext): Promise<void> {
36
- const memory = context.machineState.memory;
37
- // Resolve indirects
38
- const operands = [this.pointsOffset, this.scalarsOffset, this.outputOffset, this.pointsLengthOffset];
39
- const addressing = Addressing.fromWire(this.indirect, operands.length);
40
- const [pointsOffset, scalarsOffset, outputOffset, pointsLengthOffset] = addressing.resolve(operands, memory);
41
-
42
- // Length of the points vector should be U32
43
- memory.checkTag(TypeTag.UINT32, pointsLengthOffset);
44
- // Get the size of the unrolled (x, y , inf) points vector
45
- const pointsReadLength = memory.get(pointsLengthOffset).toNumber();
46
- if (pointsReadLength % 3 !== 0) {
47
- throw new MSMPointsLengthError(pointsReadLength);
48
- }
49
-
50
- // Get the unrolled (x, y, inf) representing the points
51
- // Important to perform this before tag validation, as getSlice() first checks
52
- // that the slice is not out of memory range. This needs to be aligned with circuit.
53
- const pointsVector = memory.getSlice(pointsOffset, pointsReadLength);
54
-
55
- // Divide by 3 since each point is represented as a triplet to get the number of points
56
- const numPoints = pointsReadLength / 3;
57
- // The tag for each triplet will be (Field, Field, Uint8)
58
- for (let i = 0; i < numPoints; i++) {
59
- const offset = pointsOffset + i * 3;
60
- // Check (Field, Field)
61
- memory.checkTagsRange(TypeTag.FIELD, offset, 2);
62
- // Check Uint1 (inf flag)
63
- memory.checkTag(TypeTag.UINT1, offset + 2);
64
- }
65
-
66
- // The size of the scalars vector is twice the NUMBER of points because of the scalar limb decomposition
67
- const scalarReadLength = numPoints * 2;
68
- context.machineState.consumeGas(this.gasCost(pointsReadLength));
69
- // Get the unrolled scalar (lo & hi) representing the scalars
70
- const scalarsVector = memory.getSlice(scalarsOffset, scalarReadLength);
71
- memory.checkTagsRange(TypeTag.FIELD, scalarsOffset, scalarReadLength);
72
-
73
- // Now we need to reconstruct the points and scalars into something we can operate on.
74
- const grumpkinPoints: Point[] = [];
75
- for (let i = 0; i < numPoints; i++) {
76
- const isInf = pointsVector[3 * i + 2].toNumber() === 1;
77
- const p: Point = new Point(pointsVector[3 * i].toFr(), pointsVector[3 * i + 1].toFr(), isInf);
78
- if (!p.isOnGrumpkin()) {
79
- throw new MSMPointNotOnCurveError(p);
80
- }
81
- grumpkinPoints.push(p);
82
- }
83
- // The scalars are read from memory as Fr elements, which are limbs of Fq elements
84
- // So we need to reconstruct them before performing the scalar multiplications
85
- const scalarFqVector: Fq[] = [];
86
- for (let i = 0; i < numPoints; i++) {
87
- const scalarLo = scalarsVector[2 * i].toFr();
88
- const scalarHi = scalarsVector[2 * i + 1].toFr();
89
- const fqScalar = Fq.fromHighLow(scalarHi, scalarLo);
90
- scalarFqVector.push(fqScalar);
91
- }
92
- // TODO: Is there an efficient MSM implementation in ts that we can replace this by?
93
- const grumpkin = new Grumpkin();
94
- // Zip the points and scalars into pairs
95
- const [firstBaseScalarPair, ...rest]: Array<[Point, Fq]> = grumpkinPoints.map((p, idx) => [p, scalarFqVector[idx]]);
96
- // Fold the points and scalars into a single point
97
- // We have to ensure get the first point, since the identity element (point at infinity) isn't quite working in ts
98
- let acc = await grumpkin.mul(firstBaseScalarPair[0], firstBaseScalarPair[1]);
99
- for (const curr of rest) {
100
- if (curr[1] === Fq.ZERO) {
101
- // If we multiply by 0, the result will the point at infinity - so we ignore it
102
- continue;
103
- } else if (curr[0].inf) {
104
- // If we multiply the point at infinity by a scalar, it's still the point at infinity
105
- continue;
106
- } else if (acc.inf) {
107
- // If we accumulator is the point at infinity, we can just return the current point
108
- acc = curr[0];
109
- } else {
110
- acc = await grumpkin.add(acc, await grumpkin.mul(curr[0], curr[1]));
111
- }
112
- }
113
- const outputPoint = acc;
114
-
115
- // Important to use setSlice() and not set() in the two following statements as
116
- // this checks that the offsets lie within memory range.
117
- memory.setSlice(outputOffset, [new Field(outputPoint.x), new Field(outputPoint.y)]);
118
- // Check representation of infinity for grumpkin
119
- memory.setSlice(outputOffset + 2, [new Uint1(outputPoint.equals(Point.ZERO) ? 1 : 0)]);
120
- }
121
- }
@@ -1,212 +0,0 @@
1
- import { AvmExecutionError, AvmParsingError, InvalidOpcodeError, InvalidProgramCounterError } from '../errors.js';
2
- import {
3
- Add,
4
- And,
5
- Call,
6
- CalldataCopy,
7
- Cast,
8
- DebugLog,
9
- Div,
10
- EcAdd,
11
- EmitNoteHash,
12
- EmitNullifier,
13
- EmitUnencryptedLog,
14
- Eq,
15
- FieldDiv,
16
- GetContractInstance,
17
- GetEnvVar,
18
- Instruction,
19
- InternalCall,
20
- InternalReturn,
21
- Jump,
22
- JumpI,
23
- KeccakF1600,
24
- L1ToL2MessageExists,
25
- Lt,
26
- Lte,
27
- Mov,
28
- Mul,
29
- Not,
30
- NoteHashExists,
31
- NullifierExists,
32
- Or,
33
- Poseidon2,
34
- Return,
35
- ReturndataCopy,
36
- ReturndataSize,
37
- Revert,
38
- SLoad,
39
- SStore,
40
- SendL2ToL1Message,
41
- Set,
42
- Sha256Compression,
43
- Shl,
44
- Shr,
45
- StaticCall,
46
- Sub,
47
- ToRadixBE,
48
- Xor,
49
- } from '../opcodes/index.js';
50
- import { MultiScalarMul } from '../opcodes/multi_scalar_mul.js';
51
- import { BufferCursor } from './buffer_cursor.js';
52
- import { MAX_OPCODE_VALUE, Opcode } from './instruction_serialization.js';
53
-
54
- export type InstructionDeserializer = (buf: BufferCursor | Buffer) => Instruction;
55
-
56
- export interface Serializable {
57
- serialize(): Buffer;
58
- }
59
-
60
- export interface Deserializable {
61
- deserialize: InstructionDeserializer;
62
- }
63
-
64
- export type InstructionSet = Map<Opcode, InstructionDeserializer>;
65
- // TODO(4359): This is a function so that Call and StaticCall can be lazily resolved.
66
- // This is a temporary solution until we solve the dependency cycle.
67
- export const INSTRUCTION_SET = () =>
68
- new Map<Opcode, InstructionDeserializer>([
69
- [Opcode.ADD_8, Add.as(Add.wireFormat8).deserialize],
70
- [Opcode.ADD_16, Add.as(Add.wireFormat16).deserialize],
71
- [Opcode.SUB_8, Sub.as(Sub.wireFormat8).deserialize],
72
- [Opcode.SUB_16, Sub.as(Sub.wireFormat16).deserialize],
73
- [Opcode.MUL_8, Mul.as(Mul.wireFormat8).deserialize],
74
- [Opcode.MUL_16, Mul.as(Mul.wireFormat16).deserialize],
75
- [Opcode.DIV_8, Div.as(Div.wireFormat8).deserialize],
76
- [Opcode.DIV_16, Div.as(Div.wireFormat16).deserialize],
77
- [Opcode.FDIV_8, FieldDiv.as(FieldDiv.wireFormat8).deserialize],
78
- [Opcode.FDIV_16, FieldDiv.as(FieldDiv.wireFormat16).deserialize],
79
- [Opcode.EQ_8, Eq.as(Eq.wireFormat8).deserialize],
80
- [Opcode.EQ_16, Eq.as(Eq.wireFormat16).deserialize],
81
- [Opcode.LT_8, Lt.as(Lt.wireFormat8).deserialize],
82
- [Opcode.LT_16, Lt.as(Lt.wireFormat16).deserialize],
83
- [Opcode.LTE_8, Lte.as(Lte.wireFormat8).deserialize],
84
- [Opcode.LTE_16, Lte.as(Lte.wireFormat16).deserialize],
85
- [Opcode.AND_8, And.as(And.wireFormat8).deserialize],
86
- [Opcode.AND_16, And.as(And.wireFormat16).deserialize],
87
- [Opcode.OR_8, Or.as(Or.wireFormat8).deserialize],
88
- [Opcode.OR_16, Or.as(Or.wireFormat16).deserialize],
89
- [Opcode.XOR_8, Xor.as(Xor.wireFormat8).deserialize],
90
- [Opcode.XOR_16, Xor.as(Xor.wireFormat16).deserialize],
91
- [Opcode.NOT_8, Not.as(Not.wireFormat8).deserialize],
92
- [Opcode.NOT_16, Not.as(Not.wireFormat16).deserialize],
93
- [Opcode.SHL_8, Shl.as(Shl.wireFormat8).deserialize],
94
- [Opcode.SHL_16, Shl.as(Shl.wireFormat16).deserialize],
95
- [Opcode.SHR_8, Shr.as(Shr.wireFormat8).deserialize],
96
- [Opcode.SHR_16, Shr.as(Shr.wireFormat16).deserialize],
97
- [Opcode.CAST_8, Cast.as(Cast.wireFormat8).deserialize],
98
- [Opcode.CAST_16, Cast.as(Cast.wireFormat16).deserialize],
99
- // Execution Environment
100
- [Opcode.GETENVVAR_16, GetEnvVar.as(GetEnvVar.wireFormat16).deserialize],
101
- [CalldataCopy.opcode, Instruction.deserialize.bind(CalldataCopy)],
102
- [Opcode.RETURNDATASIZE, Instruction.deserialize.bind(ReturndataSize)],
103
- [Opcode.RETURNDATACOPY, Instruction.deserialize.bind(ReturndataCopy)],
104
-
105
- // Machine State - Internal Control Flow
106
- [Jump.opcode, Instruction.deserialize.bind(Jump)],
107
- [JumpI.opcode, Instruction.deserialize.bind(JumpI)],
108
- [InternalCall.opcode, Instruction.deserialize.bind(InternalCall)],
109
- [InternalReturn.opcode, Instruction.deserialize.bind(InternalReturn)],
110
- [Opcode.SET_8, Set.as(Set.wireFormat8).deserialize],
111
- [Opcode.SET_16, Set.as(Set.wireFormat16).deserialize],
112
- [Opcode.SET_32, Set.as(Set.wireFormat32).deserialize],
113
- [Opcode.SET_64, Set.as(Set.wireFormat64).deserialize],
114
- [Opcode.SET_128, Set.as(Set.wireFormat128).deserialize],
115
- [Opcode.SET_FF, Set.as(Set.wireFormatFF).deserialize],
116
- [Opcode.MOV_8, Mov.as(Mov.wireFormat8).deserialize],
117
- [Opcode.MOV_16, Mov.as(Mov.wireFormat16).deserialize],
118
-
119
- // World State
120
- [SLoad.opcode, Instruction.deserialize.bind(SLoad)], // Public Storage
121
- [SStore.opcode, Instruction.deserialize.bind(SStore)], // Public Storage
122
- [NoteHashExists.opcode, Instruction.deserialize.bind(NoteHashExists)], // Notes & Nullifiers
123
- [EmitNoteHash.opcode, Instruction.deserialize.bind(EmitNoteHash)], // Notes & Nullifiers
124
- [NullifierExists.opcode, Instruction.deserialize.bind(NullifierExists)], // Notes & Nullifiers
125
- [EmitNullifier.opcode, Instruction.deserialize.bind(EmitNullifier)], // Notes & Nullifiers
126
- [L1ToL2MessageExists.opcode, Instruction.deserialize.bind(L1ToL2MessageExists)], // Messages
127
-
128
- // Accrued Substate
129
- [EmitUnencryptedLog.opcode, Instruction.deserialize.bind(EmitUnencryptedLog)],
130
- [SendL2ToL1Message.opcode, Instruction.deserialize.bind(SendL2ToL1Message)],
131
- [GetContractInstance.opcode, Instruction.deserialize.bind(GetContractInstance)],
132
-
133
- // Control Flow - Contract Calls
134
- [Call.opcode, Instruction.deserialize.bind(Call)],
135
- [StaticCall.opcode, Instruction.deserialize.bind(StaticCall)],
136
- [Return.opcode, Instruction.deserialize.bind(Return)],
137
- [Opcode.REVERT_8, Revert.as(Revert.wireFormat8).deserialize],
138
- [Opcode.REVERT_16, Revert.as(Revert.wireFormat16).deserialize],
139
-
140
- // Misc
141
- [DebugLog.opcode, Instruction.deserialize.bind(DebugLog)],
142
-
143
- // Gadgets
144
- [EcAdd.opcode, Instruction.deserialize.bind(EcAdd)],
145
- [Poseidon2.opcode, Instruction.deserialize.bind(Poseidon2)],
146
- [Sha256Compression.opcode, Instruction.deserialize.bind(Sha256Compression)],
147
- [KeccakF1600.opcode, Instruction.deserialize.bind(KeccakF1600)],
148
- [MultiScalarMul.opcode, Instruction.deserialize.bind(MultiScalarMul)],
149
-
150
- // Conversions
151
- [ToRadixBE.opcode, Instruction.deserialize.bind(ToRadixBE)],
152
- ]);
153
-
154
- /**
155
- * Serializes an array of instructions to bytecode.
156
- */
157
- export function encodeToBytecode(instructions: Serializable[]): Buffer {
158
- return Buffer.concat(instructions.map(i => i.serialize()));
159
- }
160
-
161
- // For testing only
162
- export function decodeFromBytecode(
163
- bytecode: Buffer,
164
- instructionSet: InstructionSet = INSTRUCTION_SET(),
165
- ): Instruction[] {
166
- const instructions: Instruction[] = [];
167
- let pc = 0;
168
- while (pc < bytecode.length) {
169
- const [instruction, bytesConsumed] = decodeInstructionFromBytecode(bytecode, pc, instructionSet);
170
- instructions.push(instruction);
171
- pc += bytesConsumed;
172
- }
173
- return instructions;
174
- }
175
-
176
- // Returns the instruction and the number of bytes consumed.
177
- export function decodeInstructionFromBytecode(
178
- bytecode: Buffer,
179
- pc: number,
180
- instructionSet: InstructionSet = INSTRUCTION_SET(),
181
- ): [Instruction, number] {
182
- if (pc >= bytecode.length) {
183
- throw new InvalidProgramCounterError(pc, bytecode.length);
184
- }
185
-
186
- try {
187
- const cursor = new BufferCursor(bytecode, pc);
188
- const startingPosition = cursor.position();
189
- const opcode: number = cursor.bufferAtPosition().readUint8(); // peek.
190
-
191
- if (opcode > MAX_OPCODE_VALUE) {
192
- throw new InvalidOpcodeError(
193
- `Opcode ${opcode} (0x${opcode.toString(16)}) value is not in the range of valid opcodes.`,
194
- );
195
- }
196
-
197
- const instructionDeserializerOrUndef = instructionSet.get(opcode);
198
- if (instructionDeserializerOrUndef === undefined) {
199
- throw new InvalidOpcodeError(`Opcode ${Opcode[opcode]} (0x${opcode.toString(16)}) is not implemented`);
200
- }
201
-
202
- const instructionDeserializer: InstructionDeserializer = instructionDeserializerOrUndef;
203
- const instruction = instructionDeserializer(cursor);
204
- return [instruction, cursor.position() - startingPosition];
205
- } catch (error) {
206
- if (error instanceof InvalidOpcodeError || error instanceof AvmExecutionError) {
207
- throw error;
208
- } else {
209
- throw new AvmParsingError(`${error}`);
210
- }
211
- }
212
- }
@@ -1,15 +0,0 @@
1
- export { AcirSimulator } from './simulator.js';
2
- export { ViewDataOracle } from './view_data_oracle.js';
3
- export { DBOracle, ContractClassNotFoundError, ContractNotFoundError } from './db_oracle.js';
4
- export * from './pick_notes.js';
5
- export { ExecutionNoteCache } from './execution_note_cache.js';
6
- export { extractPrivateCircuitPublicInputs } from './private_execution.js';
7
- export { witnessMapToFields } from '../acvm/deserialize.js';
8
- export { toACVMWitness } from '../acvm/serialize.js';
9
- export { extractCallStack } from '../acvm/acvm.js';
10
- export { WASMSimulator } from '../providers/acvm_wasm.js';
11
- export { NoteData, TypedOracle } from '../acvm/oracle/typed_oracle.js';
12
- export { Oracle } from '../acvm/oracle/oracle.js';
13
- export { type SimulationProvider } from '../common/simulation_provider.js';
14
- export { MessageLoadOracleInputs } from '../common/message_load_oracle_inputs.js';
15
- export { resolveAssertionMessageFromRevertData, resolveOpcodeLocations } from '../common/errors.js';
package/src/common.ts DELETED
@@ -1 +0,0 @@
1
- export * from './common/index.js';
@@ -1,4 +0,0 @@
1
- export * from './acvm_native.js';
2
- export * from './acvm_wasm_with_blobs.js';
3
- export * from '../common/simulation_provider.js';
4
- export * from './factory.js';
@@ -1,23 +0,0 @@
1
- import { computePublicDataTreeLeafSlot, deriveStorageSlotInMap } from '@aztec/circuits.js/hash';
2
- import { type AztecAddress } from '@aztec/foundation/aztec-address';
3
- import { Fr } from '@aztec/foundation/fields';
4
- import { ProtocolContractAddress } from '@aztec/protocol-contracts';
5
- import { FeeJuiceArtifact } from '@aztec/protocol-contracts/fee-juice';
6
-
7
- /**
8
- * Computes the storage slot within the Fee Juice contract for the balance of the fee payer.
9
- */
10
- export function computeFeePayerBalanceStorageSlot(feePayer: AztecAddress) {
11
- return deriveStorageSlotInMap(FeeJuiceArtifact.storageLayout.balances.slot, feePayer);
12
- }
13
-
14
- /**
15
- * Computes the leaf slot in the public data tree for the balance of the fee payer in the Fee Juice.
16
- */
17
- export async function computeFeePayerBalanceLeafSlot(feePayer: AztecAddress): Promise<Fr> {
18
- if (feePayer.isZero()) {
19
- return Fr.ZERO;
20
- }
21
- const balanceSlot = await computeFeePayerBalanceStorageSlot(feePayer);
22
- return computePublicDataTreeLeafSlot(ProtocolContractAddress.FeeJuice, balanceSlot);
23
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes