@aztec/stdlib 0.0.1-commit.e2b2873ed → 0.0.1-commit.e304674f1

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 (557) hide show
  1. package/dest/abi/abi.d.ts +138 -1
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +10 -2
  4. package/dest/abi/buffer.d.ts +14 -4
  5. package/dest/abi/buffer.d.ts.map +1 -1
  6. package/dest/abi/buffer.js +25 -4
  7. package/dest/abi/decoder.d.ts +6 -45
  8. package/dest/abi/decoder.d.ts.map +1 -1
  9. package/dest/abi/decoder.js +17 -70
  10. package/dest/abi/encoder.d.ts +1 -1
  11. package/dest/abi/encoder.d.ts.map +1 -1
  12. package/dest/abi/encoder.js +37 -6
  13. package/dest/abi/event_metadata_definition.d.ts +3 -1
  14. package/dest/abi/event_metadata_definition.d.ts.map +1 -1
  15. package/dest/abi/event_metadata_definition.js +1 -1
  16. package/dest/abi/function_selector.js +1 -1
  17. package/dest/abi/function_signature_decoder.d.ts +43 -0
  18. package/dest/abi/function_signature_decoder.d.ts.map +1 -0
  19. package/dest/abi/function_signature_decoder.js +66 -0
  20. package/dest/abi/index.d.ts +2 -1
  21. package/dest/abi/index.d.ts.map +1 -1
  22. package/dest/abi/index.js +1 -0
  23. package/dest/abi/selector.d.ts +2 -2
  24. package/dest/abi/selector.d.ts.map +1 -1
  25. package/dest/abi/selector.js +1 -1
  26. package/dest/abi/utils.d.ts +14 -1
  27. package/dest/abi/utils.d.ts.map +1 -1
  28. package/dest/abi/utils.js +15 -0
  29. package/dest/auth_witness/auth_witness.js +3 -3
  30. package/dest/avm/avm_proving_request.d.ts +166 -166
  31. package/dest/avm/revert_code.d.ts +9 -4
  32. package/dest/avm/revert_code.d.ts.map +1 -1
  33. package/dest/avm/revert_code.js +16 -21
  34. package/dest/block/block_data.d.ts +52 -0
  35. package/dest/block/block_data.d.ts.map +1 -0
  36. package/dest/block/block_data.js +12 -0
  37. package/dest/block/index.d.ts +2 -1
  38. package/dest/block/index.d.ts.map +1 -1
  39. package/dest/block/index.js +1 -0
  40. package/dest/block/l2_block.d.ts +9 -1
  41. package/dest/block/l2_block.d.ts.map +1 -1
  42. package/dest/block/l2_block.js +12 -2
  43. package/dest/block/l2_block_source.d.ts +113 -9
  44. package/dest/block/l2_block_source.d.ts.map +1 -1
  45. package/dest/block/l2_block_source.js +1 -0
  46. package/dest/block/l2_block_stream/l2_block_stream.d.ts +1 -1
  47. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  48. package/dest/block/l2_block_stream/l2_block_stream.js +10 -0
  49. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
  50. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  51. package/dest/block/l2_block_stream/l2_tips_store_base.js +17 -4
  52. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  53. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  54. package/dest/block/test/l2_tips_store_test_suite.js +3 -2
  55. package/dest/checkpoint/checkpoint.d.ts +28 -7
  56. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  57. package/dest/checkpoint/checkpoint.js +41 -17
  58. package/dest/checkpoint/checkpoint_data.d.ts +186 -0
  59. package/dest/checkpoint/checkpoint_data.d.ts.map +1 -0
  60. package/dest/checkpoint/checkpoint_data.js +36 -0
  61. package/dest/checkpoint/index.d.ts +3 -1
  62. package/dest/checkpoint/index.d.ts.map +1 -1
  63. package/dest/checkpoint/index.js +2 -0
  64. package/dest/checkpoint/published_checkpoint.d.ts +17 -2
  65. package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
  66. package/dest/checkpoint/published_checkpoint.js +1 -2
  67. package/dest/checkpoint/validate.d.ts +36 -0
  68. package/dest/checkpoint/validate.d.ts.map +1 -0
  69. package/dest/checkpoint/validate.js +120 -0
  70. package/dest/config/index.d.ts +2 -1
  71. package/dest/config/index.d.ts.map +1 -1
  72. package/dest/config/index.js +1 -0
  73. package/dest/config/pipelining-config.d.ts +19 -0
  74. package/dest/config/pipelining-config.d.ts.map +1 -0
  75. package/dest/config/pipelining-config.js +18 -0
  76. package/dest/config/sequencer-config.d.ts +4 -2
  77. package/dest/config/sequencer-config.d.ts.map +1 -1
  78. package/dest/config/sequencer-config.js +12 -0
  79. package/dest/contract/contract_address.d.ts +3 -3
  80. package/dest/contract/contract_address.js +7 -7
  81. package/dest/contract/contract_class.d.ts +2 -3
  82. package/dest/contract/contract_class.d.ts.map +1 -1
  83. package/dest/contract/contract_class_id.d.ts +3 -3
  84. package/dest/contract/contract_class_id.d.ts.map +1 -1
  85. package/dest/contract/contract_class_id.js +7 -6
  86. package/dest/contract/index.d.ts +1 -3
  87. package/dest/contract/index.d.ts.map +1 -1
  88. package/dest/contract/index.js +0 -2
  89. package/dest/contract/interfaces/contract_class.d.ts +3 -156
  90. package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
  91. package/dest/contract/interfaces/contract_class.js +1 -28
  92. package/dest/contract/private_function.js +2 -2
  93. package/dest/epoch-helpers/index.d.ts +11 -1
  94. package/dest/epoch-helpers/index.d.ts.map +1 -1
  95. package/dest/epoch-helpers/index.js +16 -2
  96. package/dest/file-store/factory.d.ts +4 -3
  97. package/dest/file-store/factory.d.ts.map +1 -1
  98. package/dest/file-store/factory.js +2 -2
  99. package/dest/file-store/http.d.ts +9 -2
  100. package/dest/file-store/http.d.ts.map +1 -1
  101. package/dest/file-store/http.js +20 -9
  102. package/dest/file-store/index.d.ts +2 -1
  103. package/dest/file-store/index.d.ts.map +1 -1
  104. package/dest/file-store/local.d.ts +3 -3
  105. package/dest/file-store/local.d.ts.map +1 -1
  106. package/dest/file-store/local.js +13 -4
  107. package/dest/file-store/s3.d.ts +1 -1
  108. package/dest/file-store/s3.d.ts.map +1 -1
  109. package/dest/file-store/s3.js +11 -3
  110. package/dest/gas/gas_fees.d.ts +1 -1
  111. package/dest/gas/gas_fees.d.ts.map +1 -1
  112. package/dest/gas/gas_fees.js +4 -1
  113. package/dest/gas/gas_settings.d.ts +40 -3
  114. package/dest/gas/gas_settings.d.ts.map +1 -1
  115. package/dest/gas/gas_settings.js +50 -6
  116. package/dest/ha-signing/config.d.ts +136 -0
  117. package/dest/ha-signing/config.d.ts.map +1 -0
  118. package/dest/ha-signing/config.js +97 -0
  119. package/dest/ha-signing/index.d.ts +4 -0
  120. package/dest/ha-signing/index.d.ts.map +1 -0
  121. package/dest/ha-signing/index.js +3 -0
  122. package/dest/ha-signing/local_config.d.ts +63 -0
  123. package/dest/ha-signing/local_config.d.ts.map +1 -0
  124. package/dest/ha-signing/local_config.js +24 -0
  125. package/dest/ha-signing/types.d.ts +85 -0
  126. package/dest/ha-signing/types.d.ts.map +1 -0
  127. package/dest/ha-signing/types.js +32 -0
  128. package/dest/hash/hash.d.ts +20 -1
  129. package/dest/hash/hash.d.ts.map +1 -1
  130. package/dest/hash/hash.js +45 -10
  131. package/dest/hash/map_slot.js +2 -2
  132. package/dest/interfaces/allowed_element.d.ts +26 -20
  133. package/dest/interfaces/allowed_element.d.ts.map +1 -1
  134. package/dest/interfaces/allowed_element.js +8 -8
  135. package/dest/interfaces/archiver.d.ts +1 -1
  136. package/dest/interfaces/archiver.d.ts.map +1 -1
  137. package/dest/interfaces/archiver.js +10 -2
  138. package/dest/interfaces/aztec-node-admin.d.ts +108 -44
  139. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  140. package/dest/interfaces/aztec-node-admin.js +12 -6
  141. package/dest/interfaces/aztec-node.d.ts +13 -7
  142. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  143. package/dest/interfaces/aztec-node.js +5 -2
  144. package/dest/interfaces/block-builder.d.ts +39 -12
  145. package/dest/interfaces/block-builder.d.ts.map +1 -1
  146. package/dest/interfaces/block-builder.js +13 -6
  147. package/dest/interfaces/configs.d.ts +77 -32
  148. package/dest/interfaces/configs.d.ts.map +1 -1
  149. package/dest/interfaces/configs.js +10 -3
  150. package/dest/interfaces/l2_logs_source.d.ts +5 -3
  151. package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
  152. package/dest/interfaces/merkle_tree_operations.d.ts +10 -20
  153. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  154. package/dest/interfaces/p2p.d.ts +3 -8
  155. package/dest/interfaces/p2p.d.ts.map +1 -1
  156. package/dest/interfaces/prover-client.d.ts +6 -1
  157. package/dest/interfaces/prover-client.d.ts.map +1 -1
  158. package/dest/interfaces/prover-client.js +7 -1
  159. package/dest/interfaces/proving-job.d.ts +36 -36
  160. package/dest/interfaces/slasher.d.ts +1 -10
  161. package/dest/interfaces/slasher.d.ts.map +1 -1
  162. package/dest/interfaces/slasher.js +0 -2
  163. package/dest/interfaces/validator.d.ts +106 -55
  164. package/dest/interfaces/validator.d.ts.map +1 -1
  165. package/dest/interfaces/validator.js +8 -5
  166. package/dest/interfaces/world_state.d.ts +5 -4
  167. package/dest/interfaces/world_state.d.ts.map +1 -1
  168. package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +3 -3
  169. package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
  170. package/dest/kernel/hints/build_note_hash_read_request_hints.js +13 -10
  171. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
  172. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  173. package/dest/kernel/hints/build_nullifier_read_request_hints.js +13 -10
  174. package/dest/kernel/hints/build_transient_data_hints.d.ts +5 -2
  175. package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
  176. package/dest/kernel/hints/build_transient_data_hints.js +9 -3
  177. package/dest/kernel/hints/index.d.ts +2 -2
  178. package/dest/kernel/hints/index.js +2 -2
  179. package/dest/kernel/hints/key_validation_request_and_separator.d.ts +24 -0
  180. package/dest/kernel/hints/key_validation_request_and_separator.d.ts.map +1 -0
  181. package/dest/kernel/hints/{key_validation_request_and_generator.js → key_validation_request_and_separator.js} +12 -15
  182. package/dest/kernel/hints/{scoped_key_validation_request_and_generator.d.ts → scoped_key_validation_request_and_separator.d.ts} +8 -8
  183. package/dest/kernel/hints/{scoped_key_validation_request_and_generator.d.ts.map → scoped_key_validation_request_and_separator.d.ts.map} +1 -1
  184. package/dest/kernel/hints/{scoped_key_validation_request_and_generator.js → scoped_key_validation_request_and_separator.js} +6 -6
  185. package/dest/kernel/private_circuit_public_inputs.d.ts +9 -9
  186. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  187. package/dest/kernel/private_circuit_public_inputs.js +16 -16
  188. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +3 -3
  189. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  190. package/dest/kernel/private_kernel_circuit_public_inputs.js +4 -4
  191. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +3 -3
  192. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
  193. package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +4 -4
  194. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +4 -3
  195. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
  196. package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +11 -7
  197. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts +3 -3
  198. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts.map +1 -1
  199. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.js +7 -7
  200. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +3 -3
  201. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
  202. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.js +7 -7
  203. package/dest/kernel/private_validation_requests.d.ts +3 -3
  204. package/dest/kernel/private_validation_requests.js +9 -9
  205. package/dest/keys/derivation.js +8 -8
  206. package/dest/keys/key_types.d.ts +3 -3
  207. package/dest/keys/key_types.d.ts.map +1 -1
  208. package/dest/keys/public_keys.js +2 -2
  209. package/dest/keys/utils.js +5 -5
  210. package/dest/kv-store/config.d.ts +17 -0
  211. package/dest/kv-store/config.d.ts.map +1 -0
  212. package/dest/kv-store/config.js +26 -0
  213. package/dest/kv-store/index.d.ts +2 -0
  214. package/dest/kv-store/index.d.ts.map +1 -0
  215. package/dest/kv-store/index.js +1 -0
  216. package/dest/l1-contracts/index.d.ts +2 -2
  217. package/dest/l1-contracts/index.d.ts.map +1 -1
  218. package/dest/l1-contracts/index.js +1 -1
  219. package/dest/logs/debug_log_store.d.ts +30 -0
  220. package/dest/logs/debug_log_store.d.ts.map +1 -0
  221. package/dest/logs/debug_log_store.js +30 -0
  222. package/dest/logs/extended_directional_app_tagging_secret.d.ts +47 -0
  223. package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -0
  224. package/dest/logs/{directional_app_tagging_secret.js → extended_directional_app_tagging_secret.js} +35 -20
  225. package/dest/logs/index.d.ts +4 -2
  226. package/dest/logs/index.d.ts.map +1 -1
  227. package/dest/logs/index.js +3 -1
  228. package/dest/logs/log_filter.d.ts +4 -1
  229. package/dest/logs/log_filter.d.ts.map +1 -1
  230. package/dest/logs/log_filter.js +2 -1
  231. package/dest/logs/message_context.d.ts +4 -7
  232. package/dest/logs/message_context.d.ts.map +1 -1
  233. package/dest/logs/message_context.js +23 -9
  234. package/dest/logs/pending_tagged_log.d.ts +2 -3
  235. package/dest/logs/pending_tagged_log.d.ts.map +1 -1
  236. package/dest/logs/pending_tagged_log.js +2 -2
  237. package/dest/logs/pre_tag.d.ts +16 -11
  238. package/dest/logs/pre_tag.d.ts.map +1 -1
  239. package/dest/logs/pre_tag.js +2 -2
  240. package/dest/logs/private_log.d.ts +2 -2
  241. package/dest/logs/private_log.d.ts.map +1 -1
  242. package/dest/logs/public_log.d.ts +4 -3
  243. package/dest/logs/public_log.d.ts.map +1 -1
  244. package/dest/logs/public_log.js +2 -1
  245. package/dest/logs/shared_secret_derivation.d.ts +11 -10
  246. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  247. package/dest/logs/shared_secret_derivation.js +15 -9
  248. package/dest/logs/siloed_tag.d.ts +8 -3
  249. package/dest/logs/siloed_tag.d.ts.map +1 -1
  250. package/dest/logs/siloed_tag.js +12 -7
  251. package/dest/logs/tag.js +1 -1
  252. package/dest/logs/tagging_index_range.d.ts +40 -0
  253. package/dest/logs/tagging_index_range.d.ts.map +1 -0
  254. package/dest/logs/tagging_index_range.js +8 -0
  255. package/dest/logs/tx_scoped_l2_log.d.ts +3 -1
  256. package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
  257. package/dest/logs/tx_scoped_l2_log.js +7 -0
  258. package/dest/messaging/l1_to_l2_message.d.ts +3 -2
  259. package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
  260. package/dest/messaging/l1_to_l2_message.js +11 -13
  261. package/dest/messaging/l1_to_l2_message_source.d.ts +4 -2
  262. package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
  263. package/dest/messaging/l2_to_l1_membership.d.ts +32 -6
  264. package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
  265. package/dest/messaging/l2_to_l1_membership.js +69 -26
  266. package/dest/noir/index.d.ts +3 -3
  267. package/dest/noir/index.d.ts.map +1 -1
  268. package/dest/note/index.d.ts +1 -2
  269. package/dest/note/index.d.ts.map +1 -1
  270. package/dest/note/index.js +0 -1
  271. package/dest/note/note_dao.d.ts +1 -1
  272. package/dest/note/note_dao.d.ts.map +1 -1
  273. package/dest/note/note_dao.js +1 -4
  274. package/dest/p2p/attestation_utils.d.ts +11 -1
  275. package/dest/p2p/attestation_utils.d.ts.map +1 -1
  276. package/dest/p2p/attestation_utils.js +45 -0
  277. package/dest/p2p/block_proposal.d.ts +2 -2
  278. package/dest/p2p/block_proposal.d.ts.map +1 -1
  279. package/dest/p2p/block_proposal.js +2 -4
  280. package/dest/p2p/checkpoint_attestation.d.ts +2 -1
  281. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  282. package/dest/p2p/checkpoint_attestation.js +1 -1
  283. package/dest/p2p/checkpoint_proposal.d.ts +11 -11
  284. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  285. package/dest/p2p/checkpoint_proposal.js +21 -38
  286. package/dest/p2p/client_type.d.ts +2 -5
  287. package/dest/p2p/client_type.d.ts.map +1 -1
  288. package/dest/p2p/client_type.js +0 -7
  289. package/dest/p2p/consensus_payload.d.ts +12 -3
  290. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  291. package/dest/p2p/consensus_payload.js +22 -15
  292. package/dest/p2p/index.d.ts +1 -2
  293. package/dest/p2p/index.d.ts.map +1 -1
  294. package/dest/p2p/index.js +0 -1
  295. package/dest/p2p/peer_error.d.ts +3 -1
  296. package/dest/p2p/peer_error.d.ts.map +1 -1
  297. package/dest/p2p/peer_error.js +5 -0
  298. package/dest/p2p/topic_type.d.ts +3 -4
  299. package/dest/p2p/topic_type.d.ts.map +1 -1
  300. package/dest/p2p/topic_type.js +7 -24
  301. package/dest/proofs/chonk_proof.d.ts +46 -2
  302. package/dest/proofs/chonk_proof.d.ts.map +1 -1
  303. package/dest/proofs/chonk_proof.js +85 -10
  304. package/dest/rollup/checkpoint_header.d.ts +2 -2
  305. package/dest/rollup/checkpoint_header.js +2 -2
  306. package/dest/slashing/index.d.ts +2 -3
  307. package/dest/slashing/index.d.ts.map +1 -1
  308. package/dest/slashing/index.js +1 -2
  309. package/dest/slashing/serialization.d.ts +2 -6
  310. package/dest/slashing/serialization.d.ts.map +1 -1
  311. package/dest/slashing/serialization.js +0 -60
  312. package/dest/slashing/types.d.ts +4 -90
  313. package/dest/slashing/types.d.ts.map +1 -1
  314. package/dest/slashing/types.js +0 -14
  315. package/dest/slashing/{tally.d.ts → votes.d.ts} +7 -2
  316. package/dest/slashing/votes.d.ts.map +1 -0
  317. package/dest/slashing/{tally.js → votes.js} +30 -2
  318. package/dest/tests/factories.d.ts +4 -4
  319. package/dest/tests/factories.d.ts.map +1 -1
  320. package/dest/tests/factories.js +30 -39
  321. package/dest/tests/mocks.d.ts +8 -3
  322. package/dest/tests/mocks.d.ts.map +1 -1
  323. package/dest/tests/mocks.js +43 -38
  324. package/dest/timetable/index.d.ts +2 -1
  325. package/dest/timetable/index.d.ts.map +1 -1
  326. package/dest/timetable/index.js +6 -2
  327. package/dest/tx/block_header.d.ts +3 -1
  328. package/dest/tx/block_header.d.ts.map +1 -1
  329. package/dest/tx/block_header.js +6 -2
  330. package/dest/tx/capsule.d.ts +6 -2
  331. package/dest/tx/capsule.d.ts.map +1 -1
  332. package/dest/tx/capsule.js +9 -3
  333. package/dest/tx/global_variable_builder.d.ts +14 -2
  334. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  335. package/dest/tx/global_variables.d.ts +4 -4
  336. package/dest/tx/global_variables.d.ts.map +1 -1
  337. package/dest/tx/private_execution_result.d.ts +6 -6
  338. package/dest/tx/private_execution_result.d.ts.map +1 -1
  339. package/dest/tx/private_execution_result.js +6 -6
  340. package/dest/tx/profiling.d.ts +17 -5
  341. package/dest/tx/profiling.d.ts.map +1 -1
  342. package/dest/tx/profiling.js +15 -5
  343. package/dest/tx/protocol_contracts.d.ts +1 -1
  344. package/dest/tx/protocol_contracts.d.ts.map +1 -1
  345. package/dest/tx/protocol_contracts.js +2 -2
  346. package/dest/tx/public_simulation_output.d.ts +4 -2
  347. package/dest/tx/public_simulation_output.d.ts.map +1 -1
  348. package/dest/tx/public_simulation_output.js +7 -3
  349. package/dest/tx/simulated_tx.d.ts +115 -4
  350. package/dest/tx/simulated_tx.d.ts.map +1 -1
  351. package/dest/tx/simulated_tx.js +6 -3
  352. package/dest/tx/tx.d.ts +6 -5
  353. package/dest/tx/tx.d.ts.map +1 -1
  354. package/dest/tx/tx.js +18 -6
  355. package/dest/tx/tx_receipt.d.ts +29 -6
  356. package/dest/tx/tx_receipt.d.ts.map +1 -1
  357. package/dest/tx/tx_receipt.js +23 -19
  358. package/dest/tx/tx_request.js +2 -2
  359. package/dest/tx/validator/error_texts.d.ts +10 -2
  360. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  361. package/dest/tx/validator/error_texts.js +11 -1
  362. package/dest/update-checker/index.d.ts +3 -2
  363. package/dest/update-checker/index.d.ts.map +1 -1
  364. package/dest/update-checker/index.js +2 -1
  365. package/dest/update-checker/package_version.d.ts +3 -0
  366. package/dest/update-checker/package_version.d.ts.map +1 -0
  367. package/dest/update-checker/package_version.js +24 -0
  368. package/dest/update-checker/version_checker.d.ts +25 -0
  369. package/dest/update-checker/version_checker.d.ts.map +1 -0
  370. package/dest/update-checker/version_checker.js +50 -0
  371. package/dest/validators/errors.d.ts +6 -1
  372. package/dest/validators/errors.d.ts.map +1 -1
  373. package/dest/validators/errors.js +7 -0
  374. package/dest/validators/schemas.d.ts +30 -30
  375. package/dest/validators/schemas.d.ts.map +1 -1
  376. package/dest/validators/schemas.js +4 -3
  377. package/dest/validators/types.d.ts +3 -3
  378. package/dest/validators/types.d.ts.map +1 -1
  379. package/dest/versioning/versioning.d.ts +4 -2
  380. package/dest/versioning/versioning.d.ts.map +1 -1
  381. package/dest/versioning/versioning.js +4 -1
  382. package/dest/world-state/genesis_data.d.ts +11 -0
  383. package/dest/world-state/genesis_data.d.ts.map +1 -0
  384. package/dest/world-state/genesis_data.js +4 -0
  385. package/dest/world-state/index.d.ts +2 -1
  386. package/dest/world-state/index.d.ts.map +1 -1
  387. package/dest/world-state/index.js +1 -0
  388. package/package.json +12 -11
  389. package/src/abi/abi.ts +25 -2
  390. package/src/abi/buffer.ts +25 -4
  391. package/src/abi/decoder.ts +36 -82
  392. package/src/abi/encoder.ts +49 -6
  393. package/src/abi/event_metadata_definition.ts +2 -0
  394. package/src/abi/function_selector.ts +1 -1
  395. package/src/abi/function_signature_decoder.ts +77 -0
  396. package/src/abi/index.ts +1 -0
  397. package/src/abi/selector.ts +1 -1
  398. package/src/abi/utils.ts +25 -0
  399. package/src/auth_witness/auth_witness.ts +3 -3
  400. package/src/avm/revert_code.ts +26 -25
  401. package/src/block/block_data.ts +26 -0
  402. package/src/block/index.ts +1 -0
  403. package/src/block/l2_block.ts +13 -1
  404. package/src/block/l2_block_source.ts +47 -8
  405. package/src/block/l2_block_stream/l2_block_stream.ts +21 -0
  406. package/src/block/l2_block_stream/l2_tips_store_base.ts +24 -12
  407. package/src/block/test/l2_tips_store_test_suite.ts +8 -1
  408. package/src/checkpoint/checkpoint.ts +54 -17
  409. package/src/checkpoint/checkpoint_data.ts +87 -0
  410. package/src/checkpoint/index.ts +2 -0
  411. package/src/checkpoint/published_checkpoint.ts +3 -1
  412. package/src/checkpoint/validate.ts +230 -0
  413. package/src/config/index.ts +1 -0
  414. package/src/config/pipelining-config.ts +31 -0
  415. package/src/config/sequencer-config.ts +19 -1
  416. package/src/contract/contract_address.ts +7 -7
  417. package/src/contract/contract_class.ts +3 -3
  418. package/src/contract/contract_class_id.ts +7 -6
  419. package/src/contract/index.ts +0 -2
  420. package/src/contract/interfaces/contract_class.ts +2 -82
  421. package/src/contract/private_function.ts +2 -2
  422. package/src/epoch-helpers/index.ts +27 -0
  423. package/src/file-store/factory.ts +13 -4
  424. package/src/file-store/http.ts +29 -10
  425. package/src/file-store/index.ts +1 -0
  426. package/src/file-store/local.ts +15 -5
  427. package/src/file-store/s3.ts +12 -3
  428. package/src/gas/README.md +123 -0
  429. package/src/gas/gas_fees.ts +7 -1
  430. package/src/gas/gas_settings.ts +65 -12
  431. package/src/ha-signing/config.ts +156 -0
  432. package/src/ha-signing/index.ts +27 -0
  433. package/src/ha-signing/local_config.ts +46 -0
  434. package/src/ha-signing/types.ts +112 -0
  435. package/src/hash/hash.ts +48 -10
  436. package/src/hash/map_slot.ts +2 -2
  437. package/src/interfaces/allowed_element.ts +29 -9
  438. package/src/interfaces/archiver.ts +10 -2
  439. package/src/interfaces/aztec-node-admin.ts +28 -7
  440. package/src/interfaces/aztec-node.ts +25 -6
  441. package/src/interfaces/block-builder.ts +61 -14
  442. package/src/interfaces/configs.ts +36 -8
  443. package/src/interfaces/l2_logs_source.ts +4 -1
  444. package/src/interfaces/merkle_tree_operations.ts +9 -19
  445. package/src/interfaces/p2p.ts +2 -13
  446. package/src/interfaces/prover-client.ts +8 -0
  447. package/src/interfaces/slasher.ts +0 -6
  448. package/src/interfaces/validator.ts +49 -33
  449. package/src/interfaces/world_state.ts +4 -3
  450. package/src/kernel/hints/build_note_hash_read_request_hints.ts +14 -18
  451. package/src/kernel/hints/build_nullifier_read_request_hints.ts +15 -18
  452. package/src/kernel/hints/build_transient_data_hints.ts +17 -2
  453. package/src/kernel/hints/index.ts +2 -2
  454. package/src/kernel/hints/{key_validation_request_and_generator.ts → key_validation_request_and_separator.ts} +12 -15
  455. package/src/kernel/hints/{scoped_key_validation_request_and_generator.ts → scoped_key_validation_request_and_separator.ts} +10 -10
  456. package/src/kernel/private_circuit_public_inputs.ts +14 -14
  457. package/src/kernel/private_kernel_circuit_public_inputs.ts +2 -2
  458. package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +2 -2
  459. package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +14 -5
  460. package/src/kernel/private_to_public_kernel_circuit_public_inputs.ts +5 -5
  461. package/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts +5 -5
  462. package/src/kernel/private_validation_requests.ts +8 -8
  463. package/src/keys/derivation.ts +8 -8
  464. package/src/keys/key_types.ts +6 -2
  465. package/src/keys/public_keys.ts +2 -2
  466. package/src/keys/utils.ts +5 -5
  467. package/src/kv-store/config.ts +36 -0
  468. package/src/kv-store/index.ts +1 -0
  469. package/src/l1-contracts/index.ts +1 -1
  470. package/src/logs/debug_log_store.ts +54 -0
  471. package/src/logs/{directional_app_tagging_secret.ts → extended_directional_app_tagging_secret.ts} +41 -22
  472. package/src/logs/index.ts +3 -1
  473. package/src/logs/log_filter.ts +5 -0
  474. package/src/logs/message_context.ts +17 -7
  475. package/src/logs/pending_tagged_log.ts +1 -3
  476. package/src/logs/pre_tag.ts +5 -5
  477. package/src/logs/public_log.ts +4 -2
  478. package/src/logs/shared_secret_derivation.ts +21 -10
  479. package/src/logs/siloed_tag.ts +15 -5
  480. package/src/logs/tag.ts +1 -1
  481. package/src/logs/tagging_index_range.ts +24 -0
  482. package/src/logs/tx_scoped_l2_log.ts +16 -0
  483. package/src/messaging/l1_to_l2_message.ts +12 -9
  484. package/src/messaging/l1_to_l2_message_source.ts +3 -1
  485. package/src/messaging/l2_to_l1_membership.ts +98 -33
  486. package/src/noir/index.ts +2 -2
  487. package/src/note/index.ts +0 -1
  488. package/src/note/note_dao.ts +1 -4
  489. package/src/p2p/attestation_utils.ts +56 -0
  490. package/src/p2p/block_proposal.ts +1 -3
  491. package/src/p2p/checkpoint_attestation.ts +6 -1
  492. package/src/p2p/checkpoint_proposal.ts +42 -50
  493. package/src/p2p/client_type.ts +0 -6
  494. package/src/p2p/consensus_payload.ts +25 -12
  495. package/src/p2p/index.ts +0 -1
  496. package/src/p2p/peer_error.ts +7 -0
  497. package/src/p2p/topic_type.ts +8 -15
  498. package/src/proofs/chonk_proof.ts +91 -5
  499. package/src/rollup/checkpoint_header.ts +2 -2
  500. package/src/slashing/index.ts +1 -2
  501. package/src/slashing/serialization.ts +1 -81
  502. package/src/slashing/types.ts +3 -35
  503. package/src/slashing/{tally.ts → votes.ts} +34 -1
  504. package/src/tests/factories.ts +26 -46
  505. package/src/tests/mocks.ts +58 -30
  506. package/src/timetable/index.ts +7 -2
  507. package/src/tx/block_header.ts +8 -2
  508. package/src/tx/capsule.ts +10 -2
  509. package/src/tx/global_variable_builder.ts +15 -0
  510. package/src/tx/global_variables.ts +3 -3
  511. package/src/tx/private_execution_result.ts +5 -5
  512. package/src/tx/profiling.ts +14 -5
  513. package/src/tx/protocol_contracts.ts +2 -2
  514. package/src/tx/public_simulation_output.ts +4 -0
  515. package/src/tx/simulated_tx.ts +13 -2
  516. package/src/tx/tx.ts +20 -11
  517. package/src/tx/tx_receipt.ts +28 -16
  518. package/src/tx/tx_request.ts +2 -2
  519. package/src/tx/validator/error_texts.ts +13 -1
  520. package/src/update-checker/index.ts +2 -1
  521. package/src/update-checker/package_version.ts +30 -0
  522. package/src/update-checker/version_checker.ts +65 -0
  523. package/src/validators/errors.ts +9 -0
  524. package/src/validators/schemas.ts +8 -1
  525. package/src/validators/types.ts +5 -4
  526. package/src/versioning/versioning.ts +4 -1
  527. package/src/world-state/genesis_data.ts +15 -0
  528. package/src/world-state/index.ts +1 -0
  529. package/dest/contract/private_function_membership_proof.d.ts +0 -32
  530. package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
  531. package/dest/contract/private_function_membership_proof.js +0 -124
  532. package/dest/contract/utility_function_membership_proof.d.ts +0 -27
  533. package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
  534. package/dest/contract/utility_function_membership_proof.js +0 -87
  535. package/dest/kernel/hints/key_validation_request_and_generator.d.ts +0 -30
  536. package/dest/kernel/hints/key_validation_request_and_generator.d.ts.map +0 -1
  537. package/dest/l1-contracts/slash_factory.d.ts +0 -45
  538. package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
  539. package/dest/l1-contracts/slash_factory.js +0 -158
  540. package/dest/logs/directional_app_tagging_secret.d.ts +0 -40
  541. package/dest/logs/directional_app_tagging_secret.d.ts.map +0 -1
  542. package/dest/note/notes_filter.d.ts +0 -30
  543. package/dest/note/notes_filter.d.ts.map +0 -1
  544. package/dest/note/notes_filter.js +0 -11
  545. package/dest/slashing/empire.d.ts +0 -31
  546. package/dest/slashing/empire.d.ts.map +0 -1
  547. package/dest/slashing/empire.js +0 -87
  548. package/dest/slashing/tally.d.ts.map +0 -1
  549. package/dest/update-checker/update-checker.d.ts +0 -49
  550. package/dest/update-checker/update-checker.d.ts.map +0 -1
  551. package/dest/update-checker/update-checker.js +0 -130
  552. package/src/contract/private_function_membership_proof.ts +0 -167
  553. package/src/contract/utility_function_membership_proof.ts +0 -118
  554. package/src/l1-contracts/slash_factory.ts +0 -180
  555. package/src/note/notes_filter.ts +0 -41
  556. package/src/slashing/empire.ts +0 -104
  557. package/src/update-checker/update-checker.ts +0 -166
@@ -3,6 +3,9 @@ import type { EpochNumber } from '@aztec/foundation/branded-types';
3
3
  import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import { SiblingPath, UnbalancedMerkleTreeCalculator, computeUnbalancedShaRoot } from '@aztec/foundation/trees';
5
5
 
6
+ import type { AztecNode } from '../interfaces/aztec-node.js';
7
+ import { TxHash } from '../tx/tx_hash.js';
8
+
6
9
  /**
7
10
  * # L2-to-L1 Message Tree Structure and Leaf IDs
8
11
  *
@@ -92,59 +95,94 @@ export function getL2ToL1MessageLeafId(
92
95
  return 2n ** BigInt(membershipWitness.siblingPath.pathSize) + membershipWitness.leafIndex;
93
96
  }
94
97
 
95
- export interface MessageRetrieval {
96
- getL2ToL1Messages(epoch: EpochNumber): Promise<Fr[][][][]>;
97
- }
98
-
99
98
  export type L2ToL1MembershipWitness = {
100
99
  root: Fr;
101
100
  leafIndex: bigint;
102
101
  siblingPath: SiblingPath<number>;
102
+ epochNumber: EpochNumber;
103
103
  };
104
104
 
105
+ /**
106
+ * Computes the L2 to L1 membership witness for a given message in a transaction.
107
+ *
108
+ * @param node - The Aztec node to query for block/tx/epoch data.
109
+ * @param message - The L2 to L1 message hash to prove membership of.
110
+ * @param txHash - The hash of the transaction that emitted the message.
111
+ * @param messageIndexInTx - Optional index of the message within the transaction's L2-to-L1 messages.
112
+ * If not provided, the message is found by scanning the tx's messages (throws if duplicates exist).
113
+ * @returns The membership witness and epoch number, or undefined if the tx is not yet in a block/epoch.
114
+ */
105
115
  export async function computeL2ToL1MembershipWitness(
106
- messageRetriever: MessageRetrieval,
107
- epoch: EpochNumber,
116
+ node: Pick<
117
+ AztecNode,
118
+ 'getL2ToL1Messages' | 'getTxReceipt' | 'getTxEffect' | 'getBlock' | 'getCheckpointsDataForEpoch'
119
+ >,
108
120
  message: Fr,
121
+ txHash: TxHash,
122
+ messageIndexInTx?: number,
109
123
  ): Promise<L2ToL1MembershipWitness | undefined> {
110
- const messagesInEpoch = await messageRetriever.getL2ToL1Messages(epoch);
111
- if (messagesInEpoch.length === 0) {
124
+ const { epochNumber, blockNumber } = await node.getTxReceipt(txHash);
125
+ if (epochNumber === undefined || blockNumber === undefined) {
126
+ return undefined;
127
+ }
128
+
129
+ const [messagesInEpoch, block, txEffect, checkpointsData] = await Promise.all([
130
+ node.getL2ToL1Messages(epochNumber),
131
+ node.getBlock(blockNumber),
132
+ node.getTxEffect(txHash),
133
+ node.getCheckpointsDataForEpoch(epochNumber),
134
+ ]);
135
+
136
+ if (messagesInEpoch.length === 0 || !block || !txEffect) {
137
+ return undefined;
138
+ }
139
+
140
+ const checkpointIndex = checkpointsData.findIndex(c => c.checkpointNumber === block.checkpointNumber);
141
+ if (checkpointIndex === -1) {
112
142
  return undefined;
113
143
  }
114
144
 
115
- return computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoch, message);
145
+ const blockIndex = block.indexWithinCheckpoint;
146
+ const txIndex = txEffect.txIndexInBlock;
147
+
148
+ const { root, leafIndex, siblingPath } = computeL2ToL1MembershipWitnessFromMessagesInEpoch(
149
+ messagesInEpoch,
150
+ message,
151
+ checkpointIndex,
152
+ blockIndex,
153
+ txIndex,
154
+ messageIndexInTx,
155
+ );
156
+ return { epochNumber, root, leafIndex, siblingPath };
116
157
  }
117
158
 
118
- // TODO: Allow to specify the message to consume by its index or by an offset, in case there are multiple messages with
119
- // the same value.
159
+ /**
160
+ * Computes a membership witness for a message in the epoch's L2-to-L1 message tree, given explicit position indices.
161
+ *
162
+ * @param messagesInEpoch - All L2-to-L1 messages in the epoch, organized as checkpoints → blocks → txs → messages.
163
+ * @param message - The message hash to prove membership of.
164
+ * @param checkpointIndex - Index of the checkpoint within the epoch's message array.
165
+ * @param blockIndex - Index of the block within the checkpoint.
166
+ * @param txIndex - Index of the transaction within the block.
167
+ * @param messageIndexInTx - Optional index of the message within the transaction's messages.
168
+ * If not provided, the message is found by scanning (throws if duplicates exist within the tx).
169
+ */
170
+ /** @internal Exported for testing only. */
120
171
  export function computeL2ToL1MembershipWitnessFromMessagesInEpoch(
121
172
  messagesInEpoch: Fr[][][][],
122
173
  message: Fr,
123
- ): L2ToL1MembershipWitness {
124
- // Find the index of the message in the tx, index of the tx in the block, and index of the block in the epoch.
125
- let messageIndexInTx = -1;
126
- let txIndex = -1;
127
- let blockIndex = -1;
128
- const checkpointIndex = messagesInEpoch.findIndex(messagesInCheckpoint => {
129
- blockIndex = messagesInCheckpoint.findIndex(messagesInBlock => {
130
- txIndex = messagesInBlock.findIndex(messagesInTx => {
131
- messageIndexInTx = messagesInTx.findIndex(msg => msg.equals(message));
132
- return messageIndexInTx !== -1;
133
- });
134
- return txIndex !== -1;
135
- });
136
- return blockIndex !== -1;
137
- });
138
-
139
- if (checkpointIndex === -1) {
140
- throw new Error('The L2ToL1Message you are trying to prove inclusion of does not exist');
141
- }
174
+ checkpointIndex: number,
175
+ blockIndex: number,
176
+ txIndex: number,
177
+ messageIndexInTx?: number,
178
+ ): { root: Fr; leafIndex: bigint; siblingPath: SiblingPath<number> } {
179
+ const messagesInTx = messagesInEpoch[checkpointIndex][blockIndex][txIndex];
180
+ const resolvedMessageIndex = resolveMessageIndex(messagesInTx, message, messageIndexInTx);
142
181
 
143
182
  // Build the tx tree.
144
- const messagesInTx = messagesInEpoch[checkpointIndex][blockIndex][txIndex];
145
183
  const txTree = UnbalancedMerkleTreeCalculator.create(messagesInTx.map(msg => msg.toBuffer()));
146
184
  // Get the sibling path of the target message in the tx tree.
147
- const pathToMessageInTxSubtree = txTree.getSiblingPathByLeafIndex(messageIndexInTx);
185
+ const pathToMessageInTxSubtree = txTree.getSiblingPathByLeafIndex(resolvedMessageIndex);
148
186
 
149
187
  // Build the tree of the block containing the target message.
150
188
  const blockTree = buildBlockTree(messagesInEpoch[checkpointIndex][blockIndex]);
@@ -189,7 +227,7 @@ export function computeL2ToL1MembershipWitnessFromMessagesInEpoch(
189
227
  // Compute the combined index.
190
228
  // It is the index of the message in the balanced tree (by filling up the wonky tree with empty nodes) at its current
191
229
  // height. It's used to validate the membership proof.
192
- const messageLeafPosition = txTree.getLeafLocation(messageIndexInTx);
230
+ const messageLeafPosition = txTree.getLeafLocation(resolvedMessageIndex);
193
231
  const txLeafPosition = blockTree.getLeafLocation(txIndex);
194
232
  const blockLeafPosition = checkpointTree.getLeafLocation(blockIndex);
195
233
  const checkpointLeafPosition = epochTree.getLeafLocation(checkpointIndex);
@@ -207,6 +245,33 @@ export function computeL2ToL1MembershipWitnessFromMessagesInEpoch(
207
245
  };
208
246
  }
209
247
 
248
+ function resolveMessageIndex(messagesInTx: Fr[], message: Fr, messageIndexInTx?: number): number {
249
+ if (messageIndexInTx !== undefined) {
250
+ if (!messagesInTx[messageIndexInTx]?.equals(message)) {
251
+ throw new Error(`Message at index ${messageIndexInTx} in tx does not match the expected message ${message}`);
252
+ }
253
+ return messageIndexInTx;
254
+ }
255
+
256
+ const indices = messagesInTx.reduce<number[]>((acc, msg, i) => {
257
+ if (msg.equals(message)) {
258
+ acc.push(i);
259
+ }
260
+ return acc;
261
+ }, []);
262
+
263
+ if (indices.length === 0) {
264
+ throw new Error('The L2ToL1Message you are trying to prove inclusion of does not exist');
265
+ }
266
+ if (indices.length > 1) {
267
+ throw new Error(
268
+ `Multiple messages with the same value ${message} found in tx (indices: ${indices.join(', ')}). ` +
269
+ `Provide messageIndexInTx to disambiguate.`,
270
+ );
271
+ }
272
+ return indices[0];
273
+ }
274
+
210
275
  function buildCheckpointTree(messagesInCheckpoint: Fr[][][]) {
211
276
  const blockOutHashes = messagesInCheckpoint.map(messagesInBlock => buildBlockTree(messagesInBlock).getRoot());
212
277
  return buildCompressedTree(blockOutHashes);
package/src/noir/index.ts CHANGED
@@ -19,7 +19,7 @@ export const AZTEC_VIEW_ATTRIBUTE = 'abi_view';
19
19
  export interface NoirFunctionAbi {
20
20
  /** The parameters of the function. */
21
21
  parameters: ABIParameter[];
22
- /** The return type of the function. */
22
+ /** The return type of the function, or null for void functions. */
23
23
  return_type: {
24
24
  /**
25
25
  * The type of the return value.
@@ -29,7 +29,7 @@ export interface NoirFunctionAbi {
29
29
  * The visibility of the return value.
30
30
  */
31
31
  visibility: ABIParameterVisibility;
32
- };
32
+ } | null;
33
33
  /** Mapping of error selector => error type */
34
34
  error_types: Partial<Record<string, AbiErrorType>>;
35
35
  }
package/src/note/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './comparator.js';
2
2
  export * from './note_dao.js';
3
- export * from './notes_filter.js';
4
3
  export * from './note_status.js';
5
4
  export * from './note.js';
@@ -1,6 +1,5 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
- import { Point } from '@aztec/foundation/curves/grumpkin';
4
3
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
6
5
  import { Note } from '@aztec/stdlib/note';
@@ -148,9 +147,7 @@ export class NoteDao {
148
147
  * @returns - Its size in bytes.
149
148
  */
150
149
  public getSize() {
151
- const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
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;
150
+ return this.toBuffer().length;
154
151
  }
155
152
 
156
153
  static async random({
@@ -33,3 +33,59 @@ export function orderAttestations(
33
33
 
34
34
  return orderedAttestations;
35
35
  }
36
+
37
+ /**
38
+ * Trims attestations to the minimum required number to save L1 calldata gas.
39
+ * Each signature costs 65 bytes of calldata vs 20 bytes for just an address.
40
+ *
41
+ * Priority order for keeping attestations:
42
+ * 1. The proposer's attestation (required by L1 contract - MissingProposerSignature revert)
43
+ * 2. Attestations from the local node's validator keys
44
+ * 3. Remaining attestations filled to reach the required count
45
+ */
46
+ export function trimAttestations(
47
+ attestations: CheckpointAttestation[],
48
+ required: number,
49
+ proposerAddress: EthAddress,
50
+ localAddresses: EthAddress[],
51
+ ): CheckpointAttestation[] {
52
+ if (attestations.length <= required) {
53
+ return attestations;
54
+ }
55
+
56
+ const proposerAttestation: CheckpointAttestation[] = [];
57
+ const localAttestations: CheckpointAttestation[] = [];
58
+ const otherAttestations: CheckpointAttestation[] = [];
59
+
60
+ for (const attestation of attestations) {
61
+ const sender = attestation.getSender();
62
+ if (!sender) {
63
+ continue;
64
+ }
65
+ if (sender.equals(proposerAddress)) {
66
+ proposerAttestation.push(attestation);
67
+ } else if (localAddresses.some(addr => addr.equals(sender))) {
68
+ localAttestations.push(attestation);
69
+ } else {
70
+ otherAttestations.push(attestation);
71
+ }
72
+ }
73
+
74
+ const result: CheckpointAttestation[] = [...proposerAttestation];
75
+
76
+ for (const att of localAttestations) {
77
+ if (result.length >= required) {
78
+ break;
79
+ }
80
+ result.push(att);
81
+ }
82
+
83
+ for (const att of otherAttestations) {
84
+ if (result.length >= required) {
85
+ break;
86
+ }
87
+ result.push(att);
88
+ }
89
+
90
+ return result;
91
+ }
@@ -6,11 +6,11 @@ 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';
10
9
 
11
10
  import type { L2Block } from '../block/l2_block.js';
12
11
  import type { L2BlockInfo } from '../block/l2_block_info.js';
13
12
  import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
13
+ import { DutyType, type SigningContext } from '../ha-signing/index.js';
14
14
  import { BlockHeader } from '../tx/block_header.js';
15
15
  import { TxHash } from '../tx/index.js';
16
16
  import type { Tx } from '../tx/tx.js';
@@ -56,8 +56,6 @@ export class BlockProposal extends Gossipable {
56
56
  /** The per-block header containing block state and global variables */
57
57
  public readonly blockHeader: BlockHeader,
58
58
 
59
- // TODO(palla/mbps): Is this really needed? Can we just derive it from the indexWithinCheckpoint of the parent block and the slot number?
60
- // 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.
61
59
  /** Index of this block within the checkpoint (0-indexed) */
62
60
  public readonly indexWithinCheckpoint: IndexWithinCheckpoint,
63
61
 
@@ -96,7 +96,12 @@ export class CheckpointAttestation extends Gossipable {
96
96
  // Create a temporary CheckpointProposal to recover the proposer address.
97
97
  // We need to use CheckpointProposal because it has a different getPayloadToSign()
98
98
  // implementation than ConsensusPayload (uses serializeToBuffer vs ABI encoding).
99
- const proposal = new CheckpointProposal(this.payload.header, this.payload.archive, this.proposerSignature);
99
+ const proposal = new CheckpointProposal(
100
+ this.payload.header,
101
+ this.payload.archive,
102
+ this.payload.feeAssetPriceModifier,
103
+ this.proposerSignature,
104
+ );
100
105
  // Cache the proposer for later use
101
106
  this.proposer = proposal.getSender();
102
107
  }
@@ -5,11 +5,11 @@ import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
5
5
  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
- import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
9
- import { DutyType, type SigningContext } from '@aztec/validator-ha-signer/types';
8
+ import { BufferReader, serializeSignedBigInt, serializeToBuffer } from '@aztec/foundation/serialize';
10
9
 
11
10
  import type { L2BlockInfo } from '../block/l2_block_info.js';
12
11
  import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
12
+ import { DutyType, type SigningContext } from '../ha-signing/index.js';
13
13
  import { CheckpointHeader } from '../rollup/checkpoint_header.js';
14
14
  import { BlockHeader } from '../tx/block_header.js';
15
15
  import { TxHash } from '../tx/index.js';
@@ -81,7 +81,10 @@ export class CheckpointProposal extends Gossipable {
81
81
  /** Archive root after this checkpoint is applied */
82
82
  public readonly archive: Fr,
83
83
 
84
- /** The proposer's signature over the checkpoint payload (checkpointHeader + archive) */
84
+ /** The fee asset price modifier in basis points (from oracle) */
85
+ public readonly feeAssetPriceModifier: bigint,
86
+
87
+ /** The proposer's signature over the checkpoint payload (checkpointHeader + archive + feeAssetPriceModifier) */
85
88
  public readonly signature: Signature,
86
89
 
87
90
  /** Optional last block info, including its own signature for BlockProposal extraction */
@@ -98,23 +101,6 @@ export class CheckpointProposal extends Gossipable {
98
101
  return this.checkpointHeader.slotNumber;
99
102
  }
100
103
 
101
- get blockNumber(): BlockNumber {
102
- if (!this.lastBlock) {
103
- throw new Error('Cannot get blockNumber without lastBlock');
104
- }
105
- return this.lastBlock.blockHeader.getBlockNumber();
106
- }
107
-
108
- /** Convenience getter for txHashes from lastBlock */
109
- get txHashes(): TxHash[] {
110
- return this.lastBlock?.txHashes ?? [];
111
- }
112
-
113
- /** Convenience getter for txs from lastBlock */
114
- get txs(): Tx[] | undefined {
115
- return this.lastBlock?.signedTxs?.txs;
116
- }
117
-
118
104
  /**
119
105
  * Extract a BlockProposal from the last block info.
120
106
  * Uses inHash from checkpointHeader.contentCommitment.inHash
@@ -160,50 +146,48 @@ export class CheckpointProposal extends Gossipable {
160
146
 
161
147
  /**
162
148
  * Get the payload to sign for this checkpoint proposal.
163
- * The signature is over the checkpoint header + archive root (for consensus).
149
+ * The signature is over the checkpoint header + archive root + feeAssetPriceModifier (for consensus).
164
150
  */
165
151
  getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer {
166
- return serializeToBuffer([domainSeparator, this.checkpointHeader, this.archive]);
152
+ return serializeToBuffer([
153
+ domainSeparator,
154
+ this.checkpointHeader,
155
+ this.archive,
156
+ serializeSignedBigInt(this.feeAssetPriceModifier),
157
+ ]);
167
158
  }
168
159
 
169
160
  static async createProposalFromSigner(
170
161
  checkpointHeader: CheckpointHeader,
171
162
  archiveRoot: Fr,
172
- lastBlockInfo: CheckpointLastBlockData | undefined,
163
+ feeAssetPriceModifier: bigint,
164
+ lastBlockProposal: BlockProposal | undefined,
173
165
  payloadSigner: (payload: Buffer32, context: SigningContext) => Promise<Signature>,
174
166
  ): Promise<CheckpointProposal> {
175
167
  // Sign the checkpoint payload with CHECKPOINT_PROPOSAL duty type
176
- const tempProposal = new CheckpointProposal(checkpointHeader, archiveRoot, Signature.empty(), undefined);
168
+ const tempProposal = new CheckpointProposal(
169
+ checkpointHeader,
170
+ archiveRoot,
171
+ feeAssetPriceModifier,
172
+ Signature.empty(),
173
+ );
177
174
  const checkpointHash = getHashedSignaturePayload(tempProposal, SignatureDomainSeparator.checkpointProposal);
178
175
 
179
176
  const checkpointContext: SigningContext = {
180
177
  slot: checkpointHeader.slotNumber,
181
- blockNumber: lastBlockInfo?.blockHeader?.globalVariables.blockNumber ?? BlockNumber(0),
178
+ blockNumber: lastBlockProposal?.blockNumber ?? BlockNumber(0),
182
179
  dutyType: DutyType.CHECKPOINT_PROPOSAL,
183
180
  };
184
- const checkpointSignature = await payloadSigner(checkpointHash, checkpointContext);
185
181
 
186
- if (!lastBlockInfo) {
187
- return new CheckpointProposal(checkpointHeader, archiveRoot, checkpointSignature);
188
- }
182
+ const checkpointSignature = await payloadSigner(checkpointHash, checkpointContext);
189
183
 
190
- const lastBlockProposal = await BlockProposal.createProposalFromSigner(
191
- lastBlockInfo.blockHeader,
192
- lastBlockInfo.indexWithinCheckpoint,
193
- checkpointHeader.inHash,
184
+ return new CheckpointProposal(
185
+ checkpointHeader,
194
186
  archiveRoot,
195
- lastBlockInfo.txHashes,
196
- lastBlockInfo.txs,
197
- payloadSigner,
187
+ feeAssetPriceModifier,
188
+ checkpointSignature,
189
+ lastBlockProposal,
198
190
  );
199
-
200
- return new CheckpointProposal(checkpointHeader, archiveRoot, checkpointSignature, {
201
- blockHeader: lastBlockInfo.blockHeader,
202
- indexWithinCheckpoint: lastBlockInfo.indexWithinCheckpoint,
203
- txHashes: lastBlockInfo.txHashes,
204
- signature: lastBlockProposal.signature,
205
- signedTxs: lastBlockProposal.signedTxs,
206
- });
207
191
  }
208
192
 
209
193
  /**
@@ -237,7 +221,12 @@ export class CheckpointProposal extends Gossipable {
237
221
  }
238
222
 
239
223
  toBuffer(): Buffer {
240
- const buffer: any[] = [this.checkpointHeader, this.archive, this.signature];
224
+ const buffer: any[] = [
225
+ this.checkpointHeader,
226
+ this.archive,
227
+ serializeSignedBigInt(this.feeAssetPriceModifier),
228
+ this.signature,
229
+ ];
241
230
 
242
231
  if (this.lastBlock) {
243
232
  buffer.push(1); // hasLastBlock = true
@@ -264,6 +253,7 @@ export class CheckpointProposal extends Gossipable {
264
253
 
265
254
  const checkpointHeader = reader.readObject(CheckpointHeader);
266
255
  const archive = reader.readObject(Fr);
256
+ const feeAssetPriceModifier = reader.readInt256();
267
257
  const signature = reader.readObject(Signature);
268
258
 
269
259
  const hasLastBlock = reader.readNumber();
@@ -286,7 +276,7 @@ export class CheckpointProposal extends Gossipable {
286
276
  }
287
277
  }
288
278
 
289
- return new CheckpointProposal(checkpointHeader, archive, signature, {
279
+ return new CheckpointProposal(checkpointHeader, archive, feeAssetPriceModifier, signature, {
290
280
  blockHeader,
291
281
  indexWithinCheckpoint,
292
282
  txHashes,
@@ -295,7 +285,7 @@ export class CheckpointProposal extends Gossipable {
295
285
  });
296
286
  }
297
287
 
298
- return new CheckpointProposal(checkpointHeader, archive, signature);
288
+ return new CheckpointProposal(checkpointHeader, archive, feeAssetPriceModifier, signature);
299
289
  }
300
290
 
301
291
  getSize(): number {
@@ -303,6 +293,7 @@ export class CheckpointProposal extends Gossipable {
303
293
  this.checkpointHeader.toBuffer().length +
304
294
  this.archive.size +
305
295
  this.signature.getSize() +
296
+ 8 /* feeAssetPriceModifier */ +
306
297
  4; /* hasLastBlock flag */
307
298
 
308
299
  if (this.lastBlock) {
@@ -320,11 +311,11 @@ export class CheckpointProposal extends Gossipable {
320
311
  }
321
312
 
322
313
  static empty(): CheckpointProposal {
323
- return new CheckpointProposal(CheckpointHeader.empty(), Fr.ZERO, Signature.empty());
314
+ return new CheckpointProposal(CheckpointHeader.empty(), Fr.ZERO, 0n, Signature.empty());
324
315
  }
325
316
 
326
317
  static random(): CheckpointProposal {
327
- return new CheckpointProposal(CheckpointHeader.random(), Fr.random(), Signature.random(), {
318
+ return new CheckpointProposal(CheckpointHeader.random(), Fr.random(), 0n, Signature.random(), {
328
319
  blockHeader: BlockHeader.random(),
329
320
  indexWithinCheckpoint: IndexWithinCheckpoint(Math.floor(Math.random() * 5)),
330
321
  txHashes: [TxHash.random(), TxHash.random()],
@@ -337,6 +328,7 @@ export class CheckpointProposal extends Gossipable {
337
328
  checkpointHeader: this.checkpointHeader.toInspect(),
338
329
  archive: this.archive.toString(),
339
330
  signature: this.signature.toString(),
331
+ feeAssetPriceModifier: this.feeAssetPriceModifier.toString(),
340
332
  lastBlock: this.lastBlock
341
333
  ? {
342
334
  blockHeader: this.lastBlock.blockHeader.toInspect(),
@@ -353,7 +345,7 @@ export class CheckpointProposal extends Gossipable {
353
345
  * Used when the lastBlock has been extracted and stored separately.
354
346
  */
355
347
  toCore(): CheckpointProposalCore {
356
- return new CheckpointProposal(this.checkpointHeader, this.archive, this.signature);
348
+ return new CheckpointProposal(this.checkpointHeader, this.archive, this.feeAssetPriceModifier, this.signature);
357
349
  }
358
350
  }
359
351
 
@@ -1,6 +0,0 @@
1
- export enum P2PClientType {
2
- // Full p2p clients will subscribe to all gossip topics
3
- Full,
4
- // Prove p2p clients will only subscribe to transaction and proving topics
5
- Prover,
6
- }
@@ -1,6 +1,6 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { schemas } from '@aztec/foundation/schemas';
3
- import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
3
+ import { BufferReader, serializeSignedBigInt, serializeToBuffer } from '@aztec/foundation/serialize';
4
4
  import { hexToBuffer } from '@aztec/foundation/string';
5
5
  import type { FieldsOf } from '@aztec/foundation/types';
6
6
 
@@ -21,6 +21,8 @@ export class ConsensusPayload implements Signable {
21
21
  public readonly header: CheckpointHeader,
22
22
  /** The archive root after the block is added */
23
23
  public readonly archive: Fr,
24
+ /** The fee asset price modifier in basis points (from oracle) */
25
+ public readonly feeAssetPriceModifier: bigint = 0n,
24
26
  ) {}
25
27
 
26
28
  static get schema() {
@@ -28,12 +30,13 @@ export class ConsensusPayload implements Signable {
28
30
  .object({
29
31
  header: CheckpointHeader.schema,
30
32
  archive: schemas.Fr,
33
+ feeAssetPriceModifier: schemas.BigInt,
31
34
  })
32
- .transform(obj => new ConsensusPayload(obj.header, obj.archive));
35
+ .transform(obj => new ConsensusPayload(obj.header, obj.archive, obj.feeAssetPriceModifier));
33
36
  }
34
37
 
35
38
  static getFields(fields: FieldsOf<ConsensusPayload>) {
36
- return [fields.header, fields.archive] as const;
39
+ return [fields.header, fields.archive, fields.feeAssetPriceModifier] as const;
37
40
  }
38
41
 
39
42
  getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer {
@@ -50,41 +53,50 @@ export class ConsensusPayload implements Signable {
50
53
  const headerHash = this.header.hash().toString();
51
54
  const encodedData = encodeAbiParameters(abi, [
52
55
  domainSeparator,
53
- [archiveRoot, [0n] /* @todo See #9963 */, headerHash],
56
+ [archiveRoot, [this.feeAssetPriceModifier], headerHash],
54
57
  ] as const);
55
58
 
56
59
  return hexToBuffer(encodedData);
57
60
  }
58
61
 
59
62
  toBuffer(): Buffer {
60
- return serializeToBuffer([this.header, this.archive]);
63
+ return serializeToBuffer([this.header, this.archive, serializeSignedBigInt(this.feeAssetPriceModifier)]);
61
64
  }
62
65
 
63
66
  public equals(other: ConsensusPayload | CheckpointProposal | CheckpointProposalCore): boolean {
64
67
  const otherHeader = 'checkpointHeader' in other ? other.checkpointHeader : other.header;
65
- return this.header.equals(otherHeader) && this.archive.equals(other.archive);
68
+ const otherModifier = 'feeAssetPriceModifier' in other ? other.feeAssetPriceModifier : 0n;
69
+ return (
70
+ this.header.equals(otherHeader) &&
71
+ this.archive.equals(other.archive) &&
72
+ this.feeAssetPriceModifier === otherModifier
73
+ );
66
74
  }
67
75
 
68
76
  static fromBuffer(buf: Buffer | BufferReader): ConsensusPayload {
69
77
  const reader = BufferReader.asReader(buf);
70
- const payload = new ConsensusPayload(reader.readObject(CheckpointHeader), reader.readObject(Fr));
78
+ const payload = new ConsensusPayload(
79
+ reader.readObject(CheckpointHeader),
80
+ reader.readObject(Fr),
81
+ reader.readInt256(),
82
+ );
71
83
  return payload;
72
84
  }
73
85
 
74
86
  static fromFields(fields: FieldsOf<ConsensusPayload>): ConsensusPayload {
75
- return new ConsensusPayload(fields.header, fields.archive);
87
+ return new ConsensusPayload(fields.header, fields.archive, fields.feeAssetPriceModifier);
76
88
  }
77
89
 
78
90
  static fromCheckpoint(checkpoint: Checkpoint): ConsensusPayload {
79
- return new ConsensusPayload(checkpoint.header, checkpoint.archive.root);
91
+ return new ConsensusPayload(checkpoint.header, checkpoint.archive.root, checkpoint.feeAssetPriceModifier);
80
92
  }
81
93
 
82
94
  static empty(): ConsensusPayload {
83
- return new ConsensusPayload(CheckpointHeader.empty(), Fr.ZERO);
95
+ return new ConsensusPayload(CheckpointHeader.empty(), Fr.ZERO, 0n);
84
96
  }
85
97
 
86
98
  static random(): ConsensusPayload {
87
- return new ConsensusPayload(CheckpointHeader.random(), Fr.random());
99
+ return new ConsensusPayload(CheckpointHeader.random(), Fr.random(), 0n);
88
100
  }
89
101
 
90
102
  /**
@@ -104,10 +116,11 @@ export class ConsensusPayload implements Signable {
104
116
  return {
105
117
  header: this.header.toInspect(),
106
118
  archive: this.archive.toString(),
119
+ feeAssetPriceModifier: this.feeAssetPriceModifier.toString(),
107
120
  };
108
121
  }
109
122
 
110
123
  toString() {
111
- return `header: ${this.header.toString()}, archive: ${this.archive.toString()}}`;
124
+ return `header: ${this.header.toString()}, archive: ${this.archive.toString()}, feeAssetPriceModifier: ${this.feeAssetPriceModifier}}`;
112
125
  }
113
126
  }
package/src/p2p/index.ts CHANGED
@@ -8,7 +8,6 @@ export * from './interface.js';
8
8
  export * from './signature_utils.js';
9
9
  export * from './signed_txs.js';
10
10
  export * from './topic_type.js';
11
- export * from './client_type.js';
12
11
  export * from './message_validator.js';
13
12
  export * from './peer_error.js';
14
13
  export * from './constants.js';
@@ -15,3 +15,10 @@ export enum PeerErrorSeverity {
15
15
  */
16
16
  HighToleranceError = 'HighToleranceError',
17
17
  }
18
+
19
+ /** Severities ordered from mildest to harshest. */
20
+ export const PeerErrorSeverityByHarshness = [
21
+ PeerErrorSeverity.HighToleranceError,
22
+ PeerErrorSeverity.MidToleranceError,
23
+ PeerErrorSeverity.LowToleranceError,
24
+ ] as const;