@aztec/stdlib 6.0.0-nightly.20260604 → 6.0.0-nightly.20260721

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (499) hide show
  1. package/dest/abi/buffer.d.ts +6 -2
  2. package/dest/abi/buffer.d.ts.map +1 -1
  3. package/dest/abi/buffer.js +13 -1
  4. package/dest/avm/avm.js +1 -1
  5. package/dest/avm/avm_proving_request.d.ts +70 -70
  6. package/dest/avm/index.d.ts +1 -6
  7. package/dest/avm/index.d.ts.map +1 -1
  8. package/dest/avm/index.js +0 -5
  9. package/dest/aztec-address/index.d.ts +35 -5
  10. package/dest/aztec-address/index.d.ts.map +1 -1
  11. package/dest/aztec-address/index.js +32 -8
  12. package/dest/block/attestation_info.d.ts +1 -1
  13. package/dest/block/attestation_info.d.ts.map +1 -1
  14. package/dest/block/attestation_info.js +7 -4
  15. package/dest/block/l2_block_source.d.ts +46 -23
  16. package/dest/block/l2_block_source.d.ts.map +1 -1
  17. package/dest/block/l2_block_source.js +15 -1
  18. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
  19. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
  20. package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
  21. package/dest/block/l2_block_stream/index.d.ts +2 -1
  22. package/dest/block/l2_block_stream/index.d.ts.map +1 -1
  23. package/dest/block/l2_block_stream/index.js +1 -0
  24. package/dest/block/l2_block_stream/interfaces.d.ts +81 -11
  25. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  26. package/dest/block/l2_block_stream/interfaces.js +25 -1
  27. package/dest/block/l2_block_stream/l2_block_stream.d.ts +23 -15
  28. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  29. package/dest/block/l2_block_stream/l2_block_stream.js +149 -152
  30. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +6 -12
  31. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
  32. package/dest/block/l2_block_stream/l2_tips_memory_store.js +8 -32
  33. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +17 -18
  34. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  35. package/dest/block/l2_block_stream/l2_tips_store_base.js +70 -58
  36. package/dest/block/proposal/attestations_and_signers.d.ts +19 -1
  37. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
  38. package/dest/block/proposal/attestations_and_signers.js +47 -7
  39. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  40. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  41. package/dest/block/test/l2_tips_store_test_suite.js +296 -37
  42. package/dest/block/validate_block_result.d.ts +16 -1
  43. package/dest/block/validate_block_result.d.ts.map +1 -1
  44. package/dest/block/validate_block_result.js +18 -3
  45. package/dest/checkpoint/checkpoint.js +2 -2
  46. package/dest/checkpoint/index.d.ts +2 -1
  47. package/dest/checkpoint/index.d.ts.map +1 -1
  48. package/dest/checkpoint/index.js +1 -0
  49. package/dest/checkpoint/simulation_overrides.d.ts +61 -0
  50. package/dest/checkpoint/simulation_overrides.d.ts.map +1 -0
  51. package/dest/checkpoint/simulation_overrides.js +98 -0
  52. package/dest/checkpoint/validate.d.ts +11 -3
  53. package/dest/checkpoint/validate.d.ts.map +1 -1
  54. package/dest/checkpoint/validate.js +9 -6
  55. package/dest/config/index.d.ts +2 -1
  56. package/dest/config/index.d.ts.map +1 -1
  57. package/dest/config/index.js +1 -0
  58. package/dest/config/network-consensus-config.d.ts +72 -0
  59. package/dest/config/network-consensus-config.d.ts.map +1 -0
  60. package/dest/config/network-consensus-config.js +223 -0
  61. package/dest/config/sequencer-config.d.ts +4 -2
  62. package/dest/config/sequencer-config.d.ts.map +1 -1
  63. package/dest/config/sequencer-config.js +22 -3
  64. package/dest/contract/contract_address.d.ts +5 -4
  65. package/dest/contract/contract_address.d.ts.map +1 -1
  66. package/dest/contract/contract_class.d.ts +1 -1
  67. package/dest/contract/contract_class.d.ts.map +1 -1
  68. package/dest/contract/contract_class.js +3 -2
  69. package/dest/contract/contract_instance.d.ts +16 -2
  70. package/dest/contract/contract_instance.d.ts.map +1 -1
  71. package/dest/contract/contract_instance.js +45 -0
  72. package/dest/contract/index.d.ts +1 -2
  73. package/dest/contract/index.d.ts.map +1 -1
  74. package/dest/contract/index.js +0 -1
  75. package/dest/contract/interfaces/contract_data_source.d.ts +3 -5
  76. package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
  77. package/dest/contract/interfaces/contract_instance.d.ts +71 -10
  78. package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
  79. package/dest/contract/interfaces/contract_instance.js +7 -2
  80. package/dest/contract/interfaces/node-info.d.ts +11 -1
  81. package/dest/contract/interfaces/node-info.d.ts.map +1 -1
  82. package/dest/contract/interfaces/node-info.js +7 -1
  83. package/dest/contract/partial_address.d.ts +9 -3
  84. package/dest/contract/partial_address.d.ts.map +1 -1
  85. package/dest/contract/partial_address.js +8 -2
  86. package/dest/database-version/version_manager.d.ts +18 -4
  87. package/dest/database-version/version_manager.d.ts.map +1 -1
  88. package/dest/database-version/version_manager.js +76 -6
  89. package/dest/deserialization/index.d.ts +35 -3
  90. package/dest/deserialization/index.d.ts.map +1 -1
  91. package/dest/deserialization/index.js +32 -1
  92. package/dest/file-store/factory.d.ts +1 -1
  93. package/dest/file-store/factory.d.ts.map +1 -1
  94. package/dest/file-store/factory.js +7 -0
  95. package/dest/file-store/index.d.ts +2 -1
  96. package/dest/file-store/index.d.ts.map +1 -1
  97. package/dest/file-store/index.js +1 -0
  98. package/dest/file-store/memory.d.ts +24 -0
  99. package/dest/file-store/memory.d.ts.map +1 -0
  100. package/dest/file-store/memory.js +80 -0
  101. package/dest/gas/gas_settings.d.ts +7 -13
  102. package/dest/gas/gas_settings.d.ts.map +1 -1
  103. package/dest/gas/gas_settings.js +9 -16
  104. package/dest/gas/index.d.ts +2 -1
  105. package/dest/gas/index.d.ts.map +1 -1
  106. package/dest/gas/index.js +1 -0
  107. package/dest/gas/tx_gas_limits.d.ts +72 -0
  108. package/dest/gas/tx_gas_limits.d.ts.map +1 -0
  109. package/dest/gas/tx_gas_limits.js +85 -0
  110. package/dest/ha-signing/config.d.ts +19 -5
  111. package/dest/ha-signing/config.d.ts.map +1 -1
  112. package/dest/ha-signing/config.js +9 -3
  113. package/dest/ha-signing/local_config.d.ts +10 -2
  114. package/dest/ha-signing/local_config.d.ts.map +1 -1
  115. package/dest/ha-signing/local_config.js +8 -2
  116. package/dest/interfaces/archiver.d.ts +7 -9
  117. package/dest/interfaces/archiver.d.ts.map +1 -1
  118. package/dest/interfaces/archiver.js +3 -2
  119. package/dest/interfaces/aztec-node-admin.d.ts +24 -17
  120. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  121. package/dest/interfaces/aztec-node-admin.js +1 -1
  122. package/dest/interfaces/aztec-node-debug.d.ts +40 -2
  123. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -1
  124. package/dest/interfaces/aztec-node-debug.js +29 -1
  125. package/dest/interfaces/aztec-node.d.ts +69 -28
  126. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  127. package/dest/interfaces/aztec-node.js +56 -20
  128. package/dest/interfaces/block-builder.d.ts +3 -1
  129. package/dest/interfaces/block-builder.d.ts.map +1 -1
  130. package/dest/interfaces/chain_tips.d.ts +8 -47
  131. package/dest/interfaces/chain_tips.d.ts.map +1 -1
  132. package/dest/interfaces/chain_tips.js +1 -6
  133. package/dest/interfaces/checkpoint_parameter.d.ts +3 -3
  134. package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -1
  135. package/dest/interfaces/checkpoint_parameter.js +3 -3
  136. package/dest/interfaces/client.d.ts +2 -1
  137. package/dest/interfaces/client.d.ts.map +1 -1
  138. package/dest/interfaces/configs.d.ts +27 -6
  139. package/dest/interfaces/configs.d.ts.map +1 -1
  140. package/dest/interfaces/configs.js +5 -1
  141. package/dest/interfaces/get_tx_by_hash_options.d.ts +9 -0
  142. package/dest/interfaces/get_tx_by_hash_options.d.ts.map +1 -0
  143. package/dest/interfaces/get_tx_by_hash_options.js +4 -0
  144. package/dest/interfaces/merkle_tree_operations.d.ts +8 -3
  145. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  146. package/dest/interfaces/p2p.d.ts +38 -9
  147. package/dest/interfaces/p2p.d.ts.map +1 -1
  148. package/dest/interfaces/p2p.js +14 -2
  149. package/dest/interfaces/private_kernel_prover.d.ts +71 -12
  150. package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
  151. package/dest/interfaces/prover-client.d.ts +2 -3
  152. package/dest/interfaces/prover-client.d.ts.map +1 -1
  153. package/dest/interfaces/prover-node.d.ts +12 -8
  154. package/dest/interfaces/prover-node.d.ts.map +1 -1
  155. package/dest/interfaces/prover-node.js +24 -17
  156. package/dest/interfaces/proving-job.d.ts +4 -4
  157. package/dest/interfaces/proving-job.d.ts.map +1 -1
  158. package/dest/interfaces/proving-job.js +2 -2
  159. package/dest/interfaces/server.d.ts +1 -3
  160. package/dest/interfaces/server.d.ts.map +1 -1
  161. package/dest/interfaces/server.js +0 -2
  162. package/dest/interfaces/server_circuit_prover.d.ts +3 -3
  163. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  164. package/dest/interfaces/validator.d.ts +15 -4
  165. package/dest/interfaces/validator.d.ts.map +1 -1
  166. package/dest/interfaces/validator.js +3 -1
  167. package/dest/interfaces/world_state.d.ts +14 -1
  168. package/dest/interfaces/world_state.d.ts.map +1 -1
  169. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
  170. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
  171. package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
  172. package/dest/kernel/hints/index.d.ts +1 -2
  173. package/dest/kernel/hints/index.d.ts.map +1 -1
  174. package/dest/kernel/hints/index.js +0 -1
  175. package/dest/kernel/hints/read_request.js +1 -1
  176. package/dest/kernel/index.d.ts +6 -2
  177. package/dest/kernel/index.d.ts.map +1 -1
  178. package/dest/kernel/index.js +5 -1
  179. package/dest/kernel/log_hash.d.ts +1 -1
  180. package/dest/kernel/log_hash.d.ts.map +1 -1
  181. package/dest/kernel/log_hash.js +2 -2
  182. package/dest/kernel/note_hash.js +1 -1
  183. package/dest/kernel/nullifier.js +1 -1
  184. package/dest/kernel/private_circuit_public_inputs.d.ts +13 -3
  185. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  186. package/dest/kernel/private_circuit_public_inputs.js +14 -7
  187. package/dest/kernel/private_context_inputs.d.ts +4 -3
  188. package/dest/kernel/private_context_inputs.d.ts.map +1 -1
  189. package/dest/kernel/private_context_inputs.js +7 -3
  190. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +7 -9
  191. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  192. package/dest/kernel/private_kernel_circuit_public_inputs.js +10 -7
  193. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +2 -3
  194. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -1
  195. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +3 -5
  196. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +2 -3
  197. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -1
  198. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +3 -5
  199. package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts +24 -0
  200. package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts.map +1 -0
  201. package/dest/kernel/private_kernel_init_4_circuit_private_inputs.js +37 -0
  202. package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts +25 -0
  203. package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts.map +1 -0
  204. package/dest/kernel/private_kernel_init_5_circuit_private_inputs.js +39 -0
  205. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
  206. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
  207. package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
  208. package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts +18 -0
  209. package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts.map +1 -0
  210. package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.js +27 -0
  211. package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts +19 -0
  212. package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts.map +1 -0
  213. package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.js +29 -0
  214. package/dest/kernel/private_kernel_prover_output.d.ts +4 -1
  215. package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
  216. package/dest/kernel/private_kernel_prover_output.js +4 -1
  217. package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
  218. package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
  219. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
  220. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
  221. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
  222. package/dest/kernel/private_kernel_simulated_output.d.ts +1 -7
  223. package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
  224. package/dest/kernel/private_kernel_simulated_output.js +2 -1
  225. package/dest/kernel/private_log_data.d.ts +1 -1
  226. package/dest/kernel/private_log_data.d.ts.map +1 -1
  227. package/dest/kernel/private_log_data.js +1 -1
  228. package/dest/kernel/utils/index.d.ts +1 -2
  229. package/dest/kernel/utils/index.d.ts.map +1 -1
  230. package/dest/kernel/utils/index.js +0 -1
  231. package/dest/keys/derivation.d.ts +41 -5
  232. package/dest/keys/derivation.d.ts.map +1 -1
  233. package/dest/keys/derivation.js +53 -23
  234. package/dest/logs/app_tagging_secret.d.ts +30 -7
  235. package/dest/logs/app_tagging_secret.d.ts.map +1 -1
  236. package/dest/logs/app_tagging_secret.js +44 -28
  237. package/dest/logs/app_tagging_secret_kind.js +1 -1
  238. package/dest/logs/contract_class_log.d.ts +1 -2
  239. package/dest/logs/contract_class_log.d.ts.map +1 -1
  240. package/dest/logs/contract_class_log.js +0 -4
  241. package/dest/logs/message_context.d.ts +5 -15
  242. package/dest/logs/message_context.d.ts.map +1 -1
  243. package/dest/logs/message_context.js +1 -66
  244. package/dest/logs/pending_tagged_log.d.ts +6 -8
  245. package/dest/logs/pending_tagged_log.d.ts.map +1 -1
  246. package/dest/logs/pending_tagged_log.js +1 -31
  247. package/dest/logs/shared_secret_derivation.d.ts +19 -6
  248. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  249. package/dest/logs/shared_secret_derivation.js +26 -11
  250. package/dest/p2p/attestation_utils.d.ts +1 -1
  251. package/dest/p2p/attestation_utils.d.ts.map +1 -1
  252. package/dest/p2p/attestation_utils.js +8 -1
  253. package/dest/p2p/checkpoint_attestation.d.ts +10 -1
  254. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  255. package/dest/p2p/checkpoint_attestation.js +10 -0
  256. package/dest/p2p/checkpoint_proposal.d.ts +2 -1
  257. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  258. package/dest/p2p/consensus_payload.d.ts +2 -1
  259. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  260. package/dest/p2p/index.d.ts +1 -2
  261. package/dest/p2p/index.d.ts.map +1 -1
  262. package/dest/p2p/index.js +0 -1
  263. package/dest/p2p/signature_utils.d.ts +10 -1
  264. package/dest/p2p/signature_utils.d.ts.map +1 -1
  265. package/dest/p2p/signature_utils.js +9 -1
  266. package/dest/rollup/avm_proof_data.d.ts +3 -3
  267. package/dest/rollup/avm_proof_data.d.ts.map +1 -1
  268. package/dest/rollup/checkpoint_header.d.ts +8 -3
  269. package/dest/rollup/checkpoint_header.d.ts.map +1 -1
  270. package/dest/rollup/checkpoint_header.js +20 -10
  271. package/dest/stats/stats.d.ts +2 -2
  272. package/dest/stats/stats.d.ts.map +1 -1
  273. package/dest/tests/factories.d.ts +1 -27
  274. package/dest/tests/factories.d.ts.map +1 -1
  275. package/dest/tests/factories.js +10 -45
  276. package/dest/tests/mocks.d.ts +1 -1
  277. package/dest/tests/mocks.d.ts.map +1 -1
  278. package/dest/tests/mocks.js +3 -2
  279. package/dest/timetable/budgets.d.ts +57 -0
  280. package/dest/timetable/budgets.d.ts.map +1 -0
  281. package/dest/timetable/budgets.js +56 -0
  282. package/dest/timetable/build_proposer_timetable.d.ts +21 -0
  283. package/dest/timetable/build_proposer_timetable.d.ts.map +1 -0
  284. package/dest/timetable/build_proposer_timetable.js +17 -0
  285. package/dest/timetable/consensus_timetable.d.ts +70 -0
  286. package/dest/timetable/consensus_timetable.d.ts.map +1 -0
  287. package/dest/timetable/consensus_timetable.js +89 -0
  288. package/dest/timetable/index.d.ts +5 -84
  289. package/dest/timetable/index.d.ts.map +1 -1
  290. package/dest/timetable/index.js +4 -209
  291. package/dest/timetable/proposer_timetable.d.ts +106 -0
  292. package/dest/timetable/proposer_timetable.d.ts.map +1 -0
  293. package/dest/timetable/proposer_timetable.js +132 -0
  294. package/dest/trees/nullifier_membership_witness.d.ts +5 -8
  295. package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
  296. package/dest/trees/nullifier_membership_witness.js +0 -9
  297. package/dest/trees/public_data_witness.d.ts +7 -17
  298. package/dest/trees/public_data_witness.d.ts.map +1 -1
  299. package/dest/trees/public_data_witness.js +0 -27
  300. package/dest/tx/execution_payload.d.ts +1 -1
  301. package/dest/tx/execution_payload.d.ts.map +1 -1
  302. package/dest/tx/execution_payload.js +1 -1
  303. package/dest/tx/fee_provider.d.ts +2 -2
  304. package/dest/tx/fee_provider.d.ts.map +1 -1
  305. package/dest/tx/global_variable_builder.d.ts +2 -12
  306. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  307. package/dest/tx/global_variables.js +2 -2
  308. package/dest/tx/index.d.ts +1 -2
  309. package/dest/tx/index.d.ts.map +1 -1
  310. package/dest/tx/index.js +0 -1
  311. package/dest/tx/private_tx_constant_data.d.ts +18 -2
  312. package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
  313. package/dest/tx/private_tx_constant_data.js +13 -4
  314. package/dest/tx/profiling.d.ts +1 -1
  315. package/dest/tx/profiling.d.ts.map +1 -1
  316. package/dest/tx/profiling.js +2 -0
  317. package/dest/tx/simulated_tx.d.ts +10 -6
  318. package/dest/tx/simulated_tx.d.ts.map +1 -1
  319. package/dest/tx/tx.d.ts +9 -1
  320. package/dest/tx/tx.d.ts.map +1 -1
  321. package/dest/tx/tx.js +15 -0
  322. package/dest/tx/validator/error_texts.d.ts +2 -2
  323. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  324. package/dest/tx/validator/error_texts.js +1 -1
  325. package/dest/world-state/world_state_revision.d.ts +1 -18
  326. package/dest/world-state/world_state_revision.d.ts.map +1 -1
  327. package/dest/world-state/world_state_revision.js +0 -20
  328. package/package.json +8 -8
  329. package/src/abi/buffer.ts +13 -1
  330. package/src/avm/avm.ts +1 -1
  331. package/src/avm/index.ts +0 -5
  332. package/src/aztec-address/index.ts +36 -6
  333. package/src/block/attestation_info.ts +7 -2
  334. package/src/block/l2_block_source.ts +67 -13
  335. package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
  336. package/src/block/l2_block_stream/index.ts +1 -0
  337. package/src/block/l2_block_stream/interfaces.ts +96 -10
  338. package/src/block/l2_block_stream/l2_block_stream.ts +216 -175
  339. package/src/block/l2_block_stream/l2_tips_memory_store.ts +12 -41
  340. package/src/block/l2_block_stream/l2_tips_store_base.ts +84 -93
  341. package/src/block/proposal/attestations_and_signers.ts +53 -7
  342. package/src/block/test/l2_tips_store_test_suite.ts +270 -28
  343. package/src/block/validate_block_result.ts +48 -2
  344. package/src/checkpoint/checkpoint.ts +2 -2
  345. package/src/checkpoint/index.ts +1 -0
  346. package/src/checkpoint/simulation_overrides.ts +171 -0
  347. package/src/checkpoint/validate.ts +16 -6
  348. package/src/config/index.ts +1 -0
  349. package/src/config/network-consensus-config.ts +291 -0
  350. package/src/config/sequencer-config.ts +36 -5
  351. package/src/contract/contract_address.ts +4 -3
  352. package/src/contract/contract_class.ts +3 -2
  353. package/src/contract/contract_instance.ts +62 -1
  354. package/src/contract/index.ts +0 -1
  355. package/src/contract/interfaces/contract_data_source.ts +2 -4
  356. package/src/contract/interfaces/contract_instance.ts +26 -8
  357. package/src/contract/interfaces/node-info.ts +11 -0
  358. package/src/contract/partial_address.ts +8 -2
  359. package/src/database-version/version_manager.ts +96 -6
  360. package/src/deserialization/index.ts +35 -2
  361. package/src/file-store/factory.ts +7 -0
  362. package/src/file-store/index.ts +1 -0
  363. package/src/file-store/memory.ts +94 -0
  364. package/src/gas/README.md +92 -0
  365. package/src/gas/gas_settings.ts +11 -21
  366. package/src/gas/index.ts +1 -0
  367. package/src/gas/tx_gas_limits.ts +123 -0
  368. package/src/ha-signing/config.ts +23 -5
  369. package/src/ha-signing/local_config.ts +20 -1
  370. package/src/interfaces/archiver.ts +8 -9
  371. package/src/interfaces/aztec-node-admin.ts +1 -1
  372. package/src/interfaces/aztec-node-debug.ts +54 -2
  373. package/src/interfaces/aztec-node.ts +121 -43
  374. package/src/interfaces/block-builder.ts +2 -0
  375. package/src/interfaces/chain_tips.ts +8 -16
  376. package/src/interfaces/checkpoint_parameter.ts +3 -3
  377. package/src/interfaces/client.ts +1 -0
  378. package/src/interfaces/configs.ts +27 -6
  379. package/src/interfaces/get_tx_by_hash_options.ts +14 -0
  380. package/src/interfaces/merkle_tree_operations.ts +8 -2
  381. package/src/interfaces/p2p.ts +29 -9
  382. package/src/interfaces/private_kernel_prover.ts +104 -13
  383. package/src/interfaces/prover-client.ts +1 -3
  384. package/src/interfaces/prover-node.ts +32 -17
  385. package/src/interfaces/proving-job.ts +3 -3
  386. package/src/interfaces/server.ts +0 -2
  387. package/src/interfaces/server_circuit_prover.ts +2 -2
  388. package/src/interfaces/validator.ts +11 -0
  389. package/src/interfaces/world_state.ts +14 -0
  390. package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
  391. package/src/kernel/hints/index.ts +0 -1
  392. package/src/kernel/hints/read_request.ts +1 -1
  393. package/src/kernel/index.ts +5 -1
  394. package/src/kernel/log_hash.ts +5 -2
  395. package/src/kernel/note_hash.ts +1 -1
  396. package/src/kernel/nullifier.ts +1 -1
  397. package/src/kernel/private_circuit_public_inputs.ts +12 -1
  398. package/src/kernel/private_context_inputs.ts +10 -3
  399. package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -7
  400. package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +0 -3
  401. package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +0 -3
  402. package/src/kernel/private_kernel_init_4_circuit_private_inputs.ts +52 -0
  403. package/src/kernel/private_kernel_init_5_circuit_private_inputs.ts +55 -0
  404. package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
  405. package/src/kernel/private_kernel_inner_4_circuit_private_inputs.ts +39 -0
  406. package/src/kernel/private_kernel_inner_5_circuit_private_inputs.ts +42 -0
  407. package/src/kernel/private_kernel_prover_output.ts +4 -0
  408. package/src/kernel/private_kernel_reset_dimensions.ts +15 -5
  409. package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
  410. package/src/kernel/private_kernel_simulated_output.ts +0 -7
  411. package/src/kernel/private_log_data.ts +4 -1
  412. package/src/kernel/utils/index.ts +0 -1
  413. package/src/keys/derivation.ts +71 -21
  414. package/src/logs/app_tagging_secret.ts +56 -24
  415. package/src/logs/app_tagging_secret_kind.ts +1 -1
  416. package/src/logs/contract_class_log.ts +0 -9
  417. package/src/logs/message_context.ts +7 -65
  418. package/src/logs/pending_tagged_log.ts +6 -33
  419. package/src/logs/shared_secret_derivation.ts +31 -15
  420. package/src/p2p/attestation_utils.ts +8 -1
  421. package/src/p2p/checkpoint_attestation.ts +12 -0
  422. package/src/p2p/index.ts +0 -1
  423. package/src/p2p/signature_utils.ts +9 -0
  424. package/src/rollup/avm_proof_data.ts +2 -2
  425. package/src/rollup/checkpoint_header.ts +16 -2
  426. package/src/stats/stats.ts +6 -2
  427. package/src/tests/factories.ts +13 -51
  428. package/src/tests/mocks.ts +7 -2
  429. package/src/timetable/README.md +609 -0
  430. package/src/timetable/budgets.ts +87 -0
  431. package/src/timetable/build_proposer_timetable.ts +42 -0
  432. package/src/timetable/consensus_timetable.ts +126 -0
  433. package/src/timetable/index.ts +4 -304
  434. package/src/timetable/proposer_timetable.ts +190 -0
  435. package/src/timetable/timetable-example.svg +108 -0
  436. package/src/trees/nullifier_membership_witness.ts +0 -11
  437. package/src/trees/public_data_witness.ts +0 -31
  438. package/src/tx/execution_payload.ts +2 -1
  439. package/src/tx/fee_provider.ts +1 -1
  440. package/src/tx/global_variable_builder.ts +1 -17
  441. package/src/tx/global_variables.ts +2 -2
  442. package/src/tx/index.ts +0 -1
  443. package/src/tx/private_tx_constant_data.ts +25 -2
  444. package/src/tx/profiling.ts +2 -0
  445. package/src/tx/tx.ts +17 -0
  446. package/src/tx/validator/error_texts.ts +2 -1
  447. package/src/world-state/world_state_revision.ts +0 -33
  448. package/dest/avm/contract_storage_read.d.ts +0 -58
  449. package/dest/avm/contract_storage_read.d.ts.map +0 -1
  450. package/dest/avm/contract_storage_read.js +0 -65
  451. package/dest/avm/contract_storage_update_request.d.ts +0 -65
  452. package/dest/avm/contract_storage_update_request.d.ts.map +0 -1
  453. package/dest/avm/contract_storage_update_request.js +0 -80
  454. package/dest/avm/public_call_stack_item_compressed.d.ts +0 -43
  455. package/dest/avm/public_call_stack_item_compressed.d.ts.map +0 -1
  456. package/dest/avm/public_call_stack_item_compressed.js +0 -70
  457. package/dest/avm/public_data_update_request.d.ts +0 -62
  458. package/dest/avm/public_data_update_request.d.ts.map +0 -1
  459. package/dest/avm/public_data_update_request.js +0 -67
  460. package/dest/avm/public_inner_call_request.d.ts +0 -50
  461. package/dest/avm/public_inner_call_request.d.ts.map +0 -1
  462. package/dest/avm/public_inner_call_request.js +0 -74
  463. package/dest/contract/deployment_info.d.ts +0 -24
  464. package/dest/contract/deployment_info.d.ts.map +0 -1
  465. package/dest/contract/deployment_info.js +0 -3
  466. package/dest/interfaces/epoch-prover.d.ts +0 -57
  467. package/dest/interfaces/epoch-prover.d.ts.map +0 -1
  468. package/dest/interfaces/epoch-prover.js +0 -1
  469. package/dest/interfaces/prover-coordination.d.ts +0 -15
  470. package/dest/interfaces/prover-coordination.d.ts.map +0 -1
  471. package/dest/interfaces/prover-coordination.js +0 -1
  472. package/dest/kernel/hints/tree_leaf_read_request.d.ts +0 -14
  473. package/dest/kernel/hints/tree_leaf_read_request.d.ts.map +0 -1
  474. package/dest/kernel/hints/tree_leaf_read_request.js +0 -33
  475. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
  476. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
  477. package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
  478. package/dest/kernel/utils/optional_number.d.ts +0 -31
  479. package/dest/kernel/utils/optional_number.d.ts.map +0 -1
  480. package/dest/kernel/utils/optional_number.js +0 -42
  481. package/dest/p2p/interface.d.ts +0 -5
  482. package/dest/p2p/interface.d.ts.map +0 -1
  483. package/dest/p2p/interface.js +0 -1
  484. package/dest/tx/validator/empty_validator.d.ts +0 -5
  485. package/dest/tx/validator/empty_validator.d.ts.map +0 -1
  486. package/dest/tx/validator/empty_validator.js +0 -7
  487. package/src/avm/contract_storage_read.ts +0 -77
  488. package/src/avm/contract_storage_update_request.ts +0 -93
  489. package/src/avm/public_call_stack_item_compressed.ts +0 -113
  490. package/src/avm/public_data_update_request.ts +0 -106
  491. package/src/avm/public_inner_call_request.ts +0 -85
  492. package/src/contract/deployment_info.ts +0 -25
  493. package/src/interfaces/epoch-prover.ts +0 -72
  494. package/src/interfaces/prover-coordination.ts +0 -17
  495. package/src/kernel/hints/tree_leaf_read_request.ts +0 -35
  496. package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
  497. package/src/kernel/utils/optional_number.ts +0 -50
  498. package/src/p2p/interface.ts +0 -4
  499. package/src/tx/validator/empty_validator.ts +0 -7
@@ -0,0 +1,171 @@
1
+ import {
2
+ type FeeHeader,
3
+ RollupContract,
4
+ SimulationOverridesBuilder,
5
+ type SimulationOverridesPlan,
6
+ } from '@aztec/ethereum/contracts';
7
+ import { CheckpointNumber } from '@aztec/foundation/branded-types';
8
+ import type { Logger } from '@aztec/foundation/log';
9
+
10
+ import type { CoordinationSignatureContext } from '../p2p/signature_utils.js';
11
+ import type { ProposedCheckpointData } from './checkpoint_data.js';
12
+ import { computeCheckpointPayloadDigest } from './digest.js';
13
+
14
+ type CheckpointSimulationOverridesPlanInput = {
15
+ /** Target rollup contract. */
16
+ rollup: RollupContract;
17
+ /** Checkpoint number to be proposed. */
18
+ checkpointNumber: CheckpointNumber;
19
+ /** Logger instance. */
20
+ log: Logger;
21
+ /**
22
+ * The proposed parent checkpoint when pipelining. Its `checkpointNumber` must equal
23
+ * `checkpointNumber - 1`; the helper enforces this. Mutually exclusive with
24
+ * `invalidateToPendingCheckpointNumber`.
25
+ */
26
+ proposedCheckpointData?: ProposedCheckpointData;
27
+ /**
28
+ * The pending checkpoint number we'll end up at after invalidation lands. Mutually exclusive
29
+ * with `proposedCheckpointData`.
30
+ */
31
+ invalidateToPendingCheckpointNumber?: CheckpointNumber;
32
+ /**
33
+ * The real on-chain pending checkpoint number (typically `syncedTo.checkpointedCheckpointNumber`).
34
+ * Used as the snapshot we pin both `pending` and `proven` to avoid prunes in simulation.
35
+ */
36
+ checkpointedCheckpointNumber: CheckpointNumber;
37
+ /**
38
+ * Chain-level consensus signature context. Used to recompute the parent's `payloadDigest` for the
39
+ * pipelined simulation override so it matches what `propose` will write into `tempCheckpointLogs[parent]`
40
+ * once the parent lands.
41
+ */
42
+ signatureContext: CoordinationSignatureContext;
43
+ };
44
+
45
+ /**
46
+ * Builds the SimulationOverridesPlan describing the simulated L1 rollup state for a checkpoint's
47
+ * enqueue-time simulations: `canProposeAt` (in Sequencer.doWork) and the propose-related sims
48
+ * (validateBlockHeader, simulateProposeTx). The plan reflects "as if our pipelined parent
49
+ * checkpoint has landed and any required invalidation has executed" — the gap that needs to be
50
+ * bridged at enqueue time.
51
+ *
52
+ * Pipelining (`proposedCheckpointData`) and invalidation (`invalidateToPendingCheckpointNumber`)
53
+ * are mutually exclusive; passing both throws.
54
+ */
55
+ export async function buildCheckpointSimulationOverridesPlan(
56
+ input: CheckpointSimulationOverridesPlanInput,
57
+ ): Promise<SimulationOverridesPlan | undefined> {
58
+ if (input.proposedCheckpointData && input.invalidateToPendingCheckpointNumber !== undefined) {
59
+ throw new Error(
60
+ 'Error in buildCheckpointSimulationOverridesPlan: proposedCheckpointData and invalidateToPendingCheckpointNumber are mutually exclusive',
61
+ );
62
+ }
63
+
64
+ const builder = new SimulationOverridesBuilder();
65
+ const pendingCheckpointNumber = derivePendingCheckpointNumber(input);
66
+
67
+ // Override the latest checkpoint number when invalidating or pipelining, so our checkpoint
68
+ // follows from it. We also override the proven chain tip so we dont need to worry about
69
+ // prunes kicking in that would break out simulation if there's a prune pending. We always
70
+ // assume that a proof will land in time. If we don't have a pending checkpoint number to force,
71
+ // we still set both tips to the current checkpoint number to avoid the prune trigger.
72
+ const overridenChainTip = pendingCheckpointNumber ?? input.checkpointedCheckpointNumber;
73
+ builder.withChainTips({ pending: overridenChainTip, proven: overridenChainTip });
74
+
75
+ if (input.proposedCheckpointData) {
76
+ const { header, archive, checkpointOutHash, feeAssetPriceModifier } = input.proposedCheckpointData;
77
+ builder.withPendingArchive(archive.root);
78
+ // Override every locally-derivable `tempCheckpointLogs[parent]` field that L1 will eventually
79
+ // write. `slotNumber` is load-bearing for `STFLib.canPruneAtTime`: without it the cell reads
80
+ // slotNumber 0, the contract treats the pending tip as belonging to an expired epoch, and
81
+ // `getEffectivePendingCheckpointNumber` silently collapses pending back to proven — producing
82
+ // a spurious `Rollup__InvalidArchive` against the on-chain genesis archive. The other fields
83
+ // (headerHash, outHash, payloadDigest) are not strictly load-bearing for `canProposeAt` /
84
+ // `validateBlockHeader`, but mirroring the full cell keeps the simulation byte-faithful with
85
+ // what the actual `propose()` send will observe, which is a defense against future reads
86
+ // taking dependencies on them.
87
+ builder.withPendingTempCheckpointLogFields({
88
+ headerHash: header.hash(),
89
+ outHash: checkpointOutHash,
90
+ slotNumber: header.slotNumber,
91
+ payloadDigest: computeCheckpointPayloadDigest({
92
+ header,
93
+ archiveRoot: archive.root,
94
+ feeAssetPriceModifier,
95
+ signatureContext: input.signatureContext,
96
+ }),
97
+ });
98
+
99
+ const feeHeader = await computePipelinedParentFeeHeader({
100
+ checkpointNumber: input.checkpointNumber,
101
+ proposedCheckpointData: input.proposedCheckpointData,
102
+ rollup: input.rollup,
103
+ log: input.log,
104
+ });
105
+ if (feeHeader) {
106
+ builder.withPendingFeeHeader(feeHeader);
107
+ }
108
+ }
109
+
110
+ return builder.build();
111
+ }
112
+
113
+ function derivePendingCheckpointNumber(input: CheckpointSimulationOverridesPlanInput): CheckpointNumber | undefined {
114
+ if (input.invalidateToPendingCheckpointNumber !== undefined) {
115
+ return input.invalidateToPendingCheckpointNumber;
116
+ }
117
+ if (!input.proposedCheckpointData) {
118
+ return undefined;
119
+ }
120
+ if (input.checkpointNumber < 1) {
121
+ throw new Error(`Cannot build simulation override for checkpoint ${input.checkpointNumber}: no parent exists`);
122
+ }
123
+ const expectedParent = CheckpointNumber(input.checkpointNumber - 1);
124
+ if (input.proposedCheckpointData.checkpointNumber !== expectedParent) {
125
+ throw new Error(
126
+ `Cannot build simulation override for checkpoint ${input.checkpointNumber}: proposedCheckpointData.checkpointNumber (${input.proposedCheckpointData.checkpointNumber}) does not match expected parent ${expectedParent}`,
127
+ );
128
+ }
129
+ return expectedParent;
130
+ }
131
+
132
+ type PipelinedParentFeeHeaderInput = {
133
+ checkpointNumber: CheckpointNumber;
134
+ proposedCheckpointData: ProposedCheckpointData;
135
+ rollup: RollupContract;
136
+ log: Logger;
137
+ };
138
+
139
+ /**
140
+ * Derives the pending parent fee header used during pipelined proposal simulation. Returns
141
+ * `undefined` only when no grandparent exists (i.e. the proposed parent is the genesis
142
+ * checkpoint); all other failure modes (missing grandparent state, missing fee header, RPC
143
+ * errors) throw so callers don't silently desync the fee-header override.
144
+ */
145
+ export async function computePipelinedParentFeeHeader(
146
+ input: PipelinedParentFeeHeaderInput,
147
+ ): Promise<FeeHeader | undefined> {
148
+ if (input.checkpointNumber < 2) {
149
+ return undefined;
150
+ }
151
+
152
+ const grandparentCheckpointNumber = CheckpointNumber(input.checkpointNumber - 2);
153
+
154
+ const [grandparentCheckpoint, manaTarget] = await Promise.all([
155
+ input.rollup.getCheckpoint(grandparentCheckpointNumber),
156
+ input.rollup.getManaTarget(),
157
+ ]);
158
+
159
+ if (!grandparentCheckpoint?.feeHeader) {
160
+ throw new Error(
161
+ `Grandparent checkpoint or feeHeader missing for checkpoint ${grandparentCheckpointNumber.toString()}`,
162
+ );
163
+ }
164
+
165
+ return RollupContract.computeChildFeeHeader(
166
+ grandparentCheckpoint.feeHeader,
167
+ input.proposedCheckpointData.totalManaUsed,
168
+ input.proposedCheckpointData.feeAssetPriceModifier,
169
+ manaTarget,
170
+ );
171
+ }
@@ -2,7 +2,7 @@ import { BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB, MAX_PROCESSABLE_DA_GAS_PER_CHECK
2
2
  import type { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
3
3
  import { sum } from '@aztec/foundation/collection';
4
4
 
5
- import { MAX_BLOCKS_PER_CHECKPOINT } from '../deserialization/index.js';
5
+ import { MAX_ATTESTABLE_BLOCKS_PER_CHECKPOINT } from '../deserialization/index.js';
6
6
  import type { Checkpoint } from './checkpoint.js';
7
7
 
8
8
  export class CheckpointValidationError extends Error {
@@ -32,9 +32,15 @@ export function validateCheckpoint(
32
32
  maxDABlockGas?: number;
33
33
  maxTxsPerCheckpoint?: number;
34
34
  maxTxsPerBlock?: number;
35
+ /**
36
+ * Max blocks per checkpoint. Defaults to {@link MAX_ATTESTABLE_BLOCKS_PER_CHECKPOINT}; the L1-sync
37
+ * ingest path passes `MAX_CAPACITY_BLOCKS_PER_CHECKPOINT` to tolerate larger checkpoints already
38
+ * accepted by L1.
39
+ */
40
+ maxBlocksPerCheckpoint?: number;
35
41
  },
36
42
  ): void {
37
- validateCheckpointStructure(checkpoint);
43
+ validateCheckpointStructure(checkpoint, { maxBlocksPerCheckpoint: opts.maxBlocksPerCheckpoint });
38
44
  validateCheckpointLimits(checkpoint, opts);
39
45
  validateCheckpointBlocksLimits(checkpoint, opts);
40
46
  }
@@ -42,7 +48,7 @@ export function validateCheckpoint(
42
48
  /**
43
49
  * Validates structural integrity of a checkpoint.
44
50
  * - Non-empty block list
45
- * - Block count within MAX_BLOCKS_PER_CHECKPOINT
51
+ * - Block count within `maxBlocksPerCheckpoint` (default {@link MAX_ATTESTABLE_BLOCKS_PER_CHECKPOINT})
46
52
  * - Checkpoint slot matches the first block's slot
47
53
  * - Checkpoint lastArchiveRoot matches the first block's lastArchive root
48
54
  * - Sequential block numbers without gaps
@@ -51,16 +57,20 @@ export function validateCheckpoint(
51
57
  * - Consistent slot number across all blocks
52
58
  * - Global variables (slot, timestamp, coinbase, feeRecipient, gasFees) match checkpoint header for each block
53
59
  */
54
- export function validateCheckpointStructure(checkpoint: Checkpoint): void {
60
+ export function validateCheckpointStructure(
61
+ checkpoint: Checkpoint,
62
+ opts: { maxBlocksPerCheckpoint?: number } = {},
63
+ ): void {
64
+ const { maxBlocksPerCheckpoint = MAX_ATTESTABLE_BLOCKS_PER_CHECKPOINT } = opts;
55
65
  const { blocks, number, slot } = checkpoint;
56
66
 
57
67
  if (blocks.length === 0) {
58
68
  throw new CheckpointValidationError('Checkpoint has no blocks', number, slot);
59
69
  }
60
70
 
61
- if (blocks.length > MAX_BLOCKS_PER_CHECKPOINT) {
71
+ if (blocks.length > maxBlocksPerCheckpoint) {
62
72
  throw new CheckpointValidationError(
63
- `Checkpoint has ${blocks.length} blocks, exceeding limit of ${MAX_BLOCKS_PER_CHECKPOINT}`,
73
+ `Checkpoint has ${blocks.length} blocks, exceeding limit of ${maxBlocksPerCheckpoint}`,
64
74
  number,
65
75
  slot,
66
76
  );
@@ -1,3 +1,4 @@
1
1
  export * from './chain-config.js';
2
+ export * from './network-consensus-config.js';
2
3
  export * from './node-rpc-config.js';
3
4
  export * from './sequencer-config.js';
@@ -0,0 +1,291 @@
1
+ import { type L1ContractsConfig, l1ContractsConfigMappings, validateSlotDurations } from '@aztec/ethereum/config';
2
+ import { type EnvVar, pickConfigMappings } from '@aztec/foundation/config';
3
+
4
+ import type { SequencerConfig } from '../interfaces/configs.js';
5
+ import {
6
+ DEFAULT_CHECKPOINT_PROPOSAL_INIT_TIME,
7
+ DEFAULT_CHECKPOINT_PROPOSAL_PREPARE_TIME,
8
+ DEFAULT_MIN_BLOCK_DURATION,
9
+ DEFAULT_P2P_PROPAGATION_TIME,
10
+ } from '../timetable/budgets.js';
11
+ import { ProposerTimetable } from '../timetable/proposer_timetable.js';
12
+ import { sharedSequencerConfigMappings } from './sequencer-config.js';
13
+
14
+ /**
15
+ * Environment variables whose values must be identical across every node of a network. They fall into three
16
+ * categories, all consensus-critical:
17
+ *
18
+ * - Timing/protocol consensus: slot and epoch durations, block sub-slot duration, max blocks per checkpoint, and
19
+ * the checkpoint-proposal materialization grace. Proposers and validators must agree on these to land on the
20
+ * same proposed chain and the same checkpoint-proposal receive/handoff deadlines.
21
+ * - Network identity and L1-posted deployment params: the L1 chain id and the staking/governance/slashing
22
+ * parameters baked into the deployed rollup contract (committee size, lags, thresholds, mana target, fee
23
+ * pricing, governance/slashing round sizes, quorums, slash amounts, etc.). A node disagreeing with the rollup
24
+ * it points at would compute the wrong epoch geometry, fees, or slashing rounds.
25
+ * - Node-side slashing offense consensus: the offense detection/penalty parameters validators apply locally to
26
+ * decide which payloads to sign. Validators must agree on these to reach the on-chain slashing quorum.
27
+ *
28
+ * Deliberately excluded: bootnodes, P2P/store/OTEL/sentinel settings, SEQ_MIN_TX_PER_BLOCK, SEQ_MAX_TX_PER_*,
29
+ * AZTEC_SLASHER_ENABLED, PROVER_REAL_PROOFS, TRANSACTIONS_DISABLED, and AZTEC_ENTRY_QUEUE_* (mainnet-only genesis
30
+ * params enforced by L1).
31
+ */
32
+ export const NETWORK_CONSENSUS_ENV_VARS = [
33
+ // Timing/protocol consensus.
34
+ 'ETHEREUM_SLOT_DURATION',
35
+ 'AZTEC_SLOT_DURATION',
36
+ 'AZTEC_EPOCH_DURATION',
37
+ 'SEQ_BLOCK_DURATION_MS',
38
+ 'MAX_BLOCKS_PER_CHECKPOINT',
39
+ 'CHECKPOINT_PROPOSAL_SYNC_GRACE_SECONDS',
40
+
41
+ // Network identity / L1-posted deployment params.
42
+ 'L1_CHAIN_ID',
43
+ 'AZTEC_TARGET_COMMITTEE_SIZE',
44
+ 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
45
+ 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
46
+ 'AZTEC_ACTIVATION_THRESHOLD',
47
+ 'AZTEC_EJECTION_THRESHOLD',
48
+ 'AZTEC_LOCAL_EJECTION_THRESHOLD',
49
+ 'AZTEC_EXIT_DELAY_SECONDS',
50
+ 'AZTEC_INBOX_LAG',
51
+ 'AZTEC_PROOF_SUBMISSION_EPOCHS',
52
+ 'AZTEC_MANA_TARGET',
53
+ 'AZTEC_PROVING_COST_PER_MANA',
54
+ 'AZTEC_INITIAL_ETH_PER_FEE_ASSET',
55
+ 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE',
56
+ 'AZTEC_GOVERNANCE_PROPOSER_QUORUM',
57
+ 'AZTEC_SLASHING_QUORUM',
58
+ 'AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS',
59
+ 'AZTEC_SLASHING_LIFETIME_IN_ROUNDS',
60
+ 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
61
+ 'AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS',
62
+ 'AZTEC_SLASHING_VETOER',
63
+ 'AZTEC_SLASHING_DISABLE_DURATION',
64
+ 'AZTEC_SLASH_AMOUNT_SMALL',
65
+ 'AZTEC_SLASH_AMOUNT_MEDIUM',
66
+ 'AZTEC_SLASH_AMOUNT_LARGE',
67
+
68
+ // Node-side slashing offense consensus.
69
+ 'SLASH_OFFENSE_EXPIRATION_ROUNDS',
70
+ 'SLASH_MAX_PAYLOAD_SIZE',
71
+ 'SLASH_EXECUTE_ROUNDS_LOOK_BACK',
72
+ 'SLASH_DATA_WITHHOLDING_TOLERANCE_SLOTS',
73
+ 'SLASH_DATA_WITHHOLDING_PENALTY',
74
+ 'SLASH_INACTIVITY_TARGET_PERCENTAGE',
75
+ 'SLASH_INACTIVITY_CONSECUTIVE_EPOCH_THRESHOLD',
76
+ 'SLASH_INACTIVITY_PENALTY',
77
+ 'SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY',
78
+ 'SLASH_DUPLICATE_PROPOSAL_PENALTY',
79
+ 'SLASH_DUPLICATE_ATTESTATION_PENALTY',
80
+ 'SLASH_PROPOSE_DESCENDANT_OF_CHECKPOINT_WITH_INVALID_ATTESTATIONS_PENALTY',
81
+ 'SLASH_ATTEST_INVALID_CHECKPOINT_PROPOSAL_PENALTY',
82
+ 'SLASH_UNKNOWN_PENALTY',
83
+ 'SLASH_INVALID_BLOCK_PENALTY',
84
+ 'SLASH_INVALID_CHECKPOINT_PROPOSAL_PENALTY',
85
+ 'SLASH_GRACE_PERIOD_L2_SLOTS',
86
+ ] as const satisfies readonly EnvVar[];
87
+
88
+ /** A consensus-critical environment variable name; see {@link NETWORK_CONSENSUS_ENV_VARS}. */
89
+ export type ConsensusEnvVar = (typeof NETWORK_CONSENSUS_ENV_VARS)[number];
90
+
91
+ /**
92
+ * The subset of consensus-critical timing config whose geometry can be validated in isolation. Composed by
93
+ * picking the canonical fields from their owning config types so the field set never drifts from the config
94
+ * layer: slot durations from {@link L1ContractsConfig}, block sub-slot/checkpoint timings from
95
+ * {@link SequencerConfig} (whose fields are optional there, hence `Required`).
96
+ */
97
+ export type NetworkConsensusConfig = Pick<L1ContractsConfig, 'aztecSlotDuration' | 'ethereumSlotDuration'> &
98
+ Required<Pick<SequencerConfig, 'blockDurationMs' | 'maxBlocksPerCheckpoint' | 'checkpointProposalSyncGraceSeconds'>>;
99
+
100
+ /** Config mappings for the slot-timing fields of {@link NetworkConsensusConfig}, picked from their owners. */
101
+ const networkConsensusConfigMappings = {
102
+ ...pickConfigMappings(l1ContractsConfigMappings, ['aztecSlotDuration', 'ethereumSlotDuration']),
103
+ ...pickConfigMappings(sharedSequencerConfigMappings, [
104
+ 'blockDurationMs',
105
+ 'maxBlocksPerCheckpoint',
106
+ 'checkpointProposalSyncGraceSeconds',
107
+ ]),
108
+ };
109
+
110
+ /**
111
+ * Extracts the timing {@link NetworkConsensusConfig} from a generated network config object. The env-var names
112
+ * and the per-field parsing both come from the canonical config mappings (`l1ContractsConfigMappings` and
113
+ * `sharedSequencerConfigMappings`), so each field is parsed exactly as the node's config layer would parse it.
114
+ * A field whose env var is absent becomes `NaN`, which {@link validateNetworkConsensusConfig} reports as an
115
+ * error. Never throws: parse helpers that would throw or yield `undefined` are coerced to `NaN`.
116
+ */
117
+ export function getConsensusConfigFromNetworkEnv(
118
+ values: Record<string, string | number | boolean>,
119
+ ): NetworkConsensusConfig {
120
+ const result = {} as Record<keyof NetworkConsensusConfig, number>;
121
+ for (const [field, mapping] of Object.entries(networkConsensusConfigMappings)) {
122
+ const raw = mapping.env !== undefined ? values[mapping.env] : undefined;
123
+ if (raw === undefined) {
124
+ result[field as keyof NetworkConsensusConfig] = NaN;
125
+ continue;
126
+ }
127
+ let parsed: number | undefined;
128
+ try {
129
+ parsed = mapping.parseEnv ? mapping.parseEnv(String(raw)) : Number(raw);
130
+ } catch {
131
+ parsed = NaN;
132
+ }
133
+ result[field as keyof NetworkConsensusConfig] = parsed ?? NaN;
134
+ }
135
+ return result;
136
+ }
137
+
138
+ /**
139
+ * Validates a {@link NetworkConsensusConfig} for self-consistency, returning a list of error messages (empty
140
+ * when valid). Used by the cli unit test that gates the generated network configs.
141
+ *
142
+ * The check requires `maxBlocksPerCheckpoint` to be *exactly* what a {@link ProposerTimetable} built from the
143
+ * same slot timings and the production default budgets derives. This exact-equality requirement ensures the
144
+ * published network value is precisely what the production default budgets produce, so every node running those
145
+ * defaults agrees on the per-checkpoint block count without clamping.
146
+ */
147
+ export function validateNetworkConsensusConfig(config: NetworkConsensusConfig): string[] {
148
+ const errors: string[] = [];
149
+
150
+ for (const [field, value] of Object.entries(config)) {
151
+ if (typeof value !== 'number' || !Number.isFinite(value)) {
152
+ errors.push(`${field} must be a finite number (got ${value})`);
153
+ }
154
+ }
155
+ if (errors.length > 0) {
156
+ return errors;
157
+ }
158
+
159
+ errors.push(...validateSlotDurations(config));
160
+ if (config.blockDurationMs <= 0) {
161
+ errors.push(`blockDurationMs must be positive (got ${config.blockDurationMs})`);
162
+ }
163
+ if (config.blockDurationMs / 1000 > config.aztecSlotDuration) {
164
+ errors.push(
165
+ `blockDurationMs (${config.blockDurationMs}ms) exceeds aztecSlotDuration (${config.aztecSlotDuration}s)`,
166
+ );
167
+ }
168
+ if (config.maxBlocksPerCheckpoint < 1) {
169
+ errors.push(`maxBlocksPerCheckpoint must be at least 1 (got ${config.maxBlocksPerCheckpoint})`);
170
+ }
171
+ if (config.checkpointProposalSyncGraceSeconds < 0) {
172
+ errors.push(
173
+ `checkpointProposalSyncGraceSeconds must be non-negative (got ${config.checkpointProposalSyncGraceSeconds})`,
174
+ );
175
+ }
176
+ if (errors.length > 0) {
177
+ return errors;
178
+ }
179
+
180
+ let computed: number;
181
+ try {
182
+ computed = new ProposerTimetable({
183
+ l1Constants: {
184
+ l1GenesisTime: 0n,
185
+ slotDuration: config.aztecSlotDuration,
186
+ ethereumSlotDuration: config.ethereumSlotDuration,
187
+ },
188
+ blockDuration: config.blockDurationMs / 1000,
189
+ minBlockDuration: DEFAULT_MIN_BLOCK_DURATION,
190
+ p2pPropagationTime: DEFAULT_P2P_PROPAGATION_TIME,
191
+ checkpointProposalPrepareTime: DEFAULT_CHECKPOINT_PROPOSAL_PREPARE_TIME,
192
+ checkpointProposalInitTime: DEFAULT_CHECKPOINT_PROPOSAL_INIT_TIME,
193
+ checkpointProposalSyncGrace: config.checkpointProposalSyncGraceSeconds,
194
+ }).getMaxBlocksPerCheckpoint();
195
+ } catch (err) {
196
+ // The timetable constructor throws when not even one block fits the default budgets; report instead.
197
+ errors.push(
198
+ `maxBlocksPerCheckpoint (${config.maxBlocksPerCheckpoint}) cannot be achieved: the default operational ` +
199
+ `budgets fit fewer than one block for slot duration ${config.aztecSlotDuration}s and block duration ` +
200
+ `${config.blockDurationMs / 1000}s (${err instanceof Error ? err.message : String(err)})`,
201
+ );
202
+ return errors;
203
+ }
204
+
205
+ if (computed !== config.maxBlocksPerCheckpoint) {
206
+ errors.push(
207
+ `maxBlocksPerCheckpoint (${config.maxBlocksPerCheckpoint}) does not match the ${computed} blocks the ` +
208
+ `production default budgets derive for slot duration ${config.aztecSlotDuration}s and block duration ` +
209
+ `${config.blockDurationMs / 1000}s`,
210
+ );
211
+ }
212
+
213
+ return errors;
214
+ }
215
+
216
+ /**
217
+ * Enforces that operators do not silently override consensus-critical values diverging from the network config.
218
+ *
219
+ * For each var in {@link NETWORK_CONSENSUS_ENV_VARS} present in `networkConfig`: if the operator set it in `env`
220
+ * to a conflicting value, this throws unless `ALLOW_OVERRIDING_NETWORK_CONFIG` is truthy (in which case it logs
221
+ * and keeps the operator value).
222
+ *
223
+ * This function is pure: it never writes to `env`. Instead it returns the canonical env writes the caller
224
+ * should apply — a map of env-var name to canonical string value for every numeric var whose env value matched
225
+ * the network value numerically. Applying these closes a bypass where the config layer parses some vars with
226
+ * `parseInt` (which reads '6e3' as 6); rewriting them to the network value's string form keeps the operator's
227
+ * numerically-equal value but in canonical form. Vars kept under `ALLOW_OVERRIDING_NETWORK_CONFIG` (genuine
228
+ * conflicts) are not included, so the operator value is preserved untouched.
229
+ *
230
+ * @returns Canonical env writes (env-var name -> canonical string value) for the caller to apply.
231
+ */
232
+ export function checkConsensusEnvOverrides(
233
+ networkConfig: Record<string, string | number | boolean>,
234
+ env: { [key: string]: string | undefined } = process.env,
235
+ log?: (msg: string) => void,
236
+ ): Record<string, string> {
237
+ const allowOverride = allowsNetworkConfigOverride(env);
238
+ const canonical: Record<string, string> = {};
239
+ const conflicts: string[] = [];
240
+
241
+ for (const envVar of NETWORK_CONSENSUS_ENV_VARS) {
242
+ const networkValue = networkConfig[envVar];
243
+ if (networkValue === undefined) {
244
+ continue;
245
+ }
246
+
247
+ const current = env[envVar];
248
+ if (current === undefined || current === '') {
249
+ continue;
250
+ }
251
+
252
+ const networkIsNumeric = typeof networkValue === 'number';
253
+ const matches = networkIsNumeric ? Number(current) === networkValue : current === String(networkValue);
254
+ if (matches) {
255
+ if (networkIsNumeric) {
256
+ canonical[envVar] = String(networkValue);
257
+ }
258
+ continue;
259
+ }
260
+
261
+ const conflict = `${envVar}=${current} conflicts with the network value ${networkValue}`;
262
+ if (allowOverride) {
263
+ log?.(
264
+ `Environment variable ${conflict}. Consensus-critical values must match across the network, but ` +
265
+ `ALLOW_OVERRIDING_NETWORK_CONFIG is set so the operator value is kept (only do this if you know what ` +
266
+ `you are doing).`,
267
+ );
268
+ continue;
269
+ }
270
+ conflicts.push(conflict);
271
+ }
272
+
273
+ // Accumulate every conflict so the operator sees all the env vars they need to reconcile at once, rather than
274
+ // fixing them one failed startup at a time.
275
+ if (conflicts.length > 0) {
276
+ throw new Error(
277
+ `Environment variables conflict with consensus-critical network values:\n` +
278
+ conflicts.map(c => ` - ${c}`).join('\n') +
279
+ `\nConsensus-critical values must match across the network. Set ALLOW_OVERRIDING_NETWORK_CONFIG=1 to ` +
280
+ `override (only do this if you know what you are doing).`,
281
+ );
282
+ }
283
+
284
+ return canonical;
285
+ }
286
+
287
+ /** Whether the env opts into overriding network-wide consensus values (`ALLOW_OVERRIDING_NETWORK_CONFIG`). */
288
+ export function allowsNetworkConfigOverride(env: { [key: string]: string | undefined } = process.env): boolean {
289
+ const value = env.ALLOW_OVERRIDING_NETWORK_CONFIG;
290
+ return value === '1' || value?.toLowerCase() === 'true';
291
+ }
@@ -6,7 +6,16 @@ import {
6
6
  } from '@aztec/foundation/config';
7
7
 
8
8
  import type { SequencerConfig } from '../interfaces/configs.js';
9
- import { DEFAULT_P2P_PROPAGATION_TIME } from '../timetable/index.js';
9
+ import {
10
+ DEFAULT_BLOCK_DURATION,
11
+ DEFAULT_CHECKPOINT_PROPOSAL_PREPARE_TIME,
12
+ DEFAULT_MIN_BLOCK_DURATION,
13
+ DEFAULT_P2P_PROPAGATION_TIME,
14
+ getDefaultCheckpointProposalSyncGrace,
15
+ } from '../timetable/index.js';
16
+
17
+ /** Default duration per block in milliseconds, used to derive how many blocks fit in a slot. */
18
+ export const DEFAULT_BLOCK_DURATION_MS = DEFAULT_BLOCK_DURATION * 1000;
10
19
 
11
20
  /** Default maximum number of transactions per block. */
12
21
  export const DEFAULT_MAX_TXS_PER_BLOCK = 32;
@@ -24,18 +33,19 @@ export const sharedSequencerConfigMappings: ConfigMappingsType<
24
33
  Pick<
25
34
  SequencerConfig,
26
35
  | 'blockDurationMs'
36
+ | 'checkpointProposalSyncGraceSeconds'
27
37
  | 'expectedBlockProposalsPerSlot'
28
38
  | 'maxTxsPerBlock'
29
39
  | 'attestationPropagationTime'
40
+ | 'checkpointProposalPrepareTime'
41
+ | 'minBlockDuration'
30
42
  | 'maxBlocksPerCheckpoint'
31
43
  >
32
44
  > = {
33
45
  blockDurationMs: {
34
46
  env: 'SEQ_BLOCK_DURATION_MS',
35
- description:
36
- 'Duration per block in milliseconds when building multiple blocks per slot. ' +
37
- 'If undefined (default), builds a single block per slot using the full slot duration.',
38
- ...optionalNumberConfigHelper(),
47
+ description: 'Duration per block in milliseconds, used to derive how many blocks fit in a slot.',
48
+ ...numberConfigHelper(DEFAULT_BLOCK_DURATION_MS),
39
49
  },
40
50
  expectedBlockProposalsPerSlot: {
41
51
  env: 'SEQ_EXPECTED_BLOCK_PROPOSALS_PER_SLOT',
@@ -44,6 +54,14 @@ export const sharedSequencerConfigMappings: ConfigMappingsType<
44
54
  '0 (default) disables block proposal scoring. Set to a positive value to enable.',
45
55
  ...numberConfigHelper(0),
46
56
  },
57
+ checkpointProposalSyncGraceSeconds: {
58
+ env: 'CHECKPOINT_PROPOSAL_SYNC_GRACE_SECONDS',
59
+ description:
60
+ 'Consensus grace in seconds for a received checkpoint proposal to materialize into local proposed state. ' +
61
+ 'Defaults to twice the block duration.',
62
+ defaultValue: getDefaultCheckpointProposalSyncGrace(DEFAULT_BLOCK_DURATION_MS / 1000),
63
+ ...optionalNumberConfigHelper(),
64
+ },
47
65
  maxTxsPerBlock: {
48
66
  env: 'SEQ_MAX_TX_PER_BLOCK',
49
67
  description: 'The maximum number of txs to include in a block.',
@@ -55,6 +73,19 @@ export const sharedSequencerConfigMappings: ConfigMappingsType<
55
73
  defaultValue: DEFAULT_P2P_PROPAGATION_TIME,
56
74
  ...floatConfigHelper(DEFAULT_P2P_PROPAGATION_TIME),
57
75
  },
76
+ checkpointProposalPrepareTime: {
77
+ env: 'SEQ_CHECKPOINT_PROPOSAL_PREPARE_TIME',
78
+ description:
79
+ 'Local time in seconds between the last block build finishing and the checkpoint proposal being ready for p2p send.',
80
+ defaultValue: DEFAULT_CHECKPOINT_PROPOSAL_PREPARE_TIME,
81
+ ...floatConfigHelper(DEFAULT_CHECKPOINT_PROPOSAL_PREPARE_TIME),
82
+ },
83
+ minBlockDuration: {
84
+ env: 'SEQ_MIN_BLOCK_DURATION',
85
+ description: 'Minimum block-building time in seconds still worth allocating if the proposer starts late.',
86
+ defaultValue: DEFAULT_MIN_BLOCK_DURATION,
87
+ ...floatConfigHelper(DEFAULT_MIN_BLOCK_DURATION),
88
+ },
58
89
  maxBlocksPerCheckpoint: {
59
90
  env: 'MAX_BLOCKS_PER_CHECKPOINT',
60
91
  description:
@@ -6,7 +6,8 @@ import { type FunctionAbi, FunctionSelector, encodeArguments } from '../abi/inde
6
6
  import type { AztecAddress } from '../aztec-address/index.js';
7
7
  import { computeVarArgsHash } from '../hash/hash.js';
8
8
  import { computeAddress } from '../keys/index.js';
9
- import type { ContractInstance } from './interfaces/contract_instance.js';
9
+ import type { ContractInstance, ContractInstancePreimage } from './interfaces/contract_instance.js';
10
+ import type { PartialAddress } from './partial_address.js';
10
11
 
11
12
  // TODO(@spalladino): Review all generator indices in this file
12
13
 
@@ -21,7 +22,7 @@ import type { ContractInstance } from './interfaces/contract_instance.js';
21
22
  */
22
23
  export async function computeContractAddressFromInstance(
23
24
  instance:
24
- | ContractInstance
25
+ | ContractInstancePreimage
25
26
  | ({ originalContractClassId: Fr; saltedInitializationHash: Fr } & Pick<ContractInstance, 'publicKeys'>),
26
27
  ): Promise<AztecAddress> {
27
28
  const partialAddress = await computePartialAddress(instance);
@@ -36,7 +37,7 @@ export async function computePartialAddress(
36
37
  instance:
37
38
  | Pick<ContractInstance, 'originalContractClassId' | 'initializationHash' | 'salt' | 'deployer' | 'immutablesHash'>
38
39
  | { originalContractClassId: Fr; saltedInitializationHash: Fr },
39
- ): Promise<Fr> {
40
+ ): Promise<PartialAddress> {
40
41
  const saltedInitializationHash =
41
42
  'saltedInitializationHash' in instance
42
43
  ? instance.saltedInitializationHash
@@ -1,4 +1,5 @@
1
- import { vkAsFieldsMegaHonk } from '@aztec/foundation/crypto/keys';
1
+ import { CircuitKind } from '@aztec/bb.js';
2
+ import { vkAsFields } from '@aztec/foundation/crypto/keys';
2
3
  import { Fr } from '@aztec/foundation/curves/bn254';
3
4
 
4
5
  import { type ContractArtifact, type FunctionArtifact, FunctionSelector, FunctionType } from '../abi/index.js';
@@ -60,5 +61,5 @@ export async function computeVerificationKeyHash(f: FunctionArtifact) {
60
61
  if (!f.verificationKey) {
61
62
  throw new Error(`Private function ${f.name} must have a verification key`);
62
63
  }
63
- return hashVK(await vkAsFieldsMegaHonk(Buffer.from(f.verificationKey, 'base64')));
64
+ return hashVK(await vkAsFields(Buffer.from(f.verificationKey, 'base64'), CircuitKind.App));
64
65
  }