@aztec/stdlib 1.2.0 → 2.0.0-nightly.20250813

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 (324) hide show
  1. package/dest/abi/abi.d.ts +0 -67
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +1 -14
  4. package/dest/abi/authorization_selector.d.ts +52 -0
  5. package/dest/abi/authorization_selector.d.ts.map +1 -0
  6. package/dest/abi/authorization_selector.js +70 -0
  7. package/dest/abi/contract_artifact.d.ts.map +1 -1
  8. package/dest/abi/contract_artifact.js +0 -40
  9. package/dest/abi/decoder.d.ts.map +1 -1
  10. package/dest/abi/decoder.js +3 -6
  11. package/dest/abi/index.d.ts +1 -0
  12. package/dest/abi/index.d.ts.map +1 -1
  13. package/dest/abi/index.js +1 -0
  14. package/dest/avm/avm.d.ts +278 -412
  15. package/dest/avm/avm.d.ts.map +1 -1
  16. package/dest/avm/avm.js +12 -12
  17. package/dest/avm/avm_proving_request.d.ts +160 -186
  18. package/dest/avm/avm_proving_request.d.ts.map +1 -1
  19. package/dest/block/l2_block.d.ts +8 -0
  20. package/dest/block/l2_block.d.ts.map +1 -1
  21. package/dest/block/l2_block.js +9 -0
  22. package/dest/block/l2_block_source.d.ts +446 -2
  23. package/dest/block/l2_block_source.d.ts.map +1 -1
  24. package/dest/block/l2_block_source.js +29 -0
  25. package/dest/block/proposal/committee_attestation.d.ts +3 -1
  26. package/dest/block/proposal/committee_attestation.d.ts.map +1 -1
  27. package/dest/block/proposal/committee_attestation.js +3 -0
  28. package/dest/block/published_l2_block.d.ts +2 -1
  29. package/dest/block/published_l2_block.d.ts.map +1 -1
  30. package/dest/block/published_l2_block.js +6 -1
  31. package/dest/contract/contract_instance.d.ts +3 -3
  32. package/dest/contract/contract_instance.d.ts.map +1 -1
  33. package/dest/contract/contract_instance.js +3 -3
  34. package/dest/contract/interfaces/contract_class.d.ts +2 -2
  35. package/dest/contract/interfaces/protocol_contract_addresses.d.ts +9 -9
  36. package/dest/contract/interfaces/protocol_contract_addresses.d.ts.map +1 -1
  37. package/dest/contract/interfaces/protocol_contract_addresses.js +4 -4
  38. package/dest/contract/private_function_membership_proof.d.ts +1 -1
  39. package/dest/contract/private_function_membership_proof.js +1 -1
  40. package/dest/contract/utility_function_membership_proof.d.ts +1 -1
  41. package/dest/contract/utility_function_membership_proof.js +1 -1
  42. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +20 -0
  43. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -0
  44. package/dest/{shared_mutable/shared_mutable_values.js → delayed_public_mutable/delayed_public_mutable_values.js} +9 -9
  45. package/dest/{shared_mutable/shared_mutable_values_with_hash.d.ts → delayed_public_mutable/delayed_public_mutable_values_with_hash.d.ts} +6 -6
  46. package/dest/delayed_public_mutable/delayed_public_mutable_values_with_hash.d.ts.map +1 -0
  47. package/dest/delayed_public_mutable/delayed_public_mutable_values_with_hash.js +30 -0
  48. package/dest/delayed_public_mutable/index.d.ts +5 -0
  49. package/dest/delayed_public_mutable/index.d.ts.map +1 -0
  50. package/dest/delayed_public_mutable/index.js +4 -0
  51. package/dest/delayed_public_mutable/scheduled_delay_change.d.ts.map +1 -0
  52. package/dest/delayed_public_mutable/scheduled_value_change.d.ts.map +1 -0
  53. package/dest/gas/gas.d.ts +1 -0
  54. package/dest/gas/gas.d.ts.map +1 -1
  55. package/dest/gas/gas.js +3 -0
  56. package/dest/hash/hash.d.ts.map +1 -1
  57. package/dest/hash/hash.js +1 -4
  58. package/dest/interfaces/archiver.d.ts.map +1 -1
  59. package/dest/interfaces/archiver.js +4 -2
  60. package/dest/interfaces/aztec-node-admin.d.ts +211 -8
  61. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  62. package/dest/interfaces/aztec-node-admin.js +9 -3
  63. package/dest/interfaces/configs.d.ts +27 -0
  64. package/dest/interfaces/configs.d.ts.map +1 -1
  65. package/dest/interfaces/configs.js +6 -1
  66. package/dest/interfaces/get_logs_response.d.ts +1 -1
  67. package/dest/interfaces/proving-job.d.ts +166 -192
  68. package/dest/interfaces/proving-job.d.ts.map +1 -1
  69. package/dest/interfaces/pxe.d.ts +3 -1
  70. package/dest/interfaces/pxe.d.ts.map +1 -1
  71. package/dest/interfaces/pxe.js +1 -1
  72. package/dest/interfaces/server.d.ts +4 -2
  73. package/dest/interfaces/server.d.ts.map +1 -1
  74. package/dest/interfaces/server.js +4 -2
  75. package/dest/interfaces/slasher.d.ts +86 -0
  76. package/dest/interfaces/slasher.d.ts.map +1 -0
  77. package/dest/interfaces/slasher.js +23 -0
  78. package/dest/interfaces/tx_provider.d.ts +24 -0
  79. package/dest/interfaces/tx_provider.d.ts.map +1 -0
  80. package/dest/kernel/claimed_length_array.d.ts +34 -0
  81. package/dest/kernel/claimed_length_array.d.ts.map +1 -0
  82. package/dest/kernel/claimed_length_array.js +58 -0
  83. package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -6
  84. package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
  85. package/dest/kernel/hints/build_note_hash_read_request_hints.js +18 -20
  86. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +7 -10
  87. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  88. package/dest/kernel/hints/build_nullifier_read_request_hints.js +17 -32
  89. package/dest/kernel/hints/build_transient_data_hints.d.ts +4 -3
  90. package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
  91. package/dest/kernel/hints/build_transient_data_hints.js +9 -10
  92. package/dest/kernel/hints/index.d.ts +1 -2
  93. package/dest/kernel/hints/index.d.ts.map +1 -1
  94. package/dest/kernel/hints/index.js +1 -2
  95. package/dest/kernel/hints/note_hash_read_request_hints.d.ts.map +1 -1
  96. package/dest/kernel/hints/note_hash_read_request_hints.js +4 -4
  97. package/dest/kernel/hints/nullifier_read_request_hints.d.ts.map +1 -1
  98. package/dest/kernel/hints/nullifier_read_request_hints.js +4 -4
  99. package/dest/kernel/hints/private_kernel_reset_hints.d.ts +5 -5
  100. package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
  101. package/dest/kernel/hints/private_kernel_reset_hints.js +9 -9
  102. package/dest/kernel/hints/read_request_hints.d.ts +17 -17
  103. package/dest/kernel/hints/read_request_hints.d.ts.map +1 -1
  104. package/dest/kernel/hints/read_request_hints.js +28 -28
  105. package/dest/kernel/hints/{transient_data_index_hint.d.ts → transient_data_squashing_hint.d.ts} +5 -5
  106. package/dest/kernel/hints/transient_data_squashing_hint.d.ts.map +1 -0
  107. package/dest/kernel/hints/{transient_data_index_hint.js → transient_data_squashing_hint.js} +5 -5
  108. package/dest/kernel/index.d.ts +1 -0
  109. package/dest/kernel/index.d.ts.map +1 -1
  110. package/dest/kernel/index.js +1 -0
  111. package/dest/kernel/private_accumulated_data.d.ts +16 -15
  112. package/dest/kernel/private_accumulated_data.d.ts.map +1 -1
  113. package/dest/kernel/private_accumulated_data.js +3 -3
  114. package/dest/kernel/private_call_data.d.ts +4 -4
  115. package/dest/kernel/private_call_data.d.ts.map +1 -1
  116. package/dest/kernel/private_call_data.js +2 -2
  117. package/dest/kernel/private_circuit_public_inputs.d.ts +26 -25
  118. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  119. package/dest/kernel/private_circuit_public_inputs.js +33 -15
  120. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +9 -0
  121. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  122. package/dest/kernel/private_kernel_circuit_public_inputs.js +8 -4
  123. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +10 -1
  124. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
  125. package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +9 -6
  126. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +11 -4
  127. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
  128. package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +20 -18
  129. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts +4 -4
  130. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts.map +1 -1
  131. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.js +9 -10
  132. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +11 -11
  133. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
  134. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.js +11 -12
  135. package/dest/kernel/private_validation_requests.d.ts +8 -20
  136. package/dest/kernel/private_validation_requests.d.ts.map +1 -1
  137. package/dest/kernel/private_validation_requests.js +9 -21
  138. package/dest/kernel/utils/order_and_comparison.d.ts +0 -3
  139. package/dest/kernel/utils/order_and_comparison.d.ts.map +1 -1
  140. package/dest/kernel/utils/order_and_comparison.js +0 -19
  141. package/dest/logs/extended_public_log.d.ts +1 -1
  142. package/dest/logs/shared_secret_derivation.d.ts +1 -1
  143. package/dest/logs/shared_secret_derivation.js +1 -1
  144. package/dest/messaging/l2_to_l1_membership.d.ts +4 -1
  145. package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
  146. package/dest/messaging/l2_to_l1_membership.js +49 -54
  147. package/dest/messaging/l2_to_l1_message.d.ts +2 -0
  148. package/dest/messaging/l2_to_l1_message.d.ts.map +1 -1
  149. package/dest/messaging/l2_to_l1_message.js +7 -0
  150. package/dest/note/notes_filter.d.ts +5 -2
  151. package/dest/note/notes_filter.d.ts.map +1 -1
  152. package/dest/note/notes_filter.js +1 -1
  153. package/dest/p2p/attestation_utils.d.ts +10 -0
  154. package/dest/p2p/attestation_utils.d.ts.map +1 -0
  155. package/dest/p2p/attestation_utils.js +21 -0
  156. package/dest/p2p/block_attestation.d.ts +3 -4
  157. package/dest/p2p/block_attestation.d.ts.map +1 -1
  158. package/dest/p2p/block_attestation.js +3 -4
  159. package/dest/p2p/block_proposal.d.ts +8 -1
  160. package/dest/p2p/block_proposal.d.ts.map +1 -1
  161. package/dest/p2p/block_proposal.js +21 -8
  162. package/dest/p2p/consensus_payload.d.ts +3 -11
  163. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  164. package/dest/p2p/consensus_payload.js +13 -22
  165. package/dest/p2p/index.d.ts +1 -0
  166. package/dest/p2p/index.d.ts.map +1 -1
  167. package/dest/p2p/index.js +1 -0
  168. package/dest/p2p/topic_type.d.ts.map +1 -1
  169. package/dest/p2p/topic_type.js +5 -3
  170. package/dest/rollup/block_root_rollup.d.ts +1 -1
  171. package/dest/slashing/index.d.ts +51 -0
  172. package/dest/slashing/index.d.ts.map +1 -0
  173. package/dest/slashing/index.js +54 -0
  174. package/dest/stats/stats.d.ts +2 -2
  175. package/dest/stats/stats.d.ts.map +1 -1
  176. package/dest/tests/factories.d.ts +0 -2
  177. package/dest/tests/factories.d.ts.map +1 -1
  178. package/dest/tests/factories.js +25 -24
  179. package/dest/tests/mocks.d.ts +2 -0
  180. package/dest/tests/mocks.d.ts.map +1 -1
  181. package/dest/tests/mocks.js +31 -22
  182. package/dest/tx/index.d.ts +0 -1
  183. package/dest/tx/index.d.ts.map +1 -1
  184. package/dest/tx/index.js +0 -1
  185. package/dest/tx/private_execution_result.d.ts +2 -2
  186. package/dest/tx/private_execution_result.d.ts.map +1 -1
  187. package/dest/tx/private_execution_result.js +11 -11
  188. package/dest/tx/processed_tx.d.ts +2 -2
  189. package/dest/tx/processed_tx.d.ts.map +1 -1
  190. package/dest/tx/processed_tx.js +4 -4
  191. package/dest/tx/proven_tx.d.ts +1 -1
  192. package/dest/tx/proven_tx.d.ts.map +1 -1
  193. package/dest/tx/proven_tx.js +7 -3
  194. package/dest/tx/simulated_tx.d.ts +11 -17
  195. package/dest/tx/simulated_tx.d.ts.map +1 -1
  196. package/dest/tx/simulated_tx.js +12 -12
  197. package/dest/tx/tx.d.ts +25 -25
  198. package/dest/tx/tx.d.ts.map +1 -1
  199. package/dest/tx/tx.js +60 -48
  200. package/dest/tx/tx_effect.d.ts +2 -2
  201. package/dest/tx/tx_effect.d.ts.map +1 -1
  202. package/dest/tx/tx_effect.js +3 -18
  203. package/dest/tx/tx_execution_request.js +2 -2
  204. package/dest/tx/tx_hash.d.ts +7 -0
  205. package/dest/tx/tx_hash.d.ts.map +1 -1
  206. package/dest/tx/tx_hash.js +19 -1
  207. package/dest/tx/tx_request.d.ts +5 -5
  208. package/dest/tx/tx_request.d.ts.map +1 -1
  209. package/dest/tx/tx_request.js +7 -7
  210. package/dest/tx/validator/error_texts.d.ts +1 -0
  211. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  212. package/dest/tx/validator/error_texts.js +1 -0
  213. package/dest/tx/validator/tx_validator.d.ts +6 -4
  214. package/dest/tx/validator/tx_validator.d.ts.map +1 -1
  215. package/dest/tx/validator/tx_validator.js +3 -0
  216. package/dest/versioning/versioning.d.ts.map +1 -1
  217. package/dest/vks/verification_key.d.ts.map +1 -1
  218. package/dest/vks/verification_key.js +4 -4
  219. package/package.json +10 -9
  220. package/src/abi/abi.ts +0 -38
  221. package/src/abi/authorization_selector.ts +95 -0
  222. package/src/abi/contract_artifact.ts +0 -49
  223. package/src/abi/decoder.ts +3 -6
  224. package/src/abi/index.ts +1 -0
  225. package/src/avm/avm.ts +7 -9
  226. package/src/block/l2_block.ts +18 -0
  227. package/src/block/l2_block_source.ts +70 -1
  228. package/src/block/proposal/committee_attestation.ts +5 -1
  229. package/src/block/published_l2_block.ts +14 -5
  230. package/src/contract/contract_instance.ts +3 -3
  231. package/src/contract/interfaces/protocol_contract_addresses.ts +5 -10
  232. package/src/contract/private_function_membership_proof.ts +1 -1
  233. package/src/contract/utility_function_membership_proof.ts +1 -1
  234. package/src/{shared_mutable/shared_mutable_values.ts → delayed_public_mutable/delayed_public_mutable_values.ts} +10 -10
  235. package/src/delayed_public_mutable/delayed_public_mutable_values_with_hash.ts +38 -0
  236. package/src/delayed_public_mutable/index.ts +4 -0
  237. package/src/gas/gas.ts +4 -0
  238. package/src/hash/hash.ts +1 -4
  239. package/src/interfaces/archiver.ts +3 -1
  240. package/src/interfaces/aztec-node-admin.ts +19 -8
  241. package/src/interfaces/configs.ts +17 -0
  242. package/src/interfaces/pxe.ts +4 -2
  243. package/src/interfaces/server.ts +4 -2
  244. package/src/interfaces/slasher.ts +49 -0
  245. package/src/interfaces/tx_provider.ts +16 -0
  246. package/src/kernel/claimed_length_array.ts +104 -0
  247. package/src/kernel/hints/build_note_hash_read_request_hints.ts +28 -30
  248. package/src/kernel/hints/build_nullifier_read_request_hints.ts +28 -59
  249. package/src/kernel/hints/build_transient_data_hints.ts +12 -14
  250. package/src/kernel/hints/index.ts +1 -2
  251. package/src/kernel/hints/note_hash_read_request_hints.ts +4 -16
  252. package/src/kernel/hints/nullifier_read_request_hints.ts +4 -16
  253. package/src/kernel/hints/private_kernel_reset_hints.ts +7 -7
  254. package/src/kernel/hints/read_request_hints.ts +22 -22
  255. package/src/kernel/hints/{transient_data_index_hint.ts → transient_data_squashing_hint.ts} +5 -5
  256. package/src/kernel/index.ts +1 -0
  257. package/src/kernel/private_accumulated_data.ts +23 -23
  258. package/src/kernel/private_call_data.ts +3 -3
  259. package/src/kernel/private_circuit_public_inputs.ts +92 -68
  260. package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -1
  261. package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +13 -4
  262. package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +20 -20
  263. package/src/kernel/private_to_public_kernel_circuit_public_inputs.ts +7 -7
  264. package/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts +16 -10
  265. package/src/kernel/private_validation_requests.ts +19 -50
  266. package/src/kernel/utils/order_and_comparison.ts +0 -25
  267. package/src/logs/shared_secret_derivation.ts +1 -1
  268. package/src/messaging/l2_to_l1_membership.ts +76 -85
  269. package/src/messaging/l2_to_l1_message.ts +9 -0
  270. package/src/note/notes_filter.ts +6 -3
  271. package/src/p2p/attestation_utils.ts +35 -0
  272. package/src/p2p/block_attestation.ts +3 -4
  273. package/src/p2p/block_proposal.ts +23 -5
  274. package/src/p2p/consensus_payload.ts +10 -29
  275. package/src/p2p/index.ts +1 -0
  276. package/src/p2p/topic_type.ts +3 -1
  277. package/src/slashing/index.ts +74 -0
  278. package/src/stats/stats.ts +2 -2
  279. package/src/tests/factories.ts +37 -27
  280. package/src/tests/mocks.ts +24 -22
  281. package/src/tx/index.ts +0 -1
  282. package/src/tx/private_execution_result.ts +11 -9
  283. package/src/tx/processed_tx.ts +6 -6
  284. package/src/tx/proven_tx.ts +7 -8
  285. package/src/tx/simulated_tx.ts +13 -19
  286. package/src/tx/tx.ts +70 -57
  287. package/src/tx/tx_effect.ts +5 -20
  288. package/src/tx/tx_execution_request.ts +2 -2
  289. package/src/tx/tx_hash.ts +21 -1
  290. package/src/tx/tx_request.ts +7 -6
  291. package/src/tx/validator/error_texts.ts +1 -0
  292. package/src/tx/validator/tx_validator.ts +5 -0
  293. package/src/versioning/versioning.ts +0 -3
  294. package/src/vks/verification_key.ts +4 -7
  295. package/dest/interfaces/tx-collector.d.ts +0 -15
  296. package/dest/interfaces/tx-collector.d.ts.map +0 -1
  297. package/dest/kernel/hints/rollup_validation_requests.d.ts +0 -34
  298. package/dest/kernel/hints/rollup_validation_requests.d.ts.map +0 -1
  299. package/dest/kernel/hints/rollup_validation_requests.js +0 -55
  300. package/dest/kernel/hints/transient_data_index_hint.d.ts.map +0 -1
  301. package/dest/shared_mutable/index.d.ts +0 -5
  302. package/dest/shared_mutable/index.d.ts.map +0 -1
  303. package/dest/shared_mutable/index.js +0 -4
  304. package/dest/shared_mutable/scheduled_delay_change.d.ts.map +0 -1
  305. package/dest/shared_mutable/scheduled_value_change.d.ts.map +0 -1
  306. package/dest/shared_mutable/shared_mutable_values.d.ts +0 -20
  307. package/dest/shared_mutable/shared_mutable_values.d.ts.map +0 -1
  308. package/dest/shared_mutable/shared_mutable_values_with_hash.d.ts.map +0 -1
  309. package/dest/shared_mutable/shared_mutable_values_with_hash.js +0 -30
  310. package/dest/tx/include_by_timestamp.d.ts +0 -54
  311. package/dest/tx/include_by_timestamp.d.ts.map +0 -1
  312. package/dest/tx/include_by_timestamp.js +0 -72
  313. package/src/interfaces/tx-collector.ts +0 -17
  314. package/src/kernel/hints/rollup_validation_requests.ts +0 -71
  315. package/src/shared_mutable/index.ts +0 -4
  316. package/src/shared_mutable/shared_mutable_values_with_hash.ts +0 -38
  317. package/src/tx/include_by_timestamp.ts +0 -90
  318. /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.d.ts +0 -0
  319. /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.js +0 -0
  320. /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_value_change.d.ts +0 -0
  321. /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_value_change.js +0 -0
  322. /package/dest/interfaces/{tx-collector.js → tx_provider.js} +0 -0
  323. /package/src/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.ts +0 -0
  324. /package/src/{shared_mutable → delayed_public_mutable}/scheduled_value_change.ts +0 -0
@@ -1,15 +1,17 @@
1
1
  import type { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { type ZodFor, schemas } from '@aztec/foundation/schemas';
2
3
  import type { TypedEventEmitter } from '@aztec/foundation/types';
3
4
 
4
5
  import { z } from 'zod';
5
6
 
6
7
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
8
+ import { BlockAttestation } from '../p2p/block_attestation.js';
7
9
  import type { BlockHeader } from '../tx/block_header.js';
8
10
  import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
9
11
  import type { TxHash } from '../tx/tx_hash.js';
10
12
  import type { TxReceipt } from '../tx/tx_receipt.js';
11
13
  import type { L2Block } from './l2_block.js';
12
- import type { PublishedL2Block } from './published_l2_block.js';
14
+ import { PublishedL2Block } from './published_l2_block.js';
13
15
 
14
16
  /**
15
17
  * Interface of classes allowing for the retrieval of L2 blocks.
@@ -122,10 +124,70 @@ export interface L2BlockSource {
122
124
  /** Latest synced L1 timestamp. */
123
125
  getL1Timestamp(): Promise<bigint>;
124
126
 
127
+ /**
128
+ * Returns whether the latest block in the pending chain on L1 is invalid (ie its attestations are incorrect).
129
+ * Note that invalid blocks do not get synced, so the latest block returned by the block source is always a valid one.
130
+ */
131
+ isPendingChainInvalid(): Promise<boolean>;
132
+
133
+ /**
134
+ * Returns the status of the pending chain validation. If the chain is invalid, reports the earliest consecutive block
135
+ * that is invalid, along with the reason for being invalid, which can be used to trigger an invalidation.
136
+ */
137
+ getPendingChainValidationStatus(): Promise<ValidateBlockResult>;
138
+
125
139
  /** Force a sync. */
126
140
  syncImmediate(): Promise<void>;
127
141
  }
128
142
 
143
+ /** Subtype for invalid block validation results */
144
+ export type ValidateBlockNegativeResult =
145
+ | {
146
+ valid: false;
147
+ block: PublishedL2Block;
148
+ committee: EthAddress[];
149
+ epoch: bigint;
150
+ seed: bigint;
151
+ attestations: BlockAttestation[];
152
+ reason: 'insufficient-attestations';
153
+ }
154
+ | {
155
+ valid: false;
156
+ block: PublishedL2Block;
157
+ committee: EthAddress[];
158
+ epoch: bigint;
159
+ seed: bigint;
160
+ reason: 'invalid-attestation';
161
+ attestations: BlockAttestation[];
162
+ invalidIndex: number;
163
+ };
164
+
165
+ /** Result type for validating a block attestations */
166
+ export type ValidateBlockResult = { valid: true } | ValidateBlockNegativeResult;
167
+
168
+ export const ValidateBlockResultSchema = z.union([
169
+ z.object({ valid: z.literal(true), block: PublishedL2Block.schema.optional() }),
170
+ z.object({
171
+ valid: z.literal(false),
172
+ block: PublishedL2Block.schema,
173
+ committee: z.array(schemas.EthAddress),
174
+ epoch: schemas.BigInt,
175
+ seed: schemas.BigInt,
176
+ attestations: z.array(BlockAttestation.schema),
177
+ reason: z.literal('insufficient-attestations'),
178
+ }),
179
+ z.object({
180
+ valid: z.literal(false),
181
+ block: PublishedL2Block.schema,
182
+ committee: z.array(schemas.EthAddress),
183
+ epoch: schemas.BigInt,
184
+ seed: schemas.BigInt,
185
+ attestations: z.array(BlockAttestation.schema),
186
+ reason: z.literal('invalid-attestation'),
187
+ invalidIndex: z.number(),
188
+ }),
189
+ ]) satisfies ZodFor<ValidateBlockResult>;
190
+
129
191
  /**
130
192
  * L2BlockSource that emits events upon pending / proven chain changes.
131
193
  * see L2BlockSourceEvents for the events emitted.
@@ -134,6 +196,7 @@ export interface L2BlockSource {
134
196
  export type ArchiverEmitter = TypedEventEmitter<{
135
197
  [L2BlockSourceEvents.L2PruneDetected]: (args: L2BlockPruneEvent) => void;
136
198
  [L2BlockSourceEvents.L2BlockProven]: (args: L2BlockProvenEvent) => void;
199
+ [L2BlockSourceEvents.InvalidAttestationsBlockDetected]: (args: InvalidBlockDetectedEvent) => void;
137
200
  }>;
138
201
  export interface L2BlockSourceEventEmitter extends L2BlockSource, ArchiverEmitter {}
139
202
 
@@ -180,6 +243,7 @@ export const L2TipsSchema = z.object({
180
243
  export enum L2BlockSourceEvents {
181
244
  L2PruneDetected = 'l2PruneDetected',
182
245
  L2BlockProven = 'l2BlockProven',
246
+ InvalidAttestationsBlockDetected = 'invalidBlockDetected',
183
247
  }
184
248
 
185
249
  export type L2BlockProvenEvent = {
@@ -194,3 +258,8 @@ export type L2BlockPruneEvent = {
194
258
  epochNumber: bigint;
195
259
  blocks: L2Block[];
196
260
  };
261
+
262
+ export type InvalidBlockDetectedEvent = {
263
+ type: 'invalidBlockDetected';
264
+ validationResult: ValidateBlockNegativeResult;
265
+ };
@@ -32,11 +32,15 @@ export class CommitteeAttestation {
32
32
  return new CommitteeAttestation(address, signature);
33
33
  }
34
34
 
35
+ static fromSignature(signature: Signature): CommitteeAttestation {
36
+ return new CommitteeAttestation(EthAddress.ZERO, signature);
37
+ }
38
+
35
39
  static fromViem(viem: ViemCommitteeAttestation): CommitteeAttestation {
36
40
  return new CommitteeAttestation(EthAddress.fromString(viem.addr), Signature.fromViemSignature(viem.signature));
37
41
  }
38
42
 
39
- static fromBuffer(buffer: Buffer): CommitteeAttestation {
43
+ static fromBuffer(buffer: Buffer | BufferReader): CommitteeAttestation {
40
44
  const reader = BufferReader.asReader(buffer);
41
45
  const address = reader.readObject(EthAddress);
42
46
  const signature = reader.readObject(Signature);
@@ -1,4 +1,6 @@
1
1
  // Ignoring import issue to fix portable inferred type issue in zod schema
2
+ import { Buffer32 } from '@aztec/foundation/buffer';
3
+ import { randomBigInt } from '@aztec/foundation/crypto';
2
4
  import { schemas } from '@aztec/foundation/schemas';
3
5
 
4
6
  import { z } from 'zod';
@@ -22,6 +24,14 @@ export class L1PublishedData {
22
24
  blockHash: z.string(),
23
25
  });
24
26
  }
27
+
28
+ static random() {
29
+ return new L1PublishedData(
30
+ randomBigInt(1000n) + 1n,
31
+ BigInt(Math.floor(Date.now() / 1000)),
32
+ Buffer32.random().toString(),
33
+ );
34
+ }
25
35
  }
26
36
 
27
37
  export class PublishedL2Block {
@@ -40,12 +50,11 @@ export class PublishedL2Block {
40
50
  }
41
51
  }
42
52
 
43
- export function getAttestationsFromPublishedL2Block(block: PublishedL2Block) {
53
+ export function getAttestationsFromPublishedL2Block(
54
+ block: Pick<PublishedL2Block, 'attestations' | 'block'>,
55
+ ): BlockAttestation[] {
44
56
  const payload = ConsensusPayload.fromBlock(block.block);
45
57
  return block.attestations
46
58
  .filter(attestation => !attestation.signature.isEmpty())
47
- .map(
48
- attestation =>
49
- new BlockAttestation(block.block.header.globalVariables.blockNumber, payload, attestation.signature),
50
- );
59
+ .map(attestation => new BlockAttestation(block.block.number, payload, attestation.signature));
51
60
  }
@@ -100,12 +100,12 @@ export class SerializableContractInstance {
100
100
  }
101
101
 
102
102
  /**
103
- * Generates a Contract Instance from the deployment params.
103
+ * Generates a Contract Instance from some instantiation params.
104
104
  * @param artifact - The account contract build artifact.
105
- * @param opts - Options for the deployment.
105
+ * @param opts - Options for the contract's instantiation.
106
106
  * @returns - The contract instance
107
107
  */
108
- export async function getContractInstanceFromDeployParams(
108
+ export async function getContractInstanceFromInstantiationParams(
109
109
  artifact: ContractArtifact,
110
110
  opts: {
111
111
  constructorArtifact?: FunctionAbi | string;
@@ -3,23 +3,18 @@ import { z } from 'zod';
3
3
  import type { AztecAddress } from '../../aztec-address/index.js';
4
4
  import { schemas } from '../../schemas/index.js';
5
5
 
6
- export const ProtocolContractsNames = [
7
- 'classRegisterer',
8
- 'feeJuice',
9
- 'instanceDeployer',
10
- 'multiCallEntrypoint',
11
- ] as const;
6
+ export const ProtocolContractsNames = ['classRegistry', 'feeJuice', 'instanceRegistry', 'multiCallEntrypoint'] as const;
12
7
 
13
8
  export type ProtocolContractAddresses = {
14
- classRegisterer: AztecAddress;
9
+ classRegistry: AztecAddress;
15
10
  feeJuice: AztecAddress;
16
- instanceDeployer: AztecAddress;
11
+ instanceRegistry: AztecAddress;
17
12
  multiCallEntrypoint: AztecAddress;
18
13
  };
19
14
 
20
15
  export const ProtocolContractAddressesSchema = z.object({
21
- classRegisterer: schemas.AztecAddress,
16
+ classRegistry: schemas.AztecAddress,
22
17
  feeJuice: schemas.AztecAddress,
23
- instanceDeployer: schemas.AztecAddress,
18
+ instanceRegistry: schemas.AztecAddress,
24
19
  multiCallEntrypoint: schemas.AztecAddress,
25
20
  });
@@ -91,7 +91,7 @@ export async function createPrivateFunctionMembershipProof(
91
91
  }
92
92
 
93
93
  /**
94
- * Verifies that a private function with a membership proof as emitted by the ClassRegisterer contract is valid,
94
+ * Verifies that a private function with a membership proof as emitted by the ClassRegistry contract is valid,
95
95
  * as defined in the protocol specs at contract-deployment/classes:
96
96
  *
97
97
  * ```
@@ -66,7 +66,7 @@ export async function createUtilityFunctionMembershipProof(
66
66
  }
67
67
 
68
68
  /**
69
- * Verifies that a utility function with a membership proof as emitted by the ClassRegisterer contract is valid,
69
+ * Verifies that a utility function with a membership proof as emitted by the ClassRegistry contract is valid,
70
70
  * as defined in the protocol specs at contract-deployment/classes:
71
71
  *
72
72
  * ```
@@ -6,9 +6,9 @@ import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/
6
6
  import { ScheduledDelayChange } from './scheduled_delay_change.js';
7
7
  import { ScheduledValueChange } from './scheduled_value_change.js';
8
8
 
9
- export const SHARED_MUTABLE_VALUES_LEN = 2 * UPDATES_VALUE_SIZE + 1;
9
+ export const DELAYED_PUBLIC_MUTABLE_VALUES_LEN = 2 * UPDATES_VALUE_SIZE + 1;
10
10
 
11
- export class SharedMutableValues {
11
+ export class DelayedPublicMutableValues {
12
12
  constructor(
13
13
  public svc: ScheduledValueChange,
14
14
  public sdc: ScheduledDelayChange,
@@ -58,32 +58,32 @@ export class SharedMutableValues {
58
58
  return serializeToBuffer(this.toFields());
59
59
  }
60
60
 
61
- static fromBuffer(buffer: Buffer | BufferReader, valueSize: number): SharedMutableValues {
61
+ static fromBuffer(buffer: Buffer | BufferReader, valueSize: number): DelayedPublicMutableValues {
62
62
  const reader = BufferReader.asReader(buffer);
63
- return SharedMutableValues.fromFields(reader.readArray(2 * valueSize + 1, Fr));
63
+ return DelayedPublicMutableValues.fromFields(reader.readArray(2 * valueSize + 1, Fr));
64
64
  }
65
65
 
66
66
  static empty(valueSize: number) {
67
67
  return new this(ScheduledValueChange.empty(valueSize), ScheduledDelayChange.empty());
68
68
  }
69
69
 
70
- static async readFromTree(sharedMutableSlot: Fr, readStorage: (storageSlot: Fr) => Promise<Fr>) {
70
+ static async readFromTree(delayedPublicMutableSlot: Fr, readStorage: (storageSlot: Fr) => Promise<Fr>) {
71
71
  const fields = [];
72
- for (let i = 0; i < SHARED_MUTABLE_VALUES_LEN; i++) {
73
- fields.push(await readStorage(sharedMutableSlot.add(new Fr(i))));
72
+ for (let i = 0; i < DELAYED_PUBLIC_MUTABLE_VALUES_LEN; i++) {
73
+ fields.push(await readStorage(delayedPublicMutableSlot.add(new Fr(i))));
74
74
  }
75
- return SharedMutableValues.fromFields(fields);
75
+ return DelayedPublicMutableValues.fromFields(fields);
76
76
  }
77
77
 
78
78
  isEmpty(): boolean {
79
79
  return this.svc.isEmpty() && this.sdc.isEmpty();
80
80
  }
81
81
 
82
- async writeToTree(sharedMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
82
+ async writeToTree(delayedPublicMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
83
83
  const fields = this.toFields();
84
84
 
85
85
  for (let i = 0; i < fields.length; i++) {
86
- await storageWrite(sharedMutableSlot.add(new Fr(i)), fields[i]);
86
+ await storageWrite(delayedPublicMutableSlot.add(new Fr(i)), fields[i]);
87
87
  }
88
88
  }
89
89
 
@@ -0,0 +1,38 @@
1
+ import { UPDATED_CLASS_IDS_SLOT } from '@aztec/constants';
2
+ import { Fr } from '@aztec/foundation/fields';
3
+
4
+ import type { AztecAddress } from '../aztec-address/index.js';
5
+ import { deriveStorageSlotInMap } from '../hash/map_slot.js';
6
+ import { DELAYED_PUBLIC_MUTABLE_VALUES_LEN, DelayedPublicMutableValues } from './delayed_public_mutable_values.js';
7
+ import { ScheduledDelayChange } from './scheduled_delay_change.js';
8
+ import { ScheduledValueChange } from './scheduled_value_change.js';
9
+
10
+ export class DelayedPublicMutableValuesWithHash {
11
+ private dpmv: DelayedPublicMutableValues;
12
+
13
+ constructor(svc: ScheduledValueChange, sdc: ScheduledDelayChange) {
14
+ this.dpmv = new DelayedPublicMutableValues(svc, sdc);
15
+ }
16
+
17
+ async toFields(): Promise<Fr[]> {
18
+ return [...this.dpmv.toFields(), await this.dpmv.hash()];
19
+ }
20
+
21
+ async writeToTree(delayedPublicMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
22
+ const fields = await this.toFields();
23
+
24
+ for (let i = 0; i < fields.length; i++) {
25
+ await storageWrite(delayedPublicMutableSlot.add(new Fr(i)), fields[i]);
26
+ }
27
+ }
28
+
29
+ static async getContractUpdateSlots(contractAddress: AztecAddress) {
30
+ const delayedPublicMutableSlot = await deriveStorageSlotInMap(new Fr(UPDATED_CLASS_IDS_SLOT), contractAddress);
31
+ const delayedPublicMutableHashSlot = delayedPublicMutableSlot.add(new Fr(DELAYED_PUBLIC_MUTABLE_VALUES_LEN));
32
+
33
+ return {
34
+ delayedPublicMutableSlot,
35
+ delayedPublicMutableHashSlot,
36
+ };
37
+ }
38
+ }
@@ -0,0 +1,4 @@
1
+ export * from './scheduled_delay_change.js';
2
+ export * from './scheduled_value_change.js';
3
+ export * from './delayed_public_mutable_values.js';
4
+ export * from './delayed_public_mutable_values_with_hash.js';
package/src/gas/gas.ts CHANGED
@@ -28,6 +28,10 @@ export class Gas {
28
28
  .transform(Gas.from);
29
29
  }
30
30
 
31
+ getSize() {
32
+ return 4 /* daGas */ + 4 /* l2Gas */;
33
+ }
34
+
31
35
  clone(): Gas {
32
36
  return new Gas(this.daGas, this.l2Gas);
33
37
  }
package/src/hash/hash.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { GeneratorIndex } from '@aztec/constants';
2
- import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
3
2
  import { poseidon2Hash, poseidon2HashWithSeparator, sha256ToField } from '@aztec/foundation/crypto';
4
3
  import type { EthAddress } from '@aztec/foundation/eth-address';
5
4
  import { Fr } from '@aztec/foundation/fields';
@@ -13,9 +12,7 @@ import type { AztecAddress } from '../aztec-address/index.js';
13
12
  */
14
13
  export async function hashVK(keyAsFields: Fr[]): Promise<Fr> {
15
14
  // Should match the implementation in barretenberg/cpp/src/barretenberg/flavor/flavor.hpp > hash()
16
- const hash = (await poseidon2Hash(keyAsFields)).toBuffer();
17
- // Taking the last 16 bytes (128 bits) of the hash.
18
- return new Fr(toBigIntBE(hash.subarray(Fr.SIZE_IN_BYTES - 16)));
15
+ return await poseidon2Hash(keyAsFields);
19
16
  }
20
17
 
21
18
  /**
@@ -3,7 +3,7 @@ import type { ApiSchemaFor } from '@aztec/foundation/schemas';
3
3
  import { z } from 'zod';
4
4
 
5
5
  import { L2Block } from '../block/l2_block.js';
6
- import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
6
+ import { type L2BlockSource, L2TipsSchema, ValidateBlockResultSchema } from '../block/l2_block_source.js';
7
7
  import { PublishedL2Block } from '../block/published_l2_block.js';
8
8
  import {
9
9
  ContractClassPublicSchema,
@@ -75,4 +75,6 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
75
75
  getL1Constants: z.function().args().returns(L1RollupConstantsSchema),
76
76
  getL1Timestamp: z.function().args().returns(schemas.BigInt),
77
77
  syncImmediate: z.function().args().returns(z.void()),
78
+ isPendingChainInvalid: z.function().args().returns(z.boolean()),
79
+ getPendingChainValidationStatus: z.function().args().returns(ValidateBlockResultSchema),
78
80
  };
@@ -3,25 +3,26 @@ import { createSafeJsonRpcClient, defaultFetch } from '@aztec/foundation/json-rp
3
3
  import { z } from 'zod';
4
4
 
5
5
  import type { ApiSchemaFor } from '../schemas/schemas.js';
6
+ import { type MonitoredSlashPayload, MonitoredSlashPayloadSchema } from '../slashing/index.js';
6
7
  import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
7
8
  import { type SequencerConfig, SequencerConfigSchema } from './configs.js';
8
9
  import { type ProverConfig, ProverConfigSchema } from './prover-client.js';
10
+ import { type SlasherConfig, SlasherConfigSchema } from './slasher.js';
9
11
 
10
12
  /**
11
13
  * Aztec node admin API.
12
14
  */
13
15
  export interface AztecNodeAdmin {
14
16
  /**
15
- * Updates the configuration of this node.
16
- * @param config - Updated configuration to be merged with the current one.
17
+ * Retrieves the configuration of this node.
17
18
  */
18
- setConfig(config: Partial<SequencerConfig & ProverConfig & { maxTxPoolSize: number }>): Promise<void>;
19
+ getConfig(): Promise<AztecNodeAdminConfig>;
19
20
 
20
21
  /**
21
- * Forces the next block to be built bypassing all time and pending checks.
22
- * Useful for testing.
22
+ * Updates the configuration of this node.
23
+ * @param config - Updated configuration to be merged with the current one.
23
24
  */
24
- flushTxs(): Promise<void>;
25
+ setConfig(config: Partial<AztecNodeAdminConfig>): Promise<void>;
25
26
 
26
27
  /**
27
28
  * Pauses syncing, creates a backup of archiver and world-state databases, and uploads them. Returns immediately.
@@ -41,15 +42,25 @@ export interface AztecNodeAdmin {
41
42
 
42
43
  /** Resumes archiver and world state syncing. */
43
44
  resumeSync(): Promise<void>;
45
+
46
+ /** Returns all monitored payloads by the slasher. */
47
+ getSlasherMonitoredPayloads(): Promise<MonitoredSlashPayload[]>;
44
48
  }
45
49
 
50
+ export type AztecNodeAdminConfig = SequencerConfig & ProverConfig & SlasherConfig & { maxTxPoolSize: number };
51
+
52
+ export const AztecNodeAdminConfigSchema = SequencerConfigSchema.merge(ProverConfigSchema)
53
+ .merge(SlasherConfigSchema)
54
+ .merge(z.object({ maxTxPoolSize: z.number() }));
55
+
46
56
  export const AztecNodeAdminApiSchema: ApiSchemaFor<AztecNodeAdmin> = {
47
- setConfig: z.function().args(SequencerConfigSchema.merge(ProverConfigSchema).partial()).returns(z.void()),
48
- flushTxs: z.function().returns(z.void()),
57
+ getConfig: z.function().returns(AztecNodeAdminConfigSchema),
58
+ setConfig: z.function().args(AztecNodeAdminConfigSchema.partial()).returns(z.void()),
49
59
  startSnapshotUpload: z.function().args(z.string()).returns(z.void()),
50
60
  rollbackTo: z.function().args(z.number()).returns(z.void()),
51
61
  pauseSync: z.function().returns(z.void()),
52
62
  resumeSync: z.function().returns(z.void()),
63
+ getSlasherMonitoredPayloads: z.function().returns(z.array(MonitoredSlashPayloadSchema)),
53
64
  };
54
65
 
55
66
  export function createAztecNodeAdminClient(
@@ -40,6 +40,18 @@ export interface SequencerConfig {
40
40
  enforceTimeTable?: boolean;
41
41
  /** How many seconds into an L1 slot we can still send a tx and get it mined. */
42
42
  maxL1TxInclusionTimeIntoSlot?: number;
43
+ /** Used for testing to introduce a fake delay after processing each tx */
44
+ fakeProcessingDelayPerTxMs?: number;
45
+ /** How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way) */
46
+ attestationPropagationTime?: number;
47
+ /** How many seconds before invalidating a block as a committee member (zero to never invalidate) */
48
+ secondsBeforeInvalidatingBlockAsCommitteeMember?: number;
49
+ /** How many seconds before invalidating a block as a non-committee member (zero to never invalidate) */
50
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember?: number;
51
+ /** Skip collecting attestations (for testing only) */
52
+ skipCollectingAttestations?: boolean;
53
+ /** Do not invalidate the previous block if invalid when we are the proposer (for testing only) */
54
+ skipInvalidateBlockAsProposer?: boolean;
43
55
  }
44
56
 
45
57
  export const SequencerConfigSchema = z.object({
@@ -58,4 +70,9 @@ export const SequencerConfigSchema = z.object({
58
70
  governanceProposerPayload: schemas.EthAddress.optional(),
59
71
  maxL1TxInclusionTimeIntoSlot: z.number().optional(),
60
72
  enforceTimeTable: z.boolean().optional(),
73
+ fakeProcessingDelayPerTxMs: z.number().optional(),
74
+ attestationPropagationTime: z.number().optional(),
75
+ skipCollectingAttestations: z.boolean().optional(),
76
+ secondsBeforeInvalidatingBlockAsCommitteeMember: z.number(),
77
+ secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.number(),
61
78
  }) satisfies ZodFor<SequencerConfig>;
@@ -125,6 +125,8 @@ export interface PXE {
125
125
  * This is called by aztec.js when instantiating a contract in a given address with a mismatching artifact.
126
126
  * @param contractAddress - The address of the contract to update.
127
127
  * @param artifact - The updated artifact for the contract.
128
+ * @throws If the artifact's contract class is not found in the PXE or if the contract class is different from
129
+ * the current one (current one from the point of view of the node to which the PXE is connected).
128
130
  */
129
131
  updateContract(contractAddress: AztecAddress, artifact: ContractArtifact): Promise<void>;
130
132
 
@@ -417,7 +419,7 @@ export interface PXEInfo {
417
419
  export interface ContractMetadata {
418
420
  contractInstance?: ContractInstanceWithAddress | undefined;
419
421
  isContractInitialized: boolean;
420
- isContractPubliclyDeployed: boolean;
422
+ isContractPublished: boolean;
421
423
  }
422
424
 
423
425
  export interface ContractClassMetadata {
@@ -429,7 +431,7 @@ export interface ContractClassMetadata {
429
431
  const ContractMetadataSchema = z.object({
430
432
  contractInstance: z.union([ContractInstanceWithAddressSchema, z.undefined()]),
431
433
  isContractInitialized: z.boolean(),
432
- isContractPubliclyDeployed: z.boolean(),
434
+ isContractPublished: z.boolean(),
433
435
  }) satisfies ZodFor<ContractMetadata>;
434
436
 
435
437
  const ContractClassMetadataSchema = z.object({
@@ -1,5 +1,7 @@
1
1
  export * from './allowed_element.js';
2
+ export * from './api_limit.js';
2
3
  export * from './archiver.js';
4
+ export * from './aztec-node.js';
3
5
  export * from './block-builder.js';
4
6
  export * from './configs.js';
5
7
  export * from './epoch-prover.js';
@@ -17,6 +19,6 @@ export * from './proving-job-source.js';
17
19
  export * from './proving-job.js';
18
20
  export * from './server_circuit_prover.js';
19
21
  export * from './service.js';
20
- export * from './tx-collector.js';
22
+ export * from './slasher.js';
23
+ export * from './tx_provider.js';
21
24
  export * from './world_state.js';
22
- export * from './api_limit.js';
@@ -0,0 +1,49 @@
1
+ import type { SecretValue } from '@aztec/foundation/config';
2
+ import type { EthAddress } from '@aztec/foundation/eth-address';
3
+ import { type ZodFor, schemas } from '@aztec/foundation/schemas';
4
+
5
+ import { z } from 'zod';
6
+
7
+ export interface SlasherConfig {
8
+ slashOverridePayload?: EthAddress;
9
+ slashPayloadTtlSeconds: number; // TTL for payloads, in seconds
10
+ slashPruneEnabled: boolean;
11
+ slashPrunePenalty: bigint;
12
+ slashPruneMaxPenalty: bigint;
13
+ slashInvalidBlockEnabled: boolean;
14
+ slashInvalidBlockPenalty: bigint;
15
+ slashInvalidBlockMaxPenalty: bigint;
16
+ slashInactivityEnabled: boolean;
17
+ slashInactivityCreateTargetPercentage: number; // 0-1, 0.9 means 90%. Must be greater than 0
18
+ slashInactivitySignalTargetPercentage: number; // 0-1, 0.6 means 60%. Must be greater than 0
19
+ slashInactivityCreatePenalty: bigint;
20
+ slashInactivityMaxPenalty: bigint;
21
+ slashProposerRoundPollingIntervalSeconds: number;
22
+ slashProposeInvalidAttestationsPenalty: bigint;
23
+ slashProposeInvalidAttestationsMaxPenalty: bigint;
24
+ slashAttestDescendantOfInvalidPenalty: bigint;
25
+ slashAttestDescendantOfInvalidMaxPenalty: bigint;
26
+ slasherPrivateKey: SecretValue<string | undefined>; // Private key of the slasher account used for creating slash payloads
27
+ }
28
+
29
+ export const SlasherConfigSchema = z.object({
30
+ slashOverridePayload: schemas.EthAddress.optional(),
31
+ slashPayloadTtlSeconds: z.number(),
32
+ slashPruneEnabled: z.boolean(),
33
+ slashPrunePenalty: schemas.BigInt,
34
+ slashPruneMaxPenalty: schemas.BigInt,
35
+ slashInvalidBlockEnabled: z.boolean(),
36
+ slashInvalidBlockPenalty: schemas.BigInt,
37
+ slashInvalidBlockMaxPenalty: schemas.BigInt,
38
+ slashInactivityEnabled: z.boolean(),
39
+ slashInactivityCreateTargetPercentage: z.number(),
40
+ slashInactivitySignalTargetPercentage: z.number(),
41
+ slashInactivityCreatePenalty: schemas.BigInt,
42
+ slashInactivityMaxPenalty: schemas.BigInt,
43
+ slashProposerRoundPollingIntervalSeconds: z.number(),
44
+ slashProposeInvalidAttestationsPenalty: schemas.BigInt,
45
+ slashProposeInvalidAttestationsMaxPenalty: schemas.BigInt,
46
+ slashAttestDescendantOfInvalidPenalty: schemas.BigInt,
47
+ slashAttestDescendantOfInvalidMaxPenalty: schemas.BigInt,
48
+ slasherPrivateKey: schemas.SecretValue(z.string().optional()),
49
+ }) satisfies ZodFor<SlasherConfig>;
@@ -0,0 +1,16 @@
1
+ import type { L2Block } from '@aztec/stdlib/block';
2
+ import type { BlockProposal } from '@aztec/stdlib/p2p';
3
+ import { type Tx, TxHash } from '@aztec/stdlib/tx';
4
+
5
+ import type { PeerId } from '@libp2p/interface';
6
+
7
+ export interface ITxProvider {
8
+ getAvailableTxs(txHashes: TxHash[]): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
9
+
10
+ getTxsForBlockProposal(
11
+ blockProposal: BlockProposal,
12
+ opts: { pinnedPeer: PeerId | undefined; deadline: Date },
13
+ ): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
14
+
15
+ getTxsForBlock(block: L2Block, opts: { deadline: Date }): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
16
+ }