@aztec/stdlib 0.0.1-commit.936cb2cae → 0.0.1-commit.949a33fd8

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 (353) 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/encoder.d.ts +1 -1
  4. package/dest/abi/encoder.d.ts.map +1 -1
  5. package/dest/abi/encoder.js +32 -6
  6. package/dest/abi/event_selector.d.ts +3 -6
  7. package/dest/abi/event_selector.d.ts.map +1 -1
  8. package/dest/abi/function_selector.d.ts +3 -6
  9. package/dest/abi/function_selector.d.ts.map +1 -1
  10. package/dest/abi/function_selector.js +1 -3
  11. package/dest/abi/note_selector.d.ts +3 -6
  12. package/dest/abi/note_selector.d.ts.map +1 -1
  13. package/dest/abi/note_selector.js +1 -3
  14. package/dest/abi/selector.d.ts +2 -2
  15. package/dest/abi/selector.d.ts.map +1 -1
  16. package/dest/abi/selector.js +1 -1
  17. package/dest/avm/revert_code.d.ts +8 -18
  18. package/dest/avm/revert_code.d.ts.map +1 -1
  19. package/dest/avm/revert_code.js +15 -30
  20. package/dest/aztec-address/index.d.ts +3 -6
  21. package/dest/aztec-address/index.d.ts.map +1 -1
  22. package/dest/aztec-address/index.js +2 -4
  23. package/dest/block/attestation_info.d.ts +3 -2
  24. package/dest/block/attestation_info.d.ts.map +1 -1
  25. package/dest/block/attestation_info.js +7 -5
  26. package/dest/block/block_data.d.ts +297 -8
  27. package/dest/block/block_data.d.ts.map +1 -1
  28. package/dest/block/block_data.js +16 -2
  29. package/dest/block/block_hash.d.ts +11 -10
  30. package/dest/block/block_hash.d.ts.map +1 -1
  31. package/dest/block/block_hash.js +10 -9
  32. package/dest/block/block_parameter.d.ts +30 -3
  33. package/dest/block/block_parameter.d.ts.map +1 -1
  34. package/dest/block/block_parameter.js +36 -2
  35. package/dest/block/l2_block_info.d.ts +6 -5
  36. package/dest/block/l2_block_info.d.ts.map +1 -1
  37. package/dest/block/l2_block_info.js +6 -5
  38. package/dest/block/l2_block_source.d.ts +116 -4
  39. package/dest/block/l2_block_source.d.ts.map +1 -1
  40. package/dest/block/l2_block_source.js +1 -0
  41. package/dest/block/l2_block_stream/interfaces.d.ts +6 -3
  42. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  43. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
  44. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  45. package/dest/block/l2_block_stream/l2_tips_store_base.js +18 -5
  46. package/dest/block/proposal/attestations_and_signers.d.ts +13 -6
  47. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
  48. package/dest/block/proposal/attestations_and_signers.js +26 -18
  49. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  50. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  51. package/dest/block/test/l2_tips_store_test_suite.js +4 -3
  52. package/dest/checkpoint/checkpoint.d.ts +7 -1
  53. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  54. package/dest/checkpoint/checkpoint.js +9 -1
  55. package/dest/checkpoint/checkpoint_data.d.ts +77 -5
  56. package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
  57. package/dest/checkpoint/checkpoint_data.js +12 -0
  58. package/dest/config/chain-config.d.ts +2 -2
  59. package/dest/config/chain-config.d.ts.map +1 -1
  60. package/dest/config/chain-config.js +9 -3
  61. package/dest/config/sequencer-config.d.ts +3 -3
  62. package/dest/config/sequencer-config.d.ts.map +1 -1
  63. package/dest/config/sequencer-config.js +11 -4
  64. package/dest/contract/contract_address.d.ts +1 -1
  65. package/dest/contract/contract_address.js +2 -2
  66. package/dest/contract/private_function.d.ts +1 -1
  67. package/dest/contract/private_function.d.ts.map +1 -1
  68. package/dest/contract/private_function.js +2 -4
  69. package/dest/epoch-helpers/index.d.ts +3 -1
  70. package/dest/epoch-helpers/index.d.ts.map +1 -1
  71. package/dest/epoch-helpers/index.js +3 -0
  72. package/dest/gas/fee_math.d.ts +49 -0
  73. package/dest/gas/fee_math.d.ts.map +1 -0
  74. package/dest/gas/fee_math.js +80 -0
  75. package/dest/gas/gas_fees.d.ts +5 -1
  76. package/dest/gas/gas_fees.d.ts.map +1 -1
  77. package/dest/gas/gas_fees.js +10 -1
  78. package/dest/gas/gas_settings.d.ts +40 -3
  79. package/dest/gas/gas_settings.d.ts.map +1 -1
  80. package/dest/gas/gas_settings.js +50 -6
  81. package/dest/gas/index.d.ts +2 -1
  82. package/dest/gas/index.d.ts.map +1 -1
  83. package/dest/gas/index.js +1 -0
  84. package/dest/ha-signing/config.d.ts +6 -6
  85. package/dest/ha-signing/config.d.ts.map +1 -1
  86. package/dest/ha-signing/config.js +4 -3
  87. package/dest/ha-signing/index.d.ts +2 -2
  88. package/dest/ha-signing/index.d.ts.map +1 -1
  89. package/dest/ha-signing/index.js +1 -1
  90. package/dest/ha-signing/local_config.d.ts +1 -1
  91. package/dest/ha-signing/local_config.d.ts.map +1 -1
  92. package/dest/ha-signing/local_config.js +2 -2
  93. package/dest/ha-signing/types.d.ts +37 -32
  94. package/dest/ha-signing/types.d.ts.map +1 -1
  95. package/dest/ha-signing/types.js +13 -6
  96. package/dest/hash/hash.d.ts +16 -1
  97. package/dest/hash/hash.d.ts.map +1 -1
  98. package/dest/hash/hash.js +32 -0
  99. package/dest/interfaces/archiver.d.ts +11 -1
  100. package/dest/interfaces/archiver.d.ts.map +1 -1
  101. package/dest/interfaces/archiver.js +11 -3
  102. package/dest/interfaces/aztec-node-admin.d.ts +19 -14
  103. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  104. package/dest/interfaces/aztec-node-admin.js +5 -4
  105. package/dest/interfaces/aztec-node-debug.d.ts +21 -0
  106. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
  107. package/dest/interfaces/aztec-node-debug.js +18 -0
  108. package/dest/interfaces/aztec-node.d.ts +54 -55
  109. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  110. package/dest/interfaces/aztec-node.js +20 -16
  111. package/dest/interfaces/block_response.d.ts +156 -0
  112. package/dest/interfaces/block_response.d.ts.map +1 -0
  113. package/dest/interfaces/block_response.js +24 -0
  114. package/dest/interfaces/chain_tips.d.ts +304 -0
  115. package/dest/interfaces/chain_tips.d.ts.map +1 -0
  116. package/dest/interfaces/chain_tips.js +11 -0
  117. package/dest/interfaces/checkpoint_parameter.d.ts +27 -0
  118. package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -0
  119. package/dest/interfaces/checkpoint_parameter.js +20 -0
  120. package/dest/interfaces/checkpoint_response.d.ts +312 -0
  121. package/dest/interfaces/checkpoint_response.d.ts.map +1 -0
  122. package/dest/interfaces/checkpoint_response.js +26 -0
  123. package/dest/interfaces/client.d.ts +7 -1
  124. package/dest/interfaces/client.d.ts.map +1 -1
  125. package/dest/interfaces/client.js +6 -0
  126. package/dest/interfaces/configs.d.ts +7 -2
  127. package/dest/interfaces/configs.d.ts.map +1 -1
  128. package/dest/interfaces/configs.js +2 -1
  129. package/dest/interfaces/l1_publish_info.d.ts +43 -0
  130. package/dest/interfaces/l1_publish_info.d.ts.map +1 -0
  131. package/dest/interfaces/l1_publish_info.js +26 -0
  132. package/dest/interfaces/merkle_tree_operations.d.ts +4 -3
  133. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  134. package/dest/interfaces/prover-client.d.ts +1 -1
  135. package/dest/interfaces/prover-client.d.ts.map +1 -1
  136. package/dest/interfaces/prover-client.js +0 -3
  137. package/dest/interfaces/proving-job.d.ts +166 -166
  138. package/dest/interfaces/server.d.ts +6 -1
  139. package/dest/interfaces/server.d.ts.map +1 -1
  140. package/dest/interfaces/server.js +5 -0
  141. package/dest/interfaces/slasher.d.ts +1 -10
  142. package/dest/interfaces/slasher.d.ts.map +1 -1
  143. package/dest/interfaces/slasher.js +0 -2
  144. package/dest/interfaces/validator.d.ts +23 -17
  145. package/dest/interfaces/validator.d.ts.map +1 -1
  146. package/dest/interfaces/validator.js +1 -0
  147. package/dest/l1-contracts/index.d.ts +2 -2
  148. package/dest/l1-contracts/index.d.ts.map +1 -1
  149. package/dest/l1-contracts/index.js +1 -1
  150. package/dest/logs/extended_directional_app_tagging_secret.d.ts +4 -4
  151. package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -1
  152. package/dest/logs/extended_directional_app_tagging_secret.js +12 -5
  153. package/dest/logs/log_id.d.ts +1 -1
  154. package/dest/logs/log_id.d.ts.map +1 -1
  155. package/dest/logs/log_id.js +1 -2
  156. package/dest/logs/siloed_tag.d.ts +5 -7
  157. package/dest/logs/siloed_tag.d.ts.map +1 -1
  158. package/dest/logs/siloed_tag.js +4 -0
  159. package/dest/logs/tag.d.ts +5 -6
  160. package/dest/logs/tag.d.ts.map +1 -1
  161. package/dest/logs/tag.js +4 -0
  162. package/dest/p2p/block_proposal.d.ts +22 -14
  163. package/dest/p2p/block_proposal.d.ts.map +1 -1
  164. package/dest/p2p/block_proposal.js +45 -40
  165. package/dest/p2p/checkpoint_attestation.d.ts +10 -8
  166. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  167. package/dest/p2p/checkpoint_attestation.js +17 -24
  168. package/dest/p2p/checkpoint_proposal.d.ts +20 -14
  169. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  170. package/dest/p2p/checkpoint_proposal.js +34 -51
  171. package/dest/p2p/consensus_payload.d.ts +18 -7
  172. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  173. package/dest/p2p/consensus_payload.js +31 -19
  174. package/dest/p2p/gossipable.d.ts +4 -4
  175. package/dest/p2p/gossipable.d.ts.map +1 -1
  176. package/dest/p2p/signature_utils.d.ts +28 -19
  177. package/dest/p2p/signature_utils.d.ts.map +1 -1
  178. package/dest/p2p/signature_utils.js +118 -21
  179. package/dest/p2p/signed_txs.d.ts +15 -13
  180. package/dest/p2p/signed_txs.d.ts.map +1 -1
  181. package/dest/p2p/signed_txs.js +26 -24
  182. package/dest/parity/parity_base_private_inputs.d.ts +7 -3
  183. package/dest/parity/parity_base_private_inputs.d.ts.map +1 -1
  184. package/dest/parity/parity_base_private_inputs.js +7 -5
  185. package/dest/parity/parity_public_inputs.d.ts +7 -3
  186. package/dest/parity/parity_public_inputs.d.ts.map +1 -1
  187. package/dest/parity/parity_public_inputs.js +6 -3
  188. package/dest/rollup/block_headers_hash.d.ts +1 -1
  189. package/dest/rollup/block_headers_hash.d.ts.map +1 -1
  190. package/dest/rollup/block_headers_hash.js +8 -2
  191. package/dest/slashing/index.d.ts +2 -3
  192. package/dest/slashing/index.d.ts.map +1 -1
  193. package/dest/slashing/index.js +1 -2
  194. package/dest/slashing/serialization.d.ts +2 -6
  195. package/dest/slashing/serialization.d.ts.map +1 -1
  196. package/dest/slashing/serialization.js +0 -60
  197. package/dest/slashing/types.d.ts +4 -90
  198. package/dest/slashing/types.d.ts.map +1 -1
  199. package/dest/slashing/types.js +0 -14
  200. package/dest/slashing/{tally.d.ts → votes.d.ts} +1 -1
  201. package/dest/slashing/{tally.d.ts.map → votes.d.ts.map} +1 -1
  202. package/dest/slashing/{tally.js → votes.js} +1 -1
  203. package/dest/tests/factories.d.ts +2 -7
  204. package/dest/tests/factories.d.ts.map +1 -1
  205. package/dest/tests/factories.js +19 -19
  206. package/dest/tests/mocks.d.ts +7 -1
  207. package/dest/tests/mocks.d.ts.map +1 -1
  208. package/dest/tests/mocks.js +39 -30
  209. package/dest/timetable/index.d.ts +51 -1
  210. package/dest/timetable/index.d.ts.map +1 -1
  211. package/dest/timetable/index.js +218 -14
  212. package/dest/trees/nullifier_leaf.d.ts +2 -1
  213. package/dest/trees/nullifier_leaf.d.ts.map +1 -1
  214. package/dest/trees/nullifier_leaf.js +3 -0
  215. package/dest/tx/block_header.d.ts +2 -2
  216. package/dest/tx/block_header.d.ts.map +1 -1
  217. package/dest/tx/block_header.js +1 -1
  218. package/dest/tx/fee_provider.d.ts +10 -0
  219. package/dest/tx/fee_provider.d.ts.map +1 -0
  220. package/dest/tx/fee_provider.js +1 -0
  221. package/dest/tx/global_variable_builder.d.ts +3 -4
  222. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  223. package/dest/tx/index.d.ts +2 -1
  224. package/dest/tx/index.d.ts.map +1 -1
  225. package/dest/tx/index.js +1 -0
  226. package/dest/tx/indexed_tx_effect.d.ts +1 -1
  227. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  228. package/dest/tx/indexed_tx_effect.js +1 -2
  229. package/dest/tx/profiling.js +4 -4
  230. package/dest/tx/simulated_tx.d.ts +4 -4
  231. package/dest/tx/simulated_tx.d.ts.map +1 -1
  232. package/dest/tx/simulated_tx.js +3 -3
  233. package/dest/tx/tx.d.ts +3 -3
  234. package/dest/tx/tx.d.ts.map +1 -1
  235. package/dest/tx/tx_receipt.d.ts +8 -4
  236. package/dest/tx/tx_receipt.d.ts.map +1 -1
  237. package/dest/tx/tx_receipt.js +8 -15
  238. package/dest/types/shared.d.ts +1 -10
  239. package/dest/types/shared.d.ts.map +1 -1
  240. package/dest/types/shared.js +0 -9
  241. package/dest/vks/verification_key.d.ts +2 -137
  242. package/dest/vks/verification_key.d.ts.map +1 -1
  243. package/dest/vks/verification_key.js +5 -126
  244. package/dest/world-state/genesis_data.d.ts +11 -0
  245. package/dest/world-state/genesis_data.d.ts.map +1 -0
  246. package/dest/world-state/genesis_data.js +4 -0
  247. package/dest/world-state/index.d.ts +2 -1
  248. package/dest/world-state/index.d.ts.map +1 -1
  249. package/dest/world-state/index.js +1 -0
  250. package/dest/world-state/world_state_revision.d.ts +8 -1
  251. package/dest/world-state/world_state_revision.d.ts.map +1 -1
  252. package/dest/world-state/world_state_revision.js +7 -1
  253. package/package.json +8 -8
  254. package/src/abi/authorization_selector.ts +2 -8
  255. package/src/abi/encoder.ts +42 -6
  256. package/src/abi/event_selector.ts +2 -8
  257. package/src/abi/function_selector.ts +3 -12
  258. package/src/abi/note_selector.ts +3 -12
  259. package/src/abi/selector.ts +1 -1
  260. package/src/avm/revert_code.ts +25 -39
  261. package/src/aztec-address/index.ts +4 -10
  262. package/src/block/attestation_info.ts +11 -11
  263. package/src/block/block_data.ts +20 -4
  264. package/src/block/block_hash.ts +21 -14
  265. package/src/block/block_parameter.ts +35 -2
  266. package/src/block/l2_block_info.ts +8 -6
  267. package/src/block/l2_block_source.ts +51 -3
  268. package/src/block/l2_block_stream/interfaces.ts +6 -2
  269. package/src/block/l2_block_stream/l2_tips_store_base.ts +25 -13
  270. package/src/block/proposal/attestations_and_signers.ts +32 -17
  271. package/src/block/test/l2_tips_store_test_suite.ts +9 -2
  272. package/src/checkpoint/checkpoint.ts +11 -1
  273. package/src/checkpoint/checkpoint_data.ts +44 -4
  274. package/src/config/chain-config.ts +9 -4
  275. package/src/config/sequencer-config.ts +20 -6
  276. package/src/contract/contract_address.ts +2 -2
  277. package/src/contract/private_function.ts +3 -1
  278. package/src/epoch-helpers/index.ts +5 -0
  279. package/src/gas/README.md +31 -0
  280. package/src/gas/fee_math.ts +120 -0
  281. package/src/gas/gas_fees.ts +17 -4
  282. package/src/gas/gas_settings.ts +65 -12
  283. package/src/gas/index.ts +1 -0
  284. package/src/ha-signing/config.ts +5 -2
  285. package/src/ha-signing/index.ts +3 -1
  286. package/src/ha-signing/local_config.ts +2 -2
  287. package/src/ha-signing/types.ts +48 -34
  288. package/src/hash/hash.ts +27 -0
  289. package/src/interfaces/archiver.ts +22 -2
  290. package/src/interfaces/aztec-node-admin.ts +8 -8
  291. package/src/interfaces/aztec-node-debug.ts +40 -0
  292. package/src/interfaces/aztec-node.ts +120 -95
  293. package/src/interfaces/block_response.ts +79 -0
  294. package/src/interfaces/chain_tips.ts +24 -0
  295. package/src/interfaces/checkpoint_parameter.ts +22 -0
  296. package/src/interfaces/checkpoint_response.ts +84 -0
  297. package/src/interfaces/client.ts +6 -0
  298. package/src/interfaces/configs.ts +5 -1
  299. package/src/interfaces/l1_publish_info.ts +40 -0
  300. package/src/interfaces/merkle_tree_operations.ts +3 -2
  301. package/src/interfaces/prover-client.ts +2 -5
  302. package/src/interfaces/server.ts +5 -0
  303. package/src/interfaces/slasher.ts +0 -6
  304. package/src/interfaces/validator.ts +20 -8
  305. package/src/l1-contracts/index.ts +1 -1
  306. package/src/logs/extended_directional_app_tagging_secret.ts +19 -8
  307. package/src/logs/log_id.ts +1 -2
  308. package/src/logs/siloed_tag.ts +8 -9
  309. package/src/logs/tag.ts +8 -8
  310. package/src/p2p/block_proposal.ts +96 -36
  311. package/src/p2p/checkpoint_attestation.ts +20 -29
  312. package/src/p2p/checkpoint_proposal.ts +88 -71
  313. package/src/p2p/consensus_payload.ts +50 -28
  314. package/src/p2p/gossipable.ts +4 -4
  315. package/src/p2p/signature_utils.ts +110 -25
  316. package/src/p2p/signed_txs.ts +46 -28
  317. package/src/parity/parity_base_private_inputs.ts +10 -4
  318. package/src/parity/parity_public_inputs.ts +9 -2
  319. package/src/rollup/block_headers_hash.ts +11 -2
  320. package/src/slashing/index.ts +1 -2
  321. package/src/slashing/serialization.ts +1 -81
  322. package/src/slashing/types.ts +3 -35
  323. package/src/slashing/{tally.ts → votes.ts} +1 -1
  324. package/src/tests/factories.ts +19 -21
  325. package/src/tests/mocks.ts +63 -39
  326. package/src/timetable/index.ts +308 -13
  327. package/src/trees/nullifier_leaf.ts +4 -0
  328. package/src/tx/block_header.ts +2 -2
  329. package/src/tx/fee_provider.ts +10 -0
  330. package/src/tx/global_variable_builder.ts +2 -3
  331. package/src/tx/index.ts +1 -0
  332. package/src/tx/indexed_tx_effect.ts +1 -2
  333. package/src/tx/profiling.ts +4 -4
  334. package/src/tx/simulated_tx.ts +6 -2
  335. package/src/tx/tx.ts +2 -2
  336. package/src/tx/tx_receipt.ts +11 -14
  337. package/src/types/shared.ts +0 -10
  338. package/src/vks/verification_key.ts +5 -184
  339. package/src/world-state/genesis_data.ts +15 -0
  340. package/src/world-state/index.ts +1 -0
  341. package/src/world-state/world_state_revision.ts +9 -1
  342. package/dest/abi/mocked_keys.d.ts +0 -2
  343. package/dest/abi/mocked_keys.d.ts.map +0 -1
  344. package/dest/abi/mocked_keys.js +0 -1
  345. package/dest/l1-contracts/slash_factory.d.ts +0 -45
  346. package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
  347. package/dest/l1-contracts/slash_factory.js +0 -158
  348. package/dest/slashing/empire.d.ts +0 -31
  349. package/dest/slashing/empire.d.ts.map +0 -1
  350. package/dest/slashing/empire.js +0 -87
  351. package/src/abi/mocked_keys.ts +0 -2
  352. package/src/l1-contracts/slash_factory.ts +0 -180
  353. package/src/slashing/empire.ts +0 -104
@@ -1,13 +1,13 @@
1
1
  import { ARCHIVE_HEIGHT, L1_TO_L2_MSG_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
2
2
  import { type L1ContractAddresses, L1ContractAddressesSchema } from '@aztec/ethereum/l1-contract-addresses';
3
3
  import {
4
- BlockNumber,
4
+ type BlockNumber,
5
5
  BlockNumberPositiveSchema,
6
6
  BlockNumberSchema,
7
- CheckpointNumber,
7
+ type CheckpointNumber,
8
8
  CheckpointNumberPositiveSchema,
9
9
  CheckpointNumberSchema,
10
- EpochNumber,
10
+ type EpochNumber,
11
11
  EpochNumberSchema,
12
12
  type SlotNumber,
13
13
  } from '@aztec/foundation/branded-types';
@@ -23,10 +23,8 @@ import { BlockHash } from '../block/block_hash.js';
23
23
  import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
24
24
  import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
25
25
  import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
26
- import { L2Block } from '../block/l2_block.js';
27
- import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
28
- import { CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
29
- import { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
26
+ import { type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
27
+ import { type CheckpointData, CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
30
28
  import {
31
29
  type ContractClassPublic,
32
30
  ContractClassPublicSchema,
@@ -37,6 +35,7 @@ import {
37
35
  type ProtocolContractAddresses,
38
36
  ProtocolContractAddressesSchema,
39
37
  } from '../contract/index.js';
38
+ import { ManaUsageEstimate } from '../gas/fee_math.js';
40
39
  import { GasFees } from '../gas/gas_fees.js';
41
40
  import { SiloedTag, Tag, TxScopedL2Log } from '../logs/index.js';
42
41
  import { type LogFilter, LogFilterSchema } from '../logs/log_filter.js';
@@ -60,6 +59,20 @@ import type { SingleValidatorStats, ValidatorsStats } from '../validators/types.
60
59
  import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
61
60
  import { type AllowedElement, AllowedElementSchema } from './allowed_element.js';
62
61
  import { MAX_RPC_BLOCKS_LEN, MAX_RPC_CHECKPOINTS_LEN, MAX_RPC_LEN, MAX_RPC_TXS_LEN } from './api_limit.js';
62
+ import {
63
+ type BlockIncludeOptions,
64
+ BlockIncludeOptionsSchema,
65
+ type BlockResponse,
66
+ BlockResponseSchema,
67
+ } from './block_response.js';
68
+ import { type ChainTip, ChainTipSchema, type ChainTips, ChainTipsSchema } from './chain_tips.js';
69
+ import { type CheckpointParameter, CheckpointParameterSchema } from './checkpoint_parameter.js';
70
+ import {
71
+ type CheckpointIncludeOptions,
72
+ CheckpointIncludeOptionsSchema,
73
+ type CheckpointResponse,
74
+ CheckpointResponseSchema,
75
+ } from './checkpoint_response.js';
63
76
  import {
64
77
  type GetContractClassLogsResponse,
65
78
  GetContractClassLogsResponseSchema,
@@ -72,21 +85,7 @@ import { type WorldStateSyncStatus, WorldStateSyncStatusSchema } from './world_s
72
85
  * The aztec node.
73
86
  * We will probably implement the additional interfaces by means other than Aztec Node as it's currently a privacy leak
74
87
  */
75
- export interface AztecNode
76
- extends Pick<
77
- L2BlockSource,
78
- | 'getBlocks'
79
- | 'getCheckpoints'
80
- | 'getBlockHeader'
81
- | 'getL2Tips'
82
- | 'getCheckpointedBlocks'
83
- | 'getCheckpointsDataForEpoch'
84
- > {
85
- /**
86
- * Returns the tips of the L2 chain.
87
- */
88
- getL2Tips(): Promise<L2Tips>;
89
-
88
+ export interface AztecNode {
90
89
  /**
91
90
  * Returns the sync status of the node's world state
92
91
  */
@@ -201,49 +200,76 @@ export interface AztecNode
201
200
  getL2ToL1Messages(epoch: EpochNumber): Promise<Fr[][][][]>;
202
201
 
203
202
  /**
204
- * Get a block specified by its block number or 'latest'.
205
- * @param blockParameter - The block parameter (block number, block hash, or 'latest').
206
- * @returns The requested block.
203
+ * Returns the block number at a given chain tip, or the latest proposed block number when
204
+ * `tip` is omitted.
207
205
  */
208
- getBlock(blockParameter: BlockParameter): Promise<L2Block | undefined>;
206
+ getBlockNumber(tip?: ChainTip): Promise<BlockNumber>;
209
207
 
210
208
  /**
211
- * Get a block specified by its hash.
212
- * @param blockHash - The block hash being requested.
213
- * @returns The requested block.
209
+ * Returns the checkpoint number at a given chain tip, or the latest checkpoint number when
210
+ * `tip` is omitted.
211
+ *
212
+ * @remarks **Semantic foot-gun**: block-side `'proposed'` means "latest proposed block" (chain
213
+ * head), but checkpoint-side `'proposed'` means "latest confirmed checkpoint" — pre-L1-confirm
214
+ * checkpoints are not exposed over RPC. `'checkpointed'` on the checkpoint side is equivalent.
214
215
  */
215
- getBlockByHash(blockHash: BlockHash): Promise<L2Block | undefined>;
216
+ getCheckpointNumber(tip?: ChainTip): Promise<CheckpointNumber>;
216
217
 
217
- /**
218
- * Get a block specified by its archive root.
219
- * @param archive - The archive root being requested.
220
- * @returns The requested block.
221
- */
222
- getBlockByArchive(archive: Fr): Promise<L2Block | undefined>;
218
+ /** Returns the tips of the L2 chain. */
219
+ getChainTips(): Promise<ChainTips>;
220
+
221
+ // TODO(spl/new-rpc-api): the following methods are kept on the interface as a stop-gap because
222
+ // `L2BlockStream` (used by PXE's block synchronizer) and `computeL2ToL1MembershipWitness` (used
223
+ // by end-to-end tests) still consume the internal archiver shapes. Remove them when those
224
+ // consumers are rewired to the unified `BlockResponse` / `CheckpointResponse` API.
225
+ /** @deprecated Scheduled for removal; use `getChainTips` for public callers. */
226
+ getL2Tips(): Promise<L2Tips>;
227
+ /** @deprecated Scheduled for removal; use `getBlock(param).then(r => r?.header)`. */
228
+ getBlockHeader(number: BlockNumber | 'latest'): Promise<BlockHeader | undefined>;
229
+ /** @deprecated Scheduled for removal; use `getBlocks(from, limit, { includeL1PublishInfo: true, includeAttestations: true })`. */
230
+ getCheckpointedBlocks(from: BlockNumber, limit: number): Promise<CheckpointedL2Block[]>;
231
+ /** @deprecated Scheduled for removal; use `getCheckpoints(from, limit)` over an explicit checkpoint range. */
232
+ getCheckpointsDataForEpoch(epoch: EpochNumber): Promise<CheckpointData[]>;
223
233
 
224
234
  /**
225
- * Method to fetch the latest block number synchronized by the node.
226
- * @returns The block number.
235
+ * Unified block fetch. Returns the block identified by `param`, with optional fields controlled
236
+ * by `options`.
237
+ * @param param - A block number, block hash, archive root, chain-tip name, or object variant.
238
+ * @param options - Narrowing options: `includeTransactions`, `includeL1PublishInfo`, `includeAttestations`.
227
239
  */
228
- getBlockNumber(): Promise<BlockNumber>;
240
+ getBlock<Opts extends BlockIncludeOptions = {}>(
241
+ param: BlockParameter,
242
+ options?: Opts,
243
+ ): Promise<BlockResponse<Opts> | undefined>;
229
244
 
230
245
  /**
231
- * Fetches the latest proven block number.
232
- * @returns The block number.
246
+ * Returns up to `limit` blocks starting from `from`, projected to the {@link BlockResponse}
247
+ * shape determined by `options`.
233
248
  */
234
- getProvenBlockNumber(): Promise<BlockNumber>;
249
+ getBlocks<Opts extends BlockIncludeOptions = {}>(
250
+ from: BlockNumber,
251
+ limit: number,
252
+ options?: Opts,
253
+ ): Promise<BlockResponse<Opts>[]>;
235
254
 
236
255
  /**
237
- * Fetches the latest checkpointed block number.
238
- * @returns The block number.
256
+ * Unified checkpoint fetch. Returns the checkpoint identified by `param`, with optional fields
257
+ * controlled by `options`.
239
258
  */
240
- getCheckpointedBlockNumber(): Promise<BlockNumber>;
259
+ getCheckpoint<Opts extends CheckpointIncludeOptions = {}>(
260
+ param: CheckpointParameter,
261
+ options?: Opts,
262
+ ): Promise<CheckpointResponse<Opts> | undefined>;
241
263
 
242
264
  /**
243
- * Method to fetch the latest checkpoint number synchronized by the node.
244
- * @returns The checkpoint number.
265
+ * Returns up to `limit` checkpoints starting from `from`, projected to the
266
+ * {@link CheckpointResponse} shape determined by `options`.
245
267
  */
246
- getCheckpointNumber(): Promise<CheckpointNumber>;
268
+ getCheckpoints<Opts extends CheckpointIncludeOptions = {}>(
269
+ from: CheckpointNumber,
270
+ limit: number,
271
+ options?: Opts,
272
+ ): Promise<CheckpointResponse<Opts>[]>;
247
273
 
248
274
  /**
249
275
  * Method to determine if the node is ready to accept transactions.
@@ -258,20 +284,21 @@ export interface AztecNode
258
284
  */
259
285
  getNodeInfo(): Promise<NodeInfo>;
260
286
 
261
- /**
262
- * Method to request blocks. Will attempt to return all requested blocks but will return only those available.
263
- * @param from - The start of the range of blocks to return.
264
- * @param limit - The maximum number of blocks to return.
265
- * @returns The blocks requested.
266
- */
267
- getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
268
-
269
287
  /**
270
288
  * Method to fetch the current min fees.
271
289
  * @returns The current min fees.
272
290
  */
273
291
  getCurrentMinFees(): Promise<GasFees>;
274
292
 
293
+ /**
294
+ * Returns predicted min fees for the current slot and next N slots.
295
+ * Each entry accounts for the L1 gas oracle transition and congestion growth based on the
296
+ * given mana usage estimate. Defaults to target usage (steady state).
297
+ * @param manaUsage - Expected mana usage per checkpoint (none, target, or limit).
298
+ * @returns An array of GasFees, one per slot in the prediction window.
299
+ */
300
+ getPredictedMinFees(manaUsage?: ManaUsageEstimate): Promise<GasFees[]>;
301
+
275
302
  /**
276
303
  * Method to fetch the current max priority fee of txs in the mempool.
277
304
  * @returns The current max priority fees.
@@ -424,20 +451,6 @@ export interface AztecNode
424
451
  */
425
452
  getPublicStorageAt(referenceBlock: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
426
453
 
427
- /**
428
- * Returns the block header for a given block number, block hash, or 'latest'.
429
- * @param block - The block parameter (block number, block hash, or 'latest'). Defaults to 'latest'.
430
- * @returns The requested block header.
431
- */
432
- getBlockHeader(block?: BlockParameter): Promise<BlockHeader | undefined>;
433
-
434
- /**
435
- * Get a block header specified by its archive root.
436
- * @param archive - The archive root being requested.
437
- * @returns The requested block header.
438
- */
439
- getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined>;
440
-
441
454
  /** Returns stats for validators if enabled. */
442
455
  getValidatorsStats(): Promise<ValidatorsStats>;
443
456
 
@@ -493,8 +506,6 @@ const MAX_SIGNATURES_PER_REGISTER_CALL = 100;
493
506
  const MAX_SIGNATURE_LEN = 10000;
494
507
 
495
508
  export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
496
- getL2Tips: z.function().args().returns(L2TipsSchema),
497
-
498
509
  getWorldStateSyncStatus: z.function().args().returns(WorldStateSyncStatusSchema),
499
510
 
500
511
  findLeavesIndexes: z
@@ -541,43 +552,61 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
541
552
  .args(EpochNumberSchema)
542
553
  .returns(z.array(z.array(z.array(z.array(schemas.Fr))))),
543
554
 
544
- getBlock: z.function().args(BlockParameterSchema).returns(L2Block.schema.optional()),
545
-
546
- getBlockByHash: z.function().args(BlockHash.schema).returns(L2Block.schema.optional()),
555
+ getBlockNumber: z.function().args(optional(ChainTipSchema)).returns(BlockNumberSchema),
547
556
 
548
- getBlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
557
+ getCheckpointNumber: z.function().args(optional(ChainTipSchema)).returns(CheckpointNumberSchema),
549
558
 
550
- getBlockNumber: z.function().returns(BlockNumberSchema),
559
+ getChainTips: z.function().args().returns(ChainTipsSchema),
551
560
 
552
- getCheckpointNumber: z.function().returns(CheckpointNumberSchema),
561
+ getL2Tips: z.function().args().returns(L2TipsSchema),
553
562
 
554
- getProvenBlockNumber: z.function().returns(BlockNumberSchema),
563
+ getBlockHeader: z
564
+ .function()
565
+ .args(z.union([BlockNumberSchema, z.literal('latest')]))
566
+ .returns(BlockHeader.schema.optional()),
555
567
 
556
- getCheckpointedBlockNumber: z.function().returns(BlockNumberSchema),
568
+ getCheckpointedBlocks: z
569
+ .function()
570
+ .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
571
+ .returns(z.array(CheckpointedL2Block.schema)),
557
572
 
558
- isReady: z.function().returns(z.boolean()),
573
+ getCheckpointsDataForEpoch: z.function().args(EpochNumberSchema).returns(z.array(CheckpointDataSchema)),
559
574
 
560
- getNodeInfo: z.function().returns(NodeInfoSchema),
575
+ getBlock: z
576
+ .function()
577
+ .args(BlockParameterSchema, optional(BlockIncludeOptionsSchema))
578
+ .returns(BlockResponseSchema.optional()),
561
579
 
562
580
  getBlocks: z
563
581
  .function()
564
- .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
565
- .returns(z.array(L2Block.schema)),
582
+ .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN), optional(BlockIncludeOptionsSchema))
583
+ .returns(z.array(BlockResponseSchema)),
566
584
 
567
- getCheckpoints: z
585
+ getCheckpoint: z
568
586
  .function()
569
- .args(CheckpointNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_CHECKPOINTS_LEN))
570
- .returns(z.array(PublishedCheckpoint.schema)),
587
+ .args(CheckpointParameterSchema, optional(CheckpointIncludeOptionsSchema))
588
+ .returns(CheckpointResponseSchema.optional()),
571
589
 
572
- getCheckpointedBlocks: z
590
+ getCheckpoints: z
573
591
  .function()
574
- .args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
575
- .returns(z.array(CheckpointedL2Block.schema)),
592
+ .args(
593
+ CheckpointNumberPositiveSchema,
594
+ z.number().gt(0).lte(MAX_RPC_CHECKPOINTS_LEN),
595
+ optional(CheckpointIncludeOptionsSchema),
596
+ )
597
+ .returns(z.array(CheckpointResponseSchema)),
576
598
 
577
- getCheckpointsDataForEpoch: z.function().args(EpochNumberSchema).returns(z.array(CheckpointDataSchema)),
599
+ isReady: z.function().returns(z.boolean()),
600
+
601
+ getNodeInfo: z.function().returns(NodeInfoSchema),
578
602
 
579
603
  getCurrentMinFees: z.function().returns(GasFees.schema),
580
604
 
605
+ getPredictedMinFees: z
606
+ .function()
607
+ .args(optional(z.nativeEnum(ManaUsageEstimate)))
608
+ .returns(z.array(GasFees.schema)),
609
+
581
610
  getMaxPriorityFees: z.function().returns(GasFees.schema),
582
611
 
583
612
  getNodeVersion: z.function().returns(z.string()),
@@ -633,10 +662,6 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
633
662
 
634
663
  getPublicStorageAt: z.function().args(BlockParameterSchema, schemas.AztecAddress, schemas.Fr).returns(schemas.Fr),
635
664
 
636
- getBlockHeader: z.function().args(optional(BlockParameterSchema)).returns(BlockHeader.schema.optional()),
637
-
638
- getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
639
-
640
665
  getValidatorsStats: z.function().returns(ValidatorsStatsSchema),
641
666
 
642
667
  getValidatorStats: z
@@ -0,0 +1,79 @@
1
+ import {
2
+ BlockNumberSchema,
3
+ CheckpointNumberSchema,
4
+ IndexWithinCheckpointSchema,
5
+ } from '@aztec/foundation/branded-types';
6
+ import type { BlockNumber, CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
7
+ import type { IfFlag, Prettify } from '@aztec/foundation/types';
8
+
9
+ import { z } from 'zod';
10
+
11
+ import { BlockHash } from '../block/block_hash.js';
12
+ import { Body } from '../block/body.js';
13
+ import { CommitteeAttestation } from '../block/proposal/committee_attestation.js';
14
+ import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
15
+ import { BlockHeader } from '../tx/block_header.js';
16
+ import { type L1PublishInfo, L1PublishInfoSchema } from './l1_publish_info.js';
17
+
18
+ /** Options for narrowing the response of `getBlock` / `getBlocks`. */
19
+ export type BlockIncludeOptions = {
20
+ /** Include the block body (tx effects). Off by default. */
21
+ includeTransactions?: boolean;
22
+ /** Include L1 publish info (populated with `published: false` if not yet on L1). Off by default. */
23
+ includeL1PublishInfo?: boolean;
24
+ /** Include committee attestations. Empty array until the block's checkpoint is published. Off by default. */
25
+ includeAttestations?: boolean;
26
+ };
27
+
28
+ export const BlockIncludeOptionsSchema: z.ZodType<BlockIncludeOptions> = z.object({
29
+ includeTransactions: z.boolean().optional(),
30
+ includeL1PublishInfo: z.boolean().optional(),
31
+ includeAttestations: z.boolean().optional(),
32
+ });
33
+
34
+ /** Required metadata always present on a {@link BlockResponse}. */
35
+ export type BlockResponseBase = {
36
+ /** Block header. */
37
+ header: BlockHeader;
38
+ /** Archive tree snapshot after this block. */
39
+ archive: AppendOnlyTreeSnapshot;
40
+ /** Hash of the block header. */
41
+ hash: BlockHash;
42
+ /** Checkpoint number this block belongs to. */
43
+ checkpointNumber: CheckpointNumber;
44
+ /** Position of the block within its checkpoint. */
45
+ indexWithinCheckpoint: IndexWithinCheckpoint;
46
+ /** L2 block number. */
47
+ number: BlockNumber;
48
+ };
49
+
50
+ /**
51
+ * RPC-surface representation of an L2 block.
52
+ *
53
+ * Generic over the include-options so that flagged fields become required when the caller passes a
54
+ * literal `true`. The default type argument ({@link BlockIncludeOptions}) yields the widest shape
55
+ * (all include-fields optional) — this is what the JSON-RPC wire layer validates against.
56
+ *
57
+ * @example
58
+ * const b: BlockResponse<{ includeTransactions: true }> = await node.getBlock(1, { includeTransactions: true });
59
+ * b.body; // required, not optional
60
+ */
61
+ export type BlockResponse<Opts extends BlockIncludeOptions = BlockIncludeOptions> = Prettify<
62
+ BlockResponseBase &
63
+ IfFlag<BlockIncludeOptions, Opts, 'includeTransactions', { body: Body }> &
64
+ IfFlag<BlockIncludeOptions, Opts, 'includeL1PublishInfo', { l1: L1PublishInfo }> &
65
+ IfFlag<BlockIncludeOptions, Opts, 'includeAttestations', { attestations: CommitteeAttestation[] }>
66
+ >;
67
+
68
+ /** Zod schema for the widest {@link BlockResponse} shape (all include-gated fields optional). */
69
+ export const BlockResponseSchema = z.object({
70
+ header: BlockHeader.schema,
71
+ archive: AppendOnlyTreeSnapshot.schema,
72
+ hash: BlockHash.schema,
73
+ checkpointNumber: CheckpointNumberSchema,
74
+ indexWithinCheckpoint: IndexWithinCheckpointSchema,
75
+ number: BlockNumberSchema,
76
+ body: Body.schema.optional(),
77
+ l1: L1PublishInfoSchema.optional(),
78
+ attestations: z.array(CommitteeAttestation.schema).optional(),
79
+ });
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+
3
+ import { type L2BlockTag, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
4
+
5
+ /**
6
+ * Public chain-tip selectors usable in RPC requests.
7
+ * Omits internal-only tags (e.g. `proposedCheckpoint`) from {@link L2BlockTag}.
8
+ */
9
+ export type ChainTip = Exclude<L2BlockTag, 'proposedCheckpoint'>;
10
+
11
+ export const ChainTipSchema = z.union([
12
+ z.literal('proposed'),
13
+ z.literal('checkpointed'),
14
+ z.literal('proven'),
15
+ z.literal('finalized'),
16
+ ]) satisfies z.ZodType<ChainTip>;
17
+
18
+ /**
19
+ * Tips of the L2 chain.
20
+ * Omits the sequencer-internal `proposedCheckpoint` from the public RPC surface.
21
+ */
22
+ export type ChainTips = Omit<L2Tips, 'proposedCheckpoint'>;
23
+
24
+ export const ChainTipsSchema = L2TipsSchema.omit({ proposedCheckpoint: true });
@@ -0,0 +1,22 @@
1
+ import { CheckpointNumberSchema, SlotNumberSchema } from '@aztec/foundation/branded-types';
2
+
3
+ import { z } from 'zod';
4
+
5
+ import { ChainTipSchema } from './chain_tips.js';
6
+
7
+ /**
8
+ * Selector for a checkpoint in RPC calls.
9
+ *
10
+ * Accepts a numeric checkpoint number (or `{ number }`), a slot number (`{ slot }`), a chain-tip
11
+ * name (e.g. `'proven'`), or `'latest'` (alias for `'proposed'` — on the checkpoint side, this
12
+ * means the most recent confirmed checkpoint).
13
+ */
14
+ export const CheckpointParameterSchema = z.union([
15
+ CheckpointNumberSchema,
16
+ ChainTipSchema,
17
+ z.literal('latest'),
18
+ z.object({ number: CheckpointNumberSchema }),
19
+ z.object({ slot: SlotNumberSchema }),
20
+ ]);
21
+
22
+ export type CheckpointParameter = z.infer<typeof CheckpointParameterSchema>;
@@ -0,0 +1,84 @@
1
+ import { BlockNumberSchema, CheckpointNumberSchema } from '@aztec/foundation/branded-types';
2
+ import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
+ import { schemas } from '@aztec/foundation/schemas';
5
+ import type { IfFlag, Prettify } from '@aztec/foundation/types';
6
+
7
+ import { z } from 'zod';
8
+
9
+ import { CommitteeAttestation } from '../block/proposal/committee_attestation.js';
10
+ import { CheckpointHeader } from '../rollup/checkpoint_header.js';
11
+ import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
12
+ import { type BlockResponse, BlockResponseSchema } from './block_response.js';
13
+ import { type L1PublishInfo, L1PublishInfoSchema } from './l1_publish_info.js';
14
+
15
+ /** Options for narrowing the response of `getCheckpoint` / `getCheckpoints`. */
16
+ export type CheckpointIncludeOptions = {
17
+ /** Include the nested blocks. Off by default. */
18
+ includeBlocks?: boolean;
19
+ /** When `includeBlocks` is true, include each block's body (tx effects). Off by default. No-op if `includeBlocks` is false. */
20
+ includeTransactions?: boolean;
21
+ /** Include L1 publish info. Off by default. */
22
+ includeL1PublishInfo?: boolean;
23
+ /** Include committee attestations. Off by default. */
24
+ includeAttestations?: boolean;
25
+ };
26
+
27
+ export const CheckpointIncludeOptionsSchema: z.ZodType<CheckpointIncludeOptions> = z.object({
28
+ includeBlocks: z.boolean().optional(),
29
+ includeTransactions: z.boolean().optional(),
30
+ includeL1PublishInfo: z.boolean().optional(),
31
+ includeAttestations: z.boolean().optional(),
32
+ });
33
+
34
+ /** Required metadata always present on a {@link CheckpointResponse}. */
35
+ export type CheckpointResponseBase = {
36
+ /** Checkpoint number. */
37
+ number: CheckpointNumber;
38
+ /** Checkpoint header. */
39
+ header: CheckpointHeader;
40
+ /** Archive tree snapshot after this checkpoint. */
41
+ archive: AppendOnlyTreeSnapshot;
42
+ /** Hash of the checkpoint out messages. */
43
+ checkpointOutHash: Fr;
44
+ /** First block number in this checkpoint. */
45
+ startBlock: BlockNumber;
46
+ /** Number of blocks in this checkpoint. */
47
+ blockCount: number;
48
+ /** Fee asset price modifier in basis points applied during this checkpoint. */
49
+ feeAssetPriceModifier: bigint;
50
+ };
51
+
52
+ // Only forward `includeTransactions` to nested blocks — the other include-flags on the checkpoint
53
+ // options do not apply to the nested block responses (those carry no independent L1 / attestations).
54
+ type NestedBlockOpts<Opts> = Opts extends { includeTransactions: true } ? { includeTransactions: true } : {};
55
+
56
+ /**
57
+ * RPC-surface representation of an L2 checkpoint.
58
+ *
59
+ * Generic over the include-options so that flagged fields become required when the caller passes a
60
+ * literal `true`. Only `includeTransactions` is forwarded to nested blocks, so
61
+ * `includeL1PublishInfo` / `includeAttestations` on a checkpoint request do not imply the same on
62
+ * its nested blocks. The default type argument ({@link CheckpointIncludeOptions}) yields the
63
+ * widest shape — what the JSON-RPC wire layer validates against.
64
+ */
65
+ export type CheckpointResponse<Opts extends CheckpointIncludeOptions = CheckpointIncludeOptions> = Prettify<
66
+ CheckpointResponseBase &
67
+ IfFlag<CheckpointIncludeOptions, Opts, 'includeBlocks', { blocks: BlockResponse<NestedBlockOpts<Opts>>[] }> &
68
+ IfFlag<CheckpointIncludeOptions, Opts, 'includeL1PublishInfo', { l1: L1PublishInfo }> &
69
+ IfFlag<CheckpointIncludeOptions, Opts, 'includeAttestations', { attestations: CommitteeAttestation[] }>
70
+ >;
71
+
72
+ /** Zod schema for the widest {@link CheckpointResponse} shape (all include-gated fields optional). */
73
+ export const CheckpointResponseSchema = z.object({
74
+ number: CheckpointNumberSchema,
75
+ header: CheckpointHeader.schema,
76
+ archive: AppendOnlyTreeSnapshot.schema,
77
+ checkpointOutHash: schemas.Fr,
78
+ startBlock: BlockNumberSchema,
79
+ blockCount: z.number(),
80
+ feeAssetPriceModifier: schemas.BigInt,
81
+ blocks: z.array(BlockResponseSchema).optional(),
82
+ l1: L1PublishInfoSchema.optional(),
83
+ attestations: z.array(CommitteeAttestation.schema).optional(),
84
+ });
@@ -1,5 +1,11 @@
1
1
  export * from './aztec-node.js';
2
2
  export * from './aztec-node-admin.js';
3
+ export * from './aztec-node-debug.js';
4
+ export * from './block_response.js';
5
+ export * from './chain_tips.js';
6
+ export * from './checkpoint_parameter.js';
7
+ export * from './checkpoint_response.js';
8
+ export * from './l1_publish_info.js';
3
9
  export * from './private_kernel_prover.js';
4
10
  export * from './get_logs_response.js';
5
11
  export * from './api_limit.js';
@@ -83,6 +83,8 @@ export interface SequencerConfig {
83
83
  minBlocksForCheckpoint?: number;
84
84
  /** Skip publishing checkpoint proposals probability (for testing checkpoint prunes only) */
85
85
  skipPublishingCheckpointsPercent?: number;
86
+ /** Skip broadcasting checkpoint and block proposals via gossipsub when proposer (for testing only) */
87
+ skipBroadcastProposals?: boolean;
86
88
  }
87
89
 
88
90
  export const SequencerConfigSchema = zodFor<SequencerConfig>()(
@@ -124,6 +126,7 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
124
126
  skipPushProposedBlocksToArchiver: z.boolean().optional(),
125
127
  minBlocksForCheckpoint: z.number().positive().optional(),
126
128
  skipPublishingCheckpointsPercent: z.number().gte(0).lte(100).optional(),
129
+ skipBroadcastProposals: z.boolean().optional(),
127
130
  }),
128
131
  );
129
132
 
@@ -145,7 +148,8 @@ type SequencerConfigOptionalKeys =
145
148
  | 'maxTxsPerCheckpoint'
146
149
  | 'maxL2BlockGas'
147
150
  | 'maxDABlockGas'
148
- | 'redistributeCheckpointBudget';
151
+ | 'redistributeCheckpointBudget'
152
+ | 'skipBroadcastProposals';
149
153
 
150
154
  export type ResolvedSequencerConfig = Prettify<
151
155
  Required<Omit<SequencerConfig, SequencerConfigOptionalKeys>> & Pick<SequencerConfig, SequencerConfigOptionalKeys>
@@ -0,0 +1,40 @@
1
+ import { schemas } from '@aztec/foundation/schemas';
2
+
3
+ import { z } from 'zod';
4
+
5
+ import { L1PublishedData } from '../checkpoint/published_checkpoint.js';
6
+
7
+ /**
8
+ * L1 publication info for a block or checkpoint.
9
+ *
10
+ * A discriminated union over `published`: when `false`, the block/checkpoint has not yet been
11
+ * published to L1. When `true`, the L1 block info (number, timestamp, hash) is present.
12
+ *
13
+ * Distinct from {@link L1PublishedData}, which is always the "published" case.
14
+ */
15
+ export type L1PublishInfo =
16
+ | { published: false }
17
+ | { published: true; blockNumber: bigint; timestamp: bigint; blockHash: string };
18
+
19
+ export const L1PublishInfoSchema = z.union([
20
+ z.object({ published: z.literal(false) }),
21
+ z.object({
22
+ published: z.literal(true),
23
+ blockNumber: schemas.BigInt,
24
+ timestamp: schemas.BigInt,
25
+ blockHash: z.string(),
26
+ }),
27
+ ]);
28
+
29
+ /** Projects the internal {@link L1PublishedData} (or its absence) to the public {@link L1PublishInfo} shape. */
30
+ export function l1PublishInfoFromL1PublishedData(data: L1PublishedData | undefined): L1PublishInfo {
31
+ if (!data) {
32
+ return { published: false };
33
+ }
34
+ return {
35
+ published: true,
36
+ blockNumber: data.blockNumber,
37
+ timestamp: data.timestamp,
38
+ blockHash: data.blockHash,
39
+ };
40
+ }
@@ -3,6 +3,7 @@ import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { type IndexedTreeLeafPreimage, SiblingPath } from '@aztec/foundation/trees';
5
5
 
6
+ import type { BlockHash } from '../block/block_hash.js';
6
7
  import type { MerkleTreeId, TreeHeights } from '../trees/merkle_tree_id.js';
7
8
  import type { NullifierLeaf } from '../trees/nullifier_leaf.js';
8
9
  import type { PublicDataTreeLeaf } from '../trees/public_data_leaf.js';
@@ -99,7 +100,7 @@ type LeafTypes = {
99
100
  [MerkleTreeId.NOTE_HASH_TREE]: Fr;
100
101
  [MerkleTreeId.PUBLIC_DATA_TREE]: Buffer;
101
102
  [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: Fr;
102
- [MerkleTreeId.ARCHIVE]: Fr;
103
+ [MerkleTreeId.ARCHIVE]: BlockHash;
103
104
  };
104
105
 
105
106
  type LeafValueTypes = {
@@ -107,7 +108,7 @@ type LeafValueTypes = {
107
108
  [MerkleTreeId.NOTE_HASH_TREE]: Fr;
108
109
  [MerkleTreeId.PUBLIC_DATA_TREE]: PublicDataTreeLeaf;
109
110
  [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: Fr;
110
- [MerkleTreeId.ARCHIVE]: Fr;
111
+ [MerkleTreeId.ARCHIVE]: BlockHash;
111
112
  };
112
113
 
113
114
  export type MerkleTreeLeafType<ID extends MerkleTreeId> = LeafTypes[ID];