@aztec/stdlib 0.0.1-commit.c7c42ec → 0.0.1-commit.f295ac2

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 (499) hide show
  1. package/dest/abi/contract_artifact.d.ts +2 -2
  2. package/dest/abi/contract_artifact.d.ts.map +1 -1
  3. package/dest/abi/contract_artifact.js +1 -1
  4. package/dest/abi/function_call.d.ts +9 -1
  5. package/dest/abi/function_call.d.ts.map +1 -1
  6. package/dest/abi/selector.js +3 -1
  7. package/dest/abi/utils.d.ts +7 -1
  8. package/dest/abi/utils.d.ts.map +1 -1
  9. package/dest/abi/utils.js +7 -0
  10. package/dest/auth_witness/auth_witness.d.ts +2 -1
  11. package/dest/auth_witness/auth_witness.d.ts.map +1 -1
  12. package/dest/avm/avm.d.ts +62 -62
  13. package/dest/avm/avm_accumulated_data.d.ts +30 -3
  14. package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
  15. package/dest/avm/avm_accumulated_data.js +5 -2
  16. package/dest/avm/avm_circuit_public_inputs.d.ts +9 -9
  17. package/dest/avm/avm_circuit_public_inputs.js +3 -1
  18. package/dest/avm/avm_proving_request.d.ts +299 -299
  19. package/dest/avm/contract_storage_read.d.ts +13 -1
  20. package/dest/avm/contract_storage_read.d.ts.map +1 -1
  21. package/dest/avm/contract_storage_update_request.d.ts +13 -1
  22. package/dest/avm/contract_storage_update_request.d.ts.map +1 -1
  23. package/dest/avm/public_call_stack_item_compressed.d.ts +3 -1
  24. package/dest/avm/public_call_stack_item_compressed.d.ts.map +1 -1
  25. package/dest/avm/public_data_read.d.ts +10 -1
  26. package/dest/avm/public_data_read.d.ts.map +1 -1
  27. package/dest/avm/public_data_update_request.d.ts +10 -1
  28. package/dest/avm/public_data_update_request.d.ts.map +1 -1
  29. package/dest/avm/public_data_update_request.js +3 -1
  30. package/dest/avm/public_data_write.d.ts +7 -1
  31. package/dest/avm/public_data_write.d.ts.map +1 -1
  32. package/dest/avm/public_inner_call_request.d.ts +4 -1
  33. package/dest/avm/public_inner_call_request.d.ts.map +1 -1
  34. package/dest/avm/public_inner_call_request.js +3 -1
  35. package/dest/avm/revert_code.d.ts +4 -4
  36. package/dest/avm/revert_code.d.ts.map +1 -1
  37. package/dest/avm/revert_code.js +3 -1
  38. package/dest/aztec-address/index.js +4 -2
  39. package/dest/block/attestation_info.d.ts +5 -5
  40. package/dest/block/attestation_info.d.ts.map +1 -1
  41. package/dest/block/attestation_info.js +4 -4
  42. package/dest/block/block_hash.d.ts +7 -1
  43. package/dest/block/block_hash.d.ts.map +1 -1
  44. package/dest/block/block_hash.js +12 -0
  45. package/dest/block/block_parameter.d.ts +4 -3
  46. package/dest/block/block_parameter.d.ts.map +1 -1
  47. package/dest/block/block_parameter.js +2 -0
  48. package/dest/block/body.d.ts +1 -1
  49. package/dest/block/body.d.ts.map +1 -1
  50. package/dest/block/body.js +5 -2
  51. package/dest/block/checkpointed_l2_block.d.ts +16 -133
  52. package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
  53. package/dest/block/checkpointed_l2_block.js +5 -43
  54. package/dest/block/in_block.d.ts +3 -3
  55. package/dest/block/in_block.d.ts.map +1 -1
  56. package/dest/block/index.d.ts +1 -3
  57. package/dest/block/index.d.ts.map +1 -1
  58. package/dest/block/index.js +0 -2
  59. package/dest/block/l2_block_new.d.ts +20 -13
  60. package/dest/block/l2_block_new.d.ts.map +1 -1
  61. package/dest/block/l2_block_new.js +13 -7
  62. package/dest/block/l2_block_source.d.ts +276 -55
  63. package/dest/block/l2_block_source.d.ts.map +1 -1
  64. package/dest/block/l2_block_source.js +25 -6
  65. package/dest/block/l2_block_stream/index.d.ts +2 -1
  66. package/dest/block/l2_block_stream/index.d.ts.map +1 -1
  67. package/dest/block/l2_block_stream/index.js +1 -0
  68. package/dest/block/l2_block_stream/interfaces.d.ts +15 -5
  69. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  70. package/dest/block/l2_block_stream/l2_block_stream.d.ts +4 -2
  71. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  72. package/dest/block/l2_block_stream/l2_block_stream.js +93 -30
  73. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +24 -16
  74. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
  75. package/dest/block/l2_block_stream/l2_tips_memory_store.js +55 -61
  76. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +49 -0
  77. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -0
  78. package/dest/block/l2_block_stream/l2_tips_store_base.js +179 -0
  79. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  80. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  81. package/dest/block/test/l2_tips_store_test_suite.js +478 -38
  82. package/dest/block/validate_block_result.d.ts +24 -24
  83. package/dest/block/validate_block_result.d.ts.map +1 -1
  84. package/dest/block/validate_block_result.js +18 -17
  85. package/dest/checkpoint/checkpoint.d.ts +24 -14
  86. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  87. package/dest/checkpoint/checkpoint.js +16 -3
  88. package/dest/checkpoint/checkpoint_info.d.ts +32 -3
  89. package/dest/checkpoint/checkpoint_info.d.ts.map +1 -1
  90. package/dest/checkpoint/checkpoint_info.js +34 -1
  91. package/dest/checkpoint/index.d.ts +2 -1
  92. package/dest/checkpoint/index.d.ts.map +1 -1
  93. package/dest/checkpoint/index.js +1 -0
  94. package/dest/checkpoint/published_checkpoint.d.ts +15 -13
  95. package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
  96. package/dest/checkpoint/published_checkpoint.js +4 -3
  97. package/dest/contract/complete_address.d.ts +4 -1
  98. package/dest/contract/complete_address.d.ts.map +1 -1
  99. package/dest/contract/contract_deployment_data.d.ts +5 -5
  100. package/dest/contract/index.d.ts +1 -3
  101. package/dest/contract/index.d.ts.map +1 -1
  102. package/dest/contract/index.js +0 -2
  103. package/dest/contract/interfaces/contract_instance.d.ts +16 -16
  104. package/dest/database-version/version_manager.d.ts +4 -2
  105. package/dest/database-version/version_manager.d.ts.map +1 -1
  106. package/dest/database-version/version_manager.js +3 -1
  107. package/dest/deserialization/index.d.ts +11 -0
  108. package/dest/deserialization/index.d.ts.map +1 -0
  109. package/dest/deserialization/index.js +10 -0
  110. package/dest/errors/proving_error.d.ts +2 -2
  111. package/dest/errors/proving_error.d.ts.map +1 -1
  112. package/dest/gas/gas.js +3 -1
  113. package/dest/gas/gas_fees.js +3 -1
  114. package/dest/interfaces/api_limit.d.ts +2 -1
  115. package/dest/interfaces/api_limit.d.ts.map +1 -1
  116. package/dest/interfaces/api_limit.js +1 -0
  117. package/dest/interfaces/archiver.d.ts +6 -6
  118. package/dest/interfaces/archiver.d.ts.map +1 -1
  119. package/dest/interfaces/archiver.js +16 -12
  120. package/dest/interfaces/aztec-node-admin.d.ts +64 -31
  121. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  122. package/dest/interfaces/aztec-node-admin.js +2 -2
  123. package/dest/interfaces/aztec-node.d.ts +45 -49
  124. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  125. package/dest/interfaces/aztec-node.js +15 -12
  126. package/dest/interfaces/block-builder.d.ts +19 -17
  127. package/dest/interfaces/block-builder.d.ts.map +1 -1
  128. package/dest/interfaces/configs.d.ts +12 -7
  129. package/dest/interfaces/configs.d.ts.map +1 -1
  130. package/dest/interfaces/configs.js +2 -1
  131. package/dest/interfaces/get_logs_response.d.ts +1 -1
  132. package/dest/interfaces/p2p.d.ts +7 -9
  133. package/dest/interfaces/p2p.d.ts.map +1 -1
  134. package/dest/interfaces/p2p.js +3 -4
  135. package/dest/interfaces/proving-job.d.ts +184 -184
  136. package/dest/interfaces/proving-job.d.ts.map +1 -1
  137. package/dest/interfaces/proving-job.js +1 -7
  138. package/dest/interfaces/server_circuit_prover.d.ts +4 -3
  139. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  140. package/dest/interfaces/validator.d.ts +108 -18
  141. package/dest/interfaces/validator.d.ts.map +1 -1
  142. package/dest/interfaces/validator.js +5 -3
  143. package/dest/kernel/claimed_length_array.js +3 -1
  144. package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -5
  145. package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
  146. package/dest/kernel/hints/build_note_hash_read_request_hints.js +19 -10
  147. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +1 -1
  148. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  149. package/dest/kernel/hints/build_nullifier_read_request_hints.js +14 -4
  150. package/dest/kernel/hints/key_validation_hint.d.ts +2 -1
  151. package/dest/kernel/hints/key_validation_hint.d.ts.map +1 -1
  152. package/dest/kernel/hints/key_validation_request.d.ts +2 -1
  153. package/dest/kernel/hints/key_validation_request.d.ts.map +1 -1
  154. package/dest/kernel/hints/key_validation_request_and_generator.d.ts +6 -1
  155. package/dest/kernel/hints/key_validation_request_and_generator.d.ts.map +1 -1
  156. package/dest/kernel/hints/private_kernel_reset_hints.d.ts +13 -1
  157. package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
  158. package/dest/kernel/hints/read_request.d.ts +7 -1
  159. package/dest/kernel/hints/read_request.d.ts.map +1 -1
  160. package/dest/kernel/hints/read_request_hints.d.ts +7 -1
  161. package/dest/kernel/hints/read_request_hints.d.ts.map +1 -1
  162. package/dest/kernel/hints/transient_data_squashing_hint.js +3 -1
  163. package/dest/kernel/log_hash.js +3 -1
  164. package/dest/kernel/private_accumulated_data.d.ts +23 -1
  165. package/dest/kernel/private_accumulated_data.d.ts.map +1 -1
  166. package/dest/kernel/private_call_data.d.ts +25 -1
  167. package/dest/kernel/private_call_data.d.ts.map +1 -1
  168. package/dest/kernel/private_call_request.d.ts +16 -1
  169. package/dest/kernel/private_call_request.d.ts.map +1 -1
  170. package/dest/kernel/private_circuit_public_inputs.d.ts +74 -1
  171. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  172. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +31 -1
  173. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  174. package/dest/kernel/private_kernel_data.d.ts +7 -1
  175. package/dest/kernel/private_kernel_data.d.ts.map +1 -1
  176. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +22 -1
  177. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
  178. package/dest/kernel/private_kernel_inner_circuit_private_inputs.d.ts +7 -1
  179. package/dest/kernel/private_kernel_inner_circuit_private_inputs.d.ts.map +1 -1
  180. package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts +4 -1
  181. package/dest/kernel/private_kernel_reset_circuit_private_inputs.d.ts.map +1 -1
  182. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +10 -1
  183. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
  184. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +23 -1
  185. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
  186. package/dest/kernel/private_log_data.js +5 -2
  187. package/dest/kernel/private_to_avm_accumulated_data.d.ts +2 -2
  188. package/dest/kernel/private_to_avm_accumulated_data.js +5 -2
  189. package/dest/kernel/private_to_public_accumulated_data.js +3 -1
  190. package/dest/kernel/private_to_rollup_accumulated_data.d.ts +17 -1
  191. package/dest/kernel/private_to_rollup_accumulated_data.d.ts.map +1 -1
  192. package/dest/kernel/private_to_rollup_accumulated_data.js +3 -1
  193. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +16 -1
  194. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
  195. package/dest/kernel/private_validation_requests.d.ts +10 -1
  196. package/dest/kernel/private_validation_requests.d.ts.map +1 -1
  197. package/dest/kernel/private_validation_requests.js +3 -1
  198. package/dest/kernel/public_call_request.d.ts +22 -1
  199. package/dest/kernel/public_call_request.d.ts.map +1 -1
  200. package/dest/kernel/public_call_request.js +5 -2
  201. package/dest/kernel/utils/optional_number.d.ts +7 -1
  202. package/dest/kernel/utils/optional_number.d.ts.map +1 -1
  203. package/dest/keys/public_keys.d.ts +5 -1
  204. package/dest/keys/public_keys.d.ts.map +1 -1
  205. package/dest/logs/contract_class_log.js +3 -1
  206. package/dest/logs/extended_contract_class_log.d.ts +3 -1
  207. package/dest/logs/extended_contract_class_log.d.ts.map +1 -1
  208. package/dest/logs/extended_public_log.d.ts +5 -3
  209. package/dest/logs/extended_public_log.d.ts.map +1 -1
  210. package/dest/logs/log_id.d.ts +5 -1
  211. package/dest/logs/log_id.d.ts.map +1 -1
  212. package/dest/logs/private_log.js +3 -1
  213. package/dest/logs/public_log.js +3 -1
  214. package/dest/messaging/in_hash.d.ts +4 -2
  215. package/dest/messaging/in_hash.d.ts.map +1 -1
  216. package/dest/messaging/in_hash.js +3 -1
  217. package/dest/messaging/inbox_leaf.d.ts +3 -1
  218. package/dest/messaging/inbox_leaf.d.ts.map +1 -1
  219. package/dest/messaging/l1_actor.d.ts +7 -1
  220. package/dest/messaging/l1_actor.d.ts.map +1 -1
  221. package/dest/messaging/l1_to_l2_message.d.ts +6 -1
  222. package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
  223. package/dest/messaging/l2_actor.d.ts +7 -1
  224. package/dest/messaging/l2_actor.d.ts.map +1 -1
  225. package/dest/messaging/l2_to_l1_membership.d.ts +88 -6
  226. package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
  227. package/dest/messaging/l2_to_l1_membership.js +160 -42
  228. package/dest/messaging/out_hash.d.ts +41 -3
  229. package/dest/messaging/out_hash.d.ts.map +1 -1
  230. package/dest/messaging/out_hash.js +54 -19
  231. package/dest/note/note_dao.d.ts +36 -5
  232. package/dest/note/note_dao.d.ts.map +1 -1
  233. package/dest/note/note_dao.js +15 -12
  234. package/dest/p2p/attestation_utils.d.ts +3 -3
  235. package/dest/p2p/attestation_utils.d.ts.map +1 -1
  236. package/dest/p2p/attestation_utils.js +1 -1
  237. package/dest/p2p/block_proposal.d.ts +93 -21
  238. package/dest/p2p/block_proposal.d.ts.map +1 -1
  239. package/dest/p2p/block_proposal.js +140 -39
  240. package/dest/p2p/checkpoint_attestation.d.ts +81 -0
  241. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -0
  242. package/dest/p2p/{block_attestation.js → checkpoint_attestation.js} +22 -19
  243. package/dest/p2p/checkpoint_proposal.d.ts +160 -0
  244. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -0
  245. package/dest/p2p/checkpoint_proposal.js +229 -0
  246. package/dest/p2p/consensus_payload.d.ts +9 -9
  247. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  248. package/dest/p2p/consensus_payload.js +3 -5
  249. package/dest/p2p/gossipable.d.ts +4 -3
  250. package/dest/p2p/gossipable.d.ts.map +1 -1
  251. package/dest/p2p/gossipable.js +16 -5
  252. package/dest/p2p/index.d.ts +4 -2
  253. package/dest/p2p/index.d.ts.map +1 -1
  254. package/dest/p2p/index.js +3 -1
  255. package/dest/p2p/signature_utils.d.ts +5 -3
  256. package/dest/p2p/signature_utils.d.ts.map +1 -1
  257. package/dest/p2p/signature_utils.js +3 -1
  258. package/dest/p2p/signed_txs.d.ts +42 -0
  259. package/dest/p2p/signed_txs.d.ts.map +1 -0
  260. package/dest/p2p/signed_txs.js +75 -0
  261. package/dest/p2p/topic_type.d.ts +3 -2
  262. package/dest/p2p/topic_type.d.ts.map +1 -1
  263. package/dest/p2p/topic_type.js +10 -3
  264. package/dest/parity/parity_base_private_inputs.d.ts +3 -1
  265. package/dest/parity/parity_base_private_inputs.d.ts.map +1 -1
  266. package/dest/parity/parity_public_inputs.d.ts +4 -1
  267. package/dest/parity/parity_public_inputs.d.ts.map +1 -1
  268. package/dest/parity/parity_root_private_inputs.d.ts +2 -1
  269. package/dest/parity/parity_root_private_inputs.d.ts.map +1 -1
  270. package/dest/proofs/chonk_proof.d.ts +1 -1
  271. package/dest/proofs/chonk_proof.d.ts.map +1 -1
  272. package/dest/proofs/chonk_proof.js +9 -4
  273. package/dest/proofs/proof.d.ts +4 -1
  274. package/dest/proofs/proof.d.ts.map +1 -1
  275. package/dest/proofs/recursive_proof.d.ts +10 -1
  276. package/dest/proofs/recursive_proof.d.ts.map +1 -1
  277. package/dest/rollup/base_rollup_hints.d.ts +34 -1
  278. package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
  279. package/dest/rollup/block_constant_data.d.ts +12 -1
  280. package/dest/rollup/block_constant_data.d.ts.map +1 -1
  281. package/dest/rollup/block_headers_hash.js +1 -1
  282. package/dest/rollup/block_merge_rollup_private_inputs.d.ts +4 -1
  283. package/dest/rollup/block_merge_rollup_private_inputs.d.ts.map +1 -1
  284. package/dest/rollup/block_rollup_public_inputs.d.ts +47 -11
  285. package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -1
  286. package/dest/rollup/block_rollup_public_inputs.js +8 -12
  287. package/dest/rollup/block_root_rollup_private_inputs.d.ts +64 -1
  288. package/dest/rollup/block_root_rollup_private_inputs.d.ts.map +1 -1
  289. package/dest/rollup/checkpoint_constant_data.d.ts +10 -1
  290. package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -1
  291. package/dest/rollup/checkpoint_constant_data.js +3 -1
  292. package/dest/rollup/checkpoint_header.d.ts +42 -12
  293. package/dest/rollup/checkpoint_header.d.ts.map +1 -1
  294. package/dest/rollup/checkpoint_header.js +49 -19
  295. package/dest/rollup/checkpoint_merge_rollup_private_inputs.d.ts +4 -1
  296. package/dest/rollup/checkpoint_merge_rollup_private_inputs.d.ts.map +1 -1
  297. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +41 -1
  298. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
  299. package/dest/rollup/checkpoint_rollup_public_inputs.js +10 -2
  300. package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +44 -3
  301. package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
  302. package/dest/rollup/checkpoint_root_rollup_private_inputs.js +13 -2
  303. package/dest/rollup/epoch_constant_data.d.ts +16 -1
  304. package/dest/rollup/epoch_constant_data.d.ts.map +1 -1
  305. package/dest/rollup/root_rollup_private_inputs.d.ts +6 -1
  306. package/dest/rollup/root_rollup_private_inputs.d.ts.map +1 -1
  307. package/dest/rollup/root_rollup_public_inputs.d.ts +18 -3
  308. package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
  309. package/dest/rollup/root_rollup_public_inputs.js +9 -3
  310. package/dest/rollup/tree_snapshot_diff_hints.d.ts +24 -1
  311. package/dest/rollup/tree_snapshot_diff_hints.d.ts.map +1 -1
  312. package/dest/rollup/tx_merge_rollup_private_inputs.d.ts +4 -1
  313. package/dest/rollup/tx_merge_rollup_private_inputs.d.ts.map +1 -1
  314. package/dest/rollup/tx_rollup_public_inputs.d.ts +29 -1
  315. package/dest/rollup/tx_rollup_public_inputs.d.ts.map +1 -1
  316. package/dest/schemas/schemas.d.ts +1 -1
  317. package/dest/tests/factories.d.ts +16 -10
  318. package/dest/tests/factories.d.ts.map +1 -1
  319. package/dest/tests/factories.js +60 -25
  320. package/dest/tests/jest.d.ts +4 -4
  321. package/dest/tests/jest.js +9 -9
  322. package/dest/tests/mocks.d.ts +66 -16
  323. package/dest/tests/mocks.d.ts.map +1 -1
  324. package/dest/tests/mocks.js +114 -54
  325. package/dest/trees/append_only_tree_snapshot.d.ts +13 -1
  326. package/dest/trees/append_only_tree_snapshot.d.ts.map +1 -1
  327. package/dest/trees/append_only_tree_snapshot.js +3 -1
  328. package/dest/trees/nullifier_leaf.d.ts +13 -1
  329. package/dest/trees/nullifier_leaf.d.ts.map +1 -1
  330. package/dest/trees/nullifier_membership_witness.d.ts +10 -1
  331. package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
  332. package/dest/trees/public_data_leaf.d.ts +16 -1
  333. package/dest/trees/public_data_leaf.d.ts.map +1 -1
  334. package/dest/trees/public_data_witness.d.ts +11 -1
  335. package/dest/trees/public_data_witness.d.ts.map +1 -1
  336. package/dest/tx/block_header.d.ts +12 -1
  337. package/dest/tx/block_header.d.ts.map +1 -1
  338. package/dest/tx/block_header.js +6 -1
  339. package/dest/tx/call_context.d.ts +13 -1
  340. package/dest/tx/call_context.d.ts.map +1 -1
  341. package/dest/tx/call_context.js +3 -1
  342. package/dest/tx/capsule.d.ts +4 -1
  343. package/dest/tx/capsule.d.ts.map +1 -1
  344. package/dest/tx/execution_payload.d.ts +9 -1
  345. package/dest/tx/execution_payload.d.ts.map +1 -1
  346. package/dest/tx/function_data.d.ts +4 -2
  347. package/dest/tx/function_data.d.ts.map +1 -1
  348. package/dest/tx/global_variable_builder.d.ts +2 -2
  349. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  350. package/dest/tx/global_variables.d.ts +9 -1
  351. package/dest/tx/global_variables.d.ts.map +1 -1
  352. package/dest/tx/global_variables.js +3 -1
  353. package/dest/tx/hashed_values.d.ts +7 -1
  354. package/dest/tx/hashed_values.d.ts.map +1 -1
  355. package/dest/tx/in_tx.d.ts +1 -1
  356. package/dest/tx/index.d.ts +1 -2
  357. package/dest/tx/index.d.ts.map +1 -1
  358. package/dest/tx/index.js +0 -1
  359. package/dest/tx/partial_state_reference.d.ts +4 -1
  360. package/dest/tx/partial_state_reference.d.ts.map +1 -1
  361. package/dest/tx/private_execution_result.d.ts +23 -6
  362. package/dest/tx/private_execution_result.d.ts.map +1 -1
  363. package/dest/tx/private_execution_result.js +4 -21
  364. package/dest/tx/private_tx_constant_data.d.ts +16 -1
  365. package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
  366. package/dest/tx/profiling.d.ts +149 -26
  367. package/dest/tx/profiling.d.ts.map +1 -1
  368. package/dest/tx/profiling.js +44 -7
  369. package/dest/tx/protocol_contracts.d.ts +1 -1
  370. package/dest/tx/public_call_request_with_calldata.d.ts +7 -1
  371. package/dest/tx/public_call_request_with_calldata.d.ts.map +1 -1
  372. package/dest/tx/public_call_request_with_calldata.js +3 -1
  373. package/dest/tx/state_reference.d.ts +3 -1
  374. package/dest/tx/state_reference.d.ts.map +1 -1
  375. package/dest/tx/state_reference.js +3 -1
  376. package/dest/tx/tree_snapshots.js +3 -1
  377. package/dest/tx/tx.d.ts +23 -1
  378. package/dest/tx/tx.d.ts.map +1 -1
  379. package/dest/tx/tx.js +3 -1
  380. package/dest/tx/tx_context.d.ts +2 -1
  381. package/dest/tx/tx_context.d.ts.map +1 -1
  382. package/dest/tx/tx_effect.d.ts +32 -6
  383. package/dest/tx/tx_effect.d.ts.map +1 -1
  384. package/dest/tx/tx_effect.js +3 -8
  385. package/dest/tx/tx_execution_request.d.ts +30 -1
  386. package/dest/tx/tx_execution_request.d.ts.map +1 -1
  387. package/dest/tx/tx_execution_request.js +6 -2
  388. package/dest/tx/tx_hash.d.ts +2 -1
  389. package/dest/tx/tx_hash.d.ts.map +1 -1
  390. package/dest/tx/tx_receipt.d.ts +7 -1
  391. package/dest/tx/tx_receipt.d.ts.map +1 -1
  392. package/dest/tx/tx_request.d.ts +6 -1
  393. package/dest/tx/tx_request.d.ts.map +1 -1
  394. package/dest/types/shared.d.ts +4 -1
  395. package/dest/types/shared.d.ts.map +1 -1
  396. package/dest/validators/schemas.d.ts +8 -8
  397. package/dest/vks/verification_key.d.ts +22 -1
  398. package/dest/vks/verification_key.d.ts.map +1 -1
  399. package/dest/vks/vk_data.d.ts +7 -1
  400. package/dest/vks/vk_data.d.ts.map +1 -1
  401. package/dest/zkpassport/index.d.ts +3 -4
  402. package/dest/zkpassport/index.d.ts.map +1 -1
  403. package/dest/zkpassport/index.js +9 -9
  404. package/package.json +12 -10
  405. package/src/abi/contract_artifact.ts +10 -10
  406. package/src/abi/utils.ts +17 -0
  407. package/src/block/attestation_info.ts +9 -6
  408. package/src/block/block_hash.ts +22 -0
  409. package/src/block/block_parameter.ts +4 -2
  410. package/src/block/body.ts +2 -1
  411. package/src/block/checkpointed_l2_block.ts +5 -55
  412. package/src/block/in_block.ts +2 -2
  413. package/src/block/index.ts +0 -2
  414. package/src/block/l2_block_new.ts +30 -9
  415. package/src/block/l2_block_source.ts +100 -30
  416. package/src/block/l2_block_stream/index.ts +1 -0
  417. package/src/block/l2_block_stream/interfaces.ts +15 -4
  418. package/src/block/l2_block_stream/l2_block_stream.ts +111 -37
  419. package/src/block/l2_block_stream/l2_tips_memory_store.ts +62 -56
  420. package/src/block/l2_block_stream/l2_tips_store_base.ts +226 -0
  421. package/src/block/test/l2_tips_store_test_suite.ts +480 -36
  422. package/src/block/validate_block_result.ts +40 -35
  423. package/src/checkpoint/checkpoint.ts +28 -5
  424. package/src/checkpoint/checkpoint_info.ts +45 -2
  425. package/src/checkpoint/index.ts +1 -0
  426. package/src/checkpoint/published_checkpoint.ts +4 -3
  427. package/src/contract/index.ts +0 -2
  428. package/src/deserialization/index.ts +21 -0
  429. package/src/interfaces/api_limit.ts +1 -0
  430. package/src/interfaces/archiver.ts +24 -14
  431. package/src/interfaces/aztec-node-admin.ts +5 -2
  432. package/src/interfaces/aztec-node.ts +81 -69
  433. package/src/interfaces/block-builder.ts +33 -26
  434. package/src/interfaces/configs.ts +5 -0
  435. package/src/interfaces/p2p.ts +8 -12
  436. package/src/interfaces/proving-job.ts +2 -11
  437. package/src/interfaces/server_circuit_prover.ts +3 -2
  438. package/src/interfaces/validator.ts +64 -14
  439. package/src/kernel/hints/build_note_hash_read_request_hints.ts +20 -12
  440. package/src/kernel/hints/build_nullifier_read_request_hints.ts +22 -10
  441. package/src/messaging/in_hash.ts +3 -1
  442. package/src/messaging/l2_to_l1_membership.ts +178 -52
  443. package/src/messaging/out_hash.ts +62 -21
  444. package/src/note/note_dao.ts +18 -13
  445. package/src/p2p/attestation_utils.ts +3 -3
  446. package/src/p2p/block_proposal.ts +204 -44
  447. package/src/p2p/{block_attestation.ts → checkpoint_attestation.ts} +31 -25
  448. package/src/p2p/checkpoint_proposal.ts +348 -0
  449. package/src/p2p/consensus_payload.ts +5 -7
  450. package/src/p2p/gossipable.ts +14 -4
  451. package/src/p2p/index.ts +3 -1
  452. package/src/p2p/signature_utils.ts +3 -1
  453. package/src/p2p/signed_txs.ts +88 -0
  454. package/src/p2p/topic_type.ts +4 -3
  455. package/src/proofs/chonk_proof.ts +9 -5
  456. package/src/rollup/block_headers_hash.ts +1 -1
  457. package/src/rollup/block_rollup_public_inputs.ts +5 -11
  458. package/src/rollup/checkpoint_header.ts +63 -20
  459. package/src/rollup/checkpoint_rollup_public_inputs.ts +12 -0
  460. package/src/rollup/checkpoint_root_rollup_private_inputs.ts +14 -1
  461. package/src/rollup/root_rollup_public_inputs.ts +9 -0
  462. package/src/tests/factories.ts +56 -40
  463. package/src/tests/jest.ts +9 -9
  464. package/src/tests/mocks.ts +198 -85
  465. package/src/tx/block_header.ts +5 -0
  466. package/src/tx/global_variable_builder.ts +1 -1
  467. package/src/tx/index.ts +0 -1
  468. package/src/tx/private_execution_result.ts +1 -16
  469. package/src/tx/profiling.ts +46 -4
  470. package/src/tx/tx.ts +2 -0
  471. package/src/tx/tx_effect.ts +0 -9
  472. package/src/tx/tx_execution_request.ts +2 -0
  473. package/src/zkpassport/index.ts +11 -12
  474. package/dest/block/l2_block.d.ts +0 -143
  475. package/dest/block/l2_block.d.ts.map +0 -1
  476. package/dest/block/l2_block.js +0 -198
  477. package/dest/block/l2_block_code_to_purge.d.ts +0 -12
  478. package/dest/block/l2_block_code_to_purge.d.ts.map +0 -1
  479. package/dest/block/l2_block_code_to_purge.js +0 -61
  480. package/dest/block/l2_block_header.d.ts +0 -98
  481. package/dest/block/l2_block_header.d.ts.map +0 -1
  482. package/dest/block/l2_block_header.js +0 -153
  483. package/dest/contract/contract_class_metadata.d.ts +0 -8
  484. package/dest/contract/contract_class_metadata.d.ts.map +0 -1
  485. package/dest/contract/contract_class_metadata.js +0 -1
  486. package/dest/contract/contract_metadata.d.ts +0 -7
  487. package/dest/contract/contract_metadata.d.ts.map +0 -1
  488. package/dest/contract/contract_metadata.js +0 -1
  489. package/dest/p2p/block_attestation.d.ts +0 -80
  490. package/dest/p2p/block_attestation.d.ts.map +0 -1
  491. package/dest/tx/content_commitment.d.ts +0 -49
  492. package/dest/tx/content_commitment.d.ts.map +0 -1
  493. package/dest/tx/content_commitment.js +0 -90
  494. package/src/block/l2_block.ts +0 -271
  495. package/src/block/l2_block_code_to_purge.ts +0 -88
  496. package/src/block/l2_block_header.ts +0 -246
  497. package/src/contract/contract_class_metadata.ts +0 -8
  498. package/src/contract/contract_metadata.ts +0 -7
  499. package/src/tx/content_commitment.ts +0 -113
@@ -1,4 +1,3 @@
1
- import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
2
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
3
2
  import { Fr } from '@aztec/foundation/curves/bn254';
4
3
  import { Point } from '@aztec/foundation/curves/grumpkin';
@@ -56,8 +55,10 @@ export class NoteDao {
56
55
  /** The L2 block hash in which the tx with this note was included. Used for note management while processing
57
56
  * reorgs.*/
58
57
  public l2BlockHash: string,
59
- /** The index of the leaf in the global note hash tree the note is stored at */
60
- public index: bigint,
58
+ /** The index of the tx within the block, used for ordering notes. */
59
+ public txIndexInBlock: number,
60
+ /** The index of the note within the tx (based on note hash position), used for ordering notes. */
61
+ public noteIndexInTx: number,
61
62
  ) {}
62
63
 
63
64
  toBuffer(): Buffer {
@@ -73,7 +74,8 @@ export class NoteDao {
73
74
  this.txHash,
74
75
  this.l2BlockNumber,
75
76
  Fr.fromHexString(this.l2BlockHash),
76
- this.index,
77
+ this.txIndexInBlock,
78
+ this.noteIndexInTx,
77
79
  ]);
78
80
  }
79
81
 
@@ -91,7 +93,8 @@ export class NoteDao {
91
93
  const txHash = reader.readObject(TxHash);
92
94
  const l2BlockNumber = BlockNumber(reader.readNumber());
93
95
  const l2BlockHash = Fr.fromBuffer(reader).toString();
94
- const index = toBigIntBE(reader.readBytes(32));
96
+ const txIndexInBlock = reader.readNumber();
97
+ const noteIndexInTx = reader.readNumber();
95
98
 
96
99
  return new NoteDao(
97
100
  note,
@@ -105,7 +108,8 @@ export class NoteDao {
105
108
  txHash,
106
109
  l2BlockNumber,
107
110
  l2BlockHash,
108
- index,
111
+ txIndexInBlock,
112
+ noteIndexInTx,
109
113
  );
110
114
  }
111
115
 
@@ -134,7 +138,8 @@ export class NoteDao {
134
138
  this.txHash.equals(other.txHash) &&
135
139
  this.l2BlockNumber === other.l2BlockNumber &&
136
140
  this.l2BlockHash === other.l2BlockHash &&
137
- this.index === other.index
141
+ this.txIndexInBlock === other.txIndexInBlock &&
142
+ this.noteIndexInTx === other.noteIndexInTx
138
143
  );
139
144
  }
140
145
 
@@ -143,11 +148,9 @@ export class NoteDao {
143
148
  * @returns - Its size in bytes.
144
149
  */
145
150
  public getSize() {
146
- const indexSize = Math.ceil(Math.log2(Number(this.index)));
147
151
  const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
148
- return (
149
- noteSize + AztecAddress.SIZE_IN_BYTES * 2 + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + indexSize
150
- );
152
+ // 2 numbers for txIndexInBlock and noteIndexInTx (4 bytes each)
153
+ return noteSize + AztecAddress.SIZE_IN_BYTES * 2 + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + 8;
151
154
  }
152
155
 
153
156
  static async random({
@@ -162,7 +165,8 @@ export class NoteDao {
162
165
  txHash = TxHash.random(),
163
166
  l2BlockNumber = BlockNumber(Math.floor(Math.random() * 1000)),
164
167
  l2BlockHash = Fr.random().toString(),
165
- index = Fr.random().toBigInt(),
168
+ txIndexInBlock = Math.floor(Math.random() * 100),
169
+ noteIndexInTx = Math.floor(Math.random() * 100),
166
170
  }: Partial<NoteDao> = {}) {
167
171
  return new NoteDao(
168
172
  note,
@@ -176,7 +180,8 @@ export class NoteDao {
176
180
  txHash,
177
181
  l2BlockNumber,
178
182
  l2BlockHash,
179
- index,
183
+ txIndexInBlock,
184
+ noteIndexInTx,
180
185
  );
181
186
  }
182
187
  }
@@ -1,7 +1,7 @@
1
1
  import type { EthAddress } from '@aztec/foundation/eth-address';
2
2
 
3
3
  import { CommitteeAttestation } from '../block/index.js';
4
- import type { BlockAttestation } from './block_attestation.js';
4
+ import type { CheckpointAttestation } from './checkpoint_attestation.js';
5
5
 
6
6
  /**
7
7
  * Returns attestation signatures in the order of a series of provided ethereum addresses
@@ -9,10 +9,10 @@ import type { BlockAttestation } from './block_attestation.js';
9
9
  * @todo: perform this logic within the memory attestation store instead?
10
10
  */
11
11
  export function orderAttestations(
12
- attestations: BlockAttestation[],
12
+ attestations: CheckpointAttestation[],
13
13
  orderAddresses: EthAddress[],
14
14
  ): CommitteeAttestation[] {
15
- // Create a map of sender addresses to BlockAttestations
15
+ // Create a map of sender addresses to attestations
16
16
  const attestationMap = new Map<string, CommitteeAttestation>();
17
17
 
18
18
  for (const attestation of attestations) {
@@ -1,4 +1,4 @@
1
- import { SlotNumber } from '@aztec/foundation/branded-types';
1
+ import { BlockNumber, IndexWithinCheckpoint, SlotNumber } from '@aztec/foundation/branded-types';
2
2
  import { Buffer32 } from '@aztec/foundation/buffer';
3
3
  import { keccak256 } from '@aztec/foundation/crypto/keccak';
4
4
  import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
@@ -6,17 +6,21 @@ import { Fr } from '@aztec/foundation/curves/bn254';
6
6
  import type { EthAddress } from '@aztec/foundation/eth-address';
7
7
  import { Signature } from '@aztec/foundation/eth-signature';
8
8
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
9
+ import { DutyType, type SigningContext } from '@aztec/validator-ha-signer/types';
9
10
 
10
11
  import type { L2BlockInfo } from '../block/l2_block_info.js';
12
+ import type { L2BlockNew } from '../block/l2_block_new.js';
13
+ import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
14
+ import { BlockHeader } from '../tx/block_header.js';
11
15
  import { TxHash } from '../tx/index.js';
12
- import { Tx } from '../tx/tx.js';
13
- import { ConsensusPayload } from './consensus_payload.js';
16
+ import type { Tx } from '../tx/tx.js';
14
17
  import { Gossipable } from './gossipable.js';
15
18
  import {
16
19
  SignatureDomainSeparator,
17
20
  getHashedSignaturePayload,
18
21
  getHashedSignaturePayloadEthSignedMessage,
19
22
  } from './signature_utils.js';
23
+ import { SignedTxs } from './signed_txs.js';
20
24
  import { TopicType } from './topic_type.js';
21
25
 
22
26
  export class BlockProposalHash extends Buffer32 {
@@ -32,10 +36,9 @@ export type BlockProposalOptions = {
32
36
  };
33
37
 
34
38
  /**
35
- * BlockProposal
36
- *
37
- * A block proposal is created by the leader of the chain proposing a sequence of transactions to
38
- * be included in the head of the chain
39
+ * A block proposal is created by the leader of the chain proposing a sequence of transactions
40
+ * to be included in a block within a checkpoint. This is used for non-last blocks in a slot.
41
+ * The last block is sent as part of a CheckpointProposal.
39
42
  */
40
43
  export class BlockProposal extends Gossipable {
41
44
  static override p2pTopic = TopicType.block_proposal;
@@ -43,18 +46,28 @@ export class BlockProposal extends Gossipable {
43
46
  private sender: EthAddress | undefined;
44
47
 
45
48
  constructor(
46
- /** The payload of the message, and what the signature is over */
47
- public readonly payload: ConsensusPayload,
49
+ /** The per-block header containing block state and global variables */
50
+ public readonly blockHeader: BlockHeader,
48
51
 
49
- /** The signer of the BlockProposal over the header of the new block*/
50
- public readonly signature: Signature,
52
+ // TODO(palla/mbps): Is this really needed? Can we just derive it from the indexWithinCheckpoint of the parent block and the slot number?
53
+ // See the block-proposal-handler, we have a lot of extra validations to check this is correct, so maybe we can avoid storing it here.
54
+ /** Index of this block within the checkpoint (0-indexed) */
55
+ public readonly indexWithinCheckpoint: IndexWithinCheckpoint,
56
+
57
+ /** Hash of L1 to L2 messages for this checkpoint (constant across all blocks in checkpoint) */
58
+ public readonly inHash: Fr,
59
+
60
+ /** Archive root after this block is applied */
61
+ public readonly archiveRoot: Fr,
51
62
 
52
63
  /** The sequence of transactions in the block */
53
64
  public readonly txHashes: TxHash[],
54
65
 
55
- // Note(md): this is placed after the txs payload in order to be backwards compatible with previous versions
56
- /** The transactions in the block */
57
- public readonly txs?: Tx[],
66
+ /** The proposer's signature over the block data */
67
+ public readonly signature: Signature,
68
+
69
+ /** The signed transactions in the block (optional, for DA guarantees) */
70
+ public readonly signedTxs?: SignedTxs,
58
71
  ) {
59
72
  super();
60
73
  }
@@ -64,59 +77,133 @@ export class BlockProposal extends Gossipable {
64
77
  }
65
78
 
66
79
  get archive(): Fr {
67
- return this.payload.archive;
80
+ return this.archiveRoot;
68
81
  }
69
82
 
70
83
  get slotNumber(): SlotNumber {
71
- return this.payload.header.slotNumber;
84
+ return this.blockHeader.getSlot();
85
+ }
86
+
87
+ get blockNumber(): BlockNumber {
88
+ return this.blockHeader.getBlockNumber();
89
+ }
90
+
91
+ /** Convenience getter for txs from signedTxs */
92
+ get txs(): Tx[] | undefined {
93
+ return this.signedTxs?.txs;
72
94
  }
73
95
 
74
96
  toBlockInfo(): Omit<L2BlockInfo, 'blockNumber'> {
75
97
  return {
76
98
  slotNumber: this.slotNumber,
77
- lastArchive: this.payload.header.lastArchiveRoot,
78
- timestamp: this.payload.header.timestamp,
79
- archive: this.archive,
99
+ lastArchive: this.blockHeader.lastArchive.root,
100
+ timestamp: this.blockHeader.globalVariables.timestamp,
101
+ archive: this.archiveRoot,
80
102
  txCount: this.txHashes.length,
81
103
  };
82
104
  }
83
105
 
106
+ /**
107
+ * Get the payload to sign for this block proposal.
108
+ * The signature is over: blockHeader + indexWithinCheckpoint + inHash + archiveRoot + txHashes
109
+ */
110
+ getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer {
111
+ return serializeToBuffer([
112
+ domainSeparator,
113
+ this.blockHeader,
114
+ this.indexWithinCheckpoint,
115
+ this.inHash,
116
+ this.archiveRoot,
117
+ this.txHashes.length,
118
+ this.txHashes,
119
+ ]);
120
+ }
121
+
84
122
  static async createProposalFromSigner(
85
- payload: ConsensusPayload,
123
+ blockHeader: BlockHeader,
124
+ indexWithinCheckpoint: IndexWithinCheckpoint,
125
+ inHash: Fr,
126
+ archiveRoot: Fr,
86
127
  txHashes: TxHash[],
87
- // Note(md): Provided separately to tx hashes such that this function can be optional
88
128
  txs: Tx[] | undefined,
89
- payloadSigner: (payload: Buffer32) => Promise<Signature>,
90
- ) {
91
- const hashed = getHashedSignaturePayload(payload, SignatureDomainSeparator.blockProposal);
92
- const sig = await payloadSigner(hashed);
129
+ payloadSigner: (payload: Buffer32, context: SigningContext) => Promise<Signature>,
130
+ ): Promise<BlockProposal> {
131
+ // Create a temporary proposal to get the payload to sign
132
+ const tempProposal = new BlockProposal(
133
+ blockHeader,
134
+ indexWithinCheckpoint,
135
+ inHash,
136
+ archiveRoot,
137
+ txHashes,
138
+ Signature.empty(),
139
+ );
140
+
141
+ // Create the block signing context
142
+ const blockContext: SigningContext = {
143
+ slot: blockHeader.globalVariables.slotNumber,
144
+ blockNumber: blockHeader.globalVariables.blockNumber,
145
+ blockIndexWithinCheckpoint: indexWithinCheckpoint,
146
+ dutyType: DutyType.BLOCK_PROPOSAL,
147
+ };
148
+
149
+ const hashed = getHashedSignaturePayload(tempProposal, SignatureDomainSeparator.blockProposal);
150
+ const sig = await payloadSigner(hashed, blockContext);
151
+
152
+ // If txs are provided, sign them as well
153
+ let signedTxs: SignedTxs | undefined;
154
+ if (txs) {
155
+ const txsSigningContext: SigningContext = { dutyType: DutyType.TXS };
156
+ const txsSigner = (payload: Buffer32) => payloadSigner(payload, txsSigningContext);
157
+ signedTxs = await SignedTxs.createFromSigner(txs, txsSigner);
158
+ }
93
159
 
94
- return new BlockProposal(payload, sig, txHashes, txs);
160
+ return new BlockProposal(blockHeader, indexWithinCheckpoint, inHash, archiveRoot, txHashes, sig, signedTxs);
95
161
  }
96
162
 
97
- /**Get Sender
98
- * Lazily evaluate the sender of the proposal; result is cached
99
- * @returns The sender address, or undefined if signature recovery fails
163
+ /**
164
+ * Lazily evaluate the sender of the proposal; result is cached.
165
+ * If there's signedTxs, also verifies the signedTxs sender matches the block proposal sender.
166
+ * @returns The sender address, or undefined if signature recovery fails or senders don't match
100
167
  */
101
168
  getSender(): EthAddress | undefined {
102
169
  if (!this.sender) {
103
- const hashed = getHashedSignaturePayloadEthSignedMessage(this.payload, SignatureDomainSeparator.blockProposal);
170
+ const hashed = getHashedSignaturePayloadEthSignedMessage(this, SignatureDomainSeparator.blockProposal);
171
+ const blockSender = tryRecoverAddress(hashed, this.signature);
172
+
173
+ // If there's signedTxs, verify the sender matches
174
+ if (blockSender && this.signedTxs) {
175
+ const txsSender = this.signedTxs.getSender();
176
+ if (!txsSender || !txsSender.equals(blockSender)) {
177
+ return undefined; // Sender mismatch - fail
178
+ }
179
+ }
180
+
104
181
  // Cache the sender for later use
105
- this.sender = tryRecoverAddress(hashed, this.signature);
182
+ this.sender = blockSender;
106
183
  }
107
184
 
108
185
  return this.sender;
109
186
  }
110
187
 
111
188
  getPayload() {
112
- return this.payload.getPayloadToSign(SignatureDomainSeparator.blockProposal);
189
+ return this.getPayloadToSign(SignatureDomainSeparator.blockProposal);
113
190
  }
114
191
 
115
192
  toBuffer(): Buffer {
116
- const buffer: any[] = [this.payload, this.signature, this.txHashes.length, this.txHashes];
117
- if (this.txs) {
118
- buffer.push(this.txs.length);
119
- buffer.push(this.txs);
193
+ const buffer: any[] = [
194
+ this.blockHeader,
195
+ this.indexWithinCheckpoint,
196
+ this.inHash,
197
+ this.archiveRoot,
198
+ this.signature,
199
+ this.txHashes.length,
200
+ this.txHashes,
201
+ ];
202
+ if (this.signedTxs) {
203
+ buffer.push(1); // hasSignedTxs = true
204
+ buffer.push(this.signedTxs.toBuffer());
205
+ } else {
206
+ buffer.push(0); // hasSignedTxs = false
120
207
  }
121
208
  return serializeToBuffer(buffer);
122
209
  }
@@ -124,25 +211,98 @@ export class BlockProposal extends Gossipable {
124
211
  static fromBuffer(buf: Buffer | BufferReader): BlockProposal {
125
212
  const reader = BufferReader.asReader(buf);
126
213
 
127
- const payload = reader.readObject(ConsensusPayload);
128
- const sig = reader.readObject(Signature);
129
- const txHashes = reader.readArray(reader.readNumber(), TxHash);
214
+ const blockHeader = reader.readObject(BlockHeader);
215
+ const indexWithinCheckpoint = IndexWithinCheckpoint(reader.readNumber());
216
+ const inHash = reader.readObject(Fr);
217
+ const archiveRoot = reader.readObject(Fr);
218
+ const signature = reader.readObject(Signature);
219
+ const txHashCount = reader.readNumber();
220
+ if (txHashCount > MAX_TXS_PER_BLOCK) {
221
+ throw new Error(`txHashes count ${txHashCount} exceeds maximum ${MAX_TXS_PER_BLOCK}`);
222
+ }
223
+ const txHashes = reader.readArray(txHashCount, TxHash);
130
224
 
131
225
  if (!reader.isEmpty()) {
132
- const txs = reader.readArray(reader.readNumber(), Tx);
133
- return new BlockProposal(payload, sig, txHashes, txs);
226
+ const hasSignedTxs = reader.readNumber();
227
+ if (hasSignedTxs) {
228
+ const signedTxs = SignedTxs.fromBuffer(reader);
229
+ return new BlockProposal(
230
+ blockHeader,
231
+ indexWithinCheckpoint,
232
+ inHash,
233
+ archiveRoot,
234
+ txHashes,
235
+ signature,
236
+ signedTxs,
237
+ );
238
+ }
134
239
  }
135
240
 
136
- return new BlockProposal(payload, sig, txHashes);
241
+ return new BlockProposal(blockHeader, indexWithinCheckpoint, inHash, archiveRoot, txHashes, signature);
137
242
  }
138
243
 
139
244
  getSize(): number {
140
245
  return (
141
- this.payload.getSize() +
246
+ this.blockHeader.getSize() +
247
+ 4 /* indexWithinCheckpoint */ +
248
+ this.inHash.size +
249
+ this.archiveRoot.size +
142
250
  this.signature.getSize() +
143
251
  4 /* txHashes.length */ +
144
252
  this.txHashes.length * TxHash.SIZE +
145
- (this.txs ? 4 /* txs.length */ + this.txs.reduce((acc, tx) => acc + tx.getSize(), 0) : 0)
253
+ 4 /* hasSignedTxs flag */ +
254
+ (this.signedTxs ? this.signedTxs.getSize() : 0)
255
+ );
256
+ }
257
+
258
+ static empty(): BlockProposal {
259
+ return new BlockProposal(BlockHeader.empty(), IndexWithinCheckpoint(0), Fr.ZERO, Fr.ZERO, [], Signature.empty());
260
+ }
261
+
262
+ static random(): BlockProposal {
263
+ return new BlockProposal(
264
+ BlockHeader.random(),
265
+ IndexWithinCheckpoint(Math.floor(Math.random() * 5)),
266
+ Fr.random(),
267
+ Fr.random(),
268
+ [TxHash.random(), TxHash.random()],
269
+ Signature.random(),
270
+ );
271
+ }
272
+
273
+ toInspect() {
274
+ return {
275
+ blockHeader: this.blockHeader.toInspect(),
276
+ indexWithinCheckpoint: this.indexWithinCheckpoint,
277
+ inHash: this.inHash.toString(),
278
+ archiveRoot: this.archiveRoot.toString(),
279
+ signature: this.signature.toString(),
280
+ txHashes: this.txHashes.map(h => h.toString()),
281
+ };
282
+ }
283
+
284
+ /**
285
+ * Check if this proposal matches the given block.
286
+ * Compares the archive root and block header.
287
+ * @param block - The L2BlockNew to compare against
288
+ * @returns True if the proposal matches the block
289
+ */
290
+ matchesBlock(block: L2BlockNew): boolean {
291
+ return this.archiveRoot.equals(block.archive.root) && this.blockHeader.equals(block.header);
292
+ }
293
+
294
+ /**
295
+ * Returns a copy of this proposal without signedTxs.
296
+ * Used when storing proposals in attestation pool to avoid storing full tx data.
297
+ */
298
+ withoutSignedTxs(): BlockProposal {
299
+ return new BlockProposal(
300
+ this.blockHeader,
301
+ this.indexWithinCheckpoint,
302
+ this.inHash,
303
+ this.archiveRoot,
304
+ this.txHashes,
305
+ this.signature,
146
306
  );
147
307
  }
148
308
  }
@@ -2,7 +2,7 @@ import { SlotNumber } from '@aztec/foundation/branded-types';
2
2
  import { Buffer32 } from '@aztec/foundation/buffer';
3
3
  import { keccak256 } from '@aztec/foundation/crypto/keccak';
4
4
  import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
5
- import { Fr } from '@aztec/foundation/curves/bn254';
5
+ import type { Fr } from '@aztec/foundation/curves/bn254';
6
6
  import type { EthAddress } from '@aztec/foundation/eth-address';
7
7
  import { Signature } from '@aztec/foundation/eth-signature';
8
8
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
@@ -10,25 +10,26 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
10
10
  import { z } from 'zod';
11
11
 
12
12
  import type { ZodFor } from '../schemas/index.js';
13
+ import { CheckpointProposal } from './checkpoint_proposal.js';
13
14
  import { ConsensusPayload } from './consensus_payload.js';
14
15
  import { Gossipable } from './gossipable.js';
15
16
  import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from './signature_utils.js';
16
17
  import { TopicType } from './topic_type.js';
17
18
 
18
- export class BlockAttestationHash extends Buffer32 {
19
+ export class CheckpointAttestationHash extends Buffer32 {
19
20
  constructor(hash: Buffer) {
20
21
  super(hash);
21
22
  }
22
23
  }
23
24
 
24
25
  /**
25
- * BlockAttestation
26
+ * CheckpointAttestation
26
27
  *
27
- * A validator that has attested to seeing the contents of a block
28
- * will produce a block attestation over the header of the block
28
+ * A validator that has attested to seeing all blocks in a checkpoint
29
+ * will produce a checkpoint attestation over the checkpoint header.
29
30
  */
30
- export class BlockAttestation extends Gossipable {
31
- static override p2pTopic = TopicType.block_attestation;
31
+ export class CheckpointAttestation extends Gossipable {
32
+ static override p2pTopic = TopicType.checkpoint_attestation;
32
33
 
33
34
  private sender: EthAddress | undefined;
34
35
  private proposer: EthAddress | undefined;
@@ -37,27 +38,27 @@ export class BlockAttestation extends Gossipable {
37
38
  /** The payload of the message, and what the signature is over */
38
39
  public readonly payload: ConsensusPayload,
39
40
 
40
- /** The signature of the block attester */
41
+ /** The signature of the checkpoint attester */
41
42
  public readonly signature: Signature,
42
43
 
43
- /** The signature from the block proposer */
44
+ /** The signature from the checkpoint proposer */
44
45
  public readonly proposerSignature: Signature,
45
46
  ) {
46
47
  super();
47
48
  }
48
49
 
49
- static get schema(): ZodFor<BlockAttestation> {
50
+ static get schema(): ZodFor<CheckpointAttestation> {
50
51
  return z
51
52
  .object({
52
53
  payload: ConsensusPayload.schema,
53
54
  signature: Signature.schema,
54
55
  proposerSignature: Signature.schema,
55
56
  })
56
- .transform(obj => new BlockAttestation(obj.payload, obj.signature, obj.proposerSignature));
57
+ .transform(obj => new CheckpointAttestation(obj.payload, obj.signature, obj.proposerSignature));
57
58
  }
58
59
 
59
60
  override generateP2PMessageIdentifier(): Promise<Buffer32> {
60
- return Promise.resolve(new BlockAttestationHash(keccak256(this.signature.toBuffer())));
61
+ return Promise.resolve(new CheckpointAttestationHash(keccak256(this.signature.toBuffer())));
61
62
  }
62
63
 
63
64
  get archive(): Fr {
@@ -75,7 +76,10 @@ export class BlockAttestation extends Gossipable {
75
76
  getSender(): EthAddress | undefined {
76
77
  if (!this.sender) {
77
78
  // Recover the sender from the attestation
78
- const hashed = getHashedSignaturePayloadEthSignedMessage(this.payload, SignatureDomainSeparator.blockAttestation);
79
+ const hashed = getHashedSignaturePayloadEthSignedMessage(
80
+ this.payload,
81
+ SignatureDomainSeparator.checkpointAttestation,
82
+ );
79
83
  // Cache the sender for later use
80
84
  this.sender = tryRecoverAddress(hashed, this.signature);
81
85
  }
@@ -84,43 +88,45 @@ export class BlockAttestation extends Gossipable {
84
88
  }
85
89
 
86
90
  /**
87
- * Lazily evaluate and cache the proposer of the block
88
- * @returns The proposer of the block
91
+ * Lazily evaluate and cache the proposer of the checkpoint
92
+ * @returns The proposer of the checkpoint
89
93
  */
90
94
  getProposer(): EthAddress | undefined {
91
95
  if (!this.proposer) {
92
- // Recover the proposer from the proposal signature
93
- const hashed = getHashedSignaturePayloadEthSignedMessage(this.payload, SignatureDomainSeparator.blockProposal);
96
+ // Create a temporary CheckpointProposal to recover the proposer address.
97
+ // We need to use CheckpointProposal because it has a different getPayloadToSign()
98
+ // implementation than ConsensusPayload (uses serializeToBuffer vs ABI encoding).
99
+ const proposal = new CheckpointProposal(this.payload.header, this.payload.archive, this.proposerSignature);
94
100
  // Cache the proposer for later use
95
- this.proposer = tryRecoverAddress(hashed, this.proposerSignature);
101
+ this.proposer = proposal.getSender();
96
102
  }
97
103
 
98
104
  return this.proposer;
99
105
  }
100
106
 
101
107
  getPayload(): Buffer {
102
- return this.payload.getPayloadToSign(SignatureDomainSeparator.blockAttestation);
108
+ return this.payload.getPayloadToSign(SignatureDomainSeparator.checkpointAttestation);
103
109
  }
104
110
 
105
111
  toBuffer(): Buffer {
106
112
  return serializeToBuffer([this.payload, this.signature, this.proposerSignature]);
107
113
  }
108
114
 
109
- static fromBuffer(buf: Buffer | BufferReader): BlockAttestation {
115
+ static fromBuffer(buf: Buffer | BufferReader): CheckpointAttestation {
110
116
  const reader = BufferReader.asReader(buf);
111
- return new BlockAttestation(
117
+ return new CheckpointAttestation(
112
118
  reader.readObject(ConsensusPayload),
113
119
  reader.readObject(Signature),
114
120
  reader.readObject(Signature),
115
121
  );
116
122
  }
117
123
 
118
- static empty(): BlockAttestation {
119
- return new BlockAttestation(ConsensusPayload.empty(), Signature.empty(), Signature.empty());
124
+ static empty(): CheckpointAttestation {
125
+ return new CheckpointAttestation(ConsensusPayload.empty(), Signature.empty(), Signature.empty());
120
126
  }
121
127
 
122
- static random(): BlockAttestation {
123
- return new BlockAttestation(ConsensusPayload.random(), Signature.random(), Signature.random());
128
+ static random(): CheckpointAttestation {
129
+ return new CheckpointAttestation(ConsensusPayload.random(), Signature.random(), Signature.random());
124
130
  }
125
131
 
126
132
  getSize(): number {