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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (429) hide show
  1. package/dest/abi/authorization_selector.d.ts +3 -6
  2. package/dest/abi/authorization_selector.d.ts.map +1 -1
  3. package/dest/abi/buffer.d.ts +14 -4
  4. package/dest/abi/buffer.d.ts.map +1 -1
  5. package/dest/abi/buffer.js +25 -4
  6. package/dest/abi/decoder.d.ts +5 -44
  7. package/dest/abi/decoder.d.ts.map +1 -1
  8. package/dest/abi/decoder.js +12 -67
  9. package/dest/abi/encoder.d.ts +1 -1
  10. package/dest/abi/encoder.d.ts.map +1 -1
  11. package/dest/abi/encoder.js +32 -6
  12. package/dest/abi/event_selector.d.ts +3 -6
  13. package/dest/abi/event_selector.d.ts.map +1 -1
  14. package/dest/abi/function_selector.d.ts +3 -6
  15. package/dest/abi/function_selector.d.ts.map +1 -1
  16. package/dest/abi/function_selector.js +2 -4
  17. package/dest/abi/function_signature_decoder.d.ts +43 -0
  18. package/dest/abi/function_signature_decoder.d.ts.map +1 -0
  19. package/dest/abi/function_signature_decoder.js +66 -0
  20. package/dest/abi/index.d.ts +2 -1
  21. package/dest/abi/index.d.ts.map +1 -1
  22. package/dest/abi/index.js +1 -0
  23. package/dest/abi/note_selector.d.ts +3 -6
  24. package/dest/abi/note_selector.d.ts.map +1 -1
  25. package/dest/abi/note_selector.js +1 -3
  26. package/dest/abi/selector.d.ts +2 -2
  27. package/dest/abi/selector.d.ts.map +1 -1
  28. package/dest/abi/selector.js +1 -1
  29. package/dest/avm/avm.d.ts +300 -300
  30. package/dest/avm/revert_code.d.ts +8 -18
  31. package/dest/avm/revert_code.d.ts.map +1 -1
  32. package/dest/avm/revert_code.js +15 -30
  33. package/dest/aztec-address/index.d.ts +3 -6
  34. package/dest/aztec-address/index.d.ts.map +1 -1
  35. package/dest/aztec-address/index.js +2 -4
  36. package/dest/block/attestation_info.d.ts +3 -2
  37. package/dest/block/attestation_info.d.ts.map +1 -1
  38. package/dest/block/attestation_info.js +7 -5
  39. package/dest/block/block_data.d.ts +297 -8
  40. package/dest/block/block_data.d.ts.map +1 -1
  41. package/dest/block/block_data.js +16 -2
  42. package/dest/block/block_hash.d.ts +11 -10
  43. package/dest/block/block_hash.d.ts.map +1 -1
  44. package/dest/block/block_hash.js +10 -9
  45. package/dest/block/block_parameter.d.ts +30 -3
  46. package/dest/block/block_parameter.d.ts.map +1 -1
  47. package/dest/block/block_parameter.js +36 -2
  48. package/dest/block/l2_block_info.d.ts +6 -5
  49. package/dest/block/l2_block_info.d.ts.map +1 -1
  50. package/dest/block/l2_block_info.js +6 -5
  51. package/dest/block/l2_block_source.d.ts +120 -6
  52. package/dest/block/l2_block_source.d.ts.map +1 -1
  53. package/dest/block/l2_block_source.js +1 -0
  54. package/dest/block/l2_block_stream/interfaces.d.ts +6 -3
  55. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  56. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
  57. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  58. package/dest/block/l2_block_stream/l2_tips_store_base.js +18 -5
  59. package/dest/block/proposal/attestations_and_signers.d.ts +13 -6
  60. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
  61. package/dest/block/proposal/attestations_and_signers.js +26 -18
  62. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  63. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  64. package/dest/block/test/l2_tips_store_test_suite.js +4 -3
  65. package/dest/checkpoint/checkpoint.d.ts +7 -1
  66. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  67. package/dest/checkpoint/checkpoint.js +9 -1
  68. package/dest/checkpoint/checkpoint_data.d.ts +77 -5
  69. package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
  70. package/dest/checkpoint/checkpoint_data.js +12 -0
  71. package/dest/config/chain-config.d.ts +2 -2
  72. package/dest/config/chain-config.d.ts.map +1 -1
  73. package/dest/config/chain-config.js +9 -3
  74. package/dest/config/sequencer-config.d.ts +3 -3
  75. package/dest/config/sequencer-config.d.ts.map +1 -1
  76. package/dest/config/sequencer-config.js +11 -4
  77. package/dest/contract/contract_address.d.ts +1 -1
  78. package/dest/contract/contract_address.js +2 -2
  79. package/dest/contract/index.d.ts +1 -3
  80. package/dest/contract/index.d.ts.map +1 -1
  81. package/dest/contract/index.js +0 -2
  82. package/dest/contract/interfaces/contract_class.d.ts +3 -156
  83. package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
  84. package/dest/contract/interfaces/contract_class.js +1 -28
  85. package/dest/contract/private_function.d.ts +1 -1
  86. package/dest/contract/private_function.d.ts.map +1 -1
  87. package/dest/contract/private_function.js +2 -4
  88. package/dest/epoch-helpers/index.d.ts +7 -1
  89. package/dest/epoch-helpers/index.d.ts.map +1 -1
  90. package/dest/epoch-helpers/index.js +12 -0
  91. package/dest/file-store/factory.d.ts +4 -3
  92. package/dest/file-store/factory.d.ts.map +1 -1
  93. package/dest/file-store/factory.js +2 -2
  94. package/dest/file-store/http.d.ts +9 -2
  95. package/dest/file-store/http.d.ts.map +1 -1
  96. package/dest/file-store/http.js +20 -9
  97. package/dest/file-store/index.d.ts +2 -1
  98. package/dest/file-store/index.d.ts.map +1 -1
  99. package/dest/gas/fee_math.d.ts +49 -0
  100. package/dest/gas/fee_math.d.ts.map +1 -0
  101. package/dest/gas/fee_math.js +80 -0
  102. package/dest/gas/gas_fees.d.ts +5 -1
  103. package/dest/gas/gas_fees.d.ts.map +1 -1
  104. package/dest/gas/gas_fees.js +10 -1
  105. package/dest/gas/gas_settings.d.ts +40 -3
  106. package/dest/gas/gas_settings.d.ts.map +1 -1
  107. package/dest/gas/gas_settings.js +50 -6
  108. package/dest/gas/index.d.ts +2 -1
  109. package/dest/gas/index.d.ts.map +1 -1
  110. package/dest/gas/index.js +1 -0
  111. package/dest/ha-signing/config.d.ts +6 -6
  112. package/dest/ha-signing/config.d.ts.map +1 -1
  113. package/dest/ha-signing/config.js +4 -3
  114. package/dest/ha-signing/index.d.ts +2 -2
  115. package/dest/ha-signing/index.d.ts.map +1 -1
  116. package/dest/ha-signing/index.js +1 -1
  117. package/dest/ha-signing/local_config.d.ts +1 -1
  118. package/dest/ha-signing/local_config.d.ts.map +1 -1
  119. package/dest/ha-signing/local_config.js +2 -2
  120. package/dest/ha-signing/types.d.ts +37 -32
  121. package/dest/ha-signing/types.d.ts.map +1 -1
  122. package/dest/ha-signing/types.js +13 -6
  123. package/dest/hash/hash.d.ts +19 -1
  124. package/dest/hash/hash.d.ts.map +1 -1
  125. package/dest/hash/hash.js +37 -0
  126. package/dest/interfaces/archiver.d.ts +11 -1
  127. package/dest/interfaces/archiver.d.ts.map +1 -1
  128. package/dest/interfaces/archiver.js +11 -3
  129. package/dest/interfaces/aztec-node-admin.d.ts +19 -17
  130. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  131. package/dest/interfaces/aztec-node-admin.js +5 -4
  132. package/dest/interfaces/aztec-node-debug.d.ts +21 -0
  133. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
  134. package/dest/interfaces/aztec-node-debug.js +18 -0
  135. package/dest/interfaces/aztec-node.d.ts +54 -55
  136. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  137. package/dest/interfaces/aztec-node.js +20 -16
  138. package/dest/interfaces/block_response.d.ts +156 -0
  139. package/dest/interfaces/block_response.d.ts.map +1 -0
  140. package/dest/interfaces/block_response.js +24 -0
  141. package/dest/interfaces/chain_tips.d.ts +304 -0
  142. package/dest/interfaces/chain_tips.d.ts.map +1 -0
  143. package/dest/interfaces/chain_tips.js +11 -0
  144. package/dest/interfaces/checkpoint_parameter.d.ts +27 -0
  145. package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -0
  146. package/dest/interfaces/checkpoint_parameter.js +20 -0
  147. package/dest/interfaces/checkpoint_response.d.ts +312 -0
  148. package/dest/interfaces/checkpoint_response.d.ts.map +1 -0
  149. package/dest/interfaces/checkpoint_response.js +26 -0
  150. package/dest/interfaces/client.d.ts +7 -1
  151. package/dest/interfaces/client.d.ts.map +1 -1
  152. package/dest/interfaces/client.js +6 -0
  153. package/dest/interfaces/configs.d.ts +7 -2
  154. package/dest/interfaces/configs.d.ts.map +1 -1
  155. package/dest/interfaces/configs.js +2 -1
  156. package/dest/interfaces/l1_publish_info.d.ts +43 -0
  157. package/dest/interfaces/l1_publish_info.d.ts.map +1 -0
  158. package/dest/interfaces/l1_publish_info.js +26 -0
  159. package/dest/interfaces/merkle_tree_operations.d.ts +4 -3
  160. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  161. package/dest/interfaces/prover-client.d.ts +1 -1
  162. package/dest/interfaces/prover-client.d.ts.map +1 -1
  163. package/dest/interfaces/prover-client.js +0 -3
  164. package/dest/interfaces/proving-job.d.ts +200 -200
  165. package/dest/interfaces/server.d.ts +6 -1
  166. package/dest/interfaces/server.d.ts.map +1 -1
  167. package/dest/interfaces/server.js +5 -0
  168. package/dest/interfaces/slasher.d.ts +1 -10
  169. package/dest/interfaces/slasher.d.ts.map +1 -1
  170. package/dest/interfaces/slasher.js +0 -2
  171. package/dest/interfaces/validator.d.ts +24 -26
  172. package/dest/interfaces/validator.d.ts.map +1 -1
  173. package/dest/interfaces/validator.js +1 -1
  174. package/dest/l1-contracts/index.d.ts +2 -2
  175. package/dest/l1-contracts/index.d.ts.map +1 -1
  176. package/dest/l1-contracts/index.js +1 -1
  177. package/dest/logs/extended_directional_app_tagging_secret.d.ts +4 -4
  178. package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -1
  179. package/dest/logs/extended_directional_app_tagging_secret.js +12 -5
  180. package/dest/logs/log_id.d.ts +1 -1
  181. package/dest/logs/log_id.d.ts.map +1 -1
  182. package/dest/logs/log_id.js +1 -2
  183. package/dest/logs/message_context.d.ts +4 -7
  184. package/dest/logs/message_context.d.ts.map +1 -1
  185. package/dest/logs/message_context.js +23 -9
  186. package/dest/logs/pending_tagged_log.d.ts +2 -3
  187. package/dest/logs/pending_tagged_log.d.ts.map +1 -1
  188. package/dest/logs/pending_tagged_log.js +2 -2
  189. package/dest/logs/shared_secret_derivation.d.ts +11 -10
  190. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  191. package/dest/logs/shared_secret_derivation.js +15 -9
  192. package/dest/logs/siloed_tag.d.ts +8 -7
  193. package/dest/logs/siloed_tag.d.ts.map +1 -1
  194. package/dest/logs/siloed_tag.js +11 -3
  195. package/dest/logs/tag.d.ts +5 -6
  196. package/dest/logs/tag.d.ts.map +1 -1
  197. package/dest/logs/tag.js +4 -0
  198. package/dest/messaging/l1_to_l2_message.d.ts +3 -2
  199. package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
  200. package/dest/messaging/l1_to_l2_message.js +11 -13
  201. package/dest/note/note_dao.d.ts +1 -1
  202. package/dest/note/note_dao.d.ts.map +1 -1
  203. package/dest/note/note_dao.js +1 -4
  204. package/dest/p2p/block_proposal.d.ts +22 -14
  205. package/dest/p2p/block_proposal.d.ts.map +1 -1
  206. package/dest/p2p/block_proposal.js +45 -40
  207. package/dest/p2p/checkpoint_attestation.d.ts +10 -8
  208. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  209. package/dest/p2p/checkpoint_attestation.js +17 -24
  210. package/dest/p2p/checkpoint_proposal.d.ts +20 -14
  211. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  212. package/dest/p2p/checkpoint_proposal.js +34 -51
  213. package/dest/p2p/consensus_payload.d.ts +18 -7
  214. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  215. package/dest/p2p/consensus_payload.js +31 -19
  216. package/dest/p2p/gossipable.d.ts +4 -4
  217. package/dest/p2p/gossipable.d.ts.map +1 -1
  218. package/dest/p2p/signature_utils.d.ts +28 -19
  219. package/dest/p2p/signature_utils.d.ts.map +1 -1
  220. package/dest/p2p/signature_utils.js +118 -21
  221. package/dest/p2p/signed_txs.d.ts +15 -13
  222. package/dest/p2p/signed_txs.d.ts.map +1 -1
  223. package/dest/p2p/signed_txs.js +26 -24
  224. package/dest/parity/parity_base_private_inputs.d.ts +7 -3
  225. package/dest/parity/parity_base_private_inputs.d.ts.map +1 -1
  226. package/dest/parity/parity_base_private_inputs.js +7 -5
  227. package/dest/parity/parity_public_inputs.d.ts +7 -3
  228. package/dest/parity/parity_public_inputs.d.ts.map +1 -1
  229. package/dest/parity/parity_public_inputs.js +6 -3
  230. package/dest/proofs/chonk_proof.d.ts +46 -2
  231. package/dest/proofs/chonk_proof.d.ts.map +1 -1
  232. package/dest/proofs/chonk_proof.js +85 -10
  233. package/dest/rollup/block_headers_hash.d.ts +1 -1
  234. package/dest/rollup/block_headers_hash.d.ts.map +1 -1
  235. package/dest/rollup/block_headers_hash.js +8 -2
  236. package/dest/slashing/index.d.ts +2 -3
  237. package/dest/slashing/index.d.ts.map +1 -1
  238. package/dest/slashing/index.js +1 -2
  239. package/dest/slashing/serialization.d.ts +2 -6
  240. package/dest/slashing/serialization.d.ts.map +1 -1
  241. package/dest/slashing/serialization.js +0 -60
  242. package/dest/slashing/types.d.ts +4 -90
  243. package/dest/slashing/types.d.ts.map +1 -1
  244. package/dest/slashing/types.js +0 -14
  245. package/dest/slashing/{tally.d.ts → votes.d.ts} +1 -1
  246. package/dest/slashing/{tally.d.ts.map → votes.d.ts.map} +1 -1
  247. package/dest/slashing/{tally.js → votes.js} +1 -1
  248. package/dest/tests/factories.d.ts +3 -10
  249. package/dest/tests/factories.d.ts.map +1 -1
  250. package/dest/tests/factories.js +19 -46
  251. package/dest/tests/mocks.d.ts +7 -1
  252. package/dest/tests/mocks.d.ts.map +1 -1
  253. package/dest/tests/mocks.js +39 -30
  254. package/dest/timetable/index.d.ts +51 -1
  255. package/dest/timetable/index.d.ts.map +1 -1
  256. package/dest/timetable/index.js +218 -14
  257. package/dest/trees/nullifier_leaf.d.ts +2 -1
  258. package/dest/trees/nullifier_leaf.d.ts.map +1 -1
  259. package/dest/trees/nullifier_leaf.js +3 -0
  260. package/dest/tx/block_header.d.ts +2 -2
  261. package/dest/tx/block_header.d.ts.map +1 -1
  262. package/dest/tx/block_header.js +1 -1
  263. package/dest/tx/capsule.d.ts +6 -2
  264. package/dest/tx/capsule.d.ts.map +1 -1
  265. package/dest/tx/capsule.js +9 -3
  266. package/dest/tx/fee_provider.d.ts +10 -0
  267. package/dest/tx/fee_provider.d.ts.map +1 -0
  268. package/dest/tx/fee_provider.js +1 -0
  269. package/dest/tx/global_variable_builder.d.ts +3 -4
  270. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  271. package/dest/tx/index.d.ts +2 -1
  272. package/dest/tx/index.d.ts.map +1 -1
  273. package/dest/tx/index.js +1 -0
  274. package/dest/tx/indexed_tx_effect.d.ts +1 -1
  275. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  276. package/dest/tx/indexed_tx_effect.js +1 -2
  277. package/dest/tx/profiling.js +4 -4
  278. package/dest/tx/simulated_tx.d.ts +4 -4
  279. package/dest/tx/simulated_tx.d.ts.map +1 -1
  280. package/dest/tx/simulated_tx.js +3 -3
  281. package/dest/tx/tx.d.ts +3 -3
  282. package/dest/tx/tx.d.ts.map +1 -1
  283. package/dest/tx/tx_receipt.d.ts +8 -4
  284. package/dest/tx/tx_receipt.d.ts.map +1 -1
  285. package/dest/tx/tx_receipt.js +8 -15
  286. package/dest/tx/validator/error_texts.d.ts +5 -1
  287. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  288. package/dest/tx/validator/error_texts.js +6 -0
  289. package/dest/types/shared.d.ts +1 -10
  290. package/dest/types/shared.d.ts.map +1 -1
  291. package/dest/types/shared.js +0 -9
  292. package/dest/vks/verification_key.d.ts +2 -137
  293. package/dest/vks/verification_key.d.ts.map +1 -1
  294. package/dest/vks/verification_key.js +5 -126
  295. package/dest/world-state/genesis_data.d.ts +11 -0
  296. package/dest/world-state/genesis_data.d.ts.map +1 -0
  297. package/dest/world-state/genesis_data.js +4 -0
  298. package/dest/world-state/index.d.ts +2 -1
  299. package/dest/world-state/index.d.ts.map +1 -1
  300. package/dest/world-state/index.js +1 -0
  301. package/dest/world-state/world_state_revision.d.ts +8 -1
  302. package/dest/world-state/world_state_revision.d.ts.map +1 -1
  303. package/dest/world-state/world_state_revision.js +7 -1
  304. package/package.json +8 -8
  305. package/src/abi/authorization_selector.ts +2 -8
  306. package/src/abi/buffer.ts +25 -4
  307. package/src/abi/decoder.ts +23 -78
  308. package/src/abi/encoder.ts +42 -6
  309. package/src/abi/event_selector.ts +2 -8
  310. package/src/abi/function_selector.ts +4 -13
  311. package/src/abi/function_signature_decoder.ts +77 -0
  312. package/src/abi/index.ts +1 -0
  313. package/src/abi/note_selector.ts +3 -12
  314. package/src/abi/selector.ts +1 -1
  315. package/src/avm/revert_code.ts +25 -39
  316. package/src/aztec-address/index.ts +4 -10
  317. package/src/block/attestation_info.ts +11 -11
  318. package/src/block/block_data.ts +20 -4
  319. package/src/block/block_hash.ts +21 -14
  320. package/src/block/block_parameter.ts +35 -2
  321. package/src/block/l2_block_info.ts +8 -6
  322. package/src/block/l2_block_source.ts +55 -5
  323. package/src/block/l2_block_stream/interfaces.ts +6 -2
  324. package/src/block/l2_block_stream/l2_tips_store_base.ts +25 -13
  325. package/src/block/proposal/attestations_and_signers.ts +32 -17
  326. package/src/block/test/l2_tips_store_test_suite.ts +9 -2
  327. package/src/checkpoint/checkpoint.ts +11 -1
  328. package/src/checkpoint/checkpoint_data.ts +44 -4
  329. package/src/config/chain-config.ts +9 -4
  330. package/src/config/sequencer-config.ts +20 -6
  331. package/src/contract/contract_address.ts +2 -2
  332. package/src/contract/index.ts +0 -2
  333. package/src/contract/interfaces/contract_class.ts +2 -82
  334. package/src/contract/private_function.ts +3 -1
  335. package/src/epoch-helpers/index.ts +24 -0
  336. package/src/file-store/factory.ts +13 -4
  337. package/src/file-store/http.ts +29 -10
  338. package/src/file-store/index.ts +1 -0
  339. package/src/gas/README.md +31 -0
  340. package/src/gas/fee_math.ts +120 -0
  341. package/src/gas/gas_fees.ts +17 -4
  342. package/src/gas/gas_settings.ts +65 -12
  343. package/src/gas/index.ts +1 -0
  344. package/src/ha-signing/config.ts +5 -2
  345. package/src/ha-signing/index.ts +3 -1
  346. package/src/ha-signing/local_config.ts +2 -2
  347. package/src/ha-signing/types.ts +48 -34
  348. package/src/hash/hash.ts +32 -0
  349. package/src/interfaces/archiver.ts +22 -2
  350. package/src/interfaces/aztec-node-admin.ts +8 -8
  351. package/src/interfaces/aztec-node-debug.ts +40 -0
  352. package/src/interfaces/aztec-node.ts +120 -95
  353. package/src/interfaces/block_response.ts +79 -0
  354. package/src/interfaces/chain_tips.ts +24 -0
  355. package/src/interfaces/checkpoint_parameter.ts +22 -0
  356. package/src/interfaces/checkpoint_response.ts +84 -0
  357. package/src/interfaces/client.ts +6 -0
  358. package/src/interfaces/configs.ts +5 -1
  359. package/src/interfaces/l1_publish_info.ts +40 -0
  360. package/src/interfaces/merkle_tree_operations.ts +3 -2
  361. package/src/interfaces/prover-client.ts +2 -5
  362. package/src/interfaces/server.ts +5 -0
  363. package/src/interfaces/slasher.ts +0 -6
  364. package/src/interfaces/validator.ts +21 -13
  365. package/src/l1-contracts/index.ts +1 -1
  366. package/src/logs/extended_directional_app_tagging_secret.ts +19 -8
  367. package/src/logs/log_id.ts +1 -2
  368. package/src/logs/message_context.ts +17 -7
  369. package/src/logs/pending_tagged_log.ts +1 -3
  370. package/src/logs/shared_secret_derivation.ts +21 -10
  371. package/src/logs/siloed_tag.ts +15 -11
  372. package/src/logs/tag.ts +8 -8
  373. package/src/messaging/l1_to_l2_message.ts +12 -9
  374. package/src/note/note_dao.ts +1 -4
  375. package/src/p2p/block_proposal.ts +96 -36
  376. package/src/p2p/checkpoint_attestation.ts +20 -29
  377. package/src/p2p/checkpoint_proposal.ts +88 -71
  378. package/src/p2p/consensus_payload.ts +50 -28
  379. package/src/p2p/gossipable.ts +4 -4
  380. package/src/p2p/signature_utils.ts +110 -25
  381. package/src/p2p/signed_txs.ts +46 -28
  382. package/src/parity/parity_base_private_inputs.ts +10 -4
  383. package/src/parity/parity_public_inputs.ts +9 -2
  384. package/src/proofs/chonk_proof.ts +91 -5
  385. package/src/rollup/block_headers_hash.ts +11 -2
  386. package/src/slashing/index.ts +1 -2
  387. package/src/slashing/serialization.ts +1 -81
  388. package/src/slashing/types.ts +3 -35
  389. package/src/slashing/{tally.ts → votes.ts} +1 -1
  390. package/src/tests/factories.ts +19 -54
  391. package/src/tests/mocks.ts +63 -39
  392. package/src/timetable/index.ts +308 -13
  393. package/src/trees/nullifier_leaf.ts +4 -0
  394. package/src/tx/block_header.ts +2 -2
  395. package/src/tx/capsule.ts +10 -2
  396. package/src/tx/fee_provider.ts +10 -0
  397. package/src/tx/global_variable_builder.ts +2 -3
  398. package/src/tx/index.ts +1 -0
  399. package/src/tx/indexed_tx_effect.ts +1 -2
  400. package/src/tx/profiling.ts +4 -4
  401. package/src/tx/simulated_tx.ts +6 -2
  402. package/src/tx/tx.ts +2 -2
  403. package/src/tx/tx_receipt.ts +11 -14
  404. package/src/tx/validator/error_texts.ts +8 -0
  405. package/src/types/shared.ts +0 -10
  406. package/src/vks/verification_key.ts +5 -184
  407. package/src/world-state/genesis_data.ts +15 -0
  408. package/src/world-state/index.ts +1 -0
  409. package/src/world-state/world_state_revision.ts +9 -1
  410. package/dest/abi/mocked_keys.d.ts +0 -2
  411. package/dest/abi/mocked_keys.d.ts.map +0 -1
  412. package/dest/abi/mocked_keys.js +0 -1
  413. package/dest/contract/private_function_membership_proof.d.ts +0 -32
  414. package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
  415. package/dest/contract/private_function_membership_proof.js +0 -124
  416. package/dest/contract/utility_function_membership_proof.d.ts +0 -27
  417. package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
  418. package/dest/contract/utility_function_membership_proof.js +0 -87
  419. package/dest/l1-contracts/slash_factory.d.ts +0 -45
  420. package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
  421. package/dest/l1-contracts/slash_factory.js +0 -158
  422. package/dest/slashing/empire.d.ts +0 -31
  423. package/dest/slashing/empire.d.ts.map +0 -1
  424. package/dest/slashing/empire.js +0 -87
  425. package/src/abi/mocked_keys.ts +0 -2
  426. package/src/contract/private_function_membership_proof.ts +0 -167
  427. package/src/contract/utility_function_membership_proof.ts +0 -118
  428. package/src/l1-contracts/slash_factory.ts +0 -180
  429. package/src/slashing/empire.ts +0 -104
@@ -1,15 +1,20 @@
1
- import { Buffer32 } from '@aztec/foundation/buffer';
2
- import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
3
1
  import type { EthAddress } from '@aztec/foundation/eth-address';
4
2
  import { Signature } from '@aztec/foundation/eth-signature';
5
3
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
6
4
 
5
+ import type { TypedDataDefinition } from 'viem';
6
+
7
7
  import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
8
8
  import { Tx } from '../tx/tx.js';
9
9
  import {
10
- SignatureDomainSeparator,
11
- getHashedSignaturePayload,
12
- getHashedSignaturePayloadEthSignedMessage,
10
+ type CoordinationSignatureContext,
11
+ type CoordinationSignatureType,
12
+ EMPTY_COORDINATION_SIGNATURE_CONTEXT,
13
+ type Signable,
14
+ getCoordinationSignatureTypedData,
15
+ readCoordinationSignatureContext,
16
+ recoverCoordinationSigner,
17
+ serializeCoordinationSignatureContext,
13
18
  } from './signature_utils.js';
14
19
 
15
20
  /**
@@ -17,50 +22,56 @@ import {
17
22
  * The signature is over the transaction objects themselves, providing
18
23
  * data availability guarantees beyond just the transaction hashes.
19
24
  */
20
- export class SignedTxs {
21
- private sender: EthAddress | undefined;
25
+ export class SignedTxs implements Signable {
26
+ readonly primaryType: CoordinationSignatureType = 'SignedTxs';
27
+
28
+ private cachedSender: EthAddress | undefined | null = undefined;
22
29
 
23
30
  constructor(
24
31
  /** The transactions */
25
32
  public readonly txs: Tx[],
26
33
  /** The proposer's signature over the transactions */
27
34
  public readonly signature: Signature,
35
+ /** The signing domain (chainId + rollupAddress) the signature is bound to */
36
+ public readonly signatureContext: CoordinationSignatureContext,
28
37
  ) {}
29
38
 
30
- /**
31
- * Get the payload to sign for this signed txs.
32
- */
33
- getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer {
34
- return serializeToBuffer([domainSeparator, this.txs.length, this.txs]);
39
+ getPayloadToSign(): Buffer {
40
+ return serializeToBuffer([this.txs.length, this.txs]);
35
41
  }
36
42
 
37
43
  /**
38
- * Lazily evaluate the sender of the signed txs; result is cached
44
+ * Lazily evaluate the sender of the signed txs; result is cached.
39
45
  * @returns The sender address, or undefined if signature recovery fails
40
46
  */
41
47
  getSender(): EthAddress | undefined {
42
- if (!this.sender) {
43
- const hashed = getHashedSignaturePayloadEthSignedMessage(this, SignatureDomainSeparator.signedTxs);
44
- this.sender = tryRecoverAddress(hashed, this.signature);
48
+ if (this.cachedSender === undefined) {
49
+ this.cachedSender = recoverCoordinationSigner(this, this.signature) ?? null;
45
50
  }
46
- return this.sender;
51
+ return this.cachedSender ?? undefined;
47
52
  }
48
53
 
49
54
  /**
50
- * Create SignedTxs from a signer function
55
+ * Create SignedTxs from a typed-data signer function
51
56
  */
52
57
  static async createFromSigner(
53
58
  txs: Tx[],
54
- payloadSigner: (payload: Buffer32) => Promise<Signature>,
59
+ signatureContext: CoordinationSignatureContext,
60
+ typedDataSigner: (typedData: TypedDataDefinition) => Promise<Signature>,
55
61
  ): Promise<SignedTxs> {
56
- const tempSignedTxs = new SignedTxs(txs, Signature.empty());
57
- const hashed = getHashedSignaturePayload(tempSignedTxs, SignatureDomainSeparator.signedTxs);
58
- const signature = await payloadSigner(hashed);
59
- return new SignedTxs(txs, signature);
62
+ const tempSignedTxs = new SignedTxs(txs, Signature.empty(), signatureContext);
63
+ const typedData = getCoordinationSignatureTypedData(tempSignedTxs);
64
+ const signature = await typedDataSigner(typedData);
65
+ return new SignedTxs(txs, signature, signatureContext);
60
66
  }
61
67
 
62
68
  toBuffer(): Buffer {
63
- return serializeToBuffer([this.txs.length, this.txs, this.signature]);
69
+ return serializeToBuffer([
70
+ this.txs.length,
71
+ this.txs,
72
+ this.signature,
73
+ serializeCoordinationSignatureContext(this.signatureContext),
74
+ ]);
64
75
  }
65
76
 
66
77
  static fromBuffer(buf: Buffer | BufferReader): SignedTxs {
@@ -71,18 +82,25 @@ export class SignedTxs {
71
82
  }
72
83
  const txs = reader.readArray(txCount, Tx);
73
84
  const signature = reader.readObject(Signature);
74
- return new SignedTxs(txs, signature);
85
+ const signatureContext = readCoordinationSignatureContext(reader);
86
+ return new SignedTxs(txs, signature, signatureContext);
75
87
  }
76
88
 
77
89
  getSize(): number {
78
- return 4 /* txs.length */ + this.txs.reduce((acc, tx) => acc + tx.getSize(), 0) + this.signature.getSize();
90
+ return (
91
+ 4 /* txs.length */ +
92
+ this.txs.reduce((acc, tx) => acc + tx.getSize(), 0) +
93
+ this.signature.getSize() +
94
+ 4 /* chainId */ +
95
+ 20 /* rollupAddress */
96
+ );
79
97
  }
80
98
 
81
99
  static empty(): SignedTxs {
82
- return new SignedTxs([], Signature.empty());
100
+ return new SignedTxs([], Signature.empty(), EMPTY_COORDINATION_SIGNATURE_CONTEXT);
83
101
  }
84
102
 
85
103
  static random(): SignedTxs {
86
- return new SignedTxs([Tx.random(), Tx.random()], Signature.random());
104
+ return new SignedTxs([Tx.random(), Tx.random()], Signature.random(), EMPTY_COORDINATION_SIGNATURE_CONTEXT);
87
105
  }
88
106
  }
@@ -10,9 +10,11 @@ export class ParityBasePrivateInputs {
10
10
  public readonly msgs: Tuple<Fr, typeof NUM_MSGS_PER_BASE_PARITY>,
11
11
  /** Root of the VK tree */
12
12
  public readonly vkTreeRoot: Fr,
13
+ /** Prover identity committed to by the circuit, for sybil protection. */
14
+ public readonly proverId: Fr,
13
15
  ) {}
14
16
 
15
- public static fromSlice(array: Fr[], index: number, vkTreeRoot: Fr): ParityBasePrivateInputs {
17
+ public static fromSlice(array: Fr[], index: number, vkTreeRoot: Fr, proverId: Fr): ParityBasePrivateInputs {
16
18
  // Can't use Tuple<Fr, typeof NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP> due to length
17
19
  if (array.length !== NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP) {
18
20
  throw new Error(
@@ -22,12 +24,12 @@ export class ParityBasePrivateInputs {
22
24
  const start = index * NUM_MSGS_PER_BASE_PARITY;
23
25
  const end = start + NUM_MSGS_PER_BASE_PARITY;
24
26
  const msgs = array.slice(start, end);
25
- return new ParityBasePrivateInputs(msgs as Tuple<Fr, typeof NUM_MSGS_PER_BASE_PARITY>, vkTreeRoot);
27
+ return new ParityBasePrivateInputs(msgs as Tuple<Fr, typeof NUM_MSGS_PER_BASE_PARITY>, vkTreeRoot, proverId);
26
28
  }
27
29
 
28
30
  /** Serializes the inputs to a buffer. */
29
31
  toBuffer() {
30
- return serializeToBuffer(this.msgs, this.vkTreeRoot);
32
+ return serializeToBuffer(this.msgs, this.vkTreeRoot, this.proverId);
31
33
  }
32
34
 
33
35
  /** Serializes the inputs to a hex string. */
@@ -41,7 +43,11 @@ export class ParityBasePrivateInputs {
41
43
  */
42
44
  static fromBuffer(buffer: Buffer | BufferReader) {
43
45
  const reader = BufferReader.asReader(buffer);
44
- return new ParityBasePrivateInputs(reader.readArray(NUM_MSGS_PER_BASE_PARITY, Fr), Fr.fromBuffer(reader));
46
+ return new ParityBasePrivateInputs(
47
+ reader.readArray(NUM_MSGS_PER_BASE_PARITY, Fr),
48
+ Fr.fromBuffer(reader),
49
+ Fr.fromBuffer(reader),
50
+ );
45
51
  }
46
52
 
47
53
  /**
@@ -12,6 +12,8 @@ export class ParityPublicInputs {
12
12
  public convertedRoot: Fr,
13
13
  /** Root of the VK tree */
14
14
  public vkTreeRoot: Fr,
15
+ /** Prover identity committed to by the circuit, for sybil protection. */
16
+ public proverId: Fr,
15
17
  ) {
16
18
  if (shaRoot.toBuffer()[0] != 0) {
17
19
  throw new Error(`shaRoot buffer must be 31 bytes. Got 32 bytes`);
@@ -54,7 +56,7 @@ export class ParityPublicInputs {
54
56
  * @returns The instance fields.
55
57
  */
56
58
  static getFields(fields: FieldsOf<ParityPublicInputs>) {
57
- return [fields.shaRoot, fields.convertedRoot, fields.vkTreeRoot] as const;
59
+ return [fields.shaRoot, fields.convertedRoot, fields.vkTreeRoot, fields.proverId] as const;
58
60
  }
59
61
 
60
62
  /**
@@ -64,7 +66,12 @@ export class ParityPublicInputs {
64
66
  */
65
67
  static fromBuffer(buffer: Buffer | BufferReader) {
66
68
  const reader = BufferReader.asReader(buffer);
67
- return new ParityPublicInputs(reader.readObject(Fr), reader.readObject(Fr), Fr.fromBuffer(reader));
69
+ return new ParityPublicInputs(
70
+ reader.readObject(Fr),
71
+ reader.readObject(Fr),
72
+ Fr.fromBuffer(reader),
73
+ Fr.fromBuffer(reader),
74
+ );
68
75
  }
69
76
 
70
77
  /**
@@ -1,21 +1,41 @@
1
+ import { BarretenbergSync, flattenChonkProofFields } from '@aztec/bb.js';
1
2
  import { CHONK_PROOF_LENGTH } from '@aztec/constants';
2
3
  import { times } from '@aztec/foundation/collection';
3
4
  import { randomBytes } from '@aztec/foundation/crypto/random';
4
5
  import { Fr } from '@aztec/foundation/curves/bn254';
5
6
  import { bufferSchemaFor } from '@aztec/foundation/schemas';
6
- import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
7
+ import { BufferReader, numToUInt32BE, serializeToBuffer } from '@aztec/foundation/serialize';
8
+
9
+ /**
10
+ * Serialization format detection for ChonkProof is size-based:
11
+ * - UNCOMPRESSED (legacy): [field_count=1632: uint32] [fields...] → total ≈ 52KB (>= 40KB)
12
+ * - COMPRESSED: [byte_count: uint32] [compressed_bytes] → total ≈ 35KB (< 40KB)
13
+ *
14
+ * Detection: if the first uint32 equals CHONK_PROOF_LENGTH (1632), it's legacy format
15
+ * (field count). Otherwise, it's compressed format (byte count). The old uncompressed
16
+ * format is never smaller than 40KB; compressed proofs are always smaller than 40KB.
17
+ */
7
18
 
8
19
  // CHONK: "Client Honk" - An UltraHonk variant with incremental folding and delayed non-native arithmetic.
9
20
  export class ChonkProof {
21
+ /**
22
+ * Optional compressed proof bytes from chonk compression (point compression + u256 encoding).
23
+ * When set, toBuffer() will serialize in compressed format (~1.7x smaller).
24
+ * When reading from compressed format, this is populated and fields are decompressed on demand.
25
+ */
26
+ public compressedProof?: Buffer;
27
+
10
28
  constructor(
11
29
  // The proof fields.
12
30
  // For native verification, attach public inputs via `attachPublicInputs(publicInputs)`.
13
31
  // Not using Tuple here due to the length being too high.
14
32
  public fields: Fr[],
33
+ compressedProof?: Buffer,
15
34
  ) {
16
35
  if (fields.length !== CHONK_PROOF_LENGTH) {
17
36
  throw new Error(`Invalid ChonkProof length: ${fields.length}`);
18
37
  }
38
+ this.compressedProof = compressedProof;
19
39
  }
20
40
 
21
41
  public attachPublicInputs(publicInputs: Fr[]) {
@@ -53,19 +73,84 @@ export class ChonkProof {
53
73
  return this.toBuffer();
54
74
  }
55
75
 
76
+ /**
77
+ * Deserialize a ChonkProof from a buffer.
78
+ * Supports both legacy (field elements) and compressed (chonk compression) formats.
79
+ *
80
+ * Size-based format detection:
81
+ * - First uint32 == CHONK_PROOF_LENGTH (1632): legacy format, read field elements
82
+ * Total proof data ≈ 52KB (always >= 40KB)
83
+ * - Otherwise: compressed format, first uint32 is byte count of compressed data
84
+ * Total proof data ≈ 35KB (always < 40KB)
85
+ */
56
86
  static fromBuffer(buffer: Buffer | BufferReader): ChonkProof {
57
87
  const reader = BufferReader.asReader(buffer);
58
- const proofLength = reader.readNumber();
59
- const proof = reader.readArray(proofLength, Fr);
60
- return new ChonkProof(proof);
88
+ const firstUint32 = reader.readNumber();
89
+
90
+ if (firstUint32 === CHONK_PROOF_LENGTH) {
91
+ // Legacy format: firstUint32 is the field count (1632)
92
+ // Widen to `number` to prevent TS from narrowing to literal 1632,
93
+ // which would cause Tuple<Fr, 1632> to exceed the recursion limit.
94
+ const fieldCount: number = firstUint32;
95
+ const proof = reader.readArray(fieldCount, Fr);
96
+ return new ChonkProof(proof);
97
+ }
98
+
99
+ // Compressed format: firstUint32 is the compressed byte count
100
+ const compressedBytes = reader.readBytes(firstUint32);
101
+ return ChonkProof.fromCompressedBytes(Buffer.from(compressedBytes));
102
+ }
103
+
104
+ /**
105
+ * Create a ChonkProof from compressed bytes by decompressing via the BarretenbergSync API.
106
+ * The compressed format uses point compression and u256 encoding (from PR #20645).
107
+ *
108
+ * @param compressed - Compressed proof bytes from chonk compression
109
+ * @returns ChonkProof with both fields and compressed bytes populated
110
+ */
111
+ static fromCompressedBytes(compressed: Buffer): ChonkProof {
112
+ const api = BarretenbergSync.getSingleton();
113
+ const result = api.chonkDecompressProof({ compressedProof: new Uint8Array(compressed) });
114
+
115
+ // Flatten the structured bb.js ChonkProof into flat Fr[] field elements
116
+ const flatFields = flattenChonkProofFields(result.proof);
117
+ const fields = flatFields.map(f => Fr.fromBuffer(Buffer.from(f)));
118
+
119
+ // The decompressed proof includes public inputs in hidingOinkProof.
120
+ // Since ChonkProof stores fields WITHOUT public inputs, strip them.
121
+ // The number of public inputs = total fields - CHONK_PROOF_LENGTH
122
+ if (fields.length > CHONK_PROOF_LENGTH) {
123
+ const numPubInputs = fields.length - CHONK_PROOF_LENGTH;
124
+ const proofFields = fields.slice(numPubInputs);
125
+ return new ChonkProof(proofFields, compressed);
126
+ }
127
+
128
+ return new ChonkProof(fields, compressed);
61
129
  }
62
130
 
131
+ /**
132
+ * Serialize the proof to a buffer.
133
+ * If compressed bytes are available, uses the compressed format (~1.7x smaller).
134
+ * Otherwise falls back to legacy field element format.
135
+ */
63
136
  public toBuffer() {
137
+ if (this.compressedProof) {
138
+ // Compressed format: [compressed_byte_count: uint32] [compressed_bytes]
139
+ return Buffer.concat([numToUInt32BE(this.compressedProof.length), this.compressedProof]);
140
+ }
141
+ // Legacy format: [field_count=1632: uint32] [fields...]
64
142
  return serializeToBuffer(this.fields.length, this.fields);
65
143
  }
66
144
  }
67
145
 
68
146
  export class ChonkProofWithPublicInputs {
147
+ /**
148
+ * Optional compressed proof bytes (covers the full proof WITH public inputs).
149
+ * Set by the prover when using chonk compression. Flows through to ChonkProof
150
+ * via removePublicInputs() so the Tx can serialize in compressed format.
151
+ */
152
+ public compressedProof?: Buffer;
153
+
69
154
  constructor(
70
155
  // The proof fields with public inputs.
71
156
  // For recursive verification, use without public inputs via `removePublicInputs()`.
@@ -83,7 +168,8 @@ export class ChonkProofWithPublicInputs {
83
168
 
84
169
  public removePublicInputs() {
85
170
  const numPublicInputs = this.fieldsWithPublicInputs.length - CHONK_PROOF_LENGTH;
86
- return new ChonkProof(this.fieldsWithPublicInputs.slice(numPublicInputs));
171
+ // Flow compressed proof bytes through so the ChonkProof can serialize efficiently
172
+ return new ChonkProof(this.fieldsWithPublicInputs.slice(numPublicInputs), this.compressedProof);
87
173
  }
88
174
 
89
175
  public isEmpty() {
@@ -1,5 +1,7 @@
1
+ import { DomainSeparator } from '@aztec/constants';
2
+ import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
1
3
  import { Fr } from '@aztec/foundation/curves/bn254';
2
- import { computeUnbalancedPoseidonRoot } from '@aztec/foundation/trees';
4
+ import { computeUnbalancedMerkleTreeRootAsync } from '@aztec/foundation/trees';
3
5
 
4
6
  import type { BlockHeader } from '../tx/block_header.js';
5
7
 
@@ -7,6 +9,13 @@ export async function computeBlockHeadersHash(blockHeaders: BlockHeader[]): Prom
7
9
  const blockHeaderHashes = await Promise.all(blockHeaders.map(header => header.hash()));
8
10
  // Must match the implementation in merge_block_rollups.nr, with the **unbalanced** rollup structure
9
11
  // (see validate_consecutive_block_rollups.nr > assert_rollups_filled_greedily.nr).
10
- const blockHeadersHash = await computeUnbalancedPoseidonRoot(blockHeaderHashes.map(hash => hash.toBuffer()));
12
+ const blockHeadersHasher = async (left: Uint8Array, right: Uint8Array) =>
13
+ (
14
+ await poseidon2HashWithSeparator([Buffer.from(left), Buffer.from(right)], DomainSeparator.BLOCK_HEADERS_HASH)
15
+ ).toBuffer() as Buffer<ArrayBuffer>;
16
+ const blockHeadersHash = await computeUnbalancedMerkleTreeRootAsync(
17
+ blockHeaderHashes.map(hash => hash.toBuffer()),
18
+ blockHeadersHasher,
19
+ );
11
20
  return Fr.fromBuffer(blockHeadersHash);
12
21
  }
@@ -1,6 +1,5 @@
1
1
  export * from './types.js';
2
2
  export * from './interfaces.js';
3
3
  export * from './helpers.js';
4
- export * from './empire.js';
5
- export * from './tally.js';
4
+ export * from './votes.js';
6
5
  export * from './serialization.js';
@@ -1,15 +1,7 @@
1
- import { times } from '@aztec/foundation/collection';
2
1
  import { EthAddress } from '@aztec/foundation/eth-address';
3
2
  import { BufferReader, bigintToUInt64BE, bigintToUInt128BE, serializeToBuffer } from '@aztec/foundation/serialize';
4
3
 
5
- import type {
6
- Offense,
7
- OffenseType,
8
- SlashPayload,
9
- SlashPayloadRound,
10
- ValidatorSlash,
11
- ValidatorSlashOffense,
12
- } from './types.js';
4
+ import type { Offense, OffenseType } from './types.js';
13
5
 
14
6
  export function serializeOffense(offense: Offense): Buffer {
15
7
  return serializeToBuffer(
@@ -29,75 +21,3 @@ export function deserializeOffense(buffer: Buffer): Offense {
29
21
 
30
22
  return { validator, amount, offenseType: offense, epochOrSlot };
31
23
  }
32
-
33
- function serializeValidatorSlashOffense(offense: ValidatorSlashOffense): Buffer {
34
- return serializeToBuffer(bigintToUInt64BE(offense.epochOrSlot), offense.offenseType);
35
- }
36
-
37
- function deserializeValidatorSlashOffense(buffer: Buffer | BufferReader): ValidatorSlashOffense {
38
- const reader = BufferReader.asReader(buffer);
39
- return {
40
- epochOrSlot: reader.readUInt64(),
41
- offenseType: reader.readNumber() as OffenseType,
42
- };
43
- }
44
-
45
- function serializeValidatorSlash(slash: ValidatorSlash): Buffer {
46
- return serializeToBuffer(
47
- slash.validator,
48
- bigintToUInt128BE(slash.amount),
49
- slash.offenses.length,
50
- slash.offenses.map(serializeValidatorSlashOffense),
51
- );
52
- }
53
-
54
- function deserializeValidatorSlash(buffer: Buffer | BufferReader): ValidatorSlash {
55
- const reader = BufferReader.asReader(buffer);
56
- const validator = reader.readObject(EthAddress);
57
- const amount = reader.readUInt128();
58
- const offensesCount = reader.readNumber();
59
- const offenses = times(offensesCount, () => deserializeValidatorSlashOffense(reader));
60
-
61
- return { validator, amount, offenses };
62
- }
63
-
64
- export function serializeSlashPayload(payload: SlashPayload): Buffer {
65
- return serializeToBuffer(
66
- payload.address,
67
- payload.slashes.length,
68
- payload.slashes.map(serializeValidatorSlash),
69
- bigintToUInt64BE(payload.timestamp),
70
- );
71
- }
72
-
73
- export function deserializeSlashPayload(buffer: Buffer): SlashPayload {
74
- const reader = BufferReader.asReader(buffer);
75
- const address = reader.readObject(EthAddress);
76
- const slashesCount = reader.readNumber();
77
- const slashes = times(slashesCount, () => deserializeValidatorSlash(reader));
78
- const timestamp = reader.readUInt64();
79
- return { address, slashes, timestamp };
80
- }
81
-
82
- export function serializeSlashPayloadRound(payload: SlashPayloadRound): Buffer {
83
- return serializeToBuffer(
84
- payload.address,
85
- payload.slashes.length,
86
- payload.slashes.map(serializeValidatorSlash),
87
- bigintToUInt64BE(payload.timestamp),
88
- Number(payload.votes),
89
- bigintToUInt64BE(payload.round),
90
- );
91
- }
92
-
93
- export function deserializeSlashPayloadRound(buffer: Buffer): SlashPayloadRound {
94
- const reader = BufferReader.asReader(buffer);
95
- const address = reader.readObject(EthAddress);
96
- const slashesCount = reader.readNumber();
97
- const slashes = times(slashesCount, () => deserializeValidatorSlash(reader));
98
- const timestamp = reader.readUInt64();
99
- const votes = BigInt(reader.readNumber());
100
- const round = reader.readUInt64();
101
-
102
- return { address, slashes, timestamp, votes, round };
103
- }
@@ -126,45 +126,13 @@ export type ValidatorSlash = {
126
126
  offenses: ValidatorSlashOffense[];
127
127
  };
128
128
 
129
- /** Slash payload as published by the empire slash proposer */
130
- export type SlashPayload = {
131
- address: EthAddress;
132
- slashes: ValidatorSlash[];
133
- timestamp: bigint;
134
- };
135
-
136
- /** Slash payload with round information from empire slash proposer */
137
- export type SlashPayloadRound = SlashPayload & { votes: bigint; round: bigint };
138
-
139
- export const SlashPayloadRoundSchema = zodFor<SlashPayloadRound>()(
140
- z.object({
141
- address: schemas.EthAddress,
142
- timestamp: schemas.BigInt,
143
- votes: schemas.BigInt,
144
- round: schemas.BigInt,
145
- slashes: z.array(
146
- z.object({
147
- validator: schemas.EthAddress,
148
- amount: schemas.BigInt,
149
- offenses: z.array(z.object({ offenseType: OffenseTypeSchema, epochOrSlot: schemas.BigInt })),
150
- }),
151
- ),
152
- }),
153
- );
154
-
155
- /** Votes for a validator slash in the consensus slash proposer */
129
+ /** Votes for a validator slash in the slashing proposer */
156
130
  export type ValidatorSlashVote = number;
157
131
 
158
132
  export type ProposerSlashAction =
159
- /** Create a new slash payload on an empire-based slash proposer */
160
- | { type: 'create-empire-payload'; data: ValidatorSlash[] }
161
- /** Vote for a slashing payload on an empire-based slash proposer */
162
- | { type: 'vote-empire-payload'; payload: EthAddress }
163
- /** Execute a slashing payload on an empire-based slash proposer */
164
- | { type: 'execute-empire-payload'; round: bigint }
165
- /** Vote for offenses on a consensus slashing proposer */
133
+ /** Vote for offenses on the slashing proposer */
166
134
  | { type: 'vote-offenses'; votes: ValidatorSlashVote[]; committees: EthAddress[][]; round: bigint }
167
- /** Execute a slashing round on a consensus slashing proposer */
135
+ /** Execute a slashing round on the slashing proposer */
168
136
  | { type: 'execute-slash'; committees: EthAddress[][]; round: bigint };
169
137
 
170
138
  export type ProposerSlashActionType = ProposerSlashAction['type'];
@@ -28,7 +28,7 @@ export function getSlashConsensusVotesFromOffenses(
28
28
  targetCommitteeSize: number;
29
29
  maxSlashedValidators?: number;
30
30
  },
31
- logger: Logger = createLogger('slasher:tally'),
31
+ logger: Logger = createLogger('slasher:votes'),
32
32
  ): ValidatorSlashVote[] {
33
33
  const { slashingAmounts, targetCommitteeSize, maxSlashedValidators } = settings;
34
34