@aztec/stdlib 0.0.1-commit.9ef841308 → 0.0.1-commit.a5db02d

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 (983) hide show
  1. package/dest/abi/abi.d.ts +121 -1197
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +31 -16
  4. package/dest/abi/authorization_selector.d.ts +4 -7
  5. package/dest/abi/authorization_selector.d.ts.map +1 -1
  6. package/dest/abi/buffer.d.ts +6 -2
  7. package/dest/abi/buffer.d.ts.map +1 -1
  8. package/dest/abi/buffer.js +13 -1
  9. package/dest/abi/contract_artifact.d.ts +14 -1
  10. package/dest/abi/contract_artifact.d.ts.map +1 -1
  11. package/dest/abi/contract_artifact.js +31 -7
  12. package/dest/abi/encoder.d.ts +1 -1
  13. package/dest/abi/encoder.d.ts.map +1 -1
  14. package/dest/abi/encoder.js +32 -6
  15. package/dest/abi/event_selector.d.ts +4 -7
  16. package/dest/abi/event_selector.d.ts.map +1 -1
  17. package/dest/abi/function_call.d.ts +7 -25
  18. package/dest/abi/function_call.d.ts.map +1 -1
  19. package/dest/abi/function_selector.d.ts +3 -6
  20. package/dest/abi/function_selector.d.ts.map +1 -1
  21. package/dest/abi/function_selector.js +1 -3
  22. package/dest/abi/note_selector.d.ts +4 -7
  23. package/dest/abi/note_selector.d.ts.map +1 -1
  24. package/dest/abi/note_selector.js +1 -3
  25. package/dest/abi/selector.d.ts +2 -2
  26. package/dest/abi/selector.d.ts.map +1 -1
  27. package/dest/abi/selector.js +1 -1
  28. package/dest/abi/utils.d.ts +1 -1
  29. package/dest/abi/utils.d.ts.map +1 -1
  30. package/dest/abi/utils.js +1 -1
  31. package/dest/auth_witness/auth_witness.d.ts +2 -2
  32. package/dest/auth_witness/auth_witness.d.ts.map +1 -1
  33. package/dest/avm/avm.d.ts +1756 -10463
  34. package/dest/avm/avm.d.ts.map +1 -1
  35. package/dest/avm/avm.js +7 -4
  36. package/dest/avm/avm_accumulated_data.d.ts +22 -86
  37. package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
  38. package/dest/avm/avm_circuit_public_inputs.d.ts +180 -932
  39. package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
  40. package/dest/avm/avm_proving_request.d.ts +653 -5446
  41. package/dest/avm/avm_proving_request.d.ts.map +1 -1
  42. package/dest/avm/message_pack.js +12 -3
  43. package/dest/avm/public_data_write.d.ts +6 -12
  44. package/dest/avm/public_data_write.d.ts.map +1 -1
  45. package/dest/avm/revert_code.d.ts +5 -21
  46. package/dest/avm/revert_code.d.ts.map +1 -1
  47. package/dest/avm/revert_code.js +12 -30
  48. package/dest/aztec-address/index.d.ts +42 -12
  49. package/dest/aztec-address/index.d.ts.map +1 -1
  50. package/dest/aztec-address/index.js +40 -13
  51. package/dest/block/attestation_info.d.ts +3 -2
  52. package/dest/block/attestation_info.d.ts.map +1 -1
  53. package/dest/block/attestation_info.js +10 -5
  54. package/dest/block/block_data.d.ts +13 -38
  55. package/dest/block/block_data.d.ts.map +1 -1
  56. package/dest/block/block_data.js +2 -2
  57. package/dest/block/block_hash.d.ts +11 -10
  58. package/dest/block/block_hash.d.ts.map +1 -1
  59. package/dest/block/block_hash.js +10 -9
  60. package/dest/block/block_parameter.d.ts +37 -4
  61. package/dest/block/block_parameter.d.ts.map +1 -1
  62. package/dest/block/block_parameter.js +53 -2
  63. package/dest/block/in_block.d.ts +5 -24
  64. package/dest/block/in_block.d.ts.map +1 -1
  65. package/dest/block/index.d.ts +1 -2
  66. package/dest/block/index.d.ts.map +1 -1
  67. package/dest/block/index.js +0 -1
  68. package/dest/block/l2_block.d.ts +13 -41
  69. package/dest/block/l2_block.d.ts.map +1 -1
  70. package/dest/block/l2_block_info.d.ts +10 -29
  71. package/dest/block/l2_block_info.d.ts.map +1 -1
  72. package/dest/block/l2_block_info.js +6 -5
  73. package/dest/block/l2_block_source.d.ts +228 -354
  74. package/dest/block/l2_block_source.d.ts.map +1 -1
  75. package/dest/block/l2_block_source.js +81 -1
  76. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
  77. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
  78. package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
  79. package/dest/block/l2_block_stream/index.d.ts +2 -1
  80. package/dest/block/l2_block_stream/index.d.ts.map +1 -1
  81. package/dest/block/l2_block_stream/index.js +1 -0
  82. package/dest/block/l2_block_stream/interfaces.d.ts +83 -10
  83. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  84. package/dest/block/l2_block_stream/interfaces.js +25 -1
  85. package/dest/block/l2_block_stream/l2_block_stream.d.ts +23 -15
  86. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  87. package/dest/block/l2_block_stream/l2_block_stream.js +159 -135
  88. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +8 -12
  89. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
  90. package/dest/block/l2_block_stream/l2_tips_memory_store.js +11 -32
  91. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +20 -18
  92. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  93. package/dest/block/l2_block_stream/l2_tips_store_base.js +84 -40
  94. package/dest/block/proposal/attestations_and_signers.d.ts +37 -30
  95. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
  96. package/dest/block/proposal/attestations_and_signers.js +73 -25
  97. package/dest/block/proposal/committee_attestation.d.ts +6 -12
  98. package/dest/block/proposal/committee_attestation.d.ts.map +1 -1
  99. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  100. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  101. package/dest/block/test/l2_tips_store_test_suite.js +296 -36
  102. package/dest/block/validate_block_result.d.ts +16 -1
  103. package/dest/block/validate_block_result.d.ts.map +1 -1
  104. package/dest/block/validate_block_result.js +18 -3
  105. package/dest/checkpoint/checkpoint.d.ts +30 -96
  106. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  107. package/dest/checkpoint/checkpoint.js +11 -3
  108. package/dest/checkpoint/checkpoint_data.d.ts +68 -91
  109. package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
  110. package/dest/checkpoint/checkpoint_data.js +12 -0
  111. package/dest/checkpoint/checkpoint_info.d.ts +7 -23
  112. package/dest/checkpoint/checkpoint_info.d.ts.map +1 -1
  113. package/dest/checkpoint/checkpoint_reexecution_tracker.d.ts +60 -0
  114. package/dest/checkpoint/checkpoint_reexecution_tracker.d.ts.map +1 -0
  115. package/dest/checkpoint/checkpoint_reexecution_tracker.js +108 -0
  116. package/dest/checkpoint/digest.d.ts +18 -0
  117. package/dest/checkpoint/digest.d.ts.map +1 -0
  118. package/dest/checkpoint/digest.js +12 -0
  119. package/dest/checkpoint/index.d.ts +5 -1
  120. package/dest/checkpoint/index.d.ts.map +1 -1
  121. package/dest/checkpoint/index.js +4 -0
  122. package/dest/checkpoint/previous_checkpoint_out_hashes.d.ts +33 -0
  123. package/dest/checkpoint/previous_checkpoint_out_hashes.d.ts.map +1 -0
  124. package/dest/checkpoint/previous_checkpoint_out_hashes.js +45 -0
  125. package/dest/checkpoint/published_checkpoint.d.ts +42 -194
  126. package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
  127. package/dest/checkpoint/simulation_overrides.d.ts +61 -0
  128. package/dest/checkpoint/simulation_overrides.d.ts.map +1 -0
  129. package/dest/checkpoint/simulation_overrides.js +98 -0
  130. package/dest/checkpoint/validate.d.ts +11 -3
  131. package/dest/checkpoint/validate.d.ts.map +1 -1
  132. package/dest/checkpoint/validate.js +9 -6
  133. package/dest/config/chain-config.d.ts +4 -9
  134. package/dest/config/chain-config.d.ts.map +1 -1
  135. package/dest/config/chain-config.js +13 -12
  136. package/dest/config/index.d.ts +2 -2
  137. package/dest/config/index.d.ts.map +1 -1
  138. package/dest/config/index.js +1 -1
  139. package/dest/config/network-consensus-config.d.ts +72 -0
  140. package/dest/config/network-consensus-config.d.ts.map +1 -0
  141. package/dest/config/network-consensus-config.js +223 -0
  142. package/dest/config/sequencer-config.d.ts +7 -3
  143. package/dest/config/sequencer-config.d.ts.map +1 -1
  144. package/dest/config/sequencer-config.js +38 -5
  145. package/dest/contract/complete_address.d.ts +3 -2
  146. package/dest/contract/complete_address.d.ts.map +1 -1
  147. package/dest/contract/complete_address.js +6 -2
  148. package/dest/contract/contract_address.d.ts +9 -8
  149. package/dest/contract/contract_address.d.ts.map +1 -1
  150. package/dest/contract/contract_address.js +5 -4
  151. package/dest/contract/contract_deployment_data.d.ts +15 -61
  152. package/dest/contract/contract_deployment_data.d.ts.map +1 -1
  153. package/dest/contract/contract_instance.d.ts +19 -3
  154. package/dest/contract/contract_instance.d.ts.map +1 -1
  155. package/dest/contract/contract_instance.js +55 -3
  156. package/dest/contract/interfaces/contract_class.d.ts +15 -86
  157. package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
  158. package/dest/contract/interfaces/contract_data_source.d.ts +3 -5
  159. package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
  160. package/dest/contract/interfaces/contract_instance.d.ts +111 -104
  161. package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
  162. package/dest/contract/interfaces/contract_instance.js +11 -4
  163. package/dest/contract/interfaces/contract_instance_update.d.ts +6 -26
  164. package/dest/contract/interfaces/contract_instance_update.d.ts.map +1 -1
  165. package/dest/contract/interfaces/node-info.d.ts +11 -1
  166. package/dest/contract/interfaces/node-info.d.ts.map +1 -1
  167. package/dest/contract/interfaces/node-info.js +7 -1
  168. package/dest/contract/interfaces/protocol_contract_addresses.d.ts +2 -12
  169. package/dest/contract/interfaces/protocol_contract_addresses.d.ts.map +1 -1
  170. package/dest/contract/partial_address.d.ts +9 -3
  171. package/dest/contract/partial_address.d.ts.map +1 -1
  172. package/dest/contract/partial_address.js +8 -2
  173. package/dest/contract/private_function.d.ts +1 -1
  174. package/dest/contract/private_function.d.ts.map +1 -1
  175. package/dest/contract/private_function.js +2 -4
  176. package/dest/database-version/database_version.d.ts +5 -11
  177. package/dest/database-version/database_version.d.ts.map +1 -1
  178. package/dest/database-version/version_manager.d.ts +22 -4
  179. package/dest/database-version/version_manager.d.ts.map +1 -1
  180. package/dest/database-version/version_manager.js +87 -6
  181. package/dest/deserialization/index.d.ts +35 -3
  182. package/dest/deserialization/index.d.ts.map +1 -1
  183. package/dest/deserialization/index.js +32 -1
  184. package/dest/epoch-helpers/index.d.ts +6 -22
  185. package/dest/epoch-helpers/index.d.ts.map +1 -1
  186. package/dest/epoch-helpers/index.js +3 -0
  187. package/dest/file-store/factory.d.ts +1 -1
  188. package/dest/file-store/factory.d.ts.map +1 -1
  189. package/dest/file-store/factory.js +7 -0
  190. package/dest/file-store/index.d.ts +2 -1
  191. package/dest/file-store/index.d.ts.map +1 -1
  192. package/dest/file-store/index.js +1 -0
  193. package/dest/file-store/memory.d.ts +24 -0
  194. package/dest/file-store/memory.d.ts.map +1 -0
  195. package/dest/file-store/memory.js +80 -0
  196. package/dest/gas/fee_math.d.ts +49 -0
  197. package/dest/gas/fee_math.d.ts.map +1 -0
  198. package/dest/gas/fee_math.js +80 -0
  199. package/dest/gas/gas.d.ts +9 -14
  200. package/dest/gas/gas.d.ts.map +1 -1
  201. package/dest/gas/gas.js +6 -3
  202. package/dest/gas/gas_fees.d.ts +13 -14
  203. package/dest/gas/gas_fees.d.ts.map +1 -1
  204. package/dest/gas/gas_fees.js +17 -4
  205. package/dest/gas/gas_settings.d.ts +60 -86
  206. package/dest/gas/gas_settings.d.ts.map +1 -1
  207. package/dest/gas/gas_settings.js +49 -9
  208. package/dest/gas/index.d.ts +3 -1
  209. package/dest/gas/index.d.ts.map +1 -1
  210. package/dest/gas/index.js +2 -0
  211. package/dest/gas/tx_gas_limits.d.ts +72 -0
  212. package/dest/gas/tx_gas_limits.d.ts.map +1 -0
  213. package/dest/gas/tx_gas_limits.js +85 -0
  214. package/dest/ha-signing/config.d.ts +29 -79
  215. package/dest/ha-signing/config.d.ts.map +1 -1
  216. package/dest/ha-signing/config.js +18 -21
  217. package/dest/ha-signing/index.d.ts +2 -2
  218. package/dest/ha-signing/index.d.ts.map +1 -1
  219. package/dest/ha-signing/index.js +1 -1
  220. package/dest/ha-signing/local_config.d.ts +12 -35
  221. package/dest/ha-signing/local_config.d.ts.map +1 -1
  222. package/dest/ha-signing/local_config.js +9 -3
  223. package/dest/ha-signing/types.d.ts +37 -32
  224. package/dest/ha-signing/types.d.ts.map +1 -1
  225. package/dest/ha-signing/types.js +13 -6
  226. package/dest/hash/hash.d.ts +16 -2
  227. package/dest/hash/hash.d.ts.map +1 -1
  228. package/dest/hash/hash.js +34 -9
  229. package/dest/interfaces/allowed_element.d.ts +4 -28
  230. package/dest/interfaces/allowed_element.d.ts.map +1 -1
  231. package/dest/interfaces/api_limit.d.ts +1 -1
  232. package/dest/interfaces/api_limit.js +1 -1
  233. package/dest/interfaces/archiver.d.ts +27 -32
  234. package/dest/interfaces/archiver.d.ts.map +1 -1
  235. package/dest/interfaces/archiver.js +216 -70
  236. package/dest/interfaces/aztec-node-admin.d.ts +74 -302
  237. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  238. package/dest/interfaces/aztec-node-admin.js +60 -17
  239. package/dest/interfaces/aztec-node-debug.d.ts +59 -0
  240. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
  241. package/dest/interfaces/aztec-node-debug.js +49 -0
  242. package/dest/interfaces/aztec-node.d.ts +160 -116
  243. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  244. package/dest/interfaces/aztec-node.js +350 -74
  245. package/dest/interfaces/block-builder.d.ts +5 -1
  246. package/dest/interfaces/block-builder.d.ts.map +1 -1
  247. package/dest/interfaces/block_response.d.ts +90 -0
  248. package/dest/interfaces/block_response.d.ts.map +1 -0
  249. package/dest/interfaces/block_response.js +30 -0
  250. package/dest/interfaces/chain_tips.d.ts +11 -0
  251. package/dest/interfaces/chain_tips.d.ts.map +1 -0
  252. package/dest/interfaces/chain_tips.js +6 -0
  253. package/dest/interfaces/checkpoint_parameter.d.ts +14 -0
  254. package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -0
  255. package/dest/interfaces/checkpoint_parameter.js +18 -0
  256. package/dest/interfaces/checkpoint_response.d.ts +122 -0
  257. package/dest/interfaces/checkpoint_response.d.ts.map +1 -0
  258. package/dest/interfaces/checkpoint_response.js +26 -0
  259. package/dest/interfaces/client.d.ts +9 -2
  260. package/dest/interfaces/client.d.ts.map +1 -1
  261. package/dest/interfaces/client.js +7 -1
  262. package/dest/interfaces/configs.d.ts +66 -134
  263. package/dest/interfaces/configs.d.ts.map +1 -1
  264. package/dest/interfaces/configs.js +14 -2
  265. package/dest/interfaces/get_tx_by_hash_options.d.ts +9 -0
  266. package/dest/interfaces/get_tx_by_hash_options.d.ts.map +1 -0
  267. package/dest/interfaces/get_tx_by_hash_options.js +4 -0
  268. package/dest/interfaces/l1_publish_info.d.ts +29 -0
  269. package/dest/interfaces/l1_publish_info.d.ts.map +1 -0
  270. package/dest/interfaces/l1_publish_info.js +26 -0
  271. package/dest/interfaces/l2_logs_source.d.ts +14 -36
  272. package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
  273. package/dest/interfaces/l2_logs_source.js +5 -0
  274. package/dest/interfaces/merkle_tree_operations.d.ts +4 -3
  275. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  276. package/dest/interfaces/p2p-bootstrap.js +8 -2
  277. package/dest/interfaces/p2p.d.ts +46 -7
  278. package/dest/interfaces/p2p.d.ts.map +1 -1
  279. package/dest/interfaces/p2p.js +41 -6
  280. package/dest/interfaces/private_kernel_prover.d.ts +69 -11
  281. package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
  282. package/dest/interfaces/prover-agent.d.ts +5 -23
  283. package/dest/interfaces/prover-agent.d.ts.map +1 -1
  284. package/dest/interfaces/prover-agent.js +4 -1
  285. package/dest/interfaces/prover-client.d.ts +7 -29
  286. package/dest/interfaces/prover-client.d.ts.map +1 -1
  287. package/dest/interfaces/prover-client.js +0 -3
  288. package/dest/interfaces/prover-node.d.ts +12 -8
  289. package/dest/interfaces/prover-node.d.ts.map +1 -1
  290. package/dest/interfaces/prover-node.js +37 -16
  291. package/dest/interfaces/proving-job-source.js +24 -4
  292. package/dest/interfaces/proving-job.d.ts +740 -5778
  293. package/dest/interfaces/proving-job.d.ts.map +1 -1
  294. package/dest/interfaces/proving-job.js +14 -5
  295. package/dest/interfaces/public_storage_override.d.ts +22 -0
  296. package/dest/interfaces/public_storage_override.d.ts.map +1 -0
  297. package/dest/interfaces/public_storage_override.js +7 -0
  298. package/dest/interfaces/server.d.ts +6 -2
  299. package/dest/interfaces/server.d.ts.map +1 -1
  300. package/dest/interfaces/server.js +5 -1
  301. package/dest/interfaces/server_circuit_prover.d.ts +3 -3
  302. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  303. package/dest/interfaces/slasher.d.ts +25 -65
  304. package/dest/interfaces/slasher.d.ts.map +1 -1
  305. package/dest/interfaces/slasher.js +8 -4
  306. package/dest/interfaces/tx_provider.d.ts +6 -1
  307. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  308. package/dest/interfaces/validator.d.ts +58 -239
  309. package/dest/interfaces/validator.d.ts.map +1 -1
  310. package/dest/interfaces/validator.js +8 -1
  311. package/dest/interfaces/world_state.d.ts +15 -2
  312. package/dest/interfaces/world_state.d.ts.map +1 -1
  313. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
  314. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
  315. package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
  316. package/dest/kernel/hints/key_validation_request.d.ts +12 -8
  317. package/dest/kernel/hints/key_validation_request.d.ts.map +1 -1
  318. package/dest/kernel/hints/key_validation_request.js +20 -18
  319. package/dest/kernel/hints/read_request.js +1 -1
  320. package/dest/kernel/index.d.ts +6 -2
  321. package/dest/kernel/index.d.ts.map +1 -1
  322. package/dest/kernel/index.js +5 -1
  323. package/dest/kernel/log_hash.d.ts +6 -2
  324. package/dest/kernel/log_hash.d.ts.map +1 -1
  325. package/dest/kernel/log_hash.js +23 -11
  326. package/dest/kernel/note_hash.js +1 -1
  327. package/dest/kernel/nullifier.js +1 -1
  328. package/dest/kernel/private_circuit_public_inputs.d.ts +14 -4
  329. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  330. package/dest/kernel/private_circuit_public_inputs.js +14 -7
  331. package/dest/kernel/private_context_inputs.d.ts +4 -3
  332. package/dest/kernel/private_context_inputs.d.ts.map +1 -1
  333. package/dest/kernel/private_context_inputs.js +7 -3
  334. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +8 -2
  335. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  336. package/dest/kernel/private_kernel_circuit_public_inputs.js +7 -0
  337. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +22 -0
  338. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -0
  339. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +33 -0
  340. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +23 -0
  341. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -0
  342. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +35 -0
  343. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
  344. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
  345. package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
  346. package/dest/kernel/private_kernel_inner_2_circuit_private_inputs.d.ts +16 -0
  347. package/dest/kernel/private_kernel_inner_2_circuit_private_inputs.d.ts.map +1 -0
  348. package/dest/kernel/private_kernel_inner_2_circuit_private_inputs.js +23 -0
  349. package/dest/kernel/private_kernel_inner_3_circuit_private_inputs.d.ts +17 -0
  350. package/dest/kernel/private_kernel_inner_3_circuit_private_inputs.d.ts.map +1 -0
  351. package/dest/kernel/private_kernel_inner_3_circuit_private_inputs.js +25 -0
  352. package/dest/kernel/private_kernel_prover_output.d.ts +3 -29
  353. package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
  354. package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
  355. package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
  356. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
  357. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
  358. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
  359. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +9 -6
  360. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
  361. package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +22 -7
  362. package/dest/kernel/private_log_data.d.ts +1 -1
  363. package/dest/kernel/private_log_data.d.ts.map +1 -1
  364. package/dest/kernel/private_log_data.js +1 -1
  365. package/dest/kernel/private_to_avm_accumulated_data.d.ts +25 -69
  366. package/dest/kernel/private_to_avm_accumulated_data.d.ts.map +1 -1
  367. package/dest/kernel/private_to_avm_accumulated_data.js +11 -5
  368. package/dest/kernel/private_to_public_accumulated_data.d.ts +4 -3
  369. package/dest/kernel/private_to_public_accumulated_data.d.ts.map +1 -1
  370. package/dest/kernel/private_to_public_accumulated_data.js +6 -3
  371. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts +5 -4
  372. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts.map +1 -1
  373. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.js +7 -3
  374. package/dest/kernel/private_to_rollup_accumulated_data.d.ts +5 -4
  375. package/dest/kernel/private_to_rollup_accumulated_data.d.ts.map +1 -1
  376. package/dest/kernel/private_to_rollup_accumulated_data.js +6 -3
  377. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +5 -4
  378. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
  379. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.js +7 -3
  380. package/dest/kernel/public_call_request.d.ts +15 -30
  381. package/dest/kernel/public_call_request.d.ts.map +1 -1
  382. package/dest/kernel/public_call_request.js +16 -7
  383. package/dest/keys/derivation.d.ts +45 -6
  384. package/dest/keys/derivation.d.ts.map +1 -1
  385. package/dest/keys/derivation.js +55 -22
  386. package/dest/keys/public_key.d.ts +22 -3
  387. package/dest/keys/public_key.d.ts.map +1 -1
  388. package/dest/keys/public_key.js +20 -1
  389. package/dest/keys/public_keys.d.ts +55 -82
  390. package/dest/keys/public_keys.d.ts.map +1 -1
  391. package/dest/keys/public_keys.js +102 -74
  392. package/dest/kv-store/config.d.ts +3 -6
  393. package/dest/kv-store/config.d.ts.map +1 -1
  394. package/dest/kv-store/config.js +2 -7
  395. package/dest/l1-contracts/index.d.ts +2 -2
  396. package/dest/l1-contracts/index.d.ts.map +1 -1
  397. package/dest/l1-contracts/index.js +1 -1
  398. package/dest/logs/app_tagging_secret.d.ts +69 -0
  399. package/dest/logs/app_tagging_secret.d.ts.map +1 -0
  400. package/dest/logs/app_tagging_secret.js +116 -0
  401. package/dest/logs/app_tagging_secret_kind.d.ts +7 -0
  402. package/dest/logs/app_tagging_secret_kind.d.ts.map +1 -0
  403. package/dest/logs/app_tagging_secret_kind.js +17 -0
  404. package/dest/logs/contract_class_log.d.ts +16 -35
  405. package/dest/logs/contract_class_log.d.ts.map +1 -1
  406. package/dest/logs/contract_class_log.js +11 -13
  407. package/dest/logs/index.d.ts +7 -9
  408. package/dest/logs/index.d.ts.map +1 -1
  409. package/dest/logs/index.js +6 -8
  410. package/dest/logs/log_cursor.d.ts +51 -0
  411. package/dest/logs/log_cursor.d.ts.map +1 -0
  412. package/dest/logs/log_cursor.js +82 -0
  413. package/dest/logs/log_result.d.ts +54 -0
  414. package/dest/logs/log_result.d.ts.map +1 -0
  415. package/dest/logs/log_result.js +56 -0
  416. package/dest/logs/logs_query.d.ts +82 -0
  417. package/dest/logs/logs_query.d.ts.map +1 -0
  418. package/dest/logs/logs_query.js +50 -0
  419. package/dest/logs/pre_tag.d.ts +11 -24
  420. package/dest/logs/pre_tag.d.ts.map +1 -1
  421. package/dest/logs/pre_tag.js +2 -2
  422. package/dest/logs/private_log.d.ts +7 -12
  423. package/dest/logs/private_log.d.ts.map +1 -1
  424. package/dest/logs/private_log.js +6 -3
  425. package/dest/logs/query_all_logs_by_tags.d.ts +24 -0
  426. package/dest/logs/query_all_logs_by_tags.d.ts.map +1 -0
  427. package/dest/logs/query_all_logs_by_tags.js +64 -0
  428. package/dest/logs/shared_secret_derivation.d.ts +29 -6
  429. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  430. package/dest/logs/shared_secret_derivation.js +44 -11
  431. package/dest/logs/siloed_tag.d.ts +5 -7
  432. package/dest/logs/siloed_tag.d.ts.map +1 -1
  433. package/dest/logs/siloed_tag.js +7 -1
  434. package/dest/logs/tag.d.ts +5 -6
  435. package/dest/logs/tag.d.ts.map +1 -1
  436. package/dest/logs/tag.js +4 -0
  437. package/dest/logs/tagging_index_range.d.ts +13 -31
  438. package/dest/logs/tagging_index_range.d.ts.map +1 -1
  439. package/dest/logs/tagging_index_range.js +2 -2
  440. package/dest/messaging/append_l1_to_l2_messages.d.ts +9 -0
  441. package/dest/messaging/append_l1_to_l2_messages.d.ts.map +1 -0
  442. package/dest/messaging/append_l1_to_l2_messages.js +12 -0
  443. package/dest/messaging/index.d.ts +2 -1
  444. package/dest/messaging/index.d.ts.map +1 -1
  445. package/dest/messaging/index.js +1 -0
  446. package/dest/messaging/l1_to_l2_message.d.ts +23 -2
  447. package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
  448. package/dest/messaging/l1_to_l2_message.js +36 -11
  449. package/dest/messaging/l2_to_l1_membership.d.ts +43 -6
  450. package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
  451. package/dest/messaging/l2_to_l1_membership.js +72 -12
  452. package/dest/messaging/l2_to_l1_message.d.ts +38 -112
  453. package/dest/messaging/l2_to_l1_message.d.ts.map +1 -1
  454. package/dest/messaging/l2_to_l1_message.js +21 -12
  455. package/dest/noir/index.d.ts +3 -1
  456. package/dest/noir/index.d.ts.map +1 -1
  457. package/dest/note/note.d.ts +2 -2
  458. package/dest/note/note.d.ts.map +1 -1
  459. package/dest/p2p/attestation_utils.d.ts +1 -1
  460. package/dest/p2p/attestation_utils.d.ts.map +1 -1
  461. package/dest/p2p/attestation_utils.js +8 -1
  462. package/dest/p2p/block_proposal.d.ts +31 -14
  463. package/dest/p2p/block_proposal.d.ts.map +1 -1
  464. package/dest/p2p/block_proposal.js +57 -39
  465. package/dest/p2p/checkpoint_attestation.d.ts +24 -9
  466. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  467. package/dest/p2p/checkpoint_attestation.js +33 -24
  468. package/dest/p2p/checkpoint_proposal.d.ts +36 -16
  469. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  470. package/dest/p2p/checkpoint_proposal.js +59 -51
  471. package/dest/p2p/consensus_payload.d.ts +27 -20
  472. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  473. package/dest/p2p/consensus_payload.js +38 -19
  474. package/dest/p2p/gossipable.d.ts +4 -4
  475. package/dest/p2p/gossipable.d.ts.map +1 -1
  476. package/dest/p2p/signature_utils.d.ts +35 -17
  477. package/dest/p2p/signature_utils.d.ts.map +1 -1
  478. package/dest/p2p/signature_utils.js +125 -20
  479. package/dest/p2p/signed_txs.d.ts +15 -13
  480. package/dest/p2p/signed_txs.d.ts.map +1 -1
  481. package/dest/p2p/signed_txs.js +26 -24
  482. package/dest/parity/parity_base_private_inputs.d.ts +8 -4
  483. package/dest/parity/parity_base_private_inputs.d.ts.map +1 -1
  484. package/dest/parity/parity_base_private_inputs.js +7 -5
  485. package/dest/parity/parity_public_inputs.d.ts +8 -4
  486. package/dest/parity/parity_public_inputs.d.ts.map +1 -1
  487. package/dest/parity/parity_public_inputs.js +6 -3
  488. package/dest/parity/parity_root_private_inputs.d.ts +2 -2
  489. package/dest/parity/parity_root_private_inputs.d.ts.map +1 -1
  490. package/dest/proofs/chonk_proof.d.ts +17 -11
  491. package/dest/proofs/chonk_proof.d.ts.map +1 -1
  492. package/dest/proofs/chonk_proof.js +44 -22
  493. package/dest/proofs/recursive_proof.d.ts +2 -2
  494. package/dest/proofs/recursive_proof.d.ts.map +1 -1
  495. package/dest/rollup/avm_proof_data.d.ts +3 -3
  496. package/dest/rollup/avm_proof_data.d.ts.map +1 -1
  497. package/dest/rollup/block_headers_hash.d.ts +1 -1
  498. package/dest/rollup/block_headers_hash.d.ts.map +1 -1
  499. package/dest/rollup/block_headers_hash.js +8 -2
  500. package/dest/rollup/block_merge_rollup_private_inputs.d.ts +2 -2
  501. package/dest/rollup/block_merge_rollup_private_inputs.d.ts.map +1 -1
  502. package/dest/rollup/block_rollup_public_inputs.d.ts +12 -2
  503. package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -1
  504. package/dest/rollup/block_rollup_public_inputs.js +12 -0
  505. package/dest/rollup/block_root_rollup_private_inputs.d.ts +6 -6
  506. package/dest/rollup/block_root_rollup_private_inputs.d.ts.map +1 -1
  507. package/dest/rollup/checkpoint_header.d.ts +8 -3
  508. package/dest/rollup/checkpoint_header.d.ts.map +1 -1
  509. package/dest/rollup/checkpoint_header.js +20 -10
  510. package/dest/rollup/checkpoint_merge_rollup_private_inputs.d.ts +2 -2
  511. package/dest/rollup/checkpoint_merge_rollup_private_inputs.d.ts.map +1 -1
  512. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +9 -2
  513. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
  514. package/dest/rollup/checkpoint_rollup_public_inputs.js +9 -0
  515. package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +5 -5
  516. package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
  517. package/dest/rollup/private_tx_base_rollup_private_inputs.d.ts +2 -2
  518. package/dest/rollup/private_tx_base_rollup_private_inputs.d.ts.map +1 -1
  519. package/dest/rollup/public_chonk_verifier_private_inputs.d.ts +2 -2
  520. package/dest/rollup/public_chonk_verifier_private_inputs.d.ts.map +1 -1
  521. package/dest/rollup/public_chonk_verifier_public_inputs.d.ts +2 -2
  522. package/dest/rollup/public_chonk_verifier_public_inputs.d.ts.map +1 -1
  523. package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts +2 -2
  524. package/dest/rollup/public_tx_base_rollup_private_inputs.d.ts.map +1 -1
  525. package/dest/rollup/root_rollup_private_inputs.d.ts +2 -2
  526. package/dest/rollup/root_rollup_private_inputs.d.ts.map +1 -1
  527. package/dest/rollup/root_rollup_public_inputs.d.ts +2 -2
  528. package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
  529. package/dest/rollup/tx_merge_rollup_private_inputs.d.ts +2 -2
  530. package/dest/rollup/tx_merge_rollup_private_inputs.d.ts.map +1 -1
  531. package/dest/rollup/tx_rollup_public_inputs.d.ts +2 -2
  532. package/dest/rollup/tx_rollup_public_inputs.d.ts.map +1 -1
  533. package/dest/schemas/schemas.d.ts +32 -78
  534. package/dest/schemas/schemas.d.ts.map +1 -1
  535. package/dest/schemas/schemas.js +2 -2
  536. package/dest/slashing/helpers.d.ts +2 -2
  537. package/dest/slashing/helpers.d.ts.map +1 -1
  538. package/dest/slashing/helpers.js +10 -7
  539. package/dest/slashing/index.d.ts +2 -3
  540. package/dest/slashing/index.d.ts.map +1 -1
  541. package/dest/slashing/index.js +1 -2
  542. package/dest/slashing/serialization.d.ts +2 -6
  543. package/dest/slashing/serialization.d.ts.map +1 -1
  544. package/dest/slashing/serialization.js +0 -60
  545. package/dest/slashing/types.d.ts +18 -112
  546. package/dest/slashing/types.d.ts.map +1 -1
  547. package/dest/slashing/types.js +16 -24
  548. package/dest/slashing/{tally.d.ts → votes.d.ts} +1 -1
  549. package/dest/slashing/{tally.d.ts.map → votes.d.ts.map} +1 -1
  550. package/dest/slashing/{tally.js → votes.js} +1 -1
  551. package/dest/snapshots/types.d.ts +15 -78
  552. package/dest/snapshots/types.d.ts.map +1 -1
  553. package/dest/stats/stats.d.ts +2 -2
  554. package/dest/stats/stats.d.ts.map +1 -1
  555. package/dest/tests/factories.d.ts +24 -29
  556. package/dest/tests/factories.d.ts.map +1 -1
  557. package/dest/tests/factories.js +81 -59
  558. package/dest/tests/mocks.d.ts +8 -5
  559. package/dest/tests/mocks.d.ts.map +1 -1
  560. package/dest/tests/mocks.js +45 -56
  561. package/dest/timetable/budgets.d.ts +57 -0
  562. package/dest/timetable/budgets.d.ts.map +1 -0
  563. package/dest/timetable/budgets.js +56 -0
  564. package/dest/timetable/build_proposer_timetable.d.ts +21 -0
  565. package/dest/timetable/build_proposer_timetable.d.ts.map +1 -0
  566. package/dest/timetable/build_proposer_timetable.js +17 -0
  567. package/dest/timetable/consensus_timetable.d.ts +70 -0
  568. package/dest/timetable/consensus_timetable.d.ts.map +1 -0
  569. package/dest/timetable/consensus_timetable.js +89 -0
  570. package/dest/timetable/index.d.ts +5 -37
  571. package/dest/timetable/index.d.ts.map +1 -1
  572. package/dest/timetable/index.js +4 -39
  573. package/dest/timetable/proposer_timetable.d.ts +106 -0
  574. package/dest/timetable/proposer_timetable.d.ts.map +1 -0
  575. package/dest/timetable/proposer_timetable.js +132 -0
  576. package/dest/trees/append_only_tree_snapshot.d.ts +9 -14
  577. package/dest/trees/append_only_tree_snapshot.d.ts.map +1 -1
  578. package/dest/trees/append_only_tree_snapshot.js +6 -3
  579. package/dest/trees/nullifier_leaf.d.ts +19 -42
  580. package/dest/trees/nullifier_leaf.d.ts.map +1 -1
  581. package/dest/trees/nullifier_leaf.js +3 -0
  582. package/dest/trees/nullifier_membership_witness.d.ts +17 -63
  583. package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
  584. package/dest/trees/nullifier_membership_witness.js +0 -21
  585. package/dest/trees/public_data_leaf.d.ts +21 -53
  586. package/dest/trees/public_data_leaf.d.ts.map +1 -1
  587. package/dest/trees/public_data_witness.d.ts +19 -71
  588. package/dest/trees/public_data_witness.d.ts.map +1 -1
  589. package/dest/trees/public_data_witness.js +0 -27
  590. package/dest/tx/block_header.d.ts +5 -4
  591. package/dest/tx/block_header.d.ts.map +1 -1
  592. package/dest/tx/block_header.js +7 -4
  593. package/dest/tx/call_context.d.ts +4 -14
  594. package/dest/tx/call_context.d.ts.map +1 -1
  595. package/dest/tx/capsule.d.ts +2 -2
  596. package/dest/tx/capsule.d.ts.map +1 -1
  597. package/dest/tx/execution_payload.d.ts +1 -1
  598. package/dest/tx/execution_payload.d.ts.map +1 -1
  599. package/dest/tx/execution_payload.js +1 -1
  600. package/dest/tx/fee_provider.d.ts +10 -0
  601. package/dest/tx/fee_provider.d.ts.map +1 -0
  602. package/dest/tx/fee_provider.js +1 -0
  603. package/dest/tx/function_data.d.ts +4 -10
  604. package/dest/tx/function_data.d.ts.map +1 -1
  605. package/dest/tx/global_variable_builder.d.ts +4 -15
  606. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  607. package/dest/tx/global_variables.d.ts +16 -49
  608. package/dest/tx/global_variables.d.ts.map +1 -1
  609. package/dest/tx/global_variables.js +10 -14
  610. package/dest/tx/hashed_values.d.ts +4 -3
  611. package/dest/tx/hashed_values.d.ts.map +1 -1
  612. package/dest/tx/hashed_values.js +6 -3
  613. package/dest/tx/in_tx.d.ts +5 -17
  614. package/dest/tx/in_tx.d.ts.map +1 -1
  615. package/dest/tx/index.d.ts +2 -1
  616. package/dest/tx/index.d.ts.map +1 -1
  617. package/dest/tx/index.js +1 -0
  618. package/dest/tx/indexed_tx_effect.d.ts +8 -19
  619. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  620. package/dest/tx/indexed_tx_effect.js +9 -6
  621. package/dest/tx/partial_state_reference.d.ts +22 -65
  622. package/dest/tx/partial_state_reference.d.ts.map +1 -1
  623. package/dest/tx/partial_state_reference.js +6 -3
  624. package/dest/tx/private_execution_result.d.ts +6 -16
  625. package/dest/tx/private_execution_result.d.ts.map +1 -1
  626. package/dest/tx/private_tx_constant_data.d.ts +18 -2
  627. package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
  628. package/dest/tx/private_tx_constant_data.js +13 -4
  629. package/dest/tx/profiling.d.ts +54 -352
  630. package/dest/tx/profiling.d.ts.map +1 -1
  631. package/dest/tx/profiling.js +4 -4
  632. package/dest/tx/protocol_contracts.d.ts +5 -9
  633. package/dest/tx/protocol_contracts.d.ts.map +1 -1
  634. package/dest/tx/proven_tx.d.ts +30 -74
  635. package/dest/tx/proven_tx.d.ts.map +1 -1
  636. package/dest/tx/proven_tx.js +6 -0
  637. package/dest/tx/public_call_request_with_calldata.d.ts +4 -3
  638. package/dest/tx/public_call_request_with_calldata.d.ts.map +1 -1
  639. package/dest/tx/public_call_request_with_calldata.js +6 -3
  640. package/dest/tx/simulated_tx.d.ts +73 -1256
  641. package/dest/tx/simulated_tx.d.ts.map +1 -1
  642. package/dest/tx/simulated_tx.js +13 -11
  643. package/dest/tx/state_reference.d.ts +30 -117
  644. package/dest/tx/state_reference.d.ts.map +1 -1
  645. package/dest/tx/state_reference.js +6 -4
  646. package/dest/tx/tree_snapshots.d.ts +27 -84
  647. package/dest/tx/tree_snapshots.d.ts.map +1 -1
  648. package/dest/tx/tree_snapshots.js +6 -4
  649. package/dest/tx/tx.d.ts +22 -13
  650. package/dest/tx/tx.d.ts.map +1 -1
  651. package/dest/tx/tx.js +44 -22
  652. package/dest/tx/tx_constant_data.d.ts +4 -3
  653. package/dest/tx/tx_constant_data.d.ts.map +1 -1
  654. package/dest/tx/tx_constant_data.js +6 -3
  655. package/dest/tx/tx_context.d.ts +32 -131
  656. package/dest/tx/tx_context.d.ts.map +1 -1
  657. package/dest/tx/tx_context.js +6 -6
  658. package/dest/tx/tx_hash.d.ts +6 -4
  659. package/dest/tx/tx_hash.d.ts.map +1 -1
  660. package/dest/tx/tx_hash.js +13 -5
  661. package/dest/tx/tx_receipt.d.ts +144 -63
  662. package/dest/tx/tx_receipt.d.ts.map +1 -1
  663. package/dest/tx/tx_receipt.js +143 -60
  664. package/dest/tx/validator/error_texts.d.ts +2 -2
  665. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  666. package/dest/tx/validator/error_texts.js +1 -1
  667. package/dest/tx/validator/tx_validator.d.ts +5 -27
  668. package/dest/tx/validator/tx_validator.d.ts.map +1 -1
  669. package/dest/tx/validator/tx_validator.js +0 -4
  670. package/dest/types/shared.d.ts +4 -12
  671. package/dest/types/shared.d.ts.map +1 -1
  672. package/dest/types/shared.js +6 -12
  673. package/dest/update-checker/dev_version.d.ts +3 -0
  674. package/dest/update-checker/dev_version.d.ts.map +1 -0
  675. package/dest/update-checker/dev_version.js +1 -0
  676. package/dest/update-checker/index.d.ts +2 -1
  677. package/dest/update-checker/index.d.ts.map +1 -1
  678. package/dest/update-checker/index.js +1 -0
  679. package/dest/update-checker/package_version.d.ts +6 -3
  680. package/dest/update-checker/package_version.d.ts.map +1 -1
  681. package/dest/update-checker/package_version.js +8 -19
  682. package/dest/validators/schemas.d.ts +147 -614
  683. package/dest/validators/schemas.d.ts.map +1 -1
  684. package/dest/validators/schemas.js +6 -4
  685. package/dest/validators/types.d.ts +20 -3
  686. package/dest/validators/types.d.ts.map +1 -1
  687. package/dest/versioning/versioning.js +1 -1
  688. package/dest/vks/verification_key.d.ts +4 -139
  689. package/dest/vks/verification_key.d.ts.map +1 -1
  690. package/dest/vks/verification_key.js +5 -126
  691. package/dest/world-state/genesis_data.d.ts +21 -0
  692. package/dest/world-state/genesis_data.d.ts.map +1 -0
  693. package/dest/world-state/genesis_data.js +8 -0
  694. package/dest/world-state/index.d.ts +2 -1
  695. package/dest/world-state/index.d.ts.map +1 -1
  696. package/dest/world-state/index.js +1 -0
  697. package/dest/world-state/world_state_revision.d.ts +15 -26
  698. package/dest/world-state/world_state_revision.d.ts.map +1 -1
  699. package/dest/world-state/world_state_revision.js +7 -1
  700. package/package.json +12 -11
  701. package/src/abi/abi.ts +53 -19
  702. package/src/abi/authorization_selector.ts +2 -8
  703. package/src/abi/buffer.ts +13 -1
  704. package/src/abi/contract_artifact.ts +30 -6
  705. package/src/abi/encoder.ts +42 -6
  706. package/src/abi/event_selector.ts +2 -8
  707. package/src/abi/function_selector.ts +3 -12
  708. package/src/abi/note_selector.ts +3 -12
  709. package/src/abi/selector.ts +1 -1
  710. package/src/abi/utils.ts +6 -4
  711. package/src/avm/avm.ts +6 -1
  712. package/src/avm/message_pack.ts +12 -3
  713. package/src/avm/revert_code.ts +19 -39
  714. package/src/aztec-address/index.ts +50 -17
  715. package/src/block/attestation_info.ts +16 -11
  716. package/src/block/block_data.ts +3 -4
  717. package/src/block/block_hash.ts +21 -14
  718. package/src/block/block_parameter.ts +72 -4
  719. package/src/block/index.ts +0 -1
  720. package/src/block/l2_block_info.ts +8 -6
  721. package/src/block/l2_block_source.ts +258 -144
  722. package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
  723. package/src/block/l2_block_stream/index.ts +1 -0
  724. package/src/block/l2_block_stream/interfaces.ts +99 -9
  725. package/src/block/l2_block_stream/l2_block_stream.ts +229 -177
  726. package/src/block/l2_block_stream/l2_tips_memory_store.ts +17 -41
  727. package/src/block/l2_block_stream/l2_tips_store_base.ts +85 -60
  728. package/src/block/proposal/attestations_and_signers.ts +85 -24
  729. package/src/block/test/l2_tips_store_test_suite.ts +271 -22
  730. package/src/block/validate_block_result.ts +48 -2
  731. package/src/checkpoint/checkpoint.ts +13 -3
  732. package/src/checkpoint/checkpoint_data.ts +44 -4
  733. package/src/checkpoint/checkpoint_reexecution_tracker.ts +167 -0
  734. package/src/checkpoint/digest.ts +28 -0
  735. package/src/checkpoint/index.ts +4 -0
  736. package/src/checkpoint/previous_checkpoint_out_hashes.ts +61 -0
  737. package/src/checkpoint/simulation_overrides.ts +171 -0
  738. package/src/checkpoint/validate.ts +16 -6
  739. package/src/config/chain-config.ts +13 -16
  740. package/src/config/index.ts +1 -1
  741. package/src/config/network-consensus-config.ts +291 -0
  742. package/src/config/sequencer-config.ts +68 -9
  743. package/src/contract/complete_address.ts +7 -3
  744. package/src/contract/contract_address.ts +10 -9
  745. package/src/contract/contract_instance.ts +73 -3
  746. package/src/contract/interfaces/contract_data_source.ts +2 -4
  747. package/src/contract/interfaces/contract_instance.ts +32 -10
  748. package/src/contract/interfaces/node-info.ts +11 -0
  749. package/src/contract/partial_address.ts +8 -2
  750. package/src/contract/private_function.ts +3 -1
  751. package/src/database-version/version_manager.ts +113 -6
  752. package/src/deserialization/index.ts +35 -2
  753. package/src/epoch-helpers/index.ts +5 -0
  754. package/src/file-store/factory.ts +7 -0
  755. package/src/file-store/index.ts +1 -0
  756. package/src/file-store/memory.ts +94 -0
  757. package/src/gas/README.md +230 -35
  758. package/src/gas/fee_math.ts +120 -0
  759. package/src/gas/gas.ts +8 -3
  760. package/src/gas/gas_fees.ts +26 -13
  761. package/src/gas/gas_settings.ts +63 -15
  762. package/src/gas/index.ts +2 -0
  763. package/src/gas/tx_gas_limits.ts +123 -0
  764. package/src/ha-signing/config.ts +37 -23
  765. package/src/ha-signing/index.ts +3 -1
  766. package/src/ha-signing/local_config.ts +21 -2
  767. package/src/ha-signing/types.ts +48 -34
  768. package/src/hash/hash.ts +29 -10
  769. package/src/interfaces/api_limit.ts +1 -1
  770. package/src/interfaces/archiver.ts +96 -93
  771. package/src/interfaces/aztec-node-admin.ts +36 -21
  772. package/src/interfaces/aztec-node-debug.ts +92 -0
  773. package/src/interfaces/aztec-node.ts +398 -271
  774. package/src/interfaces/block-builder.ts +4 -0
  775. package/src/interfaces/block_response.ts +92 -0
  776. package/src/interfaces/chain_tips.ts +16 -0
  777. package/src/interfaces/checkpoint_parameter.ts +20 -0
  778. package/src/interfaces/checkpoint_response.ts +84 -0
  779. package/src/interfaces/client.ts +8 -1
  780. package/src/interfaces/configs.ts +67 -7
  781. package/src/interfaces/get_tx_by_hash_options.ts +14 -0
  782. package/src/interfaces/l1_publish_info.ts +40 -0
  783. package/src/interfaces/l2_logs_source.ts +13 -42
  784. package/src/interfaces/merkle_tree_operations.ts +3 -2
  785. package/src/interfaces/p2p-bootstrap.ts +2 -2
  786. package/src/interfaces/p2p.ts +59 -19
  787. package/src/interfaces/private_kernel_prover.ts +98 -12
  788. package/src/interfaces/prover-agent.ts +1 -1
  789. package/src/interfaces/prover-client.ts +3 -8
  790. package/src/interfaces/prover-node.ts +36 -21
  791. package/src/interfaces/proving-job-source.ts +4 -4
  792. package/src/interfaces/proving-job.ts +18 -6
  793. package/src/interfaces/public_storage_override.ts +26 -0
  794. package/src/interfaces/server.ts +5 -1
  795. package/src/interfaces/server_circuit_prover.ts +2 -2
  796. package/src/interfaces/slasher.ts +17 -10
  797. package/src/interfaces/tx_provider.ts +6 -0
  798. package/src/interfaces/validator.ts +44 -10
  799. package/src/interfaces/world_state.ts +15 -1
  800. package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
  801. package/src/kernel/hints/key_validation_request.ts +18 -16
  802. package/src/kernel/hints/read_request.ts +1 -1
  803. package/src/kernel/index.ts +5 -1
  804. package/src/kernel/log_hash.ts +36 -13
  805. package/src/kernel/note_hash.ts +1 -1
  806. package/src/kernel/nullifier.ts +1 -1
  807. package/src/kernel/private_circuit_public_inputs.ts +12 -1
  808. package/src/kernel/private_context_inputs.ts +10 -3
  809. package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -0
  810. package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +46 -0
  811. package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +49 -0
  812. package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
  813. package/src/kernel/private_kernel_inner_2_circuit_private_inputs.ts +29 -0
  814. package/src/kernel/private_kernel_inner_3_circuit_private_inputs.ts +31 -0
  815. package/src/kernel/private_kernel_reset_dimensions.ts +15 -5
  816. package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
  817. package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +29 -14
  818. package/src/kernel/private_log_data.ts +4 -1
  819. package/src/kernel/private_to_avm_accumulated_data.ts +16 -5
  820. package/src/kernel/private_to_public_accumulated_data.ts +9 -3
  821. package/src/kernel/private_to_public_kernel_circuit_public_inputs.ts +10 -4
  822. package/src/kernel/private_to_rollup_accumulated_data.ts +8 -3
  823. package/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts +9 -9
  824. package/src/kernel/public_call_request.ts +22 -7
  825. package/src/keys/derivation.ts +79 -22
  826. package/src/keys/public_key.ts +26 -2
  827. package/src/keys/public_keys.ts +124 -110
  828. package/src/kv-store/config.ts +3 -10
  829. package/src/l1-contracts/index.ts +1 -1
  830. package/src/logs/app_tagging_secret.ts +160 -0
  831. package/src/logs/app_tagging_secret_kind.ts +21 -0
  832. package/src/logs/contract_class_log.ts +15 -14
  833. package/src/logs/index.ts +6 -8
  834. package/src/logs/log_cursor.ts +110 -0
  835. package/src/logs/log_result.ts +104 -0
  836. package/src/logs/logs_query.ts +138 -0
  837. package/src/logs/pre_tag.ts +3 -6
  838. package/src/logs/private_log.ts +9 -3
  839. package/src/logs/query_all_logs_by_tags.ts +98 -0
  840. package/src/logs/shared_secret_derivation.ts +47 -14
  841. package/src/logs/siloed_tag.ts +14 -10
  842. package/src/logs/tag.ts +8 -8
  843. package/src/logs/tagging_index_range.ts +4 -10
  844. package/src/messaging/append_l1_to_l2_messages.ts +21 -0
  845. package/src/messaging/index.ts +1 -0
  846. package/src/messaging/l1_to_l2_message.ts +51 -13
  847. package/src/messaging/l2_to_l1_membership.ts +108 -19
  848. package/src/messaging/l2_to_l1_message.ts +29 -9
  849. package/src/noir/index.ts +2 -0
  850. package/src/p2p/attestation_utils.ts +8 -1
  851. package/src/p2p/block_proposal.ts +111 -36
  852. package/src/p2p/checkpoint_attestation.ts +38 -30
  853. package/src/p2p/checkpoint_proposal.ts +128 -73
  854. package/src/p2p/consensus_payload.ts +59 -28
  855. package/src/p2p/gossipable.ts +4 -4
  856. package/src/p2p/signature_utils.ts +117 -23
  857. package/src/p2p/signed_txs.ts +46 -28
  858. package/src/parity/parity_base_private_inputs.ts +10 -4
  859. package/src/parity/parity_public_inputs.ts +9 -2
  860. package/src/proofs/chonk_proof.ts +49 -15
  861. package/src/rollup/avm_proof_data.ts +2 -2
  862. package/src/rollup/block_headers_hash.ts +11 -2
  863. package/src/rollup/block_rollup_public_inputs.ts +13 -0
  864. package/src/rollup/checkpoint_header.ts +16 -2
  865. package/src/rollup/checkpoint_rollup_public_inputs.ts +10 -0
  866. package/src/schemas/schemas.ts +6 -1
  867. package/src/slashing/helpers.ts +13 -9
  868. package/src/slashing/index.ts +1 -2
  869. package/src/slashing/serialization.ts +1 -81
  870. package/src/slashing/types.ts +24 -49
  871. package/src/slashing/{tally.ts → votes.ts} +1 -1
  872. package/src/stats/stats.ts +6 -2
  873. package/src/tests/factories.ts +111 -86
  874. package/src/tests/mocks.ts +72 -71
  875. package/src/timetable/README.md +609 -0
  876. package/src/timetable/budgets.ts +87 -0
  877. package/src/timetable/build_proposer_timetable.ts +42 -0
  878. package/src/timetable/consensus_timetable.ts +126 -0
  879. package/src/timetable/index.ts +4 -66
  880. package/src/timetable/proposer_timetable.ts +190 -0
  881. package/src/timetable/timetable-example.svg +108 -0
  882. package/src/trees/append_only_tree_snapshot.ts +8 -3
  883. package/src/trees/nullifier_leaf.ts +4 -0
  884. package/src/trees/nullifier_membership_witness.ts +0 -21
  885. package/src/trees/public_data_witness.ts +0 -31
  886. package/src/tx/block_header.ts +10 -5
  887. package/src/tx/execution_payload.ts +2 -1
  888. package/src/tx/fee_provider.ts +10 -0
  889. package/src/tx/global_variable_builder.ts +3 -20
  890. package/src/tx/global_variables.ts +12 -20
  891. package/src/tx/hashed_values.ts +8 -3
  892. package/src/tx/index.ts +1 -0
  893. package/src/tx/indexed_tx_effect.ts +18 -6
  894. package/src/tx/partial_state_reference.ts +8 -3
  895. package/src/tx/private_tx_constant_data.ts +25 -2
  896. package/src/tx/profiling.ts +4 -4
  897. package/src/tx/proven_tx.ts +6 -0
  898. package/src/tx/public_call_request_with_calldata.ts +8 -3
  899. package/src/tx/simulated_tx.ts +22 -21
  900. package/src/tx/state_reference.ts +9 -4
  901. package/src/tx/tree_snapshots.ts +9 -4
  902. package/src/tx/tx.ts +60 -24
  903. package/src/tx/tx_constant_data.ts +8 -3
  904. package/src/tx/tx_context.ts +8 -3
  905. package/src/tx/tx_hash.ts +20 -5
  906. package/src/tx/tx_receipt.ts +265 -85
  907. package/src/tx/validator/error_texts.ts +2 -1
  908. package/src/tx/validator/tx_validator.ts +1 -5
  909. package/src/types/shared.ts +8 -13
  910. package/src/update-checker/dev_version.ts +2 -0
  911. package/src/update-checker/index.ts +1 -0
  912. package/src/update-checker/package_version.ts +10 -23
  913. package/src/validators/schemas.ts +6 -4
  914. package/src/validators/types.ts +21 -2
  915. package/src/versioning/versioning.ts +1 -1
  916. package/src/vks/verification_key.ts +5 -184
  917. package/src/world-state/genesis_data.ts +37 -0
  918. package/src/world-state/index.ts +1 -0
  919. package/src/world-state/world_state_revision.ts +9 -1
  920. package/dest/abi/mocked_keys.d.ts +0 -2
  921. package/dest/abi/mocked_keys.d.ts.map +0 -1
  922. package/dest/abi/mocked_keys.js +0 -1
  923. package/dest/block/checkpointed_l2_block.d.ts +0 -150
  924. package/dest/block/checkpointed_l2_block.d.ts.map +0 -1
  925. package/dest/block/checkpointed_l2_block.js +0 -46
  926. package/dest/config/pipelining-config.d.ts +0 -19
  927. package/dest/config/pipelining-config.d.ts.map +0 -1
  928. package/dest/config/pipelining-config.js +0 -18
  929. package/dest/interfaces/epoch-prover.d.ts +0 -57
  930. package/dest/interfaces/epoch-prover.d.ts.map +0 -1
  931. package/dest/interfaces/epoch-prover.js +0 -1
  932. package/dest/interfaces/get_logs_response.d.ts +0 -97
  933. package/dest/interfaces/get_logs_response.d.ts.map +0 -1
  934. package/dest/interfaces/get_logs_response.js +0 -12
  935. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
  936. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
  937. package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
  938. package/dest/l1-contracts/slash_factory.d.ts +0 -45
  939. package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
  940. package/dest/l1-contracts/slash_factory.js +0 -158
  941. package/dest/logs/extended_contract_class_log.d.ts +0 -51
  942. package/dest/logs/extended_contract_class_log.d.ts.map +0 -1
  943. package/dest/logs/extended_contract_class_log.js +0 -67
  944. package/dest/logs/extended_directional_app_tagging_secret.d.ts +0 -47
  945. package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +0 -1
  946. package/dest/logs/extended_directional_app_tagging_secret.js +0 -72
  947. package/dest/logs/extended_public_log.d.ts +0 -106
  948. package/dest/logs/extended_public_log.d.ts.map +0 -1
  949. package/dest/logs/extended_public_log.js +0 -73
  950. package/dest/logs/log_filter.d.ts +0 -25
  951. package/dest/logs/log_filter.d.ts.map +0 -1
  952. package/dest/logs/log_filter.js +0 -12
  953. package/dest/logs/log_id.d.ts +0 -85
  954. package/dest/logs/log_id.d.ts.map +0 -1
  955. package/dest/logs/log_id.js +0 -94
  956. package/dest/logs/message_context.d.ts +0 -26
  957. package/dest/logs/message_context.d.ts.map +0 -1
  958. package/dest/logs/message_context.js +0 -70
  959. package/dest/logs/pending_tagged_log.d.ts +0 -13
  960. package/dest/logs/pending_tagged_log.d.ts.map +0 -1
  961. package/dest/logs/pending_tagged_log.js +0 -34
  962. package/dest/logs/tx_scoped_l2_log.d.ts +0 -51
  963. package/dest/logs/tx_scoped_l2_log.d.ts.map +0 -1
  964. package/dest/logs/tx_scoped_l2_log.js +0 -77
  965. package/dest/slashing/empire.d.ts +0 -31
  966. package/dest/slashing/empire.d.ts.map +0 -1
  967. package/dest/slashing/empire.js +0 -87
  968. package/src/abi/mocked_keys.ts +0 -2
  969. package/src/block/checkpointed_l2_block.ts +0 -70
  970. package/src/config/pipelining-config.ts +0 -31
  971. package/src/interfaces/epoch-prover.ts +0 -72
  972. package/src/interfaces/get_logs_response.ts +0 -35
  973. package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
  974. package/src/l1-contracts/slash_factory.ts +0 -180
  975. package/src/logs/extended_contract_class_log.ts +0 -87
  976. package/src/logs/extended_directional_app_tagging_secret.ts +0 -87
  977. package/src/logs/extended_public_log.ts +0 -94
  978. package/src/logs/log_filter.ts +0 -36
  979. package/src/logs/log_id.ts +0 -125
  980. package/src/logs/message_context.ts +0 -72
  981. package/src/logs/pending_tagged_log.ts +0 -39
  982. package/src/logs/tx_scoped_l2_log.ts +0 -114
  983. package/src/slashing/empire.ts +0 -104
package/src/gas/README.md CHANGED
@@ -1,47 +1,69 @@
1
1
  # Aztec Gas and Fee Model
2
2
 
3
3
  The minimum fee per mana and its components are computed on L1 in
4
- `l1-contracts/src/core/libraries/rollup/FeeLib.sol`. This document describes the
5
- formulas, the oracle lag/lifetime mechanism, and the TypeScript types in this directory.
4
+ `l1-contracts/src/core/libraries/rollup/FeeLib.sol` (`fee_math.ts` in this directory is a
5
+ TypeScript port of those formulas, used to predict fees a few slots ahead). This document
6
+ describes the formulas, the oracle lag/lifetime mechanism, how a transaction's fee is
7
+ derived from them, the gas and data limits, and the TypeScript types in this directory.
6
8
 
7
9
  ## Mana
8
10
 
9
- Aztec uses **mana** as its unit of work (analogous to Ethereum gas). Transactions consume
10
- mana in two dimensions: **DA** (data availability) and **L2** (execution). The total fee
11
- is `gasUsed * feePerMana` summed across both dimensions.
11
+ Aztec meters work as gas in two dimensions: **DA** (data availability, i.e. blob data
12
+ published to L1) and **L2** (execution). The L2 dimension is called **mana** (analogous to
13
+ Ethereum gas): block headers track `totalManaUsed`, and the fee model below prices one unit
14
+ of mana. The total fee is `gasUsed * feePerGas` summed across both dimensions.
15
+
16
+ ### The DA dimension is priced at zero
17
+
18
+ Only the L2 dimension currently carries a price. When building checkpoint global variables,
19
+ the sequencer sets `feePerDaGas = 0` and sets `feePerL2Gas` to the L1-computed minimum fee
20
+ per mana (`sequencer-client/src/global_variable_builder/global_builder.ts` and
21
+ `fee_provider.ts` in the same directory). The cost of publishing data is still recovered:
22
+ the blob gas a checkpoint pays on L1 is part of the *sequencer cost* component of the mana
23
+ fee below. DA gas remains fully metered and limited (see
24
+ [Gas and Data Limits](#gas-and-data-limits)) — it bounds how much data a tx or checkpoint
25
+ may publish — it just contributes nothing to the fee today.
12
26
 
13
27
  ## Fee Components
14
28
 
15
- The minimum fee per mana has four components:
29
+ The minimum fee per mana has four components. All are computed in ETH (wei) per mana and
30
+ converted to the fee asset at the end (see [Fee Asset Price](#fee-asset-price)).
16
31
 
17
32
  ### Sequencer Cost
18
33
 
19
34
  L1 cost to propose a checkpoint (calldata gas + blob data), amortized over `manaTarget`:
20
35
 
21
36
  ```
22
- sequencerCost = ((L1_GAS_PER_CHECKPOINT_PROPOSED * baseFee)
37
+ sequencerCost = ceil(((L1_GAS_PER_CHECKPOINT_PROPOSED * baseFee)
23
38
  + (BLOBS_PER_CHECKPOINT * BLOB_GAS_PER_BLOB * blobFee))
24
- / manaTarget
39
+ / manaTarget)
25
40
  ```
26
41
 
42
+ Note that `BLOBS_PER_CHECKPOINT` here is FeeLib's own constant (3), not the protocol blob
43
+ capacity of the same name (6) — see the note under [Key Constants](#key-constants).
44
+
27
45
  ### Prover Cost
28
46
 
29
47
  L1 cost to verify an epoch proof, amortized over epoch duration and `manaTarget`, plus a
30
48
  governance-set proving cost that compensates for off-chain proof generation:
31
49
 
32
50
  ```
33
- proverCost = (L1_GAS_PER_EPOCH_VERIFIED * baseFee / epochDuration) / manaTarget
51
+ proverCost = ceil(ceil((L1_GAS_PER_EPOCH_VERIFIED * baseFee) / epochDuration) / manaTarget)
34
52
  + provingCostPerMana
35
53
  ```
36
54
 
55
+ Updates to `provingCostPerMana` are rate-limited on L1 (`FeeLib.updateProvingCostPerMana`):
56
+ at most one update every 30 days, each moving the value by at most ×1.5 (or ÷1.5), with a
57
+ floor of 2 wei per mana.
58
+
37
59
  ### Congestion Cost
38
60
 
39
61
  An exponential surcharge when the network is congested (inspired by EIP-1559; the
40
62
  implementation uses the `fakeExponential` Taylor series approximation from EIP-4844):
41
63
 
42
64
  ```
43
- baseCost = sequencerCost + proverCost
44
- congestionCost = baseCost * congestionMultiplier / MINIMUM_CONGESTION_MULTIPLIER - baseCost
65
+ baseCost = sequencerCost + proverCost
66
+ congestionCost = floor(baseCost * congestionMultiplier / MINIMUM_CONGESTION_MULTIPLIER) - baseCost
45
67
  ```
46
68
 
47
69
  When there is no congestion the multiplier equals `MINIMUM_CONGESTION_MULTIPLIER` (1e9)
@@ -50,11 +72,15 @@ and congestion cost is zero.
50
72
  ### Congestion Multiplier
51
73
 
52
74
  ```
53
- excessMana = max(0, prevExcessMana + prevManaUsed - manaTarget)
54
- congestionMultiplier = fakeExponential(MINIMUM_CONGESTION_MULTIPLIER, excessMana, denominator)
75
+ excessMana = max(0, prevExcessMana + prevManaUsed - manaTarget)
76
+ denominator = manaTarget * 854,700,854 / 1e8 ≈ 8.547 * manaTarget
77
+ congestionMultiplier = fakeExponential(MINIMUM_CONGESTION_MULTIPLIER,
78
+ min(excessMana, 100 * denominator), denominator)
55
79
  ```
56
80
 
57
- Each additional `manaTarget` of excess mana increases the multiplier by ~12.5%.
81
+ Each additional `manaTarget` of excess mana multiplies the fee by `e^(1/8.547) ≈ 1.124`,
82
+ i.e. ~12.5%. The exponent is capped at 100 (multiplier ≤ ~2.7e43 × the minimum) to keep
83
+ the Taylor series from overflowing.
58
84
 
59
85
  ### Total
60
86
 
@@ -62,6 +88,11 @@ Each additional `manaTarget` of excess mana increases the multiplier by ~12.5%.
62
88
  minFeePerMana = sequencerCost + proverCost + congestionCost
63
89
  ```
64
90
 
91
+ Each component is converted from ETH to the fee asset individually (rounding up) before
92
+ summing. The sum is capped at `type(uint128).max` (`FeeLib.summedMinFee`) so it always fits
93
+ the proposal header's `feePerL2Gas` field — without the cap, extreme congestion could
94
+ produce a fee no valid header can represent, halting the chain.
95
+
65
96
  ## L1 Gas Oracle: Lag and Lifetime
66
97
 
67
98
  The oracle feeds Ethereum's `baseFee` and `blobFee` into the fee model using a two-phase
@@ -70,9 +101,9 @@ The oracle feeds Ethereum's `baseFee` and `blobFee` into the fee model using a t
70
101
  - **LAG = 2 slots** — when new L1 fees are observed, they activate `LAG` slots later
71
102
  (`slotOfChange = currentSlot + LAG`). This gives mempool transactions time to land
72
103
  before fees change.
73
- - **LIFETIME = 5 slots** — after an oracle update, the next update is rejected until
74
- `slotOfChange + (LIFETIME - LAG)` = 3 more slots have passed. This rate-limits how
75
- frequently L1 fee data can change.
104
+ - **LIFETIME = 5 slots** — after an oracle update, further updates are ignored
105
+ (`updateL1GasFeeOracle` returns without effect) until `slotOfChange + (LIFETIME - LAG)`
106
+ = 3 more slots have passed. This rate-limits how frequently L1 fee data can change.
76
107
 
77
108
  Fee resolution at a given timestamp:
78
109
 
@@ -84,40 +115,204 @@ else → use post (new fees)
84
115
  **Net effect**: L1 fee changes reach L2 with a 2-slot delay and can update at most once
85
116
  every 5 slots.
86
117
 
118
+ Because queued values only activate `LAG` slots later, the min fee for the next `LAG`
119
+ slots is fully determined by current on-chain state. `fee_math.ts` ports the FeeLib
120
+ formulas so the sequencer can predict min fees over that window (`FeePredictor` in
121
+ `sequencer-client/src/global_variable_builder`), under a configurable mana-usage
122
+ assumption (`ManaUsageEstimate`: none / target / limit).
123
+
124
+ ### Worked Example
125
+
126
+ Suppose the oracle is updated at slot 10 with new L1 fees. Here is the timeline:
127
+
128
+ ```
129
+ Slot Oracle state Active fees Notes
130
+ ──── ──────────────────── ──────────── ──────────────────────────────────
131
+ 10 pre=A, post=B, soc=12 A Update queued. slotOfChange = 10 + LAG = 12.
132
+ 11 (same) A Still before slotOfChange → pre (A).
133
+ 12 (same) B slot >= slotOfChange → post (B) activates.
134
+ 13 (same) B B remains active.
135
+ 14 (same) B B remains active.
136
+ 15 Update allowed again B Earliest next update: soc + (LIFETIME - LAG)
137
+ = 12 + 3 = 15.
138
+ ```
139
+
140
+ Key observations:
141
+
142
+ 1. **Slots 10-11**: The old fees (A) are still in effect. Transactions submitted during
143
+ these slots see the old L1 cost. This is the **LAG** window — it gives pending
144
+ transactions 2 slots to land before fees change.
145
+
146
+ 2. **Slot 12**: The new fees (B) activate. Any checkpoint proposed at slot >= 12 uses B
147
+ for its sequencer/prover cost calculation.
148
+
149
+ 3. **Slots 12-14**: No new oracle update is accepted. The system is in a **cooldown**
150
+ period of `LIFETIME - LAG = 3` slots after the transition.
151
+
152
+ 4. **Slot 15**: A new oracle update can be queued (earliest `acceptableSlot`). If
153
+ triggered, the new values would activate at slot 15 + LAG = 17.
154
+
87
155
  ## Fee Asset Price
88
156
 
89
- Fees are computed in ETH internally but converted to the fee asset (Fee Juice) via
90
- `ethPerFeeAsset` (1e12 precision). The price updates at most ±1% (±100 bps) per
91
- checkpoint:
157
+ Fees are computed in ETH (wei) internally and converted to the fee asset (Fee Juice) via
158
+ `ethPerFeeAsset` (1e12 precision), rounding up (`PriceLib.toFeeAsset` in
159
+ `l1-contracts/src/core/libraries/compressed-data/fees/FeeConfig.sol`).
160
+
161
+ Each checkpoint proposal carries a fee-asset price modifier (`OracleInput`) chosen by the
162
+ proposer, bounded to ±1% (±100 bps) per checkpoint:
92
163
 
93
164
  ```
94
165
  newPrice = currentPrice * (10000 + modifierBps) / 10000
95
166
  ```
96
167
 
168
+ The result is clamped to [`MIN_ETH_PER_FEE_ASSET` = 100, `MAX_ETH_PER_FEE_ASSET` = 1e14],
169
+ i.e. 1e-10 to 100 ETH per fee asset. The floor of 100 guarantees a ±1% step always moves
170
+ the integer price by at least 1.
171
+
172
+ ## Transaction Fees
173
+
174
+ The checkpoint's `gasFees` (the L1-computed min fee per mana, with DA priced at zero) act
175
+ as a base fee. Senders declare `GasSettings`: gas limits, teardown gas limits,
176
+ `maxFeesPerGas`, and `maxPriorityFeesPerGas`. A tx is only includable if `maxFeesPerGas`
177
+ covers the checkpoint's `gasFees` in both dimensions. The effective fee adds an
178
+ EIP-1559-style priority fee on top of the base, capped by the max
179
+ (`computeEffectiveGasFees` in `stdlib/src/fees/transaction_fee.ts`):
180
+
181
+ ```
182
+ effectiveFeePerGas = gasFees + min(maxPriorityFeePerGas, maxFeesPerGas - gasFees) (per dimension)
183
+ transactionFee = billedGas.daGas * effectiveFeePerDaGas + billedGas.l2Gas * effectiveFeePerL2Gas
184
+ ```
185
+
186
+ `billedGas` is actual consumption except for the teardown phase, which is billed at the
187
+ declared `teardownGasLimits` rather than actual usage — the fee is charged during teardown
188
+ itself, before actual teardown consumption is known.
189
+
97
190
  ## Maximum Fee Change Rate
98
191
 
99
- | Component | Bound |
100
- | ---------------------- | ------------------------------------------------------- |
101
- | L1 base fee / blob fee | At most once every 5 slots (oracle LIFETIME) |
102
- | Fee asset price | ±1% per checkpoint |
192
+ | Component | Bound |
193
+ | ---------------------- | -------------------------------------------------------- |
194
+ | L1 base fee / blob fee | At most once every 5 slots (oracle LIFETIME) |
195
+ | Fee asset price | ±1% per checkpoint |
196
+ | Proving cost per mana | At most ×1.5 (or ÷1.5) per update, one update per 30 days |
103
197
  | Congestion multiplier | Depends on excess mana accumulation/drain per checkpoint |
104
- | Sequencer/prover costs | Scale linearly with L1 fees |
198
+ | Sequencer/prover costs | Scale linearly with L1 fees |
105
199
 
106
200
  ## Key Constants
107
201
 
108
- | Constant | Value |
109
- | ------------------------------ | -------------- |
110
- | `L1_GAS_PER_CHECKPOINT_PROPOSED` | 300,000 |
111
- | `L1_GAS_PER_EPOCH_VERIFIED` | 3,600,000 |
112
- | `BLOBS_PER_CHECKPOINT` | 3 |
113
- | `BLOB_GAS_PER_BLOB` | 2^17 |
114
- | `MINIMUM_CONGESTION_MULTIPLIER` | 1e9 |
115
- | `LAG` | 2 slots |
116
- | `LIFETIME` | 5 slots |
202
+ | Constant | Value |
203
+ | ------------------------------- | -------------- |
204
+ | `L1_GAS_PER_CHECKPOINT_PROPOSED` | 300,000 |
205
+ | `L1_GAS_PER_EPOCH_VERIFIED` | 3,600,000 |
206
+ | `BLOBS_PER_CHECKPOINT` (FeeLib) | 3 |
207
+ | `BLOB_GAS_PER_BLOB` | 2^17 |
208
+ | `MINIMUM_CONGESTION_MULTIPLIER` | 1e9 |
209
+ | `LAG` | 2 slots |
210
+ | `LIFETIME` | 5 slots |
211
+ | `MIN_ETH_PER_FEE_ASSET` | 100 (1e-10 ETH) |
212
+ | `MAX_ETH_PER_FEE_ASSET` | 1e14 (100 ETH) |
213
+
214
+ ⚠️ Name clash: `FeeLib.sol` (and its port `fee_math.ts`) defines `BLOBS_PER_CHECKPOINT = 3`,
215
+ used only to price the sequencer's blob costs. The protocol constant of the same name in
216
+ `@aztec/constants` is **6** — the actual blob capacity of a checkpoint, used throughout the
217
+ limits section below. The FeeLib value is a holdover from the pre-checkpoint
218
+ `BLOBS_PER_BLOCK`, so the fee model prices half of a full checkpoint's blobs.
219
+
220
+ ## Gas and Data Limits
221
+
222
+ The fee model above is *how much you pay* per unit of gas; this section is *how much you may use*. Limits
223
+ form a hierarchy from a single transaction up to a whole checkpoint, and a tx that is admissible for relay
224
+ must also be buildable into a block and fit a valid checkpoint.
225
+
226
+ ### Per-tx protocol maxima
227
+
228
+ Hard ceilings on what any single tx may declare, independent of network configuration. Declaring more is
229
+ rejected everywhere a tx is validated.
230
+
231
+ - **`MAX_TX_DA_GAS`** (271,200) — `MAX_TX_BLOB_DATA_SIZE_IN_FIELDS` (8,475) × `DA_GAS_PER_FIELD` (32). This
232
+ is the most DA a single tx's effects can encode into a blob, so it is the most DA gas a tx could ever use.
233
+ Defined in `constants/src/constants.ts`.
234
+ - **`MAX_PROCESSABLE_L2_GAS`** (6,540,000) — the AVM's maximum processable L2 gas, derived in Noir as
235
+ `PUBLIC_TX_L2_GAS_OVERHEAD + AVM_MAX_PROCESSABLE_L2_GAS` (`constants/src/constants.gen.ts`).
236
+
237
+ ### Network admission limits
238
+
239
+ The most a single tx may *declare* and still be relayed across the network. Computed by
240
+ `computeNetworkTxGasLimits` in `tx_gas_limits.ts` per dimension as:
241
+
242
+ ```
243
+ min(per-tx max, ceil(checkpointBudget / blocksPerCheckpoint * minMultiplier))
244
+ ```
245
+
246
+ The per-block share mirrors what a proposer grants the first block of a checkpoint
247
+ (`CheckpointBuilder.capLimitsByCheckpointBudgets`), so a tx declaring this much is packable into a block.
248
+ The network-minimum multipliers are `MIN_PER_BLOCK_ALLOCATION_MULTIPLIER` (1.2, L2 and tx count) and
249
+ `MIN_PER_BLOCK_DA_ALLOCATION_MULTIPLIER` (1.5, DA). DA's is higher so a maximal contract class
250
+ registration (~97k DA gas) fits a single block at mainnet geometry (72s slots, 6s blocks → 10 blocks per
251
+ checkpoint).
252
+
253
+ The DA budget is `getDaCheckpointBudgetForTxs(maxBlocksPerCheckpoint)`, not the raw
254
+ `MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT` (786,432). Blob encoding spends overhead fields that no tx pays DA
255
+ gas for — one checkpoint-end marker field and the per-block block-end fields (7 for the first block, 6 for
256
+ each subsequent block, `blob-lib/src/encoding/block_blob_data.ts`) — so the raw constant is unattainable. The
257
+ getter nets out the full overhead for a checkpoint of `maxBlocksPerCheckpoint` blocks: at mainnet geometry
258
+ (10 blocks) that is `(24,576 − 1 − 7 − 9×6) × 32 = 24,514 × 32 = 784,448` DA gas. Subtracting every block's
259
+ overhead (not just the first) keeps admission at or below the builder's first-block blob-field cap at every
260
+ geometry — the builder is the most generous for the first block (it only reserves that block's own block-end
261
+ overhead), so being conservative here is what guarantees admitted ⇒ buildable. Without this netting a tx
262
+ near the raw limit would be admitted but never buildable.
263
+
264
+ These limits depend on network-wide inputs only (timetable-derived blocks-per-checkpoint, checkpoint
265
+ budgets, the network-minimum multipliers), never on a node's local restrictiveness. Every node always
266
+ advertises them in `NodeInfo.txsLimits` (a required field); wallets read it and pass `txsLimits.gas` to
267
+ `GasSettings.fallback` as the default gas limits when sending without explicit limits, and they are enforced
268
+ by `GasLimitsValidator` (clamped to the per-tx protocol maxima) at three points: RPC tx acceptance
269
+ (`aztec-node/src/aztec-node/server.ts`), gossip validation (`p2p/src/services/libp2p/libp2p_service.ts`),
270
+ and pending-pool admission (`p2p/src/client/factory.ts`). They are deliberately *not* enforced at req/resp or
271
+ block-proposal validation — admission is relay policy, not block validity.
272
+
273
+ ### Per-block builder budgets
274
+
275
+ While packing a checkpoint, `CheckpointBuilder.capLimitsByCheckpointBudgets`
276
+ (`validator-client/src/checkpoint_builder.ts`) computes each block's budget as a fair share of the remaining
277
+ checkpoint budget across the remaining blocks, scaled by the configured multipliers. Operators may raise the
278
+ multipliers above the network minimums but not lower them — the sequencer fails startup otherwise
279
+ (`assertConfigMeetsNetworkTxLimits` in `sequencer-client/src/sequencer/sequencer.ts`), since a node that
280
+ allocates less than it admits would accept txs over RPC/gossip that its builder can never pack.
281
+
282
+ The fair share is then min'ed with the operator's absolute per-block caps `maxL2BlockGas` / `maxDABlockGas`
283
+ and the blob-field cap (checkpoint capacity net of the checkpoint-end marker and this block's block-end
284
+ overhead). The absolute caps are allowed to be restrictive: a cap below the network admission limit only
285
+ produces a startup warning, not a failure, because such txs simply stay in the pool for other proposers to
286
+ include.
287
+
288
+ ### Per-checkpoint budgets
289
+
290
+ The outermost limits, enforced as proposal validity in `validateCheckpointLimits`
291
+ (`stdlib/src/checkpoint/validate.ts`) and physically by blob encoding:
292
+
293
+ - **Mana** — total L2 gas across all blocks ≤ `rollupManaLimit` (= `manaTarget × 2` on L1,
294
+ `l1-contracts/src/core/libraries/rollup/FeeLib.sol`).
295
+ - **DA gas** — total DA gas ≤ raw `MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT` (786,432).
296
+ - **Blob fields** — total ≤ `BLOBS_PER_CHECKPOINT × FIELDS_PER_BLOB` (6 × 4,096 = 24,576).
297
+ - **Tx counts** — total txs ≤ `maxTxsPerCheckpoint` when configured.
298
+
299
+ ### Summary
300
+
301
+ | Limit | Value (mainnet defaults) | Scope | Where enforced |
302
+ | --------------------------------------- | ------------------------------- | ------------- | ----------------------------------------------------------- |
303
+ | `MAX_TX_DA_GAS` | 271,200 | per-tx | every gas validator (hard ceiling) |
304
+ | `MAX_PROCESSABLE_L2_GAS` | 6,540,000 | per-tx | every gas validator (hard ceiling) |
305
+ | Network DA admission limit | min(271,200, ceil(784,448/10×1.5)) = 117,668 | per-tx (relay) | RPC, gossip, pending pool (`GasLimitsValidator`) |
306
+ | Network L2 admission limit | min(6,540,000, ceil(manaLimit/10×1.2)) | per-tx (relay) | RPC, gossip, pending pool (`GasLimitsValidator`) |
307
+ | Per-block fair share + caps | remaining budget / blocks × multiplier, min absolute caps & blob-field cap | per-block | `CheckpointBuilder.capLimitsByCheckpointBudgets` |
308
+ | `rollupManaLimit` | `manaTarget × 2` | per-checkpoint | `validateCheckpointLimits` |
309
+ | `MAX_PROCESSABLE_DA_GAS_PER_CHECKPOINT` | 786,432 | per-checkpoint | `validateCheckpointLimits` + blob encoding |
310
+ | `BLOBS_PER_CHECKPOINT × FIELDS_PER_BLOB`| 24,576 | per-checkpoint | `validateCheckpointLimits` + blob encoding |
117
311
 
118
312
  ## TypeScript Types
119
313
 
120
- - **`Gas`** — mana quantity in two dimensions (`daGas`, `l2Gas`).
314
+ - **`Gas`** — gas quantity in two dimensions (`daGas`, `l2Gas`).
121
315
  - **`GasFees`** — per-unit price in each dimension (`feePerDaGas`, `feePerL2Gas`).
122
316
  - **`GasSettings`** — sender-chosen fee parameters: gas limits, teardown limits, max fees, priority fees.
123
317
  - **`GasUsed`** — actual consumption after execution. Note: `billedGas` uses the teardown gas *limit*, not actual usage.
318
+ - **`fee_math.ts`** — TypeScript port of the FeeLib formulas, used for fee prediction over the oracle LAG window.
@@ -0,0 +1,120 @@
1
+ /**
2
+ * TypeScript port of fee computation logic from FeeLib.sol.
3
+ * Used to predict worst-case min fees over a future window of L2 slots.
4
+ */
5
+
6
+ // Constants matching FeeLib.sol
7
+ export const MINIMUM_CONGESTION_MULTIPLIER = 1_000_000_000n;
8
+ export const L1_GAS_PER_CHECKPOINT_PROPOSED = 300_000n;
9
+ export const L1_GAS_PER_EPOCH_VERIFIED = 3_600_000n;
10
+ export const BLOBS_PER_CHECKPOINT = 3n;
11
+ export const BLOB_GAS_PER_BLOB = 2n ** 17n;
12
+ export const MAGIC_CONGESTION_VALUE_MULTIPLIER = 854_700_854n;
13
+ export const MAGIC_CONGESTION_VALUE_DIVISOR = 100_000_000n;
14
+ export const ETH_PER_FEE_ASSET_PRECISION = 1_000_000_000_000n;
15
+ export const MIN_ETH_PER_FEE_ASSET = 100n;
16
+
17
+ /** Number of L2 slots of lag before new oracle values activate. Defines the prediction window. */
18
+ export const FEE_ORACLE_LAG = 2;
19
+
20
+ /** Expected mana usage per checkpoint for fee prediction. */
21
+ export enum ManaUsageEstimate {
22
+ /** No usage — fees decrease as congestion drains. */
23
+ None = 'none',
24
+ /** Target usage — congestion stays roughly flat (steady state). */
25
+ Target = 'target',
26
+ /** Limit usage (2x target) — worst case, congestion grows maximally. */
27
+ Limit = 'limit',
28
+ }
29
+
30
+ /** Parameters for computing the mana min fee at a given point in time. */
31
+ export type ManaMinFeeParams = {
32
+ l1BaseFee: bigint;
33
+ l1BlobFee: bigint;
34
+ manaTarget: bigint;
35
+ epochDuration: bigint;
36
+ provingCostPerManaEth: bigint;
37
+ excessMana: bigint;
38
+ ethPerFeeAsset: bigint;
39
+ };
40
+
41
+ /**
42
+ * Taylor series approximation of `factor * e^(numerator/denominator)`.
43
+ * Direct port of FeeLib.sol fakeExponential (EIP-4844 style).
44
+ */
45
+ export function fakeExponential(factor: bigint, numerator: bigint, denominator: bigint): bigint {
46
+ let i = 1n;
47
+ let output = 0n;
48
+ let numeratorAccumulator = factor * denominator;
49
+ while (numeratorAccumulator > 0n) {
50
+ output += numeratorAccumulator;
51
+ numeratorAccumulator = (numeratorAccumulator * numerator) / (denominator * i);
52
+ i += 1n;
53
+ }
54
+ return output / denominator;
55
+ }
56
+
57
+ /** Computes excess mana for the next checkpoint, clamped to zero. */
58
+ export function computeExcessMana(prevExcessMana: bigint, prevManaUsed: bigint, manaTarget: bigint): bigint {
59
+ const sum = prevExcessMana + prevManaUsed;
60
+ return sum > manaTarget ? sum - manaTarget : 0n;
61
+ }
62
+
63
+ /** Computes the congestion multiplier from excess mana (1e9 = no congestion). */
64
+ export function computeCongestionMultiplier(excessMana: bigint, manaTarget: bigint): bigint {
65
+ const denominator = (manaTarget * MAGIC_CONGESTION_VALUE_MULTIPLIER) / MAGIC_CONGESTION_VALUE_DIVISOR;
66
+ const cappedNumerator = excessMana < denominator * 100n ? excessMana : denominator * 100n;
67
+ return fakeExponential(MINIMUM_CONGESTION_MULTIPLIER, cappedNumerator, denominator);
68
+ }
69
+
70
+ /** Ceiling division for positive bigints. */
71
+ function ceilDiv(a: bigint, b: bigint): bigint {
72
+ return (a + b - 1n) / b;
73
+ }
74
+
75
+ /** Converts an ETH value to fee asset value using ethPerFeeAsset (1e12 precision). */
76
+ function toFeeAsset(ethValue: bigint, ethPerFeeAsset: bigint): bigint {
77
+ if (ethPerFeeAsset === 0n) {
78
+ return 0n;
79
+ }
80
+ return ceilDiv(ethValue * ETH_PER_FEE_ASSET_PRECISION, ethPerFeeAsset);
81
+ }
82
+
83
+ /**
84
+ * Computes the full mana min fee (sequencer + prover + congestion) in fee asset terms.
85
+ * Mirrors FeeLib.getManaMinFeeComponentsAt + summedMinFee.
86
+ */
87
+ export function computeManaMinFee(params: ManaMinFeeParams): bigint {
88
+ const { l1BaseFee, l1BlobFee, manaTarget, epochDuration, provingCostPerManaEth, excessMana, ethPerFeeAsset } = params;
89
+
90
+ if (manaTarget === 0n) {
91
+ return 0n;
92
+ }
93
+
94
+ // Sequencer cost per mana (in ETH)
95
+ const ethUsed = L1_GAS_PER_CHECKPOINT_PROPOSED * l1BaseFee + BLOBS_PER_CHECKPOINT * BLOB_GAS_PER_BLOB * l1BlobFee;
96
+ const sequencerCostEth = ceilDiv(ethUsed, manaTarget);
97
+
98
+ // Prover cost per mana (in ETH): L1 verification gas + governance-set proving cost
99
+ const proverCostEth =
100
+ ceilDiv(ceilDiv(L1_GAS_PER_EPOCH_VERIFIED * l1BaseFee, epochDuration), manaTarget) + provingCostPerManaEth;
101
+
102
+ // Total base cost in ETH (congestion is computed on this)
103
+ const totalEth = sequencerCostEth + proverCostEth;
104
+
105
+ // Congestion multiplier and cost (in ETH)
106
+ const congestionMul = computeCongestionMultiplier(excessMana, manaTarget);
107
+ const congestionCostEth = (totalEth * congestionMul) / MINIMUM_CONGESTION_MULTIPLIER - totalEth;
108
+
109
+ // Convert all components to fee asset
110
+ const clampedEthPerFeeAsset = ethPerFeeAsset < MIN_ETH_PER_FEE_ASSET ? MIN_ETH_PER_FEE_ASSET : ethPerFeeAsset;
111
+ const sequencerCost = toFeeAsset(sequencerCostEth, clampedEthPerFeeAsset);
112
+ const proverCost = toFeeAsset(proverCostEth, clampedEthPerFeeAsset);
113
+ const congestionCost = toFeeAsset(congestionCostEth, clampedEthPerFeeAsset);
114
+
115
+ const total = sequencerCost + proverCost + congestionCost;
116
+
117
+ // Cap at uint128 max (matching FeeLib.summedMinFee)
118
+ const UINT128_MAX = (1n << 128n) - 1n;
119
+ return total < UINT128_MAX ? total : UINT128_MAX;
120
+ }
package/src/gas/gas.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { schemas } from '@aztec/foundation/schemas';
3
- import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
3
+ import { BufferReader, BufferSink, FieldReader, serializeToFields, serializeToSink } from '@aztec/foundation/serialize';
4
4
  import type { FieldsOf } from '@aztec/foundation/types';
5
5
 
6
6
  import { inspect } from 'util';
@@ -79,8 +79,13 @@ export class Gas {
79
79
  return new Gas(reader.readNumber(), reader.readNumber());
80
80
  }
81
81
 
82
- toBuffer() {
83
- return serializeToBuffer(this.daGas, this.l2Gas);
82
+ toBuffer(): Buffer;
83
+ toBuffer(sink: BufferSink): void;
84
+ toBuffer(sink?: BufferSink): Buffer | void {
85
+ if (!sink) {
86
+ return BufferSink.serialize(this);
87
+ }
88
+ serializeToSink(sink, this.daGas, this.l2Gas);
84
89
  }
85
90
 
86
91
  [inspect.custom]() {
@@ -1,12 +1,6 @@
1
1
  import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { schemas } from '@aztec/foundation/schemas';
3
- import {
4
- BufferReader,
5
- FieldReader,
6
- bigintToUInt128BE,
7
- serializeToBuffer,
8
- serializeToFields,
9
- } from '@aztec/foundation/serialize';
3
+ import { BufferReader, BufferSink, FieldReader, serializeToFields } from '@aztec/foundation/serialize';
10
4
  import type { FieldsOf } from '@aztec/foundation/types';
11
5
 
12
6
  import { inspect } from 'util';
@@ -15,6 +9,17 @@ import { z } from 'zod';
15
9
  import type { UInt128 } from '../types/shared.js';
16
10
  import type { GasDimensions } from './gas.js';
17
11
 
12
+ /**
13
+ * Multiplies a bigint by a non-integer scalar and returns the ceiling of the result.
14
+ * Avoids converting the bigint to Number (which loses precision above 2^53) by instead
15
+ * scaling the scalar into a bigint rational and performing ceiling division.
16
+ */
17
+ function bigintMulCeil(value: bigint, scalar: number): bigint {
18
+ const SCALE = 1_000_000_000_000n; // 1e12
19
+ const scaledScalar = BigInt(Math.round(scalar * 1e12));
20
+ return (value * scaledScalar + SCALE - 1n) / SCALE;
21
+ }
22
+
18
23
  /** Gas prices for each dimension. */
19
24
  export class GasFees {
20
25
  public readonly feePerDaGas: UInt128;
@@ -60,10 +65,7 @@ export class GasFees {
60
65
  const s = BigInt(scalar);
61
66
  return new GasFees(this.feePerDaGas * s, this.feePerL2Gas * s);
62
67
  } else {
63
- return new GasFees(
64
- BigInt(Math.ceil(Number(this.feePerDaGas) * scalar)),
65
- BigInt(Math.ceil(Number(this.feePerL2Gas) * scalar)),
66
- );
68
+ return new GasFees(bigintMulCeil(this.feePerDaGas, scalar), bigintMulCeil(this.feePerL2Gas, scalar));
67
69
  }
68
70
  }
69
71
 
@@ -102,8 +104,14 @@ export class GasFees {
102
104
  return new GasFees(reader.readUInt128(), reader.readUInt128());
103
105
  }
104
106
 
105
- toBuffer() {
106
- return serializeToBuffer(bigintToUInt128BE(this.feePerDaGas), bigintToUInt128BE(this.feePerL2Gas));
107
+ toBuffer(): Buffer;
108
+ toBuffer(sink: BufferSink): void;
109
+ toBuffer(sink?: BufferSink): Buffer | void {
110
+ if (!sink) {
111
+ return BufferSink.serialize(this);
112
+ }
113
+ sink.writeBigInt(this.feePerDaGas, 16);
114
+ sink.writeBigInt(this.feePerL2Gas, 16);
107
115
  }
108
116
 
109
117
  static fromFields(fields: Fr[] | FieldReader) {
@@ -126,3 +134,8 @@ export class GasFees {
126
134
  return `GasFees { feePerDaGas=${this.feePerDaGas} feePerL2Gas=${this.feePerL2Gas} }`;
127
135
  }
128
136
  }
137
+
138
+ /** Provides projected minimum gas fees for the next block. */
139
+ export interface BlockMinFeesProvider {
140
+ getCurrentMinFees(): Promise<GasFees>;
141
+ }