@aztec/stdlib 0.0.1-commit.5de5ca79e → 0.0.1-commit.6201a7b05

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 (429) hide show
  1. package/dest/abi/authorization_selector.d.ts +3 -6
  2. package/dest/abi/authorization_selector.d.ts.map +1 -1
  3. package/dest/abi/buffer.d.ts +14 -4
  4. package/dest/abi/buffer.d.ts.map +1 -1
  5. package/dest/abi/buffer.js +25 -4
  6. package/dest/abi/decoder.d.ts +5 -44
  7. package/dest/abi/decoder.d.ts.map +1 -1
  8. package/dest/abi/decoder.js +12 -67
  9. package/dest/abi/encoder.d.ts +1 -1
  10. package/dest/abi/encoder.d.ts.map +1 -1
  11. package/dest/abi/encoder.js +32 -6
  12. package/dest/abi/event_selector.d.ts +3 -6
  13. package/dest/abi/event_selector.d.ts.map +1 -1
  14. package/dest/abi/function_selector.d.ts +3 -6
  15. package/dest/abi/function_selector.d.ts.map +1 -1
  16. package/dest/abi/function_selector.js +2 -4
  17. package/dest/abi/function_signature_decoder.d.ts +43 -0
  18. package/dest/abi/function_signature_decoder.d.ts.map +1 -0
  19. package/dest/abi/function_signature_decoder.js +66 -0
  20. package/dest/abi/index.d.ts +2 -1
  21. package/dest/abi/index.d.ts.map +1 -1
  22. package/dest/abi/index.js +1 -0
  23. package/dest/abi/note_selector.d.ts +3 -6
  24. package/dest/abi/note_selector.d.ts.map +1 -1
  25. package/dest/abi/note_selector.js +1 -3
  26. package/dest/abi/selector.d.ts +2 -2
  27. package/dest/abi/selector.d.ts.map +1 -1
  28. package/dest/abi/selector.js +1 -1
  29. package/dest/avm/avm.d.ts +300 -300
  30. package/dest/avm/revert_code.d.ts +8 -18
  31. package/dest/avm/revert_code.d.ts.map +1 -1
  32. package/dest/avm/revert_code.js +15 -30
  33. package/dest/aztec-address/index.d.ts +3 -6
  34. package/dest/aztec-address/index.d.ts.map +1 -1
  35. package/dest/aztec-address/index.js +2 -4
  36. package/dest/block/attestation_info.d.ts +3 -2
  37. package/dest/block/attestation_info.d.ts.map +1 -1
  38. package/dest/block/attestation_info.js +7 -5
  39. package/dest/block/block_data.d.ts +297 -8
  40. package/dest/block/block_data.d.ts.map +1 -1
  41. package/dest/block/block_data.js +16 -2
  42. package/dest/block/block_hash.d.ts +11 -10
  43. package/dest/block/block_hash.d.ts.map +1 -1
  44. package/dest/block/block_hash.js +10 -9
  45. package/dest/block/block_parameter.d.ts +30 -3
  46. package/dest/block/block_parameter.d.ts.map +1 -1
  47. package/dest/block/block_parameter.js +36 -2
  48. package/dest/block/l2_block_info.d.ts +6 -5
  49. package/dest/block/l2_block_info.d.ts.map +1 -1
  50. package/dest/block/l2_block_info.js +6 -5
  51. package/dest/block/l2_block_source.d.ts +120 -6
  52. package/dest/block/l2_block_source.d.ts.map +1 -1
  53. package/dest/block/l2_block_source.js +1 -0
  54. package/dest/block/l2_block_stream/interfaces.d.ts +6 -3
  55. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  56. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
  57. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  58. package/dest/block/l2_block_stream/l2_tips_store_base.js +18 -5
  59. package/dest/block/proposal/attestations_and_signers.d.ts +13 -6
  60. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
  61. package/dest/block/proposal/attestations_and_signers.js +26 -18
  62. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  63. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  64. package/dest/block/test/l2_tips_store_test_suite.js +4 -3
  65. package/dest/checkpoint/checkpoint.d.ts +7 -1
  66. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  67. package/dest/checkpoint/checkpoint.js +9 -1
  68. package/dest/checkpoint/checkpoint_data.d.ts +77 -5
  69. package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
  70. package/dest/checkpoint/checkpoint_data.js +12 -0
  71. package/dest/config/chain-config.d.ts +2 -2
  72. package/dest/config/chain-config.d.ts.map +1 -1
  73. package/dest/config/chain-config.js +9 -3
  74. package/dest/config/sequencer-config.d.ts +3 -3
  75. package/dest/config/sequencer-config.d.ts.map +1 -1
  76. package/dest/config/sequencer-config.js +11 -4
  77. package/dest/contract/contract_address.d.ts +1 -1
  78. package/dest/contract/contract_address.js +2 -2
  79. package/dest/contract/index.d.ts +1 -3
  80. package/dest/contract/index.d.ts.map +1 -1
  81. package/dest/contract/index.js +0 -2
  82. package/dest/contract/interfaces/contract_class.d.ts +3 -156
  83. package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
  84. package/dest/contract/interfaces/contract_class.js +1 -28
  85. package/dest/contract/private_function.d.ts +1 -1
  86. package/dest/contract/private_function.d.ts.map +1 -1
  87. package/dest/contract/private_function.js +2 -4
  88. package/dest/epoch-helpers/index.d.ts +7 -1
  89. package/dest/epoch-helpers/index.d.ts.map +1 -1
  90. package/dest/epoch-helpers/index.js +12 -0
  91. package/dest/file-store/factory.d.ts +4 -3
  92. package/dest/file-store/factory.d.ts.map +1 -1
  93. package/dest/file-store/factory.js +2 -2
  94. package/dest/file-store/http.d.ts +9 -2
  95. package/dest/file-store/http.d.ts.map +1 -1
  96. package/dest/file-store/http.js +20 -9
  97. package/dest/file-store/index.d.ts +2 -1
  98. package/dest/file-store/index.d.ts.map +1 -1
  99. package/dest/gas/fee_math.d.ts +49 -0
  100. package/dest/gas/fee_math.d.ts.map +1 -0
  101. package/dest/gas/fee_math.js +80 -0
  102. package/dest/gas/gas_fees.d.ts +5 -1
  103. package/dest/gas/gas_fees.d.ts.map +1 -1
  104. package/dest/gas/gas_fees.js +10 -1
  105. package/dest/gas/gas_settings.d.ts +40 -3
  106. package/dest/gas/gas_settings.d.ts.map +1 -1
  107. package/dest/gas/gas_settings.js +50 -6
  108. package/dest/gas/index.d.ts +2 -1
  109. package/dest/gas/index.d.ts.map +1 -1
  110. package/dest/gas/index.js +1 -0
  111. package/dest/ha-signing/config.d.ts +6 -6
  112. package/dest/ha-signing/config.d.ts.map +1 -1
  113. package/dest/ha-signing/config.js +4 -3
  114. package/dest/ha-signing/index.d.ts +2 -2
  115. package/dest/ha-signing/index.d.ts.map +1 -1
  116. package/dest/ha-signing/index.js +1 -1
  117. package/dest/ha-signing/local_config.d.ts +1 -1
  118. package/dest/ha-signing/local_config.d.ts.map +1 -1
  119. package/dest/ha-signing/local_config.js +2 -2
  120. package/dest/ha-signing/types.d.ts +37 -32
  121. package/dest/ha-signing/types.d.ts.map +1 -1
  122. package/dest/ha-signing/types.js +13 -6
  123. package/dest/hash/hash.d.ts +19 -1
  124. package/dest/hash/hash.d.ts.map +1 -1
  125. package/dest/hash/hash.js +37 -0
  126. package/dest/interfaces/archiver.d.ts +11 -1
  127. package/dest/interfaces/archiver.d.ts.map +1 -1
  128. package/dest/interfaces/archiver.js +11 -3
  129. package/dest/interfaces/aztec-node-admin.d.ts +19 -17
  130. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  131. package/dest/interfaces/aztec-node-admin.js +5 -4
  132. package/dest/interfaces/aztec-node-debug.d.ts +21 -0
  133. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
  134. package/dest/interfaces/aztec-node-debug.js +18 -0
  135. package/dest/interfaces/aztec-node.d.ts +54 -55
  136. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  137. package/dest/interfaces/aztec-node.js +20 -16
  138. package/dest/interfaces/block_response.d.ts +156 -0
  139. package/dest/interfaces/block_response.d.ts.map +1 -0
  140. package/dest/interfaces/block_response.js +24 -0
  141. package/dest/interfaces/chain_tips.d.ts +304 -0
  142. package/dest/interfaces/chain_tips.d.ts.map +1 -0
  143. package/dest/interfaces/chain_tips.js +11 -0
  144. package/dest/interfaces/checkpoint_parameter.d.ts +27 -0
  145. package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -0
  146. package/dest/interfaces/checkpoint_parameter.js +20 -0
  147. package/dest/interfaces/checkpoint_response.d.ts +312 -0
  148. package/dest/interfaces/checkpoint_response.d.ts.map +1 -0
  149. package/dest/interfaces/checkpoint_response.js +26 -0
  150. package/dest/interfaces/client.d.ts +7 -1
  151. package/dest/interfaces/client.d.ts.map +1 -1
  152. package/dest/interfaces/client.js +6 -0
  153. package/dest/interfaces/configs.d.ts +7 -2
  154. package/dest/interfaces/configs.d.ts.map +1 -1
  155. package/dest/interfaces/configs.js +2 -1
  156. package/dest/interfaces/l1_publish_info.d.ts +43 -0
  157. package/dest/interfaces/l1_publish_info.d.ts.map +1 -0
  158. package/dest/interfaces/l1_publish_info.js +26 -0
  159. package/dest/interfaces/merkle_tree_operations.d.ts +4 -3
  160. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  161. package/dest/interfaces/prover-client.d.ts +1 -1
  162. package/dest/interfaces/prover-client.d.ts.map +1 -1
  163. package/dest/interfaces/prover-client.js +0 -3
  164. package/dest/interfaces/proving-job.d.ts +200 -200
  165. package/dest/interfaces/server.d.ts +6 -1
  166. package/dest/interfaces/server.d.ts.map +1 -1
  167. package/dest/interfaces/server.js +5 -0
  168. package/dest/interfaces/slasher.d.ts +1 -10
  169. package/dest/interfaces/slasher.d.ts.map +1 -1
  170. package/dest/interfaces/slasher.js +0 -2
  171. package/dest/interfaces/validator.d.ts +24 -26
  172. package/dest/interfaces/validator.d.ts.map +1 -1
  173. package/dest/interfaces/validator.js +1 -1
  174. package/dest/l1-contracts/index.d.ts +2 -2
  175. package/dest/l1-contracts/index.d.ts.map +1 -1
  176. package/dest/l1-contracts/index.js +1 -1
  177. package/dest/logs/extended_directional_app_tagging_secret.d.ts +4 -4
  178. package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -1
  179. package/dest/logs/extended_directional_app_tagging_secret.js +12 -5
  180. package/dest/logs/log_id.d.ts +1 -1
  181. package/dest/logs/log_id.d.ts.map +1 -1
  182. package/dest/logs/log_id.js +1 -2
  183. package/dest/logs/message_context.d.ts +4 -7
  184. package/dest/logs/message_context.d.ts.map +1 -1
  185. package/dest/logs/message_context.js +23 -9
  186. package/dest/logs/pending_tagged_log.d.ts +2 -3
  187. package/dest/logs/pending_tagged_log.d.ts.map +1 -1
  188. package/dest/logs/pending_tagged_log.js +2 -2
  189. package/dest/logs/shared_secret_derivation.d.ts +11 -10
  190. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  191. package/dest/logs/shared_secret_derivation.js +15 -9
  192. package/dest/logs/siloed_tag.d.ts +8 -7
  193. package/dest/logs/siloed_tag.d.ts.map +1 -1
  194. package/dest/logs/siloed_tag.js +11 -3
  195. package/dest/logs/tag.d.ts +5 -6
  196. package/dest/logs/tag.d.ts.map +1 -1
  197. package/dest/logs/tag.js +4 -0
  198. package/dest/messaging/l1_to_l2_message.d.ts +3 -2
  199. package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
  200. package/dest/messaging/l1_to_l2_message.js +11 -13
  201. package/dest/note/note_dao.d.ts +1 -1
  202. package/dest/note/note_dao.d.ts.map +1 -1
  203. package/dest/note/note_dao.js +1 -4
  204. package/dest/p2p/block_proposal.d.ts +22 -14
  205. package/dest/p2p/block_proposal.d.ts.map +1 -1
  206. package/dest/p2p/block_proposal.js +45 -40
  207. package/dest/p2p/checkpoint_attestation.d.ts +10 -8
  208. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  209. package/dest/p2p/checkpoint_attestation.js +17 -24
  210. package/dest/p2p/checkpoint_proposal.d.ts +20 -14
  211. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  212. package/dest/p2p/checkpoint_proposal.js +34 -51
  213. package/dest/p2p/consensus_payload.d.ts +18 -7
  214. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  215. package/dest/p2p/consensus_payload.js +31 -19
  216. package/dest/p2p/gossipable.d.ts +4 -4
  217. package/dest/p2p/gossipable.d.ts.map +1 -1
  218. package/dest/p2p/signature_utils.d.ts +28 -19
  219. package/dest/p2p/signature_utils.d.ts.map +1 -1
  220. package/dest/p2p/signature_utils.js +118 -21
  221. package/dest/p2p/signed_txs.d.ts +15 -13
  222. package/dest/p2p/signed_txs.d.ts.map +1 -1
  223. package/dest/p2p/signed_txs.js +26 -24
  224. package/dest/parity/parity_base_private_inputs.d.ts +7 -3
  225. package/dest/parity/parity_base_private_inputs.d.ts.map +1 -1
  226. package/dest/parity/parity_base_private_inputs.js +7 -5
  227. package/dest/parity/parity_public_inputs.d.ts +7 -3
  228. package/dest/parity/parity_public_inputs.d.ts.map +1 -1
  229. package/dest/parity/parity_public_inputs.js +6 -3
  230. package/dest/proofs/chonk_proof.d.ts +46 -2
  231. package/dest/proofs/chonk_proof.d.ts.map +1 -1
  232. package/dest/proofs/chonk_proof.js +85 -10
  233. package/dest/rollup/block_headers_hash.d.ts +1 -1
  234. package/dest/rollup/block_headers_hash.d.ts.map +1 -1
  235. package/dest/rollup/block_headers_hash.js +8 -2
  236. package/dest/slashing/index.d.ts +2 -3
  237. package/dest/slashing/index.d.ts.map +1 -1
  238. package/dest/slashing/index.js +1 -2
  239. package/dest/slashing/serialization.d.ts +2 -6
  240. package/dest/slashing/serialization.d.ts.map +1 -1
  241. package/dest/slashing/serialization.js +0 -60
  242. package/dest/slashing/types.d.ts +4 -90
  243. package/dest/slashing/types.d.ts.map +1 -1
  244. package/dest/slashing/types.js +0 -14
  245. package/dest/slashing/{tally.d.ts → votes.d.ts} +1 -1
  246. package/dest/slashing/{tally.d.ts.map → votes.d.ts.map} +1 -1
  247. package/dest/slashing/{tally.js → votes.js} +1 -1
  248. package/dest/tests/factories.d.ts +3 -10
  249. package/dest/tests/factories.d.ts.map +1 -1
  250. package/dest/tests/factories.js +19 -46
  251. package/dest/tests/mocks.d.ts +7 -1
  252. package/dest/tests/mocks.d.ts.map +1 -1
  253. package/dest/tests/mocks.js +39 -30
  254. package/dest/timetable/index.d.ts +51 -1
  255. package/dest/timetable/index.d.ts.map +1 -1
  256. package/dest/timetable/index.js +218 -14
  257. package/dest/trees/nullifier_leaf.d.ts +2 -1
  258. package/dest/trees/nullifier_leaf.d.ts.map +1 -1
  259. package/dest/trees/nullifier_leaf.js +3 -0
  260. package/dest/tx/block_header.d.ts +2 -2
  261. package/dest/tx/block_header.d.ts.map +1 -1
  262. package/dest/tx/block_header.js +1 -1
  263. package/dest/tx/capsule.d.ts +6 -2
  264. package/dest/tx/capsule.d.ts.map +1 -1
  265. package/dest/tx/capsule.js +9 -3
  266. package/dest/tx/fee_provider.d.ts +10 -0
  267. package/dest/tx/fee_provider.d.ts.map +1 -0
  268. package/dest/tx/fee_provider.js +1 -0
  269. package/dest/tx/global_variable_builder.d.ts +3 -4
  270. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  271. package/dest/tx/index.d.ts +2 -1
  272. package/dest/tx/index.d.ts.map +1 -1
  273. package/dest/tx/index.js +1 -0
  274. package/dest/tx/indexed_tx_effect.d.ts +1 -1
  275. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  276. package/dest/tx/indexed_tx_effect.js +1 -2
  277. package/dest/tx/profiling.js +4 -4
  278. package/dest/tx/simulated_tx.d.ts +4 -4
  279. package/dest/tx/simulated_tx.d.ts.map +1 -1
  280. package/dest/tx/simulated_tx.js +3 -3
  281. package/dest/tx/tx.d.ts +3 -3
  282. package/dest/tx/tx.d.ts.map +1 -1
  283. package/dest/tx/tx_receipt.d.ts +8 -4
  284. package/dest/tx/tx_receipt.d.ts.map +1 -1
  285. package/dest/tx/tx_receipt.js +8 -15
  286. package/dest/tx/validator/error_texts.d.ts +5 -1
  287. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  288. package/dest/tx/validator/error_texts.js +6 -0
  289. package/dest/types/shared.d.ts +1 -10
  290. package/dest/types/shared.d.ts.map +1 -1
  291. package/dest/types/shared.js +0 -9
  292. package/dest/vks/verification_key.d.ts +2 -137
  293. package/dest/vks/verification_key.d.ts.map +1 -1
  294. package/dest/vks/verification_key.js +5 -126
  295. package/dest/world-state/genesis_data.d.ts +11 -0
  296. package/dest/world-state/genesis_data.d.ts.map +1 -0
  297. package/dest/world-state/genesis_data.js +4 -0
  298. package/dest/world-state/index.d.ts +2 -1
  299. package/dest/world-state/index.d.ts.map +1 -1
  300. package/dest/world-state/index.js +1 -0
  301. package/dest/world-state/world_state_revision.d.ts +8 -1
  302. package/dest/world-state/world_state_revision.d.ts.map +1 -1
  303. package/dest/world-state/world_state_revision.js +7 -1
  304. package/package.json +8 -8
  305. package/src/abi/authorization_selector.ts +2 -8
  306. package/src/abi/buffer.ts +25 -4
  307. package/src/abi/decoder.ts +23 -78
  308. package/src/abi/encoder.ts +42 -6
  309. package/src/abi/event_selector.ts +2 -8
  310. package/src/abi/function_selector.ts +4 -13
  311. package/src/abi/function_signature_decoder.ts +77 -0
  312. package/src/abi/index.ts +1 -0
  313. package/src/abi/note_selector.ts +3 -12
  314. package/src/abi/selector.ts +1 -1
  315. package/src/avm/revert_code.ts +25 -39
  316. package/src/aztec-address/index.ts +4 -10
  317. package/src/block/attestation_info.ts +11 -11
  318. package/src/block/block_data.ts +20 -4
  319. package/src/block/block_hash.ts +21 -14
  320. package/src/block/block_parameter.ts +35 -2
  321. package/src/block/l2_block_info.ts +8 -6
  322. package/src/block/l2_block_source.ts +55 -5
  323. package/src/block/l2_block_stream/interfaces.ts +6 -2
  324. package/src/block/l2_block_stream/l2_tips_store_base.ts +25 -13
  325. package/src/block/proposal/attestations_and_signers.ts +32 -17
  326. package/src/block/test/l2_tips_store_test_suite.ts +9 -2
  327. package/src/checkpoint/checkpoint.ts +11 -1
  328. package/src/checkpoint/checkpoint_data.ts +44 -4
  329. package/src/config/chain-config.ts +9 -4
  330. package/src/config/sequencer-config.ts +20 -6
  331. package/src/contract/contract_address.ts +2 -2
  332. package/src/contract/index.ts +0 -2
  333. package/src/contract/interfaces/contract_class.ts +2 -82
  334. package/src/contract/private_function.ts +3 -1
  335. package/src/epoch-helpers/index.ts +24 -0
  336. package/src/file-store/factory.ts +13 -4
  337. package/src/file-store/http.ts +29 -10
  338. package/src/file-store/index.ts +1 -0
  339. package/src/gas/README.md +31 -0
  340. package/src/gas/fee_math.ts +120 -0
  341. package/src/gas/gas_fees.ts +17 -4
  342. package/src/gas/gas_settings.ts +65 -12
  343. package/src/gas/index.ts +1 -0
  344. package/src/ha-signing/config.ts +5 -2
  345. package/src/ha-signing/index.ts +3 -1
  346. package/src/ha-signing/local_config.ts +2 -2
  347. package/src/ha-signing/types.ts +48 -34
  348. package/src/hash/hash.ts +32 -0
  349. package/src/interfaces/archiver.ts +22 -2
  350. package/src/interfaces/aztec-node-admin.ts +8 -8
  351. package/src/interfaces/aztec-node-debug.ts +40 -0
  352. package/src/interfaces/aztec-node.ts +120 -95
  353. package/src/interfaces/block_response.ts +79 -0
  354. package/src/interfaces/chain_tips.ts +24 -0
  355. package/src/interfaces/checkpoint_parameter.ts +22 -0
  356. package/src/interfaces/checkpoint_response.ts +84 -0
  357. package/src/interfaces/client.ts +6 -0
  358. package/src/interfaces/configs.ts +5 -1
  359. package/src/interfaces/l1_publish_info.ts +40 -0
  360. package/src/interfaces/merkle_tree_operations.ts +3 -2
  361. package/src/interfaces/prover-client.ts +2 -5
  362. package/src/interfaces/server.ts +5 -0
  363. package/src/interfaces/slasher.ts +0 -6
  364. package/src/interfaces/validator.ts +21 -13
  365. package/src/l1-contracts/index.ts +1 -1
  366. package/src/logs/extended_directional_app_tagging_secret.ts +19 -8
  367. package/src/logs/log_id.ts +1 -2
  368. package/src/logs/message_context.ts +17 -7
  369. package/src/logs/pending_tagged_log.ts +1 -3
  370. package/src/logs/shared_secret_derivation.ts +21 -10
  371. package/src/logs/siloed_tag.ts +15 -11
  372. package/src/logs/tag.ts +8 -8
  373. package/src/messaging/l1_to_l2_message.ts +12 -9
  374. package/src/note/note_dao.ts +1 -4
  375. package/src/p2p/block_proposal.ts +96 -36
  376. package/src/p2p/checkpoint_attestation.ts +20 -29
  377. package/src/p2p/checkpoint_proposal.ts +88 -71
  378. package/src/p2p/consensus_payload.ts +50 -28
  379. package/src/p2p/gossipable.ts +4 -4
  380. package/src/p2p/signature_utils.ts +110 -25
  381. package/src/p2p/signed_txs.ts +46 -28
  382. package/src/parity/parity_base_private_inputs.ts +10 -4
  383. package/src/parity/parity_public_inputs.ts +9 -2
  384. package/src/proofs/chonk_proof.ts +91 -5
  385. package/src/rollup/block_headers_hash.ts +11 -2
  386. package/src/slashing/index.ts +1 -2
  387. package/src/slashing/serialization.ts +1 -81
  388. package/src/slashing/types.ts +3 -35
  389. package/src/slashing/{tally.ts → votes.ts} +1 -1
  390. package/src/tests/factories.ts +19 -54
  391. package/src/tests/mocks.ts +63 -39
  392. package/src/timetable/index.ts +308 -13
  393. package/src/trees/nullifier_leaf.ts +4 -0
  394. package/src/tx/block_header.ts +2 -2
  395. package/src/tx/capsule.ts +10 -2
  396. package/src/tx/fee_provider.ts +10 -0
  397. package/src/tx/global_variable_builder.ts +2 -3
  398. package/src/tx/index.ts +1 -0
  399. package/src/tx/indexed_tx_effect.ts +1 -2
  400. package/src/tx/profiling.ts +4 -4
  401. package/src/tx/simulated_tx.ts +6 -2
  402. package/src/tx/tx.ts +2 -2
  403. package/src/tx/tx_receipt.ts +11 -14
  404. package/src/tx/validator/error_texts.ts +8 -0
  405. package/src/types/shared.ts +0 -10
  406. package/src/vks/verification_key.ts +5 -184
  407. package/src/world-state/genesis_data.ts +15 -0
  408. package/src/world-state/index.ts +1 -0
  409. package/src/world-state/world_state_revision.ts +9 -1
  410. package/dest/abi/mocked_keys.d.ts +0 -2
  411. package/dest/abi/mocked_keys.d.ts.map +0 -1
  412. package/dest/abi/mocked_keys.js +0 -1
  413. package/dest/contract/private_function_membership_proof.d.ts +0 -32
  414. package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
  415. package/dest/contract/private_function_membership_proof.js +0 -124
  416. package/dest/contract/utility_function_membership_proof.d.ts +0 -27
  417. package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
  418. package/dest/contract/utility_function_membership_proof.js +0 -87
  419. package/dest/l1-contracts/slash_factory.d.ts +0 -45
  420. package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
  421. package/dest/l1-contracts/slash_factory.js +0 -158
  422. package/dest/slashing/empire.d.ts +0 -31
  423. package/dest/slashing/empire.d.ts.map +0 -1
  424. package/dest/slashing/empire.js +0 -87
  425. package/src/abi/mocked_keys.ts +0 -2
  426. package/src/contract/private_function_membership_proof.ts +0 -167
  427. package/src/contract/utility_function_membership_proof.ts +0 -118
  428. package/src/l1-contracts/slash_factory.ts +0 -180
  429. package/src/slashing/empire.ts +0 -104
@@ -5,35 +5,17 @@ import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
5
5
  import { inspect } from 'util';
6
6
  import { z } from 'zod';
7
7
 
8
- /**
9
- * Tracks which revertible phases of a transaction's public execution reverted.
10
- *
11
- * A transaction executes in three sequential phases:
12
- * 1. SETUP – non-revertible; if this fails the entire transaction is rejected.
13
- * 2. APP_LOGIC – revertible; its state changes are rolled back on failure.
14
- * 3. TEARDOWN – revertible; always runs (even after app-logic revert) so the fee-payment contract can clean up.
15
- *
16
- * Only APP_LOGIC and TEARDOWN can produce a revert code. SETUP failures throw instead and discard the transaction
17
- * entirely.
18
- */
8
+ /** Whether a transaction's public execution reverted. */
19
9
  export enum RevertCodeEnum {
20
10
  /** All phases completed successfully; no state was rolled back. */
21
11
  OK = 0,
22
- /** APP_LOGIC reverted; its state changes were discarded. If present, TEARDOWN still ran and succeeded. */
23
- APP_LOGIC_REVERTED = 1,
24
- /** TEARDOWN reverted; its state changes were discarded. APP_LOGIC succeeded. */
25
- TEARDOWN_REVERTED = 2,
26
- /** Both APP_LOGIC and TEARDOWN reverted; only SETUP effects are kept. */
27
- BOTH_REVERTED = 3,
12
+ /** One or more revertible phases reverted; their state changes were discarded. */
13
+ REVERTED = 1,
28
14
  }
29
15
 
30
- function isRevertCodeEnum(value: number): value is RevertCodeEnum {
31
- return (
32
- (value as RevertCodeEnum) === RevertCodeEnum.OK ||
33
- (value as RevertCodeEnum) === RevertCodeEnum.APP_LOGIC_REVERTED ||
34
- (value as RevertCodeEnum) === RevertCodeEnum.TEARDOWN_REVERTED ||
35
- (value as RevertCodeEnum) === RevertCodeEnum.BOTH_REVERTED
36
- );
16
+ /** Returns a valid RevertCodeEnum, coercing any value >= 1 to REVERTED. */
17
+ function toRevertCodeEnum(value: number): RevertCodeEnum {
18
+ return value >= 1 ? RevertCodeEnum.REVERTED : RevertCodeEnum.OK;
37
19
  }
38
20
 
39
21
  /**
@@ -45,9 +27,13 @@ export class RevertCode {
45
27
  this.code = e.valueOf();
46
28
  }
47
29
  static readonly OK: RevertCode = new RevertCode(RevertCodeEnum.OK);
48
- static readonly APP_LOGIC_REVERTED: RevertCode = new RevertCode(RevertCodeEnum.APP_LOGIC_REVERTED);
49
- static readonly TEARDOWN_REVERTED: RevertCode = new RevertCode(RevertCodeEnum.TEARDOWN_REVERTED);
50
- static readonly BOTH_REVERTED: RevertCode = new RevertCode(RevertCodeEnum.BOTH_REVERTED);
30
+ static readonly REVERTED: RevertCode = new RevertCode(RevertCodeEnum.REVERTED);
31
+ /** @deprecated Use REVERTED instead. */
32
+ static readonly APP_LOGIC_REVERTED: RevertCode = RevertCode.REVERTED;
33
+ /** @deprecated Use REVERTED instead. */
34
+ static readonly TEARDOWN_REVERTED: RevertCode = RevertCode.REVERTED;
35
+ /** @deprecated Use REVERTED instead. */
36
+ static readonly BOTH_REVERTED: RevertCode = RevertCode.REVERTED;
51
37
 
52
38
  public getCode(): RevertCodeEnum {
53
39
  return this.code;
@@ -65,12 +51,8 @@ export class RevertCode {
65
51
  switch (this.code as RevertCodeEnum) {
66
52
  case RevertCodeEnum.OK:
67
53
  return 'OK';
68
- case RevertCodeEnum.APP_LOGIC_REVERTED:
69
- return 'Application logic reverted';
70
- case RevertCodeEnum.TEARDOWN_REVERTED:
71
- return 'Teardown reverted';
72
- case RevertCodeEnum.BOTH_REVERTED:
73
- return 'Both reverted';
54
+ case RevertCodeEnum.REVERTED:
55
+ return 'Reverted';
74
56
  default:
75
57
  return `Unknown RevertCode: ${this.code}`;
76
58
  }
@@ -81,7 +63,11 @@ export class RevertCode {
81
63
  }
82
64
 
83
65
  static get schema(): ZodFor<RevertCode> {
84
- return z.nativeEnum(RevertCodeEnum).transform(value => new RevertCode(value));
66
+ return z
67
+ .number()
68
+ .int()
69
+ .min(0)
70
+ .transform(value => new RevertCode(toRevertCodeEnum(value)));
85
71
  }
86
72
 
87
73
  /**
@@ -96,10 +82,10 @@ export class RevertCode {
96
82
  return obj;
97
83
  }
98
84
  const code = typeof obj === 'number' ? obj : (obj.code ?? obj);
99
- if (!isRevertCodeEnum(code)) {
85
+ if (typeof code !== 'number' || code < 0) {
100
86
  throw new Error(`Invalid RevertCode: ${code}`);
101
87
  }
102
- return new RevertCode(code);
88
+ return new RevertCode(toRevertCodeEnum(code));
103
89
  }
104
90
 
105
91
  /**
@@ -131,10 +117,10 @@ export class RevertCode {
131
117
  }
132
118
 
133
119
  public static fromNumber(code: number): RevertCode {
134
- if (!isRevertCodeEnum(code)) {
120
+ if (code < 0) {
135
121
  throw new Error(`Invalid RevertCode: ${code}`);
136
122
  }
137
- return new RevertCode(code);
123
+ return new RevertCode(toRevertCodeEnum(code));
138
124
  }
139
125
 
140
126
  public static fromField(field: Fr): RevertCode {
@@ -152,7 +138,7 @@ export class RevertCode {
152
138
  return RevertCode.fromNumber(code);
153
139
  }
154
140
 
155
- private static readonly NUM_OPTIONS = 4;
141
+ private static readonly NUM_OPTIONS = 2;
156
142
  static random(): RevertCode {
157
143
  return new RevertCode(Math.floor(Math.random() * RevertCode.NUM_OPTIONS));
158
144
  }
@@ -1,18 +1,12 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
2
1
  import { Fr, fromBuffer } from '@aztec/foundation/curves/bn254';
3
2
  import { Point } from '@aztec/foundation/curves/grumpkin';
4
3
  import { type ZodFor, bufferSchemaFor, hexSchemaFor } from '@aztec/foundation/schemas';
5
- import { type BufferReader, FieldReader, TypeRegistry } from '@aztec/foundation/serialize';
4
+ import { type BufferReader, FieldReader } from '@aztec/foundation/serialize';
6
5
  import { hexToBuffer } from '@aztec/foundation/string';
7
6
 
8
7
  import { inspect } from 'util';
9
8
  import { z } from 'zod';
10
9
 
11
- /** Branding to ensure fields are not interchangeable types. */
12
- export interface AztecAddress {
13
- /** Brand. */
14
- _branding: 'AztecAddress';
15
- }
16
10
  /**
17
11
  * AztecAddress represents a 32-byte address in the Aztec Protocol. It provides methods to create, manipulate, and
18
12
  * compare addresses, as well as conversion to and from strings, buffers, and other formats.
@@ -23,6 +17,9 @@ export interface AztecAddress {
23
17
  * wild.
24
18
  */
25
19
  export class AztecAddress {
20
+ /** Branding for nominal typing. */
21
+ declare private readonly _branding: 'AztecAddress';
22
+
26
23
  private xCoord: Fr;
27
24
 
28
25
  constructor(buffer: Buffer | Fr) {
@@ -165,6 +162,3 @@ export class AztecAddress {
165
162
  ]);
166
163
  }
167
164
  }
168
-
169
- // For deserializing JSON.
170
- TypeRegistry.register('AztecAddress', AztecAddress);
@@ -3,7 +3,7 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
3
3
 
4
4
  import { Checkpoint } from '../checkpoint/checkpoint.js';
5
5
  import { ConsensusPayload } from '../p2p/consensus_payload.js';
6
- import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from '../p2p/signature_utils.js';
6
+ import { type CoordinationSignatureContext, getHashedSignaturePayloadTypedData } from '../p2p/signature_utils.js';
7
7
  import type { CommitteeAttestation } from './proposal/committee_attestation.js';
8
8
 
9
9
  /**
@@ -32,11 +32,14 @@ export type AttestationInfo =
32
32
  * Extracts attestation information from a published checkpoint.
33
33
  * Returns info for each attestation, preserving array indices.
34
34
  */
35
- export function getAttestationInfoFromPublishedCheckpoint(block: {
36
- attestations: CommitteeAttestation[];
37
- checkpoint: Checkpoint;
38
- }): AttestationInfo[] {
39
- const payload = ConsensusPayload.fromCheckpoint(block.checkpoint);
35
+ export function getAttestationInfoFromPublishedCheckpoint(
36
+ block: {
37
+ attestations: CommitteeAttestation[];
38
+ checkpoint: Checkpoint;
39
+ },
40
+ signatureContext: CoordinationSignatureContext,
41
+ ): AttestationInfo[] {
42
+ const payload = ConsensusPayload.fromCheckpoint(block.checkpoint, signatureContext);
40
43
  return getAttestationInfoFromPayload(payload, block.attestations);
41
44
  }
42
45
 
@@ -44,10 +47,7 @@ export function getAttestationInfoFromPayload(
44
47
  payload: ConsensusPayload,
45
48
  attestations: CommitteeAttestation[],
46
49
  ): AttestationInfo[] {
47
- const hashedPayload = getHashedSignaturePayloadEthSignedMessage(
48
- payload,
49
- SignatureDomainSeparator.checkpointAttestation,
50
- );
50
+ const hashedPayload = getHashedSignaturePayloadTypedData(payload);
51
51
 
52
52
  return attestations.map(attestation => {
53
53
  // If signature is empty, check if we have an address directly
@@ -62,7 +62,7 @@ export function getAttestationInfoFromPayload(
62
62
 
63
63
  // Try to recover address from signature
64
64
  try {
65
- const recoveredAddress = recoverAddress(hashedPayload, attestation.signature);
65
+ const recoveredAddress = recoverAddress(hashedPayload, attestation.signature, { allowYParityAsV: true });
66
66
  return { address: recoveredAddress, status: 'recovered-from-signature' as const };
67
67
  } catch {
68
68
  // Signature present but recovery failed
@@ -1,18 +1,20 @@
1
1
  import { CheckpointNumberSchema, IndexWithinCheckpointSchema } from '@aztec/foundation/branded-types';
2
2
  import type { CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
3
- import type { Fr } from '@aztec/foundation/curves/bn254';
4
- import { schemas } from '@aztec/foundation/schemas';
5
3
 
6
4
  import { z } from 'zod';
7
5
 
6
+ import { CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
7
+ import { L1PublishedData } from '../checkpoint/published_checkpoint.js';
8
8
  import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
9
9
  import { BlockHeader } from '../tx/block_header.js';
10
+ import { BlockHash } from './block_hash.js';
11
+ import { CommitteeAttestation } from './proposal/committee_attestation.js';
10
12
 
11
13
  /** L2Block metadata. Equivalent to L2Block but without block body containing tx data. */
12
14
  export type BlockData = {
13
15
  header: BlockHeader;
14
16
  archive: AppendOnlyTreeSnapshot;
15
- blockHash: Fr;
17
+ blockHash: BlockHash;
16
18
  checkpointNumber: CheckpointNumber;
17
19
  indexWithinCheckpoint: IndexWithinCheckpoint;
18
20
  };
@@ -20,7 +22,21 @@ export type BlockData = {
20
22
  export const BlockDataSchema = z.object({
21
23
  header: BlockHeader.schema,
22
24
  archive: AppendOnlyTreeSnapshot.schema,
23
- blockHash: schemas.Fr,
25
+ blockHash: BlockHash.schema,
24
26
  checkpointNumber: CheckpointNumberSchema,
25
27
  indexWithinCheckpoint: IndexWithinCheckpointSchema,
26
28
  });
29
+
30
+ export const BlockDataWithCheckpointContextSchema = z
31
+ .object({
32
+ data: BlockDataSchema,
33
+ checkpoint: CheckpointDataSchema.optional(),
34
+ l1: L1PublishedData.schema.optional(),
35
+ attestations: z.array(CommitteeAttestation.schema),
36
+ })
37
+ .transform(obj => ({
38
+ data: obj.data,
39
+ checkpoint: obj.checkpoint,
40
+ l1: obj.l1,
41
+ attestations: obj.attestations,
42
+ }));
@@ -1,21 +1,24 @@
1
- import { Fr } from '@aztec/foundation/curves/bn254';
1
+ import { GENESIS_BLOCK_HEADER_HASH as GENESIS_BLOCK_HEADER_HASH_FR } from '@aztec/constants';
2
+ import { BaseFr, Fr } from '@aztec/foundation/curves/bn254';
2
3
  import type { ZodFor } from '@aztec/foundation/schemas';
4
+ import type { BufferReader } from '@aztec/foundation/serialize';
3
5
 
4
6
  import { inspect } from 'util';
5
7
 
6
8
  import { hexSchemaFor } from '../schemas/schemas.js';
7
9
 
8
- const BLOCK_HASH_BRAND = Symbol.for('aztec.BlockHash');
9
-
10
10
  /** Hash of an L2 block. */
11
- export class BlockHash extends Fr {
12
- readonly [BLOCK_HASH_BRAND] = true as const;
11
+ export class BlockHash extends BaseFr {
12
+ /** Branding for nominal typing. */
13
+ declare private readonly _branding: 'BlockHash';
14
+
15
+ static ZERO = new BlockHash(Fr.ZERO);
13
16
 
14
17
  constructor(hash: Fr) {
15
18
  super(hash);
16
19
  }
17
20
 
18
- override [inspect.custom]() {
21
+ [inspect.custom]() {
19
22
  return `BlockHash<${this.toString()}>`;
20
23
  }
21
24
 
@@ -23,23 +26,27 @@ export class BlockHash extends Fr {
23
26
  return new Fr(this.toBigInt());
24
27
  }
25
28
 
26
- /**
27
- * Type guard that checks if a value is a BlockHash instance.
28
- * Uses Symbol.for to ensure cross-module compatibility.
29
- */
29
+ /** Type guard that checks if a value is a BlockHash instance. */
30
30
  static isBlockHash(value: unknown): value is BlockHash {
31
- return typeof value === 'object' && value !== null && BLOCK_HASH_BRAND in value;
31
+ return value instanceof BlockHash;
32
32
  }
33
33
 
34
- static override random() {
34
+ static random() {
35
35
  return new BlockHash(Fr.random());
36
36
  }
37
37
 
38
- static override fromString(str: string): BlockHash {
38
+ static fromBuffer(buffer: Buffer | BufferReader): BlockHash {
39
+ return new BlockHash(Fr.fromBuffer(buffer));
40
+ }
41
+
42
+ static fromString(str: string): BlockHash {
39
43
  return new BlockHash(Fr.fromString(str));
40
44
  }
41
45
 
42
- static override get schema() {
46
+ static get schema() {
43
47
  return hexSchemaFor(BlockHash) as ZodFor<BlockHash>;
44
48
  }
45
49
  }
50
+
51
+ /** The block header hash for the genesis block (block 0). */
52
+ export const GENESIS_BLOCK_HEADER_HASH: BlockHash = new BlockHash(GENESIS_BLOCK_HEADER_HASH_FR);
@@ -1,10 +1,43 @@
1
1
  import { BlockNumberSchema } from '@aztec/foundation/branded-types';
2
+ import { jsonStringify } from '@aztec/foundation/json-rpc';
3
+ import { schemas } from '@aztec/foundation/schemas';
2
4
 
3
5
  import { z } from 'zod';
4
6
 
7
+ import { ChainTipSchema } from '../interfaces/chain_tips.js';
5
8
  import { BlockHash } from './block_hash.js';
6
9
 
7
- export const BlockParameterSchema = z.union([BlockHash.schema, BlockNumberSchema, z.literal('latest')]);
10
+ /**
11
+ * Selector for a block in RPC calls.
12
+ *
13
+ * Accepts a block number, a {@link BlockHash}, a chain-tip name (e.g. `'proven'`, `'checkpointed'`),
14
+ * `'latest'` (alias for `'proposed'`), or the explicit object variants `{ number }`, `{ hash }`,
15
+ * and `{ archive }`.
16
+ */
17
+ export const BlockParameterSchema = z.union([
18
+ BlockHash.schema,
19
+ BlockNumberSchema,
20
+ ChainTipSchema,
21
+ z.literal('latest'),
22
+ z.object({ number: BlockNumberSchema }),
23
+ z.object({ hash: BlockHash.schema }),
24
+ z.object({ archive: schemas.Fr }),
25
+ ]);
8
26
 
9
- /** Block parameter - either a specific BlockNumber, block hash (BlockHash), or 'latest' */
10
27
  export type BlockParameter = z.infer<typeof BlockParameterSchema>;
28
+
29
+ export function inspectBlockParameter(param: BlockParameter) {
30
+ if (typeof param === 'number') {
31
+ return param.toString();
32
+ } else if (typeof param === 'string') {
33
+ return param;
34
+ } else if ('number' in param) {
35
+ return `number=${param.number.toString()}`;
36
+ } else if ('hash' in param) {
37
+ return `hash=${param.hash.toString()}`;
38
+ } else if ('archive' in param) {
39
+ return `archive=${param.archive.toString()}`;
40
+ } else {
41
+ return jsonStringify(param);
42
+ }
43
+ }
@@ -5,8 +5,10 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
5
 
6
6
  import { z } from 'zod';
7
7
 
8
+ import { BlockHash } from './block_hash.js';
9
+
8
10
  export type L2BlockInfo = {
9
- blockHash?: Fr;
11
+ blockHash?: BlockHash;
10
12
  archive: Fr;
11
13
  lastArchive: Fr;
12
14
  blockNumber: BlockNumber;
@@ -17,7 +19,7 @@ export type L2BlockInfo = {
17
19
 
18
20
  export function randomBlockInfo(blockNumber?: BlockNumber | number): L2BlockInfo {
19
21
  return {
20
- blockHash: Fr.random(),
22
+ blockHash: BlockHash.random(),
21
23
  archive: Fr.random(),
22
24
  lastArchive: Fr.random(),
23
25
  blockNumber: BlockNumber(blockNumber ?? Math.floor(Math.random() * 100000) + 1),
@@ -28,7 +30,7 @@ export function randomBlockInfo(blockNumber?: BlockNumber | number): L2BlockInfo
28
30
  }
29
31
 
30
32
  export const BlockInfoSchema = z.object({
31
- blockHash: schemas.Fr.optional(),
33
+ blockHash: BlockHash.schema.optional(),
32
34
  archive: schemas.Fr,
33
35
  lastArchive: schemas.Fr,
34
36
  blockNumber: BlockNumberSchema,
@@ -39,7 +41,7 @@ export const BlockInfoSchema = z.object({
39
41
 
40
42
  export function serializeBlockInfo(blockInfo: L2BlockInfo): Buffer {
41
43
  return serializeToBuffer(
42
- blockInfo.blockHash ?? Fr.ZERO,
44
+ blockInfo.blockHash ?? BlockHash.ZERO,
43
45
  blockInfo.archive,
44
46
  blockInfo.lastArchive,
45
47
  blockInfo.blockNumber,
@@ -51,9 +53,9 @@ export function serializeBlockInfo(blockInfo: L2BlockInfo): Buffer {
51
53
 
52
54
  export function deserializeBlockInfo(buffer: Buffer | BufferReader): L2BlockInfo {
53
55
  const reader = BufferReader.asReader(buffer);
54
- const blockHash = reader.readObject(Fr);
56
+ const blockHash = BlockHash.fromBuffer(reader);
55
57
  return {
56
- blockHash: blockHash.equals(Fr.ZERO) ? undefined : blockHash,
58
+ blockHash: blockHash.equals(BlockHash.ZERO) ? undefined : blockHash,
57
59
  archive: reader.readObject(Fr),
58
60
  lastArchive: reader.readObject(Fr),
59
61
  blockNumber: BlockNumber(reader.readNumber()),
@@ -13,8 +13,8 @@ import type { TypedEventEmitter } from '@aztec/foundation/types';
13
13
  import { z } from 'zod';
14
14
 
15
15
  import type { Checkpoint } from '../checkpoint/checkpoint.js';
16
- import type { CheckpointData } from '../checkpoint/checkpoint_data.js';
17
- import type { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
16
+ import type { CheckpointData, CommonCheckpointData, ProposedCheckpointData } from '../checkpoint/checkpoint_data.js';
17
+ import type { L1PublishedData, PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
18
18
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
19
19
  import { CheckpointHeader } from '../rollup/checkpoint_header.js';
20
20
  import type { BlockHeader } from '../tx/block_header.js';
@@ -25,8 +25,17 @@ import type { BlockData } from './block_data.js';
25
25
  import type { BlockHash } from './block_hash.js';
26
26
  import type { CheckpointedL2Block } from './checkpointed_l2_block.js';
27
27
  import type { L2Block } from './l2_block.js';
28
+ import type { CommitteeAttestation } from './proposal/committee_attestation.js';
28
29
  import type { ValidateCheckpointNegativeResult, ValidateCheckpointResult } from './validate_block_result.js';
29
30
 
31
+ /** Block metadata plus checkpoint-derived context (L1 publish info, attestations). */
32
+ export type BlockDataWithCheckpointContext = {
33
+ data: BlockData;
34
+ checkpoint?: CheckpointData;
35
+ l1?: L1PublishedData;
36
+ attestations: CommitteeAttestation[];
37
+ };
38
+
30
39
  /**
31
40
  * Interface of classes allowing for the retrieval of L2 blocks.
32
41
  */
@@ -111,6 +120,37 @@ export interface L2BlockSource {
111
120
  */
112
121
  getCheckpointsDataForEpoch(epochNumber: EpochNumber): Promise<CheckpointData[]>;
113
122
 
123
+ /**
124
+ * Gets lightweight checkpoint metadata for a single checkpoint.
125
+ * Cheap passthrough for metadata-only queries (no block body reads).
126
+ * @param checkpointNumber - The checkpoint number to retrieve.
127
+ * @returns The requested checkpoint data (or undefined if not found).
128
+ */
129
+ getCheckpointData(checkpointNumber: CheckpointNumber): Promise<CheckpointData | undefined>;
130
+
131
+ /**
132
+ * Gets up to `limit` amount of checkpoint metadata entries starting from `from`.
133
+ * Cheap passthrough for metadata-only queries (no block body reads).
134
+ * @param from - The first checkpoint number to return (inclusive).
135
+ * @param limit - The maximum number of checkpoints to return.
136
+ */
137
+ getCheckpointDataRange(from: CheckpointNumber, limit: number): Promise<CheckpointData[]>;
138
+
139
+ /**
140
+ * Looks up the checkpoint number that contains the given slot.
141
+ * @param slot - The slot number to look up.
142
+ * @returns The checkpoint number (or undefined if not found).
143
+ */
144
+ getCheckpointNumberBySlot(slot: SlotNumber): Promise<CheckpointNumber | undefined>;
145
+
146
+ /**
147
+ * Gets block metadata plus checkpoint-derived context (L1 publish info, attestations)
148
+ * without deserializing tx bodies. Uses checkpoint-level values when the block is
149
+ * checkpointed; otherwise returns `l1: undefined` and empty attestations.
150
+ * @param number - The block number to retrieve.
151
+ */
152
+ getBlockDataWithCheckpointContext(number: BlockNumber): Promise<BlockDataWithCheckpointContext | undefined>;
153
+
114
154
  /**
115
155
  * Gets a block header by its hash.
116
156
  * @param blockHash - The block hash to retrieve.
@@ -175,8 +215,10 @@ export interface L2BlockSource {
175
215
  getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined>;
176
216
 
177
217
  /**
178
- * Returns the last L2 slot number that has been fully synchronized from L1.
179
- * An L2 slot is fully synced when all L1 blocks that fall within its time range have been processed.
218
+ * Returns the last L2 slot number for which we have all L1 data needed to build the next checkpoint.
219
+ * Determined by the max of two signals: L1 block sync progress and latest synced checkpoint slot.
220
+ * The checkpoint signal handles missed L1 blocks, since a published checkpoint seals the message tree
221
+ * for the next checkpoint via the inbox LAG mechanism.
180
222
  */
181
223
  getSyncedL2SlotNumber(): Promise<SlotNumber | undefined>;
182
224
 
@@ -227,6 +269,12 @@ export interface L2BlockSource {
227
269
  */
228
270
  getPendingChainValidationStatus(): Promise<ValidateCheckpointResult>;
229
271
 
272
+ /** Returns the checkpoint at the proposed chain tip. */
273
+ getLastCheckpoint(): Promise<CommonCheckpointData | undefined>;
274
+
275
+ /** Returns proposed checkpoint, if set, undefined if not*/
276
+ getLastProposedCheckpoint(): Promise<ProposedCheckpointData | undefined>;
277
+
230
278
  /** Force a sync. */
231
279
  syncImmediate(): Promise<void>;
232
280
 
@@ -310,12 +358,13 @@ export interface L2BlockSourceEventEmitter extends L2BlockSource {
310
358
  * - proven: Proven block on L1.
311
359
  * - finalized: Proven block on a finalized L1 block (not implemented, set to proven for now).
312
360
  */
313
- export type L2BlockTag = 'proposed' | 'checkpointed' | 'proven' | 'finalized';
361
+ export type L2BlockTag = 'proposed' | 'proposedCheckpoint' | 'checkpointed' | 'proven' | 'finalized';
314
362
 
315
363
  /** Tips of the L2 chain. */
316
364
  export type L2Tips = {
317
365
  proposed: L2BlockId;
318
366
  checkpointed: L2TipId;
367
+ proposedCheckpoint: L2TipId;
319
368
  proven: L2TipId;
320
369
  finalized: L2TipId;
321
370
  };
@@ -360,6 +409,7 @@ const L2TipIdSchema = z.object({
360
409
  export const L2TipsSchema = z.object({
361
410
  proposed: L2BlockIdSchema,
362
411
  checkpointed: L2TipIdSchema,
412
+ proposedCheckpoint: L2TipIdSchema,
363
413
  proven: L2TipIdSchema,
364
414
  finalized: L2TipIdSchema,
365
415
  });
@@ -2,10 +2,14 @@ import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.
2
2
  import type { L2Block } from '../l2_block.js';
3
3
  import type { CheckpointId, L2BlockId, L2Tips } from '../l2_block_source.js';
4
4
 
5
+ /** Provides the current chain tips. Implemented by world-state, l2-tips-store, and AztecNode. */
6
+ export interface L2TipsProvider {
7
+ getL2Tips(): Promise<L2Tips>;
8
+ }
9
+
5
10
  /** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
6
- export interface L2BlockStreamLocalDataProvider {
11
+ export interface L2BlockStreamLocalDataProvider extends L2TipsProvider {
7
12
  getL2BlockHash(number: number): Promise<string | undefined>;
8
- getL2Tips(): Promise<L2Tips>;
9
13
  }
10
14
 
11
15
  /** Interface to a handler of events emitted. */
@@ -1,7 +1,7 @@
1
- import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
2
1
  import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
2
 
4
3
  import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
4
+ import { GENESIS_BLOCK_HEADER_HASH } from '../block_hash.js';
5
5
  import type { L2Block } from '../l2_block.js';
6
6
  import {
7
7
  type CheckpointId,
@@ -66,24 +66,29 @@ export abstract class L2TipsStoreBase implements L2BlockStreamEventHandler, L2Bl
66
66
 
67
67
  public getL2Tips(): Promise<L2Tips> {
68
68
  return this.runInTransaction(async () => {
69
- const [proposedBlockId, finalizedBlockId, provenBlockId, checkpointedBlockId] = await Promise.all([
70
- this.getBlockId('proposed'),
71
- this.getBlockId('finalized'),
72
- this.getBlockId('proven'),
73
- this.getBlockId('checkpointed'),
74
- ]);
75
-
76
- const [finalizedCheckpointId, provenCheckpointId, checkpointedCheckpointId] = await Promise.all([
77
- this.getCheckpointId('finalized'),
78
- this.getCheckpointId('proven'),
79
- this.getCheckpointId('checkpointed'),
80
- ]);
69
+ const [proposedBlockId, finalizedBlockId, provenBlockId, checkpointedBlockId, proposedCheckpointBlockId] =
70
+ await Promise.all([
71
+ this.getBlockId('proposed'),
72
+ this.getBlockId('finalized'),
73
+ this.getBlockId('proven'),
74
+ this.getBlockId('checkpointed'),
75
+ this.getBlockId('proposedCheckpoint'),
76
+ ]);
77
+
78
+ const [finalizedCheckpointId, provenCheckpointId, checkpointedCheckpointId, proposedCheckpointId] =
79
+ await Promise.all([
80
+ this.getCheckpointId('finalized'),
81
+ this.getCheckpointId('proven'),
82
+ this.getCheckpointId('checkpointed'),
83
+ this.getCheckpointId('proposedCheckpoint'),
84
+ ]);
81
85
 
82
86
  return {
83
87
  proposed: proposedBlockId,
84
88
  finalized: { block: finalizedBlockId, checkpoint: finalizedCheckpointId },
85
89
  proven: { block: provenBlockId, checkpoint: provenCheckpointId },
86
90
  checkpointed: { block: checkpointedBlockId, checkpoint: checkpointedCheckpointId },
91
+ proposedCheckpoint: { block: proposedCheckpointBlockId, checkpoint: proposedCheckpointId },
87
92
  };
88
93
  });
89
94
  }
@@ -164,6 +169,12 @@ export abstract class L2TipsStoreBase implements L2BlockStreamEventHandler, L2Bl
164
169
  await this.runInTransaction(async () => {
165
170
  await this.saveTag('checkpointed', event.block);
166
171
  await this.saveCheckpoint(event.checkpoint);
172
+ // proposedCheckpoint is always >= checkpointed. If checkpointed has caught up
173
+ // or surpassed it, advance proposedCheckpoint to match.
174
+ const proposedCheckpointBlock = await this.getBlockId('proposedCheckpoint');
175
+ if (event.block.number > proposedCheckpointBlock.number) {
176
+ await this.saveTag('proposedCheckpoint', event.block);
177
+ }
167
178
  });
168
179
  }
169
180
 
@@ -174,6 +185,7 @@ export abstract class L2TipsStoreBase implements L2BlockStreamEventHandler, L2Bl
174
185
  await this.runInTransaction(async () => {
175
186
  await this.saveTag('proposed', event.block);
176
187
  await this.saveTag('checkpointed', event.block);
188
+ await this.saveTag('proposedCheckpoint', event.block);
177
189
  const storeProven = await this.getBlockId('proven');
178
190
  if (storeProven.number > event.block.number) {
179
191
  await this.saveTag('proven', event.block);