@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,87 @@
1
+ /** Default block sub-slot duration (`D`) in seconds, used to derive how many blocks fit in a slot. */
2
+ export const DEFAULT_BLOCK_DURATION = 3;
3
+
4
+ /** Default minimum block-building duration (`min_block_duration`) in seconds. */
5
+ export const DEFAULT_MIN_BLOCK_DURATION = 2;
6
+
7
+ /** Default one-way P2P propagation time (`p2p_propagation_time`) for proposals and attestations in seconds. */
8
+ export const DEFAULT_P2P_PROPAGATION_TIME = 2;
9
+
10
+ /** Default local checkpoint proposal preparation time (`checkpoint_proposal_prepare_time`) in seconds. */
11
+ export const DEFAULT_CHECKPOINT_PROPOSAL_PREPARE_TIME = 1;
12
+
13
+ /** Default local tolerance for archiver orphan-prune checks when no checkpoint proposal was received. */
14
+ export const DEFAULT_ORPHAN_PRUNE_NO_PROPOSAL_TOLERANCE = 1;
15
+
16
+ /**
17
+ * Default proposer initialization time (`checkpoint_proposal_init_time`) in seconds: the budget reserved at
18
+ * the start of the build frame for sync, the proposer check, and checkpoint initialization before the first
19
+ * block sub-slot opens. The proposer rarely starts building exactly at `build_frame_start`; this offset
20
+ * shifts the sub-slot grid so the first sub-slot still has its full duration once the prologue completes.
21
+ */
22
+ export const DEFAULT_CHECKPOINT_PROPOSAL_INIT_TIME = 1;
23
+
24
+ /**
25
+ * Ethereum slot duration (seconds) below which a network is treated as a fast local/e2e profile with mocked
26
+ * p2p. Profiles at or above this keep the production operational budgets. Mainnet is 12s; fast anvil-style
27
+ * local profiles run at 4s.
28
+ */
29
+ export const FAST_PROFILE_ETHEREUM_SLOT_DURATION = 8;
30
+
31
+ /**
32
+ * Operational timing budgets for the fast local/e2e profile (mocked p2p), per the README's "Local e2e with
33
+ * mocked p2p" section. When `ethereum_slot_duration < FAST_PROFILE_ETHEREUM_SLOT_DURATION`, these cap the
34
+ * proposer's operational budgets so a fast network does not inherit the conservative production budgets,
35
+ * which would shrink the per-checkpoint build window and under-pack checkpoints. Explicitly configured
36
+ * budgets below these caps are kept as-is (the budgets are clamped down, never raised).
37
+ */
38
+ export const FAST_PROFILE_P2P_PROPAGATION_TIME = 0.5;
39
+
40
+ /** Fast-profile checkpoint proposal preparation budget (seconds). See {@link FAST_PROFILE_P2P_PROPAGATION_TIME}. */
41
+ export const FAST_PROFILE_CHECKPOINT_PROPOSAL_PREPARE_TIME = 0.5;
42
+
43
+ /** Fast-profile minimum block-building budget (seconds). See {@link FAST_PROFILE_P2P_PROPAGATION_TIME}. */
44
+ export const FAST_PROFILE_MIN_BLOCK_DURATION = 1;
45
+
46
+ /** Resolved operational timing budgets used to size the proposer build window. */
47
+ export type ResolvedTimingBudgets = {
48
+ minBlockDuration: number;
49
+ p2pPropagationTime: number;
50
+ checkpointProposalPrepareTime: number;
51
+ checkpointProposalInitTime: number;
52
+ };
53
+
54
+ /** Default consensus grace for received checkpoint proposals to materialize locally. */
55
+ export function getDefaultCheckpointProposalSyncGrace(blockDuration: number): number {
56
+ return 2 * blockDuration;
57
+ }
58
+
59
+ /**
60
+ * Resolves the operational timing budgets, applying the fast local/e2e profile when
61
+ * `ethereumSlotDuration < FAST_PROFILE_ETHEREUM_SLOT_DURATION`.
62
+ *
63
+ * Production profiles (`ethereumSlotDuration >= FAST_PROFILE_ETHEREUM_SLOT_DURATION`) use the configured
64
+ * budgets verbatim. Fast profiles clamp `p2pPropagationTime`, `checkpointProposalPrepareTime`, and
65
+ * `minBlockDuration` down to the fast-profile caps so a fast network (mocked p2p) gets a build window sized
66
+ * for local timing rather than the conservative production budgets. The clamp only lowers budgets, so an
67
+ * operator that explicitly configured a smaller value keeps it. `checkpointProposalInitTime` is unchanged by
68
+ * the profile: it is a proposer prologue budget, not a propagation/preparation budget.
69
+ */
70
+ export function resolveTimingBudgets(ethereumSlotDuration: number, opts: ResolvedTimingBudgets): ResolvedTimingBudgets {
71
+ const { minBlockDuration, p2pPropagationTime, checkpointProposalPrepareTime, checkpointProposalInitTime } = opts;
72
+
73
+ const isFastProfile = ethereumSlotDuration < FAST_PROFILE_ETHEREUM_SLOT_DURATION;
74
+ if (!isFastProfile) {
75
+ return { minBlockDuration, p2pPropagationTime, checkpointProposalPrepareTime, checkpointProposalInitTime };
76
+ }
77
+
78
+ return {
79
+ minBlockDuration: Math.min(minBlockDuration, FAST_PROFILE_MIN_BLOCK_DURATION),
80
+ p2pPropagationTime: Math.min(p2pPropagationTime, FAST_PROFILE_P2P_PROPAGATION_TIME),
81
+ checkpointProposalPrepareTime: Math.min(
82
+ checkpointProposalPrepareTime,
83
+ FAST_PROFILE_CHECKPOINT_PROPOSAL_PREPARE_TIME,
84
+ ),
85
+ checkpointProposalInitTime,
86
+ };
87
+ }
@@ -0,0 +1,42 @@
1
+ import {
2
+ DEFAULT_BLOCK_DURATION,
3
+ DEFAULT_CHECKPOINT_PROPOSAL_INIT_TIME,
4
+ DEFAULT_CHECKPOINT_PROPOSAL_PREPARE_TIME,
5
+ DEFAULT_MIN_BLOCK_DURATION,
6
+ DEFAULT_P2P_PROPAGATION_TIME,
7
+ } from './budgets.js';
8
+ import type { SlotTimingConstants } from './consensus_timetable.js';
9
+ import { ProposerTimetable } from './proposer_timetable.js';
10
+
11
+ /**
12
+ * Subset of the sequencer/p2p config the proposer timetable derives its operational budgets from. Both
13
+ * {@link SequencerConfig} and {@link P2PConfig} structurally satisfy this, so the same builder is used by
14
+ * the sequencer, the p2p layer, and the node's `getNodeInfo`.
15
+ */
16
+ export type ProposerTimetableConfig = {
17
+ blockDurationMs?: number;
18
+ minBlockDuration?: number;
19
+ attestationPropagationTime?: number;
20
+ checkpointProposalPrepareTime?: number;
21
+ checkpointProposalSyncGraceSeconds?: number;
22
+ };
23
+
24
+ /**
25
+ * Builds the proposer timetable from a sequencer/p2p config and the slot-timing protocol constants,
26
+ * applying the shared stdlib budget defaults. Single source of truth shared by the sequencer, the p2p
27
+ * layer, and the node's `getNodeInfo` so they all derive the same `maxBlocksPerCheckpoint`.
28
+ */
29
+ export function buildProposerTimetable(
30
+ config: ProposerTimetableConfig,
31
+ l1Constants: SlotTimingConstants,
32
+ ): ProposerTimetable {
33
+ return new ProposerTimetable({
34
+ l1Constants,
35
+ blockDuration: config.blockDurationMs !== undefined ? config.blockDurationMs / 1000 : DEFAULT_BLOCK_DURATION,
36
+ minBlockDuration: config.minBlockDuration ?? DEFAULT_MIN_BLOCK_DURATION,
37
+ p2pPropagationTime: config.attestationPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME,
38
+ checkpointProposalPrepareTime: config.checkpointProposalPrepareTime ?? DEFAULT_CHECKPOINT_PROPOSAL_PREPARE_TIME,
39
+ checkpointProposalInitTime: DEFAULT_CHECKPOINT_PROPOSAL_INIT_TIME,
40
+ checkpointProposalSyncGrace: config.checkpointProposalSyncGraceSeconds,
41
+ });
42
+ }
@@ -0,0 +1,126 @@
1
+ import type { SlotNumber } from '@aztec/foundation/branded-types';
2
+
3
+ import { type L1RollupConstants, getTimestampForSlot } from '../epoch-helpers/index.js';
4
+ import { getDefaultCheckpointProposalSyncGrace } from './budgets.js';
5
+
6
+ /** Slot-timing protocol constants the timetables derive wall-clock times from. */
7
+ export type SlotTimingConstants = Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>;
8
+
9
+ /**
10
+ * Consensus acceptance bounds for the pipelined timetable.
11
+ *
12
+ * Returns the deadlines and matching receive-window lower bounds that validators and p2p use to decide
13
+ * whether a proposal or attestation is acceptable for a given target slot. All getters take a target slot
14
+ * and return an absolute wall-clock timestamp in seconds.
15
+ *
16
+ * Inputs are protocol slot-timing constants only (`genesis`, `aztec_slot_duration`,
17
+ * `ethereum_slot_duration`, `block_duration`, `checkpoint_proposal_sync_grace`); no operational budgets, so every
18
+ * node agrees on these bounds. See `stdlib/src/timetable/README.md` for the timing model.
19
+ */
20
+ export class ConsensusTimetable {
21
+ /** Aztec slot duration (`S`) in seconds. */
22
+ public readonly aztecSlotDuration: number;
23
+
24
+ /** Ethereum slot duration (`E`) in seconds. */
25
+ public readonly ethereumSlotDuration: number;
26
+
27
+ /** Block sub-slot duration (`D`) in seconds. */
28
+ public readonly blockDuration: number;
29
+
30
+ /** L1 genesis timestamp in seconds (`genesis`), the anchor all slot timings derive from. */
31
+ public readonly genesisTime: bigint;
32
+
33
+ /** Consensus grace for received checkpoint proposals to materialize into local proposed state. */
34
+ public readonly checkpointProposalSyncGrace: number;
35
+
36
+ constructor(opts: { l1Constants: SlotTimingConstants; blockDuration: number; checkpointProposalSyncGrace?: number }) {
37
+ const { l1Constants, blockDuration } = opts;
38
+ const checkpointProposalSyncGrace =
39
+ opts.checkpointProposalSyncGrace ?? getDefaultCheckpointProposalSyncGrace(blockDuration);
40
+ if (l1Constants.slotDuration <= 0) {
41
+ throw new Error(`aztecSlotDuration must be positive (got ${l1Constants.slotDuration})`);
42
+ }
43
+ if (l1Constants.ethereumSlotDuration <= 0) {
44
+ throw new Error(`ethereumSlotDuration must be positive (got ${l1Constants.ethereumSlotDuration})`);
45
+ }
46
+ if (blockDuration <= 0) {
47
+ throw new Error(`blockDuration must be positive (got ${blockDuration})`);
48
+ }
49
+ if (checkpointProposalSyncGrace < 0) {
50
+ throw new Error(`checkpointProposalSyncGrace must be non-negative (got ${checkpointProposalSyncGrace})`);
51
+ }
52
+
53
+ this.aztecSlotDuration = l1Constants.slotDuration;
54
+ this.ethereumSlotDuration = l1Constants.ethereumSlotDuration;
55
+ this.blockDuration = blockDuration;
56
+ this.genesisTime = l1Constants.l1GenesisTime;
57
+ this.checkpointProposalSyncGrace = checkpointProposalSyncGrace;
58
+ }
59
+
60
+ /**
61
+ * Build-frame start for the target slot: `target_slot_start - S - E`. Anchors all sub-slot timings.
62
+ * Computed directly (not via a `slot - 1` hop) so it is well-defined for slot 0, whose build frame
63
+ * predates genesis; p2p validators evaluate acceptance windows for arbitrary peer-supplied slots.
64
+ */
65
+ public getBuildFrameStart(slot: SlotNumber): number {
66
+ return this.getTargetSlotStart(slot) - this.aztecSlotDuration - this.ethereumSlotDuration;
67
+ }
68
+
69
+ /** Start of the target slot: `genesis + slot * S`. */
70
+ public getTargetSlotStart(slot: SlotNumber): number {
71
+ return Number(getTimestampForSlot(slot, this.getL1Constants()));
72
+ }
73
+
74
+ /**
75
+ * Earliest acceptable arrival for a checkpoint proposal: `target_slot_start - S - E` (the build frame
76
+ * opening). Nothing legitimate for this slot exists before its build frame opens.
77
+ */
78
+ public getCheckpointProposalReceiveStart(slot: SlotNumber): number {
79
+ return this.getBuildFrameStart(slot);
80
+ }
81
+
82
+ /**
83
+ * Hard consensus receive deadline for a checkpoint proposal: `target_slot_start - E - D`. Validators
84
+ * reject proposals arriving after this, and the next proposer does not build on them.
85
+ */
86
+ public getCheckpointProposalReceiveDeadline(slot: SlotNumber): number {
87
+ return this.getTargetSlotStart(slot) - this.ethereumSlotDuration - this.blockDuration;
88
+ }
89
+
90
+ /**
91
+ * Wall-clock deadline by which a received checkpoint proposal should have materialized into local proposed
92
+ * state. This is `next_proposer_build_frame_start + checkpointProposalSyncGrace`, rounded up to the next
93
+ * integer second because L1 timestamps and archiver comparisons are second-granularity.
94
+ */
95
+ public getCheckpointProposalSyncedDeadline(slot: SlotNumber): number {
96
+ return Math.ceil(
97
+ this.getCheckpointProposalReceiveDeadline(slot) + this.blockDuration + this.checkpointProposalSyncGrace,
98
+ );
99
+ }
100
+
101
+ /**
102
+ * Earliest acceptable arrival for an attestation: `target_slot_start - S - E` (the build frame
103
+ * opening). Deliberately liberal; attestations are attributed by content, not timing.
104
+ */
105
+ public getAttestationReceiveStart(slot: SlotNumber): number {
106
+ return this.getBuildFrameStart(slot);
107
+ }
108
+
109
+ /**
110
+ * Single hard consensus deadline: `target_slot_start + S - 2E`. The latest the checkpoint can still
111
+ * land on L1 in the target slot, and the cutoff by which every block and the checkpoint must be
112
+ * re-executed, validated, and signed. Consensus-driven (used for inactivity/slashing decisions).
113
+ */
114
+ public getAttestationDeadline(slot: SlotNumber): number {
115
+ return this.getTargetSlotStart(slot) + this.aztecSlotDuration - 2 * this.ethereumSlotDuration;
116
+ }
117
+
118
+ /** Slot-timing protocol constants this timetable derives wall-clock times from. */
119
+ public getL1Constants(): SlotTimingConstants {
120
+ return {
121
+ l1GenesisTime: this.genesisTime,
122
+ slotDuration: this.aztecSlotDuration,
123
+ ethereumSlotDuration: this.ethereumSlotDuration,
124
+ };
125
+ }
126
+ }
@@ -1,304 +1,4 @@
1
- /**
2
- * Timetable constants used for sequencer timing calculations.
3
- * These define the time budgets for various phases of block production.
4
- *
5
- * The sequencer slot is divided into phases:
6
- * 1. Checkpoint initialization (sync + proposer check)
7
- * 2. Block building (execution)
8
- * 3. Checkpoint assembly
9
- * 4. P2P propagation for proposal and attestations (round-trip)
10
- * 5. L1 publishing
11
- */
12
-
13
- /** Time budget for checkpoint initialization (sync + proposer check) in seconds */
14
- export const CHECKPOINT_INITIALIZATION_TIME = 1;
15
-
16
- /** Time budget for assembling a checkpoint after building the last block in seconds */
17
- export const CHECKPOINT_ASSEMBLE_TIME = 1;
18
-
19
- /** Default one-way P2P propagation time for proposals and attestations in seconds */
20
- export const DEFAULT_P2P_PROPAGATION_TIME = 2;
21
-
22
- /** Default L1 publishing time (matches Ethereum slot duration on mainnet) in seconds */
23
- export const DEFAULT_L1_PUBLISHING_TIME = 12;
24
-
25
- /** Minimum execution time for building a block in seconds */
26
- export const MIN_EXECUTION_TIME = 2;
27
-
28
- export type CheckpointTimingConfig = {
29
- aztecSlotDuration: number;
30
- ethereumSlotDuration?: number;
31
- blockDuration?: number;
32
- checkpointAssembleTime?: number;
33
- checkpointInitializationTime?: number;
34
- l1PublishingTime?: number;
35
- minExecutionTime?: number;
36
- p2pPropagationTime?: number;
37
- };
38
-
39
- export interface CheckpointTiming {
40
- readonly aztecSlotDuration: number;
41
- readonly blockDuration: number | undefined;
42
- readonly checkpointAssembleTime: number;
43
- readonly checkpointInitializationTime: number;
44
- readonly l1PublishingTime: number;
45
- readonly minExecutionTime: number;
46
- readonly p2pPropagationTime: number;
47
- readonly checkpointFinalizationTime: number;
48
- readonly pipeliningAttestationGracePeriod: number;
49
- readonly timeReservedAtEnd: number;
50
- readonly minimumBuildSlotWork: number;
51
- readonly initializeDeadline: number;
52
- readonly checkpointAssemblyDeadline: number;
53
- readonly checkpointAttestationStartDeadline: number;
54
- readonly checkpointAttestationDeadline: number;
55
- readonly checkpointPublishingDeadline: number;
56
-
57
- calculateMaxBlocksPerSlot(): number;
58
- }
59
-
60
- export interface PipelinedCheckpointTiming extends CheckpointTiming {
61
- readonly proposalWindowIntoTargetSlot: number;
62
- readonly attestationWindowIntoTargetSlot: number;
63
- }
64
-
65
- /**
66
- * Checkpoint timing model for proposer pipelining.
67
- *
68
- * The build work starts at the wall-clock slot boundary and the checkpoint
69
- * proposal is broadcast early enough that attestations complete by the end of
70
- * the build slot. L1 submission can then be sent at the boundary of the target
71
- * slot. The target-slot window getters are intended for consumers such as P2P
72
- * validators that need to validate pipelined messages against wallclock time.
73
- */
74
- class CheckpointTimingModel implements PipelinedCheckpointTiming {
75
- public readonly aztecSlotDuration: number;
76
- public readonly blockDuration: number | undefined;
77
- public readonly checkpointAssembleTime: number;
78
- public readonly checkpointInitializationTime: number;
79
- public readonly l1PublishingTime: number;
80
- public readonly minExecutionTime: number;
81
- public readonly p2pPropagationTime: number;
82
- private readonly ethereumSlotDuration: number;
83
-
84
- constructor(opts: CheckpointTimingConfig) {
85
- this.aztecSlotDuration = opts.aztecSlotDuration;
86
- this.blockDuration = opts.blockDuration;
87
-
88
- this.checkpointAssembleTime = opts.checkpointAssembleTime ?? CHECKPOINT_ASSEMBLE_TIME;
89
- this.checkpointInitializationTime = opts.checkpointInitializationTime ?? CHECKPOINT_INITIALIZATION_TIME;
90
- this.l1PublishingTime = opts.l1PublishingTime ?? DEFAULT_L1_PUBLISHING_TIME;
91
- this.minExecutionTime = opts.minExecutionTime ?? MIN_EXECUTION_TIME;
92
- this.p2pPropagationTime = opts.p2pPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME;
93
- this.ethereumSlotDuration = opts.ethereumSlotDuration ?? this.l1PublishingTime;
94
- }
95
-
96
- public get checkpointFinalizationTime(): number {
97
- // Allow enough time to
98
- // - build the checkpoint
99
- // - Round-trip over p2p
100
- // - Publish to L1
101
- return this.checkpointAssembleTime + this.p2pPropagationTime * 2 + this.l1PublishingTime;
102
- }
103
-
104
- public get proposalWindowIntoTargetSlot(): number {
105
- // Proposals no longer spill into the target slot: they are broadcast early
106
- // enough in the build slot that attestations complete before the boundary.
107
- // Any residual tolerance into the target slot is covered by clock disparity.
108
- return 0;
109
- }
110
-
111
- public get attestationWindowIntoTargetSlot(): number {
112
- // Span from the target-slot start to the L1 publish deadline (12s before the last L1 block of
113
- // the target slot). The p2p layer accepts slot-N attestations until right before the publish
114
- // deadline so the proposer can keep collecting useful attestations up to the latest moment the
115
- // checkpoint can still land on L1 in the target slot.
116
- return Math.max(0, this.aztecSlotDuration - 2 * this.ethereumSlotDuration);
117
- }
118
-
119
- public get pipeliningAttestationGracePeriod(): number {
120
- // Under the early-pipelining regime attestations complete inside the build slot itself. Local
121
- // networks can publish much faster than the Ethereum slot geometry, so they may use the target
122
- // slot attestation window without moving the L1 publish cutoff.
123
- return this.l1PublishingTime < this.ethereumSlotDuration ? this.attestationWindowIntoTargetSlot : 0;
124
- }
125
-
126
- public get timeReservedAtEnd(): number {
127
- // Reserve enough time at the end of the build slot for:
128
- // - assembling and broadcasting the checkpoint proposal
129
- // - round-trip p2p propagation (proposal out, attestations back)
130
- // - validators re-executing the last block
131
- return this.checkpointAssembleTime + 2 * this.p2pPropagationTime + (this.blockDuration ?? 0);
132
- }
133
-
134
- public get minimumBuildSlotWork(): number {
135
- return this.checkpointInitializationTime + this.minExecutionTime * 2;
136
- }
137
-
138
- public get initializeDeadline(): number {
139
- return this.aztecSlotDuration - this.minimumBuildSlotWork;
140
- }
141
-
142
- public get checkpointAssemblyDeadline(): number {
143
- // Allow enough time to build all blocks and receive attestations. With
144
- // `pipeliningAttestationGracePeriod = 0` this equals `aztecSlotDuration`.
145
- return this.aztecSlotDuration + this.pipeliningAttestationGracePeriod;
146
- }
147
-
148
- public get checkpointAttestationStartDeadline(): number {
149
- return this.checkpointAssemblyDeadline;
150
- }
151
-
152
- public get checkpointAttestationDeadline(): number {
153
- // L1 publish deadline — 12s (one Ethereum slot) before the last L1 block of the target L2 slot;
154
- // the latest the checkpoint can be submitted and still land on L1 in the target slot. This is an
155
- // L1-geometry bound (ethereumSlotDuration), matching the publisher's send lead in sendRequestsAt
156
- // (which also targets one Ethereum slot before the target slot start).
157
- return this.aztecSlotDuration * 2 - this.ethereumSlotDuration;
158
- }
159
-
160
- public get checkpointPublishingDeadline(): number {
161
- // L1 publish deadline — 12s (one Ethereum slot) before the last L1 block of the target L2 slot;
162
- // the latest the checkpoint can be submitted and still land on L1 in the target slot.
163
- return this.aztecSlotDuration * 2 - this.ethereumSlotDuration;
164
- }
165
-
166
- public calculateMaxBlocksPerSlot(): number {
167
- if (!this.blockDuration) {
168
- return 1;
169
- }
170
-
171
- const timeAvailableForBlocks = this.aztecSlotDuration - this.checkpointInitializationTime - this.timeReservedAtEnd;
172
- return Math.floor(timeAvailableForBlocks / this.blockDuration);
173
- }
174
- }
175
-
176
- /**
177
- * Creates a checkpoint timing model.
178
- *
179
- * Most callers should use this factory and depend only on the shared
180
- * `CheckpointTiming` interface.
181
- */
182
- export function createCheckpointTimingModel(opts: CheckpointTimingConfig): CheckpointTiming {
183
- return createPipelinedCheckpointTimingModel(opts);
184
- }
185
-
186
- /**
187
- * Creates a checkpoint timing model exposing the target-slot window accessors.
188
- *
189
- * Use this when the caller specifically needs the pipelined timing surface, such
190
- * as proposal or attestation acceptance windows into the target slot.
191
- */
192
- export function createPipelinedCheckpointTimingModel(opts: CheckpointTimingConfig): PipelinedCheckpointTiming {
193
- validateCheckpointTimingConfig(opts);
194
- const normalizedOpts = normalizeCheckpointTimingConfig(opts);
195
-
196
- const timing = new CheckpointTimingModel(normalizedOpts);
197
- validateCheckpointTimingModel(timing);
198
- return timing;
199
- }
200
-
201
- /**
202
- * Calculates the maximum number of blocks that can be built in a slot.
203
- * Used by both the sequencer timetable and p2p gossipsub scoring.
204
- *
205
- * @param aztecSlotDurationSec - Aztec slot duration in seconds
206
- * @param blockDurationSec - Duration per block in seconds (undefined = single block mode)
207
- * @param opts - Optional overrides for timing constants
208
- * @returns Maximum number of blocks per slot
209
- */
210
- export function calculateMaxBlocksPerSlot(
211
- aztecSlotDurationSec: number,
212
- blockDurationSec: number | undefined,
213
- opts: {
214
- checkpointInitializationTime?: number;
215
- checkpointAssembleTime?: number;
216
- p2pPropagationTime?: number;
217
- l1PublishingTime?: number;
218
- } = {},
219
- ): number {
220
- return createCheckpointTimingModel({
221
- aztecSlotDuration: aztecSlotDurationSec,
222
- blockDuration: blockDurationSec,
223
- checkpointAssembleTime: opts.checkpointAssembleTime,
224
- checkpointInitializationTime: opts.checkpointInitializationTime,
225
- l1PublishingTime: opts.l1PublishingTime,
226
- p2pPropagationTime: opts.p2pPropagationTime,
227
- }).calculateMaxBlocksPerSlot();
228
- }
229
-
230
- function assertNonNegative(name: string, value: number): void {
231
- if (value < 0) {
232
- throw new Error(`${name} must be non-negative (got ${value})`);
233
- }
234
- }
235
-
236
- function validateCheckpointTimingConfig(opts: CheckpointTimingConfig): void {
237
- if (opts.aztecSlotDuration <= 0) {
238
- throw new Error(`aztecSlotDuration must be positive (got ${opts.aztecSlotDuration})`);
239
- }
240
-
241
- if (opts.ethereumSlotDuration !== undefined && opts.ethereumSlotDuration <= 0) {
242
- throw new Error(`ethereumSlotDuration must be positive when provided (got ${opts.ethereumSlotDuration})`);
243
- }
244
-
245
- if (opts.blockDuration !== undefined && opts.blockDuration <= 0) {
246
- throw new Error(`blockDuration must be positive when provided (got ${opts.blockDuration})`);
247
- }
248
-
249
- if (opts.minExecutionTime !== undefined && opts.minExecutionTime <= 0) {
250
- throw new Error(`minExecutionTime must be positive when provided (got ${opts.minExecutionTime})`);
251
- }
252
-
253
- if (opts.checkpointAssembleTime !== undefined) {
254
- assertNonNegative('checkpointAssembleTime', opts.checkpointAssembleTime);
255
- }
256
- if (opts.checkpointInitializationTime !== undefined) {
257
- assertNonNegative('checkpointInitializationTime', opts.checkpointInitializationTime);
258
- }
259
- if (opts.l1PublishingTime !== undefined) {
260
- assertNonNegative('l1PublishingTime', opts.l1PublishingTime);
261
- }
262
- if (opts.p2pPropagationTime !== undefined) {
263
- assertNonNegative('p2pPropagationTime', opts.p2pPropagationTime);
264
- }
265
- }
266
-
267
- function normalizeCheckpointTimingConfig(opts: CheckpointTimingConfig): CheckpointTimingConfig {
268
- let checkpointAssembleTime = opts.checkpointAssembleTime ?? CHECKPOINT_ASSEMBLE_TIME;
269
- let checkpointInitializationTime = opts.checkpointInitializationTime ?? CHECKPOINT_INITIALIZATION_TIME;
270
- let minExecutionTime = opts.minExecutionTime ?? MIN_EXECUTION_TIME;
271
- let p2pPropagationTime = opts.p2pPropagationTime ?? DEFAULT_P2P_PROPAGATION_TIME;
272
-
273
- if (opts.ethereumSlotDuration !== undefined && opts.ethereumSlotDuration < 8) {
274
- p2pPropagationTime = 0;
275
- checkpointAssembleTime = 0.5;
276
- checkpointInitializationTime = 0.5;
277
- minExecutionTime = 1;
278
- }
279
-
280
- if (opts.blockDuration !== undefined && minExecutionTime > opts.blockDuration) {
281
- minExecutionTime = opts.blockDuration;
282
- }
283
-
284
- return {
285
- ...opts,
286
- checkpointAssembleTime,
287
- checkpointInitializationTime,
288
- minExecutionTime,
289
- p2pPropagationTime,
290
- };
291
- }
292
-
293
- function validateCheckpointTimingModel(model: CheckpointTiming): void {
294
- if (model.blockDuration === undefined) {
295
- return;
296
- }
297
-
298
- const timeAvailableForBlocks = model.aztecSlotDuration - model.checkpointInitializationTime - model.timeReservedAtEnd;
299
- if (timeAvailableForBlocks < model.blockDuration) {
300
- throw new Error(
301
- `Invalid timing configuration: only ${timeAvailableForBlocks}s available for block building, which is less than one blockDuration (${model.blockDuration}s).`,
302
- );
303
- }
304
- }
1
+ export * from './budgets.js';
2
+ export * from './build_proposer_timetable.js';
3
+ export * from './consensus_timetable.js';
4
+ export * from './proposer_timetable.js';