@aztec/stdlib 0.0.1-commit.993d240 → 0.0.1-commit.9a89641

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 (587) hide show
  1. package/dest/abi/abi.d.ts +32 -7
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +11 -2
  4. package/dest/abi/buffer.d.ts +6 -2
  5. package/dest/abi/buffer.d.ts.map +1 -1
  6. package/dest/abi/buffer.js +13 -1
  7. package/dest/abi/contract_artifact.d.ts +1 -1
  8. package/dest/abi/contract_artifact.d.ts.map +1 -1
  9. package/dest/abi/contract_artifact.js +35 -19
  10. package/dest/abi/decoder.d.ts +12 -5
  11. package/dest/abi/decoder.d.ts.map +1 -1
  12. package/dest/abi/decoder.js +18 -21
  13. package/dest/abi/function_call.d.ts +17 -8
  14. package/dest/abi/function_call.d.ts.map +1 -1
  15. package/dest/abi/function_call.js +28 -9
  16. package/dest/avm/avm.d.ts +212 -211
  17. package/dest/avm/avm.d.ts.map +1 -1
  18. package/dest/avm/avm.js +4 -2
  19. package/dest/avm/index.d.ts +1 -6
  20. package/dest/avm/index.d.ts.map +1 -1
  21. package/dest/avm/index.js +0 -5
  22. package/dest/aztec-address/index.d.ts +35 -5
  23. package/dest/aztec-address/index.d.ts.map +1 -1
  24. package/dest/aztec-address/index.js +32 -8
  25. package/dest/block/attestation_info.d.ts +1 -1
  26. package/dest/block/attestation_info.d.ts.map +1 -1
  27. package/dest/block/attestation_info.js +7 -4
  28. package/dest/block/l2_block_source.d.ts +57 -28
  29. package/dest/block/l2_block_source.d.ts.map +1 -1
  30. package/dest/block/l2_block_source.js +20 -2
  31. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
  32. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
  33. package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
  34. package/dest/block/l2_block_stream/index.d.ts +2 -1
  35. package/dest/block/l2_block_stream/index.d.ts.map +1 -1
  36. package/dest/block/l2_block_stream/index.js +1 -0
  37. package/dest/block/l2_block_stream/interfaces.d.ts +83 -11
  38. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  39. package/dest/block/l2_block_stream/interfaces.js +25 -1
  40. package/dest/block/l2_block_stream/l2_block_stream.d.ts +24 -15
  41. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  42. package/dest/block/l2_block_stream/l2_block_stream.js +175 -151
  43. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +6 -12
  44. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
  45. package/dest/block/l2_block_stream/l2_tips_memory_store.js +8 -32
  46. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +17 -18
  47. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  48. package/dest/block/l2_block_stream/l2_tips_store_base.js +70 -58
  49. package/dest/block/proposal/attestations_and_signers.d.ts +19 -1
  50. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
  51. package/dest/block/proposal/attestations_and_signers.js +47 -7
  52. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  53. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  54. package/dest/block/test/l2_tips_store_test_suite.js +301 -37
  55. package/dest/block/validate_block_result.d.ts +16 -1
  56. package/dest/block/validate_block_result.d.ts.map +1 -1
  57. package/dest/block/validate_block_result.js +18 -3
  58. package/dest/checkpoint/checkpoint.js +2 -2
  59. package/dest/checkpoint/index.d.ts +2 -1
  60. package/dest/checkpoint/index.d.ts.map +1 -1
  61. package/dest/checkpoint/index.js +1 -0
  62. package/dest/checkpoint/simulation_overrides.d.ts +61 -0
  63. package/dest/checkpoint/simulation_overrides.d.ts.map +1 -0
  64. package/dest/checkpoint/simulation_overrides.js +98 -0
  65. package/dest/checkpoint/validate.d.ts +11 -3
  66. package/dest/checkpoint/validate.d.ts.map +1 -1
  67. package/dest/checkpoint/validate.js +9 -6
  68. package/dest/config/index.d.ts +2 -2
  69. package/dest/config/index.d.ts.map +1 -1
  70. package/dest/config/index.js +1 -1
  71. package/dest/config/network-consensus-config.d.ts +72 -0
  72. package/dest/config/network-consensus-config.d.ts.map +1 -0
  73. package/dest/config/network-consensus-config.js +223 -0
  74. package/dest/config/node-rpc-config.d.ts +1 -1
  75. package/dest/config/node-rpc-config.d.ts.map +1 -1
  76. package/dest/config/node-rpc-config.js +1 -1
  77. package/dest/config/sequencer-config.d.ts +4 -2
  78. package/dest/config/sequencer-config.d.ts.map +1 -1
  79. package/dest/config/sequencer-config.js +22 -3
  80. package/dest/contract/artifact_hash.d.ts +2 -2
  81. package/dest/contract/artifact_hash.d.ts.map +1 -1
  82. package/dest/contract/artifact_hash.js +10 -2
  83. package/dest/contract/contract_address.d.ts +5 -4
  84. package/dest/contract/contract_address.d.ts.map +1 -1
  85. package/dest/contract/contract_class.d.ts +1 -1
  86. package/dest/contract/contract_class.d.ts.map +1 -1
  87. package/dest/contract/contract_class.js +3 -2
  88. package/dest/contract/contract_instance.d.ts +16 -2
  89. package/dest/contract/contract_instance.d.ts.map +1 -1
  90. package/dest/contract/contract_instance.js +45 -0
  91. package/dest/contract/index.d.ts +1 -2
  92. package/dest/contract/index.d.ts.map +1 -1
  93. package/dest/contract/index.js +0 -1
  94. package/dest/contract/interfaces/contract_data_source.d.ts +3 -5
  95. package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
  96. package/dest/contract/interfaces/contract_instance.d.ts +71 -10
  97. package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
  98. package/dest/contract/interfaces/contract_instance.js +7 -2
  99. package/dest/contract/interfaces/node-info.d.ts +11 -1
  100. package/dest/contract/interfaces/node-info.d.ts.map +1 -1
  101. package/dest/contract/interfaces/node-info.js +7 -1
  102. package/dest/contract/partial_address.d.ts +9 -3
  103. package/dest/contract/partial_address.d.ts.map +1 -1
  104. package/dest/contract/partial_address.js +8 -2
  105. package/dest/database-version/version_manager.d.ts +18 -4
  106. package/dest/database-version/version_manager.d.ts.map +1 -1
  107. package/dest/database-version/version_manager.js +76 -6
  108. package/dest/deserialization/index.d.ts +35 -3
  109. package/dest/deserialization/index.d.ts.map +1 -1
  110. package/dest/deserialization/index.js +32 -1
  111. package/dest/file-store/factory.d.ts +1 -1
  112. package/dest/file-store/factory.d.ts.map +1 -1
  113. package/dest/file-store/factory.js +7 -0
  114. package/dest/file-store/index.d.ts +2 -1
  115. package/dest/file-store/index.d.ts.map +1 -1
  116. package/dest/file-store/index.js +1 -0
  117. package/dest/file-store/memory.d.ts +24 -0
  118. package/dest/file-store/memory.d.ts.map +1 -0
  119. package/dest/file-store/memory.js +80 -0
  120. package/dest/gas/gas_settings.d.ts +7 -13
  121. package/dest/gas/gas_settings.d.ts.map +1 -1
  122. package/dest/gas/gas_settings.js +9 -16
  123. package/dest/gas/index.d.ts +2 -1
  124. package/dest/gas/index.d.ts.map +1 -1
  125. package/dest/gas/index.js +1 -0
  126. package/dest/gas/tx_gas_limits.d.ts +72 -0
  127. package/dest/gas/tx_gas_limits.d.ts.map +1 -0
  128. package/dest/gas/tx_gas_limits.js +85 -0
  129. package/dest/ha-signing/config.d.ts +19 -5
  130. package/dest/ha-signing/config.d.ts.map +1 -1
  131. package/dest/ha-signing/config.js +9 -3
  132. package/dest/ha-signing/local_config.d.ts +10 -2
  133. package/dest/ha-signing/local_config.d.ts.map +1 -1
  134. package/dest/ha-signing/local_config.js +8 -2
  135. package/dest/hash/hash.d.ts +1 -2
  136. package/dest/hash/hash.d.ts.map +1 -1
  137. package/dest/hash/hash.js +0 -7
  138. package/dest/interfaces/api_limit.d.ts +6 -1
  139. package/dest/interfaces/api_limit.d.ts.map +1 -1
  140. package/dest/interfaces/api_limit.js +3 -0
  141. package/dest/interfaces/archiver.d.ts +12 -7
  142. package/dest/interfaces/archiver.d.ts.map +1 -1
  143. package/dest/interfaces/archiver.js +13 -6
  144. package/dest/interfaces/aztec-node-admin.d.ts +25 -17
  145. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  146. package/dest/interfaces/aztec-node-admin.js +1 -1
  147. package/dest/interfaces/aztec-node-debug.d.ts +40 -2
  148. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -1
  149. package/dest/interfaces/aztec-node-debug.js +29 -1
  150. package/dest/interfaces/aztec-node.d.ts +100 -33
  151. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  152. package/dest/interfaces/aztec-node.js +72 -23
  153. package/dest/interfaces/block-builder.d.ts +9 -2
  154. package/dest/interfaces/block-builder.d.ts.map +1 -1
  155. package/dest/interfaces/block_response.d.ts +5 -5
  156. package/dest/interfaces/block_response.d.ts.map +1 -1
  157. package/dest/interfaces/chain_tips.d.ts +8 -47
  158. package/dest/interfaces/chain_tips.d.ts.map +1 -1
  159. package/dest/interfaces/chain_tips.js +1 -6
  160. package/dest/interfaces/checkpoint_parameter.d.ts +3 -3
  161. package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -1
  162. package/dest/interfaces/checkpoint_parameter.js +3 -3
  163. package/dest/interfaces/checkpoint_response.d.ts +5 -5
  164. package/dest/interfaces/checkpoint_response.d.ts.map +1 -1
  165. package/dest/interfaces/client.d.ts +2 -1
  166. package/dest/interfaces/client.d.ts.map +1 -1
  167. package/dest/interfaces/configs.d.ts +33 -6
  168. package/dest/interfaces/configs.d.ts.map +1 -1
  169. package/dest/interfaces/configs.js +6 -1
  170. package/dest/interfaces/get_tx_by_hash_options.d.ts +9 -0
  171. package/dest/interfaces/get_tx_by_hash_options.d.ts.map +1 -0
  172. package/dest/interfaces/get_tx_by_hash_options.js +4 -0
  173. package/dest/interfaces/merkle_tree_operations.d.ts +8 -3
  174. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  175. package/dest/interfaces/p2p.d.ts +38 -9
  176. package/dest/interfaces/p2p.d.ts.map +1 -1
  177. package/dest/interfaces/p2p.js +14 -2
  178. package/dest/interfaces/private_kernel_prover.d.ts +71 -12
  179. package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
  180. package/dest/interfaces/prover-client.d.ts +2 -3
  181. package/dest/interfaces/prover-client.d.ts.map +1 -1
  182. package/dest/interfaces/prover-node.d.ts +12 -8
  183. package/dest/interfaces/prover-node.d.ts.map +1 -1
  184. package/dest/interfaces/prover-node.js +24 -17
  185. package/dest/interfaces/proving-job.d.ts +17 -4
  186. package/dest/interfaces/proving-job.d.ts.map +1 -1
  187. package/dest/interfaces/proving-job.js +13 -4
  188. package/dest/interfaces/server.d.ts +1 -3
  189. package/dest/interfaces/server.d.ts.map +1 -1
  190. package/dest/interfaces/server.js +0 -2
  191. package/dest/interfaces/server_circuit_prover.d.ts +3 -3
  192. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  193. package/dest/interfaces/tx_provider.d.ts +5 -1
  194. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  195. package/dest/interfaces/validator.d.ts +15 -4
  196. package/dest/interfaces/validator.d.ts.map +1 -1
  197. package/dest/interfaces/validator.js +3 -1
  198. package/dest/interfaces/world_state.d.ts +14 -1
  199. package/dest/interfaces/world_state.d.ts.map +1 -1
  200. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
  201. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
  202. package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
  203. package/dest/kernel/hints/index.d.ts +1 -2
  204. package/dest/kernel/hints/index.d.ts.map +1 -1
  205. package/dest/kernel/hints/index.js +0 -1
  206. package/dest/kernel/hints/read_request.js +1 -1
  207. package/dest/kernel/index.d.ts +6 -2
  208. package/dest/kernel/index.d.ts.map +1 -1
  209. package/dest/kernel/index.js +5 -1
  210. package/dest/kernel/log_hash.d.ts +1 -1
  211. package/dest/kernel/log_hash.d.ts.map +1 -1
  212. package/dest/kernel/log_hash.js +2 -2
  213. package/dest/kernel/note_hash.js +1 -1
  214. package/dest/kernel/nullifier.js +1 -1
  215. package/dest/kernel/private_circuit_public_inputs.d.ts +13 -3
  216. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  217. package/dest/kernel/private_circuit_public_inputs.js +14 -7
  218. package/dest/kernel/private_context_inputs.d.ts +4 -3
  219. package/dest/kernel/private_context_inputs.d.ts.map +1 -1
  220. package/dest/kernel/private_context_inputs.js +7 -3
  221. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +7 -9
  222. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  223. package/dest/kernel/private_kernel_circuit_public_inputs.js +10 -7
  224. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +2 -3
  225. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -1
  226. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +3 -5
  227. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +2 -3
  228. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -1
  229. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +3 -5
  230. package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts +24 -0
  231. package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts.map +1 -0
  232. package/dest/kernel/private_kernel_init_4_circuit_private_inputs.js +37 -0
  233. package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts +25 -0
  234. package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts.map +1 -0
  235. package/dest/kernel/private_kernel_init_5_circuit_private_inputs.js +39 -0
  236. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
  237. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
  238. package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
  239. package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts +18 -0
  240. package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts.map +1 -0
  241. package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.js +27 -0
  242. package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts +19 -0
  243. package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts.map +1 -0
  244. package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.js +29 -0
  245. package/dest/kernel/private_kernel_prover_output.d.ts +4 -1
  246. package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
  247. package/dest/kernel/private_kernel_prover_output.js +4 -1
  248. package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
  249. package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
  250. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
  251. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
  252. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
  253. package/dest/kernel/private_kernel_simulated_output.d.ts +1 -7
  254. package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
  255. package/dest/kernel/private_kernel_simulated_output.js +2 -1
  256. package/dest/kernel/private_log_data.d.ts +1 -1
  257. package/dest/kernel/private_log_data.d.ts.map +1 -1
  258. package/dest/kernel/private_log_data.js +1 -1
  259. package/dest/kernel/utils/index.d.ts +1 -2
  260. package/dest/kernel/utils/index.d.ts.map +1 -1
  261. package/dest/kernel/utils/index.js +0 -1
  262. package/dest/keys/derivation.d.ts +41 -6
  263. package/dest/keys/derivation.d.ts.map +1 -1
  264. package/dest/keys/derivation.js +49 -26
  265. package/dest/logs/app_tagging_secret.d.ts +30 -7
  266. package/dest/logs/app_tagging_secret.d.ts.map +1 -1
  267. package/dest/logs/app_tagging_secret.js +46 -39
  268. package/dest/logs/app_tagging_secret_kind.d.ts +2 -1
  269. package/dest/logs/app_tagging_secret_kind.d.ts.map +1 -1
  270. package/dest/logs/app_tagging_secret_kind.js +13 -0
  271. package/dest/logs/contract_class_log.d.ts +1 -2
  272. package/dest/logs/contract_class_log.d.ts.map +1 -1
  273. package/dest/logs/contract_class_log.js +0 -4
  274. package/dest/logs/log_result.d.ts +3 -3
  275. package/dest/logs/log_result.d.ts.map +1 -1
  276. package/dest/logs/logs_query.d.ts +2 -2
  277. package/dest/logs/message_context.d.ts +4 -13
  278. package/dest/logs/message_context.d.ts.map +1 -1
  279. package/dest/logs/message_context.js +1 -62
  280. package/dest/logs/pending_tagged_log.d.ts +6 -8
  281. package/dest/logs/pending_tagged_log.d.ts.map +1 -1
  282. package/dest/logs/pending_tagged_log.js +1 -31
  283. package/dest/logs/shared_secret_derivation.d.ts +29 -6
  284. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  285. package/dest/logs/shared_secret_derivation.js +44 -11
  286. package/dest/messaging/l1_to_l2_message.d.ts +23 -2
  287. package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
  288. package/dest/messaging/l1_to_l2_message.js +36 -11
  289. package/dest/messaging/l2_to_l1_membership.d.ts +11 -4
  290. package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
  291. package/dest/messaging/l2_to_l1_membership.js +22 -7
  292. package/dest/noir/index.d.ts +3 -3
  293. package/dest/noir/index.d.ts.map +1 -1
  294. package/dest/p2p/attestation_utils.d.ts +1 -1
  295. package/dest/p2p/attestation_utils.d.ts.map +1 -1
  296. package/dest/p2p/attestation_utils.js +8 -1
  297. package/dest/p2p/checkpoint_attestation.d.ts +10 -1
  298. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  299. package/dest/p2p/checkpoint_attestation.js +10 -0
  300. package/dest/p2p/checkpoint_proposal.d.ts +2 -1
  301. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  302. package/dest/p2p/consensus_payload.d.ts +2 -1
  303. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  304. package/dest/p2p/index.d.ts +1 -2
  305. package/dest/p2p/index.d.ts.map +1 -1
  306. package/dest/p2p/index.js +0 -1
  307. package/dest/p2p/signature_utils.d.ts +10 -1
  308. package/dest/p2p/signature_utils.d.ts.map +1 -1
  309. package/dest/p2p/signature_utils.js +9 -1
  310. package/dest/rollup/avm_proof_data.d.ts +3 -3
  311. package/dest/rollup/avm_proof_data.d.ts.map +1 -1
  312. package/dest/rollup/checkpoint_header.d.ts +8 -3
  313. package/dest/rollup/checkpoint_header.d.ts.map +1 -1
  314. package/dest/rollup/checkpoint_header.js +20 -10
  315. package/dest/stats/stats.d.ts +2 -2
  316. package/dest/stats/stats.d.ts.map +1 -1
  317. package/dest/tests/factories.d.ts +1 -27
  318. package/dest/tests/factories.d.ts.map +1 -1
  319. package/dest/tests/factories.js +10 -45
  320. package/dest/tests/mocks.d.ts +1 -1
  321. package/dest/tests/mocks.d.ts.map +1 -1
  322. package/dest/tests/mocks.js +3 -2
  323. package/dest/timetable/budgets.d.ts +57 -0
  324. package/dest/timetable/budgets.d.ts.map +1 -0
  325. package/dest/timetable/budgets.js +56 -0
  326. package/dest/timetable/build_proposer_timetable.d.ts +21 -0
  327. package/dest/timetable/build_proposer_timetable.d.ts.map +1 -0
  328. package/dest/timetable/build_proposer_timetable.js +17 -0
  329. package/dest/timetable/consensus_timetable.d.ts +70 -0
  330. package/dest/timetable/consensus_timetable.d.ts.map +1 -0
  331. package/dest/timetable/consensus_timetable.js +89 -0
  332. package/dest/timetable/index.d.ts +5 -87
  333. package/dest/timetable/index.d.ts.map +1 -1
  334. package/dest/timetable/index.js +4 -243
  335. package/dest/timetable/proposer_timetable.d.ts +106 -0
  336. package/dest/timetable/proposer_timetable.d.ts.map +1 -0
  337. package/dest/timetable/proposer_timetable.js +132 -0
  338. package/dest/trees/nullifier_membership_witness.d.ts +5 -8
  339. package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
  340. package/dest/trees/nullifier_membership_witness.js +0 -9
  341. package/dest/trees/public_data_witness.d.ts +7 -17
  342. package/dest/trees/public_data_witness.d.ts.map +1 -1
  343. package/dest/trees/public_data_witness.js +0 -27
  344. package/dest/tx/execution_payload.d.ts +1 -1
  345. package/dest/tx/execution_payload.d.ts.map +1 -1
  346. package/dest/tx/execution_payload.js +1 -1
  347. package/dest/tx/fee_provider.d.ts +2 -2
  348. package/dest/tx/fee_provider.d.ts.map +1 -1
  349. package/dest/tx/global_variable_builder.d.ts +2 -12
  350. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  351. package/dest/tx/global_variables.js +2 -2
  352. package/dest/tx/hashed_values.d.ts +7 -1
  353. package/dest/tx/hashed_values.d.ts.map +1 -1
  354. package/dest/tx/hashed_values.js +9 -1
  355. package/dest/tx/index.d.ts +1 -2
  356. package/dest/tx/index.d.ts.map +1 -1
  357. package/dest/tx/index.js +0 -1
  358. package/dest/tx/indexed_tx_effect.d.ts +5 -2
  359. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  360. package/dest/tx/indexed_tx_effect.js +8 -4
  361. package/dest/tx/offchain_effect.js +1 -1
  362. package/dest/tx/private_tx_constant_data.d.ts +18 -2
  363. package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
  364. package/dest/tx/private_tx_constant_data.js +13 -4
  365. package/dest/tx/profiling.d.ts +1 -1
  366. package/dest/tx/profiling.d.ts.map +1 -1
  367. package/dest/tx/profiling.js +2 -0
  368. package/dest/tx/simulated_tx.d.ts +10 -6
  369. package/dest/tx/simulated_tx.d.ts.map +1 -1
  370. package/dest/tx/simulated_tx.js +7 -2
  371. package/dest/tx/tx.d.ts +23 -1
  372. package/dest/tx/tx.d.ts.map +1 -1
  373. package/dest/tx/tx.js +32 -3
  374. package/dest/tx/tx_receipt.d.ts +143 -60
  375. package/dest/tx/tx_receipt.d.ts.map +1 -1
  376. package/dest/tx/tx_receipt.js +141 -45
  377. package/dest/tx/validator/error_texts.d.ts +2 -2
  378. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  379. package/dest/tx/validator/error_texts.js +1 -1
  380. package/dest/validators/errors.d.ts +16 -1
  381. package/dest/validators/errors.d.ts.map +1 -1
  382. package/dest/validators/errors.js +12 -0
  383. package/dest/world-state/genesis_data.d.ts +9 -1
  384. package/dest/world-state/genesis_data.d.ts.map +1 -1
  385. package/dest/world-state/genesis_data.js +1 -0
  386. package/dest/world-state/world_state_revision.d.ts +1 -18
  387. package/dest/world-state/world_state_revision.d.ts.map +1 -1
  388. package/dest/world-state/world_state_revision.js +0 -20
  389. package/package.json +8 -8
  390. package/src/abi/abi.ts +32 -4
  391. package/src/abi/buffer.ts +13 -1
  392. package/src/abi/contract_artifact.ts +40 -16
  393. package/src/abi/decoder.ts +20 -24
  394. package/src/abi/function_call.ts +19 -7
  395. package/src/avm/avm.ts +5 -2
  396. package/src/avm/index.ts +0 -5
  397. package/src/aztec-address/index.ts +36 -6
  398. package/src/block/attestation_info.ts +7 -2
  399. package/src/block/l2_block_source.ts +95 -19
  400. package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
  401. package/src/block/l2_block_stream/index.ts +1 -0
  402. package/src/block/l2_block_stream/interfaces.ts +98 -10
  403. package/src/block/l2_block_stream/l2_block_stream.ts +255 -177
  404. package/src/block/l2_block_stream/l2_tips_memory_store.ts +12 -41
  405. package/src/block/l2_block_stream/l2_tips_store_base.ts +84 -93
  406. package/src/block/proposal/attestations_and_signers.ts +53 -7
  407. package/src/block/test/l2_tips_store_test_suite.ts +275 -28
  408. package/src/block/validate_block_result.ts +48 -2
  409. package/src/checkpoint/checkpoint.ts +2 -2
  410. package/src/checkpoint/index.ts +1 -0
  411. package/src/checkpoint/simulation_overrides.ts +171 -0
  412. package/src/checkpoint/validate.ts +16 -6
  413. package/src/config/index.ts +1 -1
  414. package/src/config/network-consensus-config.ts +291 -0
  415. package/src/config/node-rpc-config.ts +2 -1
  416. package/src/config/sequencer-config.ts +36 -5
  417. package/src/contract/artifact_hash.ts +15 -3
  418. package/src/contract/contract_address.ts +4 -3
  419. package/src/contract/contract_class.ts +3 -2
  420. package/src/contract/contract_instance.ts +62 -1
  421. package/src/contract/index.ts +0 -1
  422. package/src/contract/interfaces/contract_data_source.ts +2 -4
  423. package/src/contract/interfaces/contract_instance.ts +26 -8
  424. package/src/contract/interfaces/node-info.ts +11 -0
  425. package/src/contract/partial_address.ts +8 -2
  426. package/src/database-version/version_manager.ts +96 -6
  427. package/src/deserialization/index.ts +35 -2
  428. package/src/file-store/factory.ts +7 -0
  429. package/src/file-store/index.ts +1 -0
  430. package/src/file-store/memory.ts +94 -0
  431. package/src/gas/README.md +199 -35
  432. package/src/gas/gas_settings.ts +11 -21
  433. package/src/gas/index.ts +1 -0
  434. package/src/gas/tx_gas_limits.ts +123 -0
  435. package/src/ha-signing/config.ts +23 -5
  436. package/src/ha-signing/local_config.ts +20 -1
  437. package/src/hash/hash.ts +0 -8
  438. package/src/interfaces/api_limit.ts +5 -0
  439. package/src/interfaces/archiver.ts +22 -9
  440. package/src/interfaces/aztec-node-admin.ts +1 -1
  441. package/src/interfaces/aztec-node-debug.ts +54 -2
  442. package/src/interfaces/aztec-node.ts +175 -49
  443. package/src/interfaces/block-builder.ts +8 -1
  444. package/src/interfaces/block_response.ts +4 -4
  445. package/src/interfaces/chain_tips.ts +8 -16
  446. package/src/interfaces/checkpoint_parameter.ts +3 -3
  447. package/src/interfaces/checkpoint_response.ts +4 -4
  448. package/src/interfaces/client.ts +1 -0
  449. package/src/interfaces/configs.ts +33 -6
  450. package/src/interfaces/get_tx_by_hash_options.ts +14 -0
  451. package/src/interfaces/merkle_tree_operations.ts +8 -2
  452. package/src/interfaces/p2p.ts +29 -9
  453. package/src/interfaces/private_kernel_prover.ts +104 -13
  454. package/src/interfaces/prover-client.ts +1 -3
  455. package/src/interfaces/prover-node.ts +32 -17
  456. package/src/interfaces/proving-job.ts +15 -3
  457. package/src/interfaces/server.ts +0 -2
  458. package/src/interfaces/server_circuit_prover.ts +2 -2
  459. package/src/interfaces/tx_provider.ts +4 -0
  460. package/src/interfaces/validator.ts +11 -0
  461. package/src/interfaces/world_state.ts +14 -0
  462. package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
  463. package/src/kernel/hints/index.ts +0 -1
  464. package/src/kernel/hints/read_request.ts +1 -1
  465. package/src/kernel/index.ts +5 -1
  466. package/src/kernel/log_hash.ts +5 -2
  467. package/src/kernel/note_hash.ts +1 -1
  468. package/src/kernel/nullifier.ts +1 -1
  469. package/src/kernel/private_circuit_public_inputs.ts +12 -1
  470. package/src/kernel/private_context_inputs.ts +10 -3
  471. package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -7
  472. package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +0 -3
  473. package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +0 -3
  474. package/src/kernel/private_kernel_init_4_circuit_private_inputs.ts +52 -0
  475. package/src/kernel/private_kernel_init_5_circuit_private_inputs.ts +55 -0
  476. package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
  477. package/src/kernel/private_kernel_inner_4_circuit_private_inputs.ts +39 -0
  478. package/src/kernel/private_kernel_inner_5_circuit_private_inputs.ts +42 -0
  479. package/src/kernel/private_kernel_prover_output.ts +4 -0
  480. package/src/kernel/private_kernel_reset_dimensions.ts +16 -6
  481. package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
  482. package/src/kernel/private_kernel_simulated_output.ts +0 -7
  483. package/src/kernel/private_log_data.ts +4 -1
  484. package/src/kernel/utils/index.ts +0 -1
  485. package/src/keys/derivation.ts +69 -24
  486. package/src/logs/app_tagging_secret.ts +62 -39
  487. package/src/logs/app_tagging_secret_kind.ts +15 -0
  488. package/src/logs/contract_class_log.ts +0 -9
  489. package/src/logs/log_result.ts +2 -2
  490. package/src/logs/logs_query.ts +2 -2
  491. package/src/logs/message_context.ts +6 -60
  492. package/src/logs/pending_tagged_log.ts +6 -33
  493. package/src/logs/shared_secret_derivation.ts +47 -14
  494. package/src/messaging/l1_to_l2_message.ts +51 -13
  495. package/src/messaging/l2_to_l1_membership.ts +28 -11
  496. package/src/noir/index.ts +2 -1
  497. package/src/p2p/attestation_utils.ts +8 -1
  498. package/src/p2p/checkpoint_attestation.ts +12 -0
  499. package/src/p2p/index.ts +0 -1
  500. package/src/p2p/signature_utils.ts +9 -0
  501. package/src/rollup/avm_proof_data.ts +2 -2
  502. package/src/rollup/checkpoint_header.ts +16 -2
  503. package/src/stats/stats.ts +6 -2
  504. package/src/tests/factories.ts +13 -51
  505. package/src/tests/mocks.ts +7 -2
  506. package/src/timetable/README.md +609 -0
  507. package/src/timetable/budgets.ts +87 -0
  508. package/src/timetable/build_proposer_timetable.ts +42 -0
  509. package/src/timetable/consensus_timetable.ts +126 -0
  510. package/src/timetable/index.ts +4 -361
  511. package/src/timetable/proposer_timetable.ts +190 -0
  512. package/src/timetable/timetable-example.svg +108 -0
  513. package/src/trees/nullifier_membership_witness.ts +0 -11
  514. package/src/trees/public_data_witness.ts +0 -31
  515. package/src/tx/execution_payload.ts +2 -1
  516. package/src/tx/fee_provider.ts +1 -1
  517. package/src/tx/global_variable_builder.ts +1 -17
  518. package/src/tx/global_variables.ts +2 -2
  519. package/src/tx/hashed_values.ts +11 -6
  520. package/src/tx/index.ts +0 -1
  521. package/src/tx/indexed_tx_effect.ts +17 -4
  522. package/src/tx/offchain_effect.ts +1 -1
  523. package/src/tx/private_tx_constant_data.ts +25 -2
  524. package/src/tx/profiling.ts +2 -0
  525. package/src/tx/simulated_tx.ts +13 -2
  526. package/src/tx/tx.ts +46 -3
  527. package/src/tx/tx_receipt.ts +263 -71
  528. package/src/tx/validator/error_texts.ts +2 -1
  529. package/src/validators/errors.ts +17 -0
  530. package/src/world-state/genesis_data.ts +10 -0
  531. package/src/world-state/world_state_revision.ts +0 -33
  532. package/dest/avm/contract_storage_read.d.ts +0 -58
  533. package/dest/avm/contract_storage_read.d.ts.map +0 -1
  534. package/dest/avm/contract_storage_read.js +0 -65
  535. package/dest/avm/contract_storage_update_request.d.ts +0 -65
  536. package/dest/avm/contract_storage_update_request.d.ts.map +0 -1
  537. package/dest/avm/contract_storage_update_request.js +0 -80
  538. package/dest/avm/public_call_stack_item_compressed.d.ts +0 -43
  539. package/dest/avm/public_call_stack_item_compressed.d.ts.map +0 -1
  540. package/dest/avm/public_call_stack_item_compressed.js +0 -70
  541. package/dest/avm/public_data_update_request.d.ts +0 -62
  542. package/dest/avm/public_data_update_request.d.ts.map +0 -1
  543. package/dest/avm/public_data_update_request.js +0 -67
  544. package/dest/avm/public_inner_call_request.d.ts +0 -50
  545. package/dest/avm/public_inner_call_request.d.ts.map +0 -1
  546. package/dest/avm/public_inner_call_request.js +0 -74
  547. package/dest/config/pipelining-config.d.ts +0 -15
  548. package/dest/config/pipelining-config.d.ts.map +0 -1
  549. package/dest/config/pipelining-config.js +0 -18
  550. package/dest/contract/deployment_info.d.ts +0 -24
  551. package/dest/contract/deployment_info.d.ts.map +0 -1
  552. package/dest/contract/deployment_info.js +0 -3
  553. package/dest/interfaces/epoch-prover.d.ts +0 -57
  554. package/dest/interfaces/epoch-prover.d.ts.map +0 -1
  555. package/dest/interfaces/epoch-prover.js +0 -1
  556. package/dest/interfaces/prover-coordination.d.ts +0 -15
  557. package/dest/interfaces/prover-coordination.d.ts.map +0 -1
  558. package/dest/interfaces/prover-coordination.js +0 -1
  559. package/dest/kernel/hints/tree_leaf_read_request.d.ts +0 -14
  560. package/dest/kernel/hints/tree_leaf_read_request.d.ts.map +0 -1
  561. package/dest/kernel/hints/tree_leaf_read_request.js +0 -33
  562. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
  563. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
  564. package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
  565. package/dest/kernel/utils/optional_number.d.ts +0 -31
  566. package/dest/kernel/utils/optional_number.d.ts.map +0 -1
  567. package/dest/kernel/utils/optional_number.js +0 -42
  568. package/dest/p2p/interface.d.ts +0 -5
  569. package/dest/p2p/interface.d.ts.map +0 -1
  570. package/dest/p2p/interface.js +0 -1
  571. package/dest/tx/validator/empty_validator.d.ts +0 -5
  572. package/dest/tx/validator/empty_validator.d.ts.map +0 -1
  573. package/dest/tx/validator/empty_validator.js +0 -7
  574. package/src/avm/contract_storage_read.ts +0 -77
  575. package/src/avm/contract_storage_update_request.ts +0 -93
  576. package/src/avm/public_call_stack_item_compressed.ts +0 -113
  577. package/src/avm/public_data_update_request.ts +0 -106
  578. package/src/avm/public_inner_call_request.ts +0 -85
  579. package/src/config/pipelining-config.ts +0 -31
  580. package/src/contract/deployment_info.ts +0 -25
  581. package/src/interfaces/epoch-prover.ts +0 -72
  582. package/src/interfaces/prover-coordination.ts +0 -17
  583. package/src/kernel/hints/tree_leaf_read_request.ts +0 -35
  584. package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
  585. package/src/kernel/utils/optional_number.ts +0 -50
  586. package/src/p2p/interface.ts +0 -4
  587. package/src/tx/validator/empty_validator.ts +0 -7
@@ -13,7 +13,9 @@ import {
13
13
  type ABIParameter,
14
14
  type ABIParameterVisibility,
15
15
  ARTIFACT_VERSION_BEFORE_INJECTION,
16
+ type AbiNamedValue,
16
17
  type AbiType,
18
+ type AbiValue,
17
19
  type BasicValue,
18
20
  type ContractArtifact,
19
21
  ContractArtifactSchema,
@@ -166,9 +168,9 @@ function generateFunctionAbi(fn: NoirCompiledContractFunction, contract: NoirCom
166
168
  parameters = parameters.slice(1);
167
169
  }
168
170
 
169
- let returnTypes: AbiType[] = [];
171
+ let returnType: AbiType | undefined;
170
172
  if (functionType === FunctionType.UTILITY) {
171
- returnTypes = fn.abi.return_type ? [fn.abi.return_type.abi_type] : returnTypes;
173
+ returnType = fn.abi.return_type?.abi_type;
172
174
  } else {
173
175
  const pathToFind = `${contract.name}::${fn.name}_abi`;
174
176
  const abiStructs: AbiType[] = contract.outputs.structs['functions'];
@@ -180,10 +182,7 @@ function generateFunctionAbi(fn: NoirCompiledContractFunction, contract: NoirCom
180
182
  throw new Error('Could not generate contract function artifact');
181
183
  }
182
184
 
183
- const returnTypeField = returnStruct.fields.find(field => field.name === 'return_type');
184
- if (returnTypeField) {
185
- returnTypes = [returnTypeField.type];
186
- }
185
+ returnType = returnStruct.fields.find(field => field.name === 'return_type')?.type;
187
186
  }
188
187
  }
189
188
 
@@ -194,7 +193,10 @@ function generateFunctionAbi(fn: NoirCompiledContractFunction, contract: NoirCom
194
193
  isStatic,
195
194
  isInitializer: fn.custom_attributes.includes(AZTEC_INITIALIZER_ATTRIBUTE),
196
195
  parameters,
197
- returnTypes,
196
+ returnType,
197
+ // Old consumers expect `returnTypes` property, not `returnType`. So we write both down for now, until we can
198
+ // safely remove the old version.
199
+ returnTypes: returnType ? [returnType] : [],
198
200
  errorTypes: fn.abi.error_types,
199
201
  ...(fn.assert_messages ? { assertMessages: fn.assert_messages } : undefined),
200
202
  };
@@ -246,20 +248,24 @@ function hasKernelFunctionInputs(params: ABIParameter[]): boolean {
246
248
 
247
249
  /**
248
250
  * Generates a storage layout for the contract artifact.
249
- * @param input - The compiled noir contract to get storage layout for
251
+ * @param contractName - The name of the compiled Noir contract.
252
+ * @param globals - The normalized globals exported by the contract.
250
253
  * @returns A storage layout for the contract.
251
254
  */
252
- function getStorageLayout(input: NoirCompiledContract) {
255
+ function getStorageLayout(contractName: string, globals: Record<string, AbiValue[]>) {
253
256
  // If another contract is imported by the main contract, its storage layout its going to also show up here.
254
257
  // The layout export includes the contract name, so here we can find the one that belongs to the current one and
255
258
  // ignore the rest.
256
- const storageExports = input.outputs.globals.storage ? (input.outputs.globals.storage as StructValue[]) : [];
257
- const storageForContract = storageExports.find(storageExport => {
259
+ const storageExports = globals.storage ?? [];
260
+ const storageForContract = storageExports.find((storageExport): storageExport is StructValue => {
261
+ if (storageExport.kind !== 'struct') {
262
+ return false;
263
+ }
258
264
  const contractNameField = storageExport.fields.find(field => field.name === 'contract_name')?.value as BasicValue<
259
265
  'string',
260
266
  string
261
267
  >;
262
- return contractNameField.value === input.name;
268
+ return contractNameField.value === contractName;
263
269
  });
264
270
  const storageFields = storageForContract
265
271
  ? ((storageForContract.fields.find(field => field.name == 'fields') as TypedStructFieldValue<StructValue>).value
@@ -280,6 +286,22 @@ function getStorageLayout(input: NoirCompiledContract) {
280
286
  }, {});
281
287
  }
282
288
 
289
+ function isAbiNamedValue(value: AbiNamedValue | AbiValue): value is AbiNamedValue {
290
+ return 'name' in value;
291
+ }
292
+
293
+ function normalizeContractOutputs(outputs: NoirCompiledContract['outputs']): ContractArtifact['outputs'] {
294
+ return {
295
+ structs: outputs.structs,
296
+ globals: Object.fromEntries(
297
+ Object.entries(outputs.globals).map(([tag, values]) => [
298
+ tag,
299
+ values.map(value => (isAbiNamedValue(value) ? value.value : value)),
300
+ ]),
301
+ ),
302
+ };
303
+ }
304
+
283
305
  /**
284
306
  * Given a post-processed Nargo output defined as `contract` generates an Aztec-compatible contract artifact.
285
307
  *
@@ -290,6 +312,7 @@ function generateContractArtifact(contract: NoirCompiledContract): ContractArtif
290
312
  if (!contract.transpiled) {
291
313
  throw new Error("Contract's public bytecode has not been transpiled");
292
314
  }
315
+ const outputs = normalizeContractOutputs(contract.outputs);
293
316
  return ContractArtifactSchema.parse({
294
317
  name: contract.name,
295
318
  aztecVersion: contract.aztec_version,
@@ -297,8 +320,8 @@ function generateContractArtifact(contract: NoirCompiledContract): ContractArtif
297
320
  nonDispatchPublicFunctions: contract.functions
298
321
  .filter(f => !retainBytecode(f))
299
322
  .map(f => generateFunctionAbi(f, contract)),
300
- outputs: contract.outputs,
301
- storageLayout: getStorageLayout(contract),
323
+ outputs,
324
+ storageLayout: getStorageLayout(contract.name, outputs.globals),
302
325
  fileMap: contract.file_map,
303
326
  });
304
327
  } catch (err) {
@@ -313,6 +336,7 @@ function generateContractArtifact(contract: NoirCompiledContract): ContractArtif
313
336
  */
314
337
  function generateContractArtifactForPublic(contract: NoirCompiledContract): ContractArtifact {
315
338
  try {
339
+ const outputs = normalizeContractOutputs(contract.outputs);
316
340
  return ContractArtifactSchema.parse({
317
341
  name: contract.name,
318
342
  aztecVersion: contract.aztec_version,
@@ -320,8 +344,8 @@ function generateContractArtifactForPublic(contract: NoirCompiledContract): Cont
320
344
  nonDispatchPublicFunctions: contract.functions
321
345
  .filter(f => !retainBytecode(f))
322
346
  .map(f => generateFunctionAbi(f, contract)),
323
- outputs: contract.outputs,
324
- storageLayout: getStorageLayout(contract),
347
+ outputs,
348
+ storageLayout: getStorageLayout(contract.name, outputs.globals),
325
349
  fileMap: contract.file_map,
326
350
  });
327
351
  } catch (err) {
@@ -32,17 +32,14 @@ export type AbiDecoded =
32
32
  * Decodes values using a provided ABI.
33
33
  */
34
34
  class AbiDecoder {
35
- constructor(
36
- private types: AbiType[],
37
- private flattened: Fr[],
38
- ) {}
35
+ constructor(private flattened: Fr[]) {}
39
36
 
40
37
  /**
41
- * Decodes a single return value from field to the given type.
42
- * @param abiType - The type of the return value.
43
- * @returns The decoded return value.
38
+ * Decodes a single value from field to the given type.
39
+ * @param abiType - The type of the value.
40
+ * @returns The decoded value.
44
41
  */
45
- private decodeNext(abiType: AbiType): AbiDecoded {
42
+ public decodeNext(abiType: AbiType): AbiDecoded {
46
43
  switch (abiType.kind) {
47
44
  case 'field':
48
45
  return this.getNextField().toBigInt();
@@ -121,26 +118,25 @@ class AbiDecoder {
121
118
  }
122
119
  return field;
123
120
  }
121
+ }
124
122
 
125
- /**
126
- * Decodes all the values for the given ABI.
127
- * The decided value can be simple types, structs or arrays
128
- * @returns The decoded return values.
129
- */
130
- public decode(): AbiDecoded {
131
- if (this.types.length === 1) {
132
- return this.decodeNext(this.types[0]);
133
- }
134
- return this.types.map(type => this.decodeNext(type));
135
- }
123
+ /**
124
+ * Decodes the single value a function returns, or undefined if it returns nothing. Multiple return values are expressed
125
+ * as one `tuple` type, so they decode through here too.
126
+ * @param type - The type the function returns.
127
+ * @param buffer - The flattened Field array to decode.
128
+ */
129
+ export function decodeFromAbi(type: AbiType | undefined, buffer: Fr[]): AbiDecoded {
130
+ return type === undefined ? undefined : new AbiDecoder(buffer.slice()).decodeNext(type);
136
131
  }
137
132
 
138
133
  /**
139
- * Decodes values in a flattened Field array using a provided ABI.
140
- * @param abi - The ABI to use as reference.
134
+ * Decodes one value per given type, consumed from the buffer in order. Always returns one decoded value per type, so
135
+ * callers can index the result positionally. A function's arguments are encoded this way.
136
+ * @param types - The type of each value, in order.
141
137
  * @param buffer - The flattened Field array to decode.
142
- * @returns
143
138
  */
144
- export function decodeFromAbi(typ: AbiType[], buffer: Fr[]) {
145
- return new AbiDecoder(typ, buffer.slice()).decode();
139
+ export function decodeEachFromAbi(types: AbiType[], buffer: Fr[]): AbiDecoded[] {
140
+ const decoder = new AbiDecoder(buffer.slice());
141
+ return types.map(type => decoder.decodeNext(type));
146
142
  }
@@ -5,7 +5,7 @@ import { z } from 'zod';
5
5
 
6
6
  import { AztecAddress } from '../aztec-address/index.js';
7
7
  import { schemas } from '../schemas/index.js';
8
- import { type AbiType, AbiTypeSchema, FunctionType } from './abi.js';
8
+ import { type AbiType, AbiTypeSchema, FunctionType, getFunctionReturnType } from './abi.js';
9
9
  import { FunctionSelector } from './function_selector.js';
10
10
 
11
11
  /** A request to call a function on a contract. */
@@ -25,8 +25,8 @@ export class FunctionCall {
25
25
  public isStatic: boolean,
26
26
  /** The encoded args */
27
27
  public args: Fr[],
28
- /** The return type for decoding */
29
- public returnTypes: AbiType[],
28
+ /** The type the call returns, for decoding, or undefined if it returns nothing */
29
+ public returnType?: AbiType,
30
30
  ) {}
31
31
 
32
32
  static getFields(fields: FieldsOf<FunctionCall>) {
@@ -38,7 +38,7 @@ export class FunctionCall {
38
38
  fields.hideMsgSender,
39
39
  fields.isStatic,
40
40
  fields.args,
41
- fields.returnTypes,
41
+ fields.returnType,
42
42
  ] as const;
43
43
  }
44
44
 
@@ -56,9 +56,22 @@ export class FunctionCall {
56
56
  isStatic: z.boolean(),
57
57
  hideMsgSender: z.boolean(),
58
58
  args: z.array(schemas.Fr),
59
- returnTypes: z.array(AbiTypeSchema),
59
+ returnType: AbiTypeSchema.optional(),
60
+ // Old consumers send `returnTypes`, not `returnType`. So we accept both for now, until we can safely remove
61
+ // the old version.
62
+ returnTypes: z.array(AbiTypeSchema).optional(),
60
63
  })
61
- .transform(FunctionCall.from);
64
+ .transform(({ returnType, returnTypes, ...fields }) =>
65
+ FunctionCall.from({ ...fields, returnType: getFunctionReturnType({ returnType, returnTypes }) }),
66
+ );
67
+ }
68
+
69
+ /**
70
+ * Serializes the deprecated `returnTypes` alongside `returnType`, so that peers that still require the old field can
71
+ * parse calls sent by this version.
72
+ */
73
+ public toJSON() {
74
+ return { ...this, returnTypes: this.returnType ? [this.returnType] : [] };
62
75
  }
63
76
 
64
77
  public isPublicStatic(): boolean {
@@ -78,7 +91,6 @@ export class FunctionCall {
78
91
  hideMsgSender: false,
79
92
  isStatic: false,
80
93
  args: [],
81
- returnTypes: [],
82
94
  });
83
95
  }
84
96
  }
package/src/avm/avm.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { DEFAULT_MAX_DEBUG_LOG_MEMORY_READS } from '@aztec/constants';
2
1
  import { Fr } from '@aztec/foundation/curves/bn254';
3
2
  import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
4
3
 
@@ -1152,7 +1151,7 @@ export class CallStackMetadata {
1152
1151
 
1153
1152
  const { stack, leaf } = failingCall;
1154
1153
  const aztecCallStack = stack.map(call => ({
1155
- contractAddress: AztecAddress.fromField(call.contractAddress),
1154
+ contractAddress: AztecAddress.fromFieldUnsafe(call.contractAddress),
1156
1155
  functionSelector: call.calldata.length > 0 ? FunctionSelector.fromFieldOrUndefined(call.calldata[0]) : undefined,
1157
1156
  }));
1158
1157
 
@@ -1384,6 +1383,10 @@ export class PublicTxResult {
1384
1383
  }
1385
1384
  }
1386
1385
 
1386
+ // Excessive memory reads due to debug logging can open a DOS vector to nodes that perform public tx simulation for users.
1387
+ // This default limit (4MB) can be configured further by node runners via the `RPC_SIMULATE_PUBLIC_MAX_DEBUG_LOG_MEMORY_READS` environment variable.
1388
+ export const DEFAULT_MAX_DEBUG_LOG_MEMORY_READS = 125000;
1389
+
1387
1390
  export class CollectionLimitsConfig {
1388
1391
  constructor(
1389
1392
  public readonly maxDebugLogMemoryReads: number,
package/src/avm/index.ts CHANGED
@@ -3,10 +3,5 @@ export * from './avm_accumulated_data.js';
3
3
  export * from './avm_circuit_public_inputs.js';
4
4
  export * from './revert_code.js';
5
5
  export * from './public_data_write.js';
6
- export * from './public_data_update_request.js';
7
- export * from './contract_storage_update_request.js';
8
- export * from './contract_storage_read.js';
9
- export * from './public_inner_call_request.js';
10
- export * from './public_call_stack_item_compressed.js';
11
6
  export * from './avm_proving_request.js';
12
7
  export * from './message_pack.js';
@@ -43,34 +43,64 @@ export class AztecAddress {
43
43
  static ZERO = new AztecAddress(Buffer.alloc(32, 0));
44
44
 
45
45
  /** Null msg sender address. Not part of the protocol contracts tree. */
46
- static NULL_MSG_SENDER = AztecAddress.fromBigInt(NULL_MSG_SENDER_CONTRACT_ADDRESS);
46
+ static NULL_MSG_SENDER = AztecAddress.fromBigIntUnsafe(NULL_MSG_SENDER_CONTRACT_ADDRESS);
47
47
 
48
48
  static zero(): AztecAddress {
49
49
  return AztecAddress.ZERO;
50
50
  }
51
51
 
52
- static fromField(fr: Fr) {
52
+ /**
53
+ * Builds an `AztecAddress` from a field **without checking it is a valid address** (the x-coordinate of a point on
54
+ * the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
55
+ * untrusted one, or {@link AztecAddress.random} for valid test addresses.
56
+ */
57
+ static fromFieldUnsafe(fr: Fr) {
53
58
  return new AztecAddress(fr);
54
59
  }
55
60
 
61
+ /**
62
+ * Deserializes an `AztecAddress` from a buffer. It does **not** check the value is a valid Grumpkin-curve address
63
+ * (see {@link AztecAddress.isValid}); it is meant for reading addresses from already-validated serialized data. Use
64
+ * {@link AztecAddress.random} for valid test addresses.
65
+ */
56
66
  static fromBuffer(buffer: Buffer | BufferReader) {
57
67
  return new AztecAddress(fromBuffer(buffer, Fr));
58
68
  }
59
69
 
70
+ /**
71
+ * Deserializes an `AztecAddress` from a field reader. It does **not** check the value is a valid Grumpkin-curve
72
+ * address (see {@link AztecAddress.isValid}); it is meant for reading addresses from already-validated serialized
73
+ * data. Use {@link AztecAddress.random} for valid test addresses.
74
+ */
60
75
  static fromFields(fields: Fr[] | FieldReader) {
61
76
  const reader = FieldReader.asReader(fields);
62
77
  return new AztecAddress(reader.readField());
63
78
  }
64
79
 
65
- static fromBigInt(value: bigint) {
80
+ /**
81
+ * Builds an `AztecAddress` from a bigint **without checking it is a valid address** (the x-coordinate of a point on
82
+ * the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
83
+ * untrusted one, or {@link AztecAddress.random} for valid test addresses.
84
+ */
85
+ static fromBigIntUnsafe(value: bigint) {
66
86
  return new AztecAddress(new Fr(value));
67
87
  }
68
88
 
69
- static fromNumber(value: number) {
89
+ /**
90
+ * Builds an `AztecAddress` from a number **without checking it is a valid address** (the x-coordinate of a point on
91
+ * the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
92
+ * untrusted one, or {@link AztecAddress.random} for valid test addresses.
93
+ */
94
+ static fromNumberUnsafe(value: number) {
70
95
  return new AztecAddress(new Fr(value));
71
96
  }
72
97
 
73
- static fromString(buf: string) {
98
+ /**
99
+ * Builds an `AztecAddress` from a hex string **without checking it is a valid address** (the x-coordinate of a
100
+ * point on the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to
101
+ * validate an untrusted one, or {@link AztecAddress.random} for valid test addresses.
102
+ */
103
+ static fromStringUnsafe(buf: string) {
74
104
  return new AztecAddress(hexToBuffer(buf));
75
105
  }
76
106
 
@@ -89,7 +119,7 @@ export class AztecAddress {
89
119
  if (obj instanceof Buffer || Buffer.isBuffer(obj)) {
90
120
  return new AztecAddress(obj);
91
121
  }
92
- return AztecAddress.fromString(obj);
122
+ return AztecAddress.fromStringUnsafe(obj);
93
123
  }
94
124
 
95
125
  /**
@@ -60,9 +60,14 @@ export function getAttestationInfoFromPayload(
60
60
  return { address: attestation.address, status: 'provided-as-address' as const };
61
61
  }
62
62
 
63
- // Try to recover address from signature
63
+ // Try to recover address from signature. Recover with default opts (no allowYParityAsV): a slot
64
+ // whose recovery byte is in yParity form (v ∈ {0, 1}) is judged invalid here, matching L1 proving
65
+ // (ValidatorSelectionLib.verifyAttestations → ECDSA.recover only accepts v ∈ {27, 28}). A malicious
66
+ // proposer that lands such a slot cannot have it silently treated as valid off-chain; it is routed to
67
+ // invalid-attestation and invalidated. The gossip receipt path (recoverCoordinationSigner) stays
68
+ // lenient with allowYParityAsV; A-1351 normalizes on pool ingress and before the L1 bundle.
64
69
  try {
65
- const recoveredAddress = recoverAddress(hashedPayload, attestation.signature, { allowYParityAsV: true });
70
+ const recoveredAddress = recoverAddress(hashedPayload, attestation.signature);
66
71
  return { address: recoveredAddress, status: 'recovered-from-signature' as const };
67
72
  } catch {
68
73
  // Signature present but recovery failed
@@ -19,10 +19,11 @@ import type { CheckpointData, ProposedCheckpointData, ProposedCheckpointInput }
19
19
  import type { CheckpointInfo } from '../checkpoint/checkpoint_info.js';
20
20
  import type { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
21
21
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
22
+ import { MAX_RPC_CHECKPOINTS_DATA_LEN } from '../interfaces/api_limit.js';
23
+ import type { L2ToL1MembershipWitness } from '../messaging/l2_to_l1_membership.js';
22
24
  import { CheckpointHeader } from '../rollup/checkpoint_header.js';
23
25
  import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
24
26
  import type { TxHash } from '../tx/tx_hash.js';
25
- import type { TxReceipt } from '../tx/tx_receipt.js';
26
27
  import type { BlockData } from './block_data.js';
27
28
  import { BlockHash } from './block_hash.js';
28
29
  import { BlockTagWithoutLatestSchema, type NormalizedBlockParameter } from './block_parameter.js';
@@ -63,8 +64,18 @@ export type CheckpointQuery =
63
64
  | { slot: SlotNumber }
64
65
  | { tag: 'checkpointed' | 'proven' | 'finalized' };
65
66
 
66
- /** Query a range of confirmed checkpoints by start/limit or by epoch. */
67
- export type CheckpointsQuery = { from: CheckpointNumber; limit: number } | { epoch: EpochNumber };
67
+ /**
68
+ * Query a range of confirmed checkpoints by start/limit, by slot anchor, or by epoch.
69
+ *
70
+ * The `fromSlot` variant walks the slot index: it returns up to `limit` checkpoints anchored at
71
+ * `fromSlot`, ordered nearest-first. With `reverse` it takes the checkpoints at or before the slot
72
+ * (descending); otherwise the checkpoints at or after it (ascending). Use `limit: 1, reverse: true`
73
+ * to find the latest checkpoint at or before a slot in a single range scan.
74
+ */
75
+ export type CheckpointsQuery =
76
+ | { from: CheckpointNumber; limit: number }
77
+ | { fromSlot: SlotNumber; limit: number; reverse?: boolean }
78
+ | { epoch: EpochNumber };
68
79
 
69
80
  /**
70
81
  * Lookup a proposed (archiver-internal, not-yet-L1-confirmed) checkpoint.
@@ -79,8 +90,20 @@ export const CheckpointQuerySchema: z.ZodType<CheckpointQuery, unknown> = z.unio
79
90
  z.object({ tag: z.union([z.literal('checkpointed'), z.literal('proven'), z.literal('finalized')]) }).strict(),
80
91
  ]);
81
92
 
93
+ const checkpointsQueryLimitSchema = () =>
94
+ z
95
+ .number()
96
+ .int()
97
+ .min(1)
98
+ .max(MAX_RPC_CHECKPOINTS_DATA_LEN, {
99
+ message: `limit must be at most ${MAX_RPC_CHECKPOINTS_DATA_LEN}`,
100
+ });
101
+
82
102
  export const CheckpointsQuerySchema: z.ZodType<CheckpointsQuery, unknown> = z.union([
83
- z.object({ from: CheckpointNumberSchema, limit: z.number().int().min(1) }).strict(),
103
+ z.object({ from: CheckpointNumberSchema, limit: checkpointsQueryLimitSchema() }).strict(),
104
+ z
105
+ .object({ fromSlot: SlotNumberSchema, limit: checkpointsQueryLimitSchema(), reverse: z.boolean().optional() })
106
+ .strict(),
84
107
  z.object({ epoch: EpochNumberSchema }).strict(),
85
108
  ]);
86
109
 
@@ -162,11 +185,21 @@ export interface L2BlockSource {
162
185
  getTxEffect(txHash: TxHash): Promise<IndexedTxEffect | undefined>;
163
186
 
164
187
  /**
165
- * Gets a receipt of a settled tx.
166
- * @param txHash - The hash of a tx we try to get the receipt for.
167
- * @returns The requested tx receipt (or undefined if not found).
188
+ * Returns the L2-to-L1 membership witness for `message` emitted by tx `txHash`, built against the
189
+ * smallest partial-proof root on the Outbox that covers the tx's checkpoint.
190
+ *
191
+ * The Outbox roots are read lazily, pinned to the node's synced L1 block, so the witness reflects
192
+ * the node's synced view. Returns `undefined` if the tx isn't yet in a block/epoch or no covering
193
+ * root has landed on L1 as of the synced block.
194
+ *
195
+ * Caveat: cached roots that are sealed and L1-finalized are not re-validated. A reorg deeper than
196
+ * L1 finality could leave the node serving a witness against a no-longer-canonical root.
168
197
  */
169
- getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined>;
198
+ getL2ToL1MembershipWitness(
199
+ txHash: TxHash,
200
+ message: Fr,
201
+ messageIndexInTx?: number,
202
+ ): Promise<L2ToL1MembershipWitness | undefined>;
170
203
 
171
204
  /**
172
205
  * Returns the last L2 slot number for which we have all L1 data needed to build the next checkpoint.
@@ -231,7 +264,10 @@ export interface L2BlockSource {
231
264
 
232
265
  /**
233
266
  * Looks up a proposed (archiver-internal, not-yet-L1-confirmed) checkpoint.
234
- * Returns the latest proposed entry when called with no args or `{ tag: 'proposed' }`.
267
+ * Returns the latest proposed entry when called with no args or `{ tag: 'proposed' }`; since a
268
+ * proposed entry can only be stored with a checkpoint number beyond the confirmed frontier (and is
269
+ * deleted on confirmation), the latest entry is always the leading one. Callers derive the proposed
270
+ * tip from the payload (checkpoint number, and last block `startBlock + blockCount - 1`).
235
271
  * With `{ number }` or `{ slot }`, returns the matching entry or undefined.
236
272
  * Never falls back to confirmed checkpoints.
237
273
  */
@@ -311,36 +347,37 @@ export type ArchiverEmitter = TypedEventEmitter<{
311
347
  [L2BlockSourceEvents.DescendentOfInvalidAttestationsCheckpointDetected]: (
312
348
  args: DescendentOfInvalidAttestationsCheckpointEvent,
313
349
  ) => void;
350
+ [L2BlockSourceEvents.L2BlockSourceUpdated]: (args: L2BlockSourceUpdatedEvent) => void;
314
351
  }>;
315
352
  export interface L2BlockSourceEventEmitter extends L2BlockSource {
316
353
  events: ArchiverEmitter;
317
354
  }
318
355
 
319
356
  /**
320
- * Identifier for L2 block tags. Internal counterpart to {@link BlockTag} that exposes
321
- * the additional `proposedCheckpoint` value (used for the optimistic chain tip on the
322
- * archiver side) and omits `latest` (which is an alias for `proposed` accepted only at
323
- * the public RPC surface).
357
+ * Identifier for L2 block tags. Internal counterpart to {@link BlockTag} that omits `latest`
358
+ * (which is an alias for `proposed` accepted only at the public RPC surface).
324
359
  *
325
360
  * - proposed: Latest block proposed on L2.
326
- * - proposedCheckpoint: Latest block in the most recent proposed checkpoint (archiver-internal).
327
361
  * - checkpointed: Latest block whose enclosing checkpoint has been published on L1.
328
362
  * - proven: Latest block whose enclosing checkpoint has been proven on L1.
329
363
  * - finalized: Latest block whose proving L1 transaction has reached L1 finality.
330
- *
331
- * TODO(palla): Remove `proposedCheckpoint` and unify with `proposed`.
332
364
  */
333
- export type L2BlockTag = 'proposed' | 'proposedCheckpoint' | 'checkpointed' | 'proven' | 'finalized';
365
+ export type L2BlockTag = 'proposed' | 'checkpointed' | 'proven' | 'finalized';
334
366
 
335
367
  /** Tips of the L2 chain. */
336
368
  export type L2Tips = {
337
369
  proposed: L2BlockId;
338
370
  checkpointed: L2TipId;
339
- proposedCheckpoint: L2TipId;
340
371
  proven: L2TipId;
341
372
  finalized: L2TipId;
342
373
  };
343
374
 
375
+ /**
376
+ * Tips of the L2 chain as tracked by a local provider (world-state, l2-tips-store). Identical to
377
+ * {@link L2Tips}; the alias is retained for call sites that document a local-only provenance.
378
+ */
379
+ export type LocalL2Tips = L2Tips;
380
+
344
381
  export const GENESIS_CHECKPOINT_HEADER_HASH = CheckpointHeader.empty().hash();
345
382
 
346
383
  /** Identifies a block by number and hash. */
@@ -363,6 +400,28 @@ export function makeL2CheckpointId(number: CheckpointNumber, hash: string): Chec
363
400
  return { number, hash };
364
401
  }
365
402
 
403
+ function l2BlockIdEquals(a: L2BlockId, b: L2BlockId): boolean {
404
+ return a.number === b.number && a.hash === b.hash;
405
+ }
406
+
407
+ function l2TipIdEquals(a: L2TipId, b: L2TipId): boolean {
408
+ return (
409
+ l2BlockIdEquals(a.block, b.block) &&
410
+ a.checkpoint.number === b.checkpoint.number &&
411
+ a.checkpoint.hash === b.checkpoint.hash
412
+ );
413
+ }
414
+
415
+ /** Returns whether two {@link L2Tips} snapshots agree on every tier (proposed, checkpointed, proven, finalized). */
416
+ export function l2TipsEqual(a: L2Tips, b: L2Tips): boolean {
417
+ return (
418
+ l2BlockIdEquals(a.proposed, b.proposed) &&
419
+ l2TipIdEquals(a.checkpointed, b.checkpointed) &&
420
+ l2TipIdEquals(a.proven, b.proven) &&
421
+ l2TipIdEquals(a.finalized, b.finalized)
422
+ );
423
+ }
424
+
366
425
  const L2BlockIdSchema = z.object({
367
426
  number: BlockNumberSchema,
368
427
  hash: z.string(),
@@ -381,7 +440,6 @@ const L2TipIdSchema = z.object({
381
440
  export const L2TipsSchema = z.object({
382
441
  proposed: L2BlockIdSchema,
383
442
  checkpointed: L2TipIdSchema,
384
- proposedCheckpoint: L2TipIdSchema,
385
443
  proven: L2TipIdSchema,
386
444
  finalized: L2TipIdSchema,
387
445
  });
@@ -394,8 +452,26 @@ export enum L2BlockSourceEvents {
394
452
  InvalidAttestationsCheckpointDetected = 'invalidCheckpointDetected',
395
453
  CheckpointEquivocationDetected = 'checkpointEquivocationDetected',
396
454
  DescendentOfInvalidAttestationsCheckpointDetected = 'descendentOfInvalidAttestationsCheckpointDetected',
455
+ L2BlockSourceUpdated = 'l2BlockSourceUpdated',
397
456
  }
398
457
 
458
+ /**
459
+ * Aggregate event emitted once per committed archiver sync pass that mutated local state. Carries the chain tips
460
+ * before and after the pass, and the blocks added during it. Consumers compare `fromTips` and `toTips` to learn what
461
+ * moved; there is no separate `changed` section.
462
+ *
463
+ * This is an optimization signal that lets a block stream reconcile immediately on an archiver update rather than
464
+ * waiting for its next poll. Polling remains the correctness fallback, so a missed event only affects latency.
465
+ * `blocksAdded` are hydrated blocks already in hand from the sync pass, so a triggered sync that is caught up to
466
+ * `fromTips` can reuse them (and `toTips`) instead of re-reading the store.
467
+ */
468
+ export type L2BlockSourceUpdatedEvent = {
469
+ type: 'l2BlockSourceUpdated';
470
+ fromTips: L2Tips;
471
+ toTips: L2Tips;
472
+ blocksAdded: readonly L2Block[];
473
+ };
474
+
399
475
  export type L2BlockProvenEvent = {
400
476
  type: 'l2BlockProven';
401
477
  blockNumber: BlockNumber;