@aztec/stdlib 0.0.1-commit.2f68f620 → 0.0.1-commit.3100065

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 (491) 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/abi/contract_artifact.d.ts +14 -1
  5. package/dest/abi/contract_artifact.d.ts.map +1 -1
  6. package/dest/abi/contract_artifact.js +17 -0
  7. package/dest/avm/avm.js +1 -1
  8. package/dest/avm/avm_proving_request.d.ts +70 -70
  9. package/dest/avm/contract_storage_read.d.ts +58 -0
  10. package/dest/avm/contract_storage_read.d.ts.map +1 -0
  11. package/dest/avm/contract_storage_read.js +65 -0
  12. package/dest/avm/contract_storage_update_request.d.ts +65 -0
  13. package/dest/avm/contract_storage_update_request.d.ts.map +1 -0
  14. package/dest/avm/contract_storage_update_request.js +80 -0
  15. package/dest/avm/index.d.ts +6 -1
  16. package/dest/avm/index.d.ts.map +1 -1
  17. package/dest/avm/index.js +5 -0
  18. package/dest/avm/public_call_stack_item_compressed.d.ts +43 -0
  19. package/dest/avm/public_call_stack_item_compressed.d.ts.map +1 -0
  20. package/dest/avm/public_call_stack_item_compressed.js +70 -0
  21. package/dest/avm/public_data_update_request.d.ts +62 -0
  22. package/dest/avm/public_data_update_request.d.ts.map +1 -0
  23. package/dest/avm/public_data_update_request.js +67 -0
  24. package/dest/avm/public_inner_call_request.d.ts +50 -0
  25. package/dest/avm/public_inner_call_request.d.ts.map +1 -0
  26. package/dest/avm/public_inner_call_request.js +74 -0
  27. package/dest/aztec-address/index.d.ts +35 -5
  28. package/dest/aztec-address/index.d.ts.map +1 -1
  29. package/dest/aztec-address/index.js +32 -8
  30. package/dest/block/attestation_info.d.ts +1 -1
  31. package/dest/block/attestation_info.d.ts.map +1 -1
  32. package/dest/block/attestation_info.js +7 -4
  33. package/dest/block/l2_block_source.d.ts +46 -23
  34. package/dest/block/l2_block_source.d.ts.map +1 -1
  35. package/dest/block/l2_block_source.js +15 -1
  36. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
  37. package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
  38. package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
  39. package/dest/block/l2_block_stream/index.d.ts +2 -1
  40. package/dest/block/l2_block_stream/index.d.ts.map +1 -1
  41. package/dest/block/l2_block_stream/index.js +1 -0
  42. package/dest/block/l2_block_stream/interfaces.d.ts +81 -11
  43. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  44. package/dest/block/l2_block_stream/interfaces.js +25 -1
  45. package/dest/block/l2_block_stream/l2_block_stream.d.ts +23 -15
  46. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  47. package/dest/block/l2_block_stream/l2_block_stream.js +149 -152
  48. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +6 -12
  49. package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
  50. package/dest/block/l2_block_stream/l2_tips_memory_store.js +8 -32
  51. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +17 -18
  52. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  53. package/dest/block/l2_block_stream/l2_tips_store_base.js +70 -58
  54. package/dest/block/proposal/attestations_and_signers.d.ts +19 -1
  55. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
  56. package/dest/block/proposal/attestations_and_signers.js +47 -7
  57. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  58. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  59. package/dest/block/test/l2_tips_store_test_suite.js +296 -37
  60. package/dest/block/validate_block_result.d.ts +16 -1
  61. package/dest/block/validate_block_result.d.ts.map +1 -1
  62. package/dest/block/validate_block_result.js +18 -3
  63. package/dest/checkpoint/checkpoint.js +2 -2
  64. package/dest/checkpoint/index.d.ts +2 -1
  65. package/dest/checkpoint/index.d.ts.map +1 -1
  66. package/dest/checkpoint/index.js +1 -0
  67. package/dest/checkpoint/simulation_overrides.d.ts +61 -0
  68. package/dest/checkpoint/simulation_overrides.d.ts.map +1 -0
  69. package/dest/checkpoint/simulation_overrides.js +98 -0
  70. package/dest/checkpoint/validate.d.ts +11 -3
  71. package/dest/checkpoint/validate.d.ts.map +1 -1
  72. package/dest/checkpoint/validate.js +9 -6
  73. package/dest/config/index.d.ts +2 -1
  74. package/dest/config/index.d.ts.map +1 -1
  75. package/dest/config/index.js +1 -0
  76. package/dest/config/network-consensus-config.d.ts +72 -0
  77. package/dest/config/network-consensus-config.d.ts.map +1 -0
  78. package/dest/config/network-consensus-config.js +223 -0
  79. package/dest/config/sequencer-config.d.ts +4 -2
  80. package/dest/config/sequencer-config.d.ts.map +1 -1
  81. package/dest/config/sequencer-config.js +22 -3
  82. package/dest/contract/contract_address.d.ts +5 -4
  83. package/dest/contract/contract_address.d.ts.map +1 -1
  84. package/dest/contract/contract_instance.d.ts +16 -2
  85. package/dest/contract/contract_instance.d.ts.map +1 -1
  86. package/dest/contract/contract_instance.js +45 -0
  87. package/dest/contract/deployment_info.d.ts +24 -0
  88. package/dest/contract/deployment_info.d.ts.map +1 -0
  89. package/dest/contract/deployment_info.js +3 -0
  90. package/dest/contract/index.d.ts +2 -1
  91. package/dest/contract/index.d.ts.map +1 -1
  92. package/dest/contract/index.js +1 -0
  93. package/dest/contract/interfaces/contract_data_source.d.ts +3 -5
  94. package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
  95. package/dest/contract/interfaces/contract_instance.d.ts +71 -10
  96. package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
  97. package/dest/contract/interfaces/contract_instance.js +7 -2
  98. package/dest/contract/interfaces/node-info.d.ts +11 -1
  99. package/dest/contract/interfaces/node-info.d.ts.map +1 -1
  100. package/dest/contract/interfaces/node-info.js +7 -1
  101. package/dest/contract/partial_address.d.ts +9 -3
  102. package/dest/contract/partial_address.d.ts.map +1 -1
  103. package/dest/contract/partial_address.js +8 -2
  104. package/dest/database-version/version_manager.d.ts +18 -4
  105. package/dest/database-version/version_manager.d.ts.map +1 -1
  106. package/dest/database-version/version_manager.js +76 -6
  107. package/dest/deserialization/index.d.ts +35 -3
  108. package/dest/deserialization/index.d.ts.map +1 -1
  109. package/dest/deserialization/index.js +32 -1
  110. package/dest/file-store/factory.d.ts +1 -1
  111. package/dest/file-store/factory.d.ts.map +1 -1
  112. package/dest/file-store/factory.js +7 -0
  113. package/dest/file-store/index.d.ts +2 -1
  114. package/dest/file-store/index.d.ts.map +1 -1
  115. package/dest/file-store/index.js +1 -0
  116. package/dest/file-store/memory.d.ts +24 -0
  117. package/dest/file-store/memory.d.ts.map +1 -0
  118. package/dest/file-store/memory.js +80 -0
  119. package/dest/gas/gas_settings.d.ts +7 -13
  120. package/dest/gas/gas_settings.d.ts.map +1 -1
  121. package/dest/gas/gas_settings.js +9 -16
  122. package/dest/gas/index.d.ts +2 -1
  123. package/dest/gas/index.d.ts.map +1 -1
  124. package/dest/gas/index.js +1 -0
  125. package/dest/gas/tx_gas_limits.d.ts +72 -0
  126. package/dest/gas/tx_gas_limits.d.ts.map +1 -0
  127. package/dest/gas/tx_gas_limits.js +85 -0
  128. package/dest/ha-signing/config.d.ts +19 -5
  129. package/dest/ha-signing/config.d.ts.map +1 -1
  130. package/dest/ha-signing/config.js +9 -3
  131. package/dest/ha-signing/local_config.d.ts +10 -2
  132. package/dest/ha-signing/local_config.d.ts.map +1 -1
  133. package/dest/ha-signing/local_config.js +8 -2
  134. package/dest/hash/hash.d.ts +1 -2
  135. package/dest/hash/hash.d.ts.map +1 -1
  136. package/dest/hash/hash.js +0 -7
  137. package/dest/interfaces/archiver.d.ts +12 -7
  138. package/dest/interfaces/archiver.d.ts.map +1 -1
  139. package/dest/interfaces/archiver.js +4 -2
  140. package/dest/interfaces/aztec-node-admin.d.ts +24 -17
  141. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  142. package/dest/interfaces/aztec-node-admin.js +1 -1
  143. package/dest/interfaces/aztec-node-debug.d.ts +40 -2
  144. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -1
  145. package/dest/interfaces/aztec-node-debug.js +29 -1
  146. package/dest/interfaces/aztec-node.d.ts +69 -28
  147. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  148. package/dest/interfaces/aztec-node.js +56 -20
  149. package/dest/interfaces/block-builder.d.ts +3 -1
  150. package/dest/interfaces/block-builder.d.ts.map +1 -1
  151. package/dest/interfaces/chain_tips.d.ts +8 -47
  152. package/dest/interfaces/chain_tips.d.ts.map +1 -1
  153. package/dest/interfaces/chain_tips.js +1 -6
  154. package/dest/interfaces/checkpoint_parameter.d.ts +3 -3
  155. package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -1
  156. package/dest/interfaces/checkpoint_parameter.js +3 -3
  157. package/dest/interfaces/client.d.ts +2 -1
  158. package/dest/interfaces/client.d.ts.map +1 -1
  159. package/dest/interfaces/configs.d.ts +27 -6
  160. package/dest/interfaces/configs.d.ts.map +1 -1
  161. package/dest/interfaces/configs.js +5 -1
  162. package/dest/interfaces/get_tx_by_hash_options.d.ts +9 -0
  163. package/dest/interfaces/get_tx_by_hash_options.d.ts.map +1 -0
  164. package/dest/interfaces/get_tx_by_hash_options.js +4 -0
  165. package/dest/interfaces/merkle_tree_operations.d.ts +3 -9
  166. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  167. package/dest/interfaces/p2p.d.ts +38 -9
  168. package/dest/interfaces/p2p.d.ts.map +1 -1
  169. package/dest/interfaces/p2p.js +14 -2
  170. package/dest/interfaces/private_kernel_prover.d.ts +9 -11
  171. package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
  172. package/dest/interfaces/prover-client.d.ts +2 -3
  173. package/dest/interfaces/prover-client.d.ts.map +1 -1
  174. package/dest/interfaces/prover-coordination.d.ts +15 -0
  175. package/dest/interfaces/prover-coordination.d.ts.map +1 -0
  176. package/dest/interfaces/prover-coordination.js +1 -0
  177. package/dest/interfaces/prover-node.d.ts +12 -8
  178. package/dest/interfaces/prover-node.d.ts.map +1 -1
  179. package/dest/interfaces/prover-node.js +24 -17
  180. package/dest/interfaces/proving-job.d.ts +87 -74
  181. package/dest/interfaces/proving-job.d.ts.map +1 -1
  182. package/dest/interfaces/proving-job.js +13 -4
  183. package/dest/interfaces/server.d.ts +2 -2
  184. package/dest/interfaces/server.d.ts.map +1 -1
  185. package/dest/interfaces/server.js +1 -1
  186. package/dest/interfaces/server_circuit_prover.d.ts +3 -3
  187. package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
  188. package/dest/interfaces/validator.d.ts +15 -4
  189. package/dest/interfaces/validator.d.ts.map +1 -1
  190. package/dest/interfaces/validator.js +3 -1
  191. package/dest/interfaces/world_state.d.ts +14 -1
  192. package/dest/interfaces/world_state.d.ts.map +1 -1
  193. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
  194. package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
  195. package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
  196. package/dest/kernel/hints/index.d.ts +2 -1
  197. package/dest/kernel/hints/index.d.ts.map +1 -1
  198. package/dest/kernel/hints/index.js +1 -0
  199. package/dest/kernel/hints/read_request.js +1 -1
  200. package/dest/kernel/hints/tree_leaf_read_request.d.ts +14 -0
  201. package/dest/kernel/hints/tree_leaf_read_request.d.ts.map +1 -0
  202. package/dest/kernel/hints/tree_leaf_read_request.js +33 -0
  203. package/dest/kernel/index.d.ts +2 -2
  204. package/dest/kernel/index.d.ts.map +1 -1
  205. package/dest/kernel/index.js +1 -1
  206. package/dest/kernel/log_hash.d.ts +1 -1
  207. package/dest/kernel/log_hash.d.ts.map +1 -1
  208. package/dest/kernel/log_hash.js +2 -2
  209. package/dest/kernel/note_hash.js +1 -1
  210. package/dest/kernel/nullifier.js +1 -1
  211. package/dest/kernel/private_circuit_public_inputs.d.ts +13 -3
  212. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  213. package/dest/kernel/private_circuit_public_inputs.js +14 -7
  214. package/dest/kernel/private_context_inputs.d.ts +4 -3
  215. package/dest/kernel/private_context_inputs.d.ts.map +1 -1
  216. package/dest/kernel/private_context_inputs.js +7 -3
  217. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +7 -1
  218. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  219. package/dest/kernel/private_kernel_circuit_public_inputs.js +7 -0
  220. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +2 -3
  221. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -1
  222. package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +3 -5
  223. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +2 -3
  224. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -1
  225. package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +3 -5
  226. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
  227. package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
  228. package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
  229. package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
  230. package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
  231. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
  232. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
  233. package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
  234. package/dest/kernel/private_kernel_simulated_output.d.ts +7 -1
  235. package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
  236. package/dest/kernel/private_kernel_simulated_output.js +1 -2
  237. package/dest/kernel/private_log_data.d.ts +1 -1
  238. package/dest/kernel/private_log_data.d.ts.map +1 -1
  239. package/dest/kernel/private_log_data.js +1 -1
  240. package/dest/kernel/utils/index.d.ts +2 -1
  241. package/dest/kernel/utils/index.d.ts.map +1 -1
  242. package/dest/kernel/utils/index.js +1 -0
  243. package/dest/kernel/utils/optional_number.d.ts +31 -0
  244. package/dest/kernel/utils/optional_number.d.ts.map +1 -0
  245. package/dest/kernel/utils/optional_number.js +42 -0
  246. package/dest/keys/derivation.d.ts +41 -6
  247. package/dest/keys/derivation.d.ts.map +1 -1
  248. package/dest/keys/derivation.js +49 -26
  249. package/dest/logs/app_tagging_secret.d.ts +30 -7
  250. package/dest/logs/app_tagging_secret.d.ts.map +1 -1
  251. package/dest/logs/app_tagging_secret.js +46 -39
  252. package/dest/logs/app_tagging_secret_kind.js +1 -1
  253. package/dest/logs/contract_class_log.d.ts +1 -2
  254. package/dest/logs/contract_class_log.d.ts.map +1 -1
  255. package/dest/logs/contract_class_log.js +0 -4
  256. package/dest/logs/index.d.ts +1 -3
  257. package/dest/logs/index.d.ts.map +1 -1
  258. package/dest/logs/index.js +0 -2
  259. package/dest/logs/shared_secret_derivation.d.ts +19 -6
  260. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  261. package/dest/logs/shared_secret_derivation.js +26 -11
  262. package/dest/messaging/l1_to_l2_message.d.ts +23 -2
  263. package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
  264. package/dest/messaging/l1_to_l2_message.js +36 -11
  265. package/dest/p2p/attestation_utils.d.ts +1 -1
  266. package/dest/p2p/attestation_utils.d.ts.map +1 -1
  267. package/dest/p2p/attestation_utils.js +8 -1
  268. package/dest/p2p/checkpoint_attestation.d.ts +10 -1
  269. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  270. package/dest/p2p/checkpoint_attestation.js +10 -0
  271. package/dest/p2p/checkpoint_proposal.d.ts +2 -1
  272. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  273. package/dest/p2p/consensus_payload.d.ts +2 -1
  274. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  275. package/dest/p2p/index.d.ts +2 -1
  276. package/dest/p2p/index.d.ts.map +1 -1
  277. package/dest/p2p/index.js +1 -0
  278. package/dest/p2p/interface.d.ts +5 -0
  279. package/dest/p2p/interface.d.ts.map +1 -0
  280. package/dest/p2p/interface.js +1 -0
  281. package/dest/p2p/signature_utils.d.ts +10 -1
  282. package/dest/p2p/signature_utils.d.ts.map +1 -1
  283. package/dest/p2p/signature_utils.js +9 -1
  284. package/dest/rollup/avm_proof_data.d.ts +3 -3
  285. package/dest/rollup/avm_proof_data.d.ts.map +1 -1
  286. package/dest/rollup/checkpoint_header.d.ts +8 -3
  287. package/dest/rollup/checkpoint_header.d.ts.map +1 -1
  288. package/dest/rollup/checkpoint_header.js +20 -10
  289. package/dest/stats/stats.d.ts +2 -2
  290. package/dest/stats/stats.d.ts.map +1 -1
  291. package/dest/tests/factories.d.ts +27 -1
  292. package/dest/tests/factories.d.ts.map +1 -1
  293. package/dest/tests/factories.js +40 -15
  294. package/dest/tests/mocks.d.ts +1 -1
  295. package/dest/tests/mocks.d.ts.map +1 -1
  296. package/dest/tests/mocks.js +3 -2
  297. package/dest/timetable/budgets.d.ts +57 -0
  298. package/dest/timetable/budgets.d.ts.map +1 -0
  299. package/dest/timetable/budgets.js +56 -0
  300. package/dest/timetable/build_proposer_timetable.d.ts +21 -0
  301. package/dest/timetable/build_proposer_timetable.d.ts.map +1 -0
  302. package/dest/timetable/build_proposer_timetable.js +17 -0
  303. package/dest/timetable/consensus_timetable.d.ts +70 -0
  304. package/dest/timetable/consensus_timetable.d.ts.map +1 -0
  305. package/dest/timetable/consensus_timetable.js +89 -0
  306. package/dest/timetable/index.d.ts +5 -84
  307. package/dest/timetable/index.d.ts.map +1 -1
  308. package/dest/timetable/index.js +4 -209
  309. package/dest/timetable/proposer_timetable.d.ts +106 -0
  310. package/dest/timetable/proposer_timetable.d.ts.map +1 -0
  311. package/dest/timetable/proposer_timetable.js +132 -0
  312. package/dest/trees/nullifier_membership_witness.d.ts +5 -8
  313. package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
  314. package/dest/trees/nullifier_membership_witness.js +0 -9
  315. package/dest/trees/public_data_witness.d.ts +7 -17
  316. package/dest/trees/public_data_witness.d.ts.map +1 -1
  317. package/dest/trees/public_data_witness.js +0 -27
  318. package/dest/tx/execution_payload.d.ts +1 -1
  319. package/dest/tx/execution_payload.d.ts.map +1 -1
  320. package/dest/tx/execution_payload.js +1 -1
  321. package/dest/tx/fee_provider.d.ts +2 -2
  322. package/dest/tx/fee_provider.d.ts.map +1 -1
  323. package/dest/tx/global_variable_builder.d.ts +2 -12
  324. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  325. package/dest/tx/global_variables.js +2 -2
  326. package/dest/tx/index.d.ts +2 -1
  327. package/dest/tx/index.d.ts.map +1 -1
  328. package/dest/tx/index.js +1 -0
  329. package/dest/tx/private_tx_constant_data.d.ts +18 -2
  330. package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
  331. package/dest/tx/private_tx_constant_data.js +13 -4
  332. package/dest/tx/simulated_tx.d.ts +10 -6
  333. package/dest/tx/simulated_tx.d.ts.map +1 -1
  334. package/dest/tx/tx.d.ts +9 -1
  335. package/dest/tx/tx.d.ts.map +1 -1
  336. package/dest/tx/tx.js +15 -0
  337. package/dest/tx/validator/empty_validator.d.ts +5 -0
  338. package/dest/tx/validator/empty_validator.d.ts.map +1 -0
  339. package/dest/tx/validator/empty_validator.js +7 -0
  340. package/dest/tx/validator/error_texts.d.ts +2 -2
  341. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  342. package/dest/tx/validator/error_texts.js +1 -1
  343. package/dest/world-state/genesis_data.d.ts +9 -1
  344. package/dest/world-state/genesis_data.d.ts.map +1 -1
  345. package/dest/world-state/genesis_data.js +1 -0
  346. package/dest/world-state/world_state_revision.d.ts +18 -1
  347. package/dest/world-state/world_state_revision.d.ts.map +1 -1
  348. package/dest/world-state/world_state_revision.js +20 -0
  349. package/package.json +8 -8
  350. package/src/abi/buffer.ts +13 -1
  351. package/src/abi/contract_artifact.ts +19 -0
  352. package/src/avm/avm.ts +1 -1
  353. package/src/avm/contract_storage_read.ts +77 -0
  354. package/src/avm/contract_storage_update_request.ts +93 -0
  355. package/src/avm/index.ts +5 -0
  356. package/src/avm/public_call_stack_item_compressed.ts +113 -0
  357. package/src/avm/public_data_update_request.ts +106 -0
  358. package/src/avm/public_inner_call_request.ts +85 -0
  359. package/src/aztec-address/index.ts +36 -6
  360. package/src/block/attestation_info.ts +7 -2
  361. package/src/block/l2_block_source.ts +67 -13
  362. package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
  363. package/src/block/l2_block_stream/index.ts +1 -0
  364. package/src/block/l2_block_stream/interfaces.ts +96 -10
  365. package/src/block/l2_block_stream/l2_block_stream.ts +216 -175
  366. package/src/block/l2_block_stream/l2_tips_memory_store.ts +12 -41
  367. package/src/block/l2_block_stream/l2_tips_store_base.ts +84 -93
  368. package/src/block/proposal/attestations_and_signers.ts +53 -7
  369. package/src/block/test/l2_tips_store_test_suite.ts +270 -28
  370. package/src/block/validate_block_result.ts +48 -2
  371. package/src/checkpoint/checkpoint.ts +2 -2
  372. package/src/checkpoint/index.ts +1 -0
  373. package/src/checkpoint/simulation_overrides.ts +171 -0
  374. package/src/checkpoint/validate.ts +16 -6
  375. package/src/config/index.ts +1 -0
  376. package/src/config/network-consensus-config.ts +291 -0
  377. package/src/config/sequencer-config.ts +36 -5
  378. package/src/contract/contract_address.ts +4 -3
  379. package/src/contract/contract_instance.ts +62 -1
  380. package/src/contract/deployment_info.ts +25 -0
  381. package/src/contract/index.ts +1 -0
  382. package/src/contract/interfaces/contract_data_source.ts +2 -4
  383. package/src/contract/interfaces/contract_instance.ts +26 -8
  384. package/src/contract/interfaces/node-info.ts +11 -0
  385. package/src/contract/partial_address.ts +8 -2
  386. package/src/database-version/version_manager.ts +96 -6
  387. package/src/deserialization/index.ts +35 -2
  388. package/src/file-store/factory.ts +7 -0
  389. package/src/file-store/index.ts +1 -0
  390. package/src/file-store/memory.ts +94 -0
  391. package/src/gas/README.md +92 -0
  392. package/src/gas/gas_settings.ts +11 -21
  393. package/src/gas/index.ts +1 -0
  394. package/src/gas/tx_gas_limits.ts +123 -0
  395. package/src/ha-signing/config.ts +23 -5
  396. package/src/ha-signing/local_config.ts +20 -1
  397. package/src/hash/hash.ts +0 -8
  398. package/src/interfaces/archiver.ts +14 -7
  399. package/src/interfaces/aztec-node-admin.ts +1 -1
  400. package/src/interfaces/aztec-node-debug.ts +54 -2
  401. package/src/interfaces/aztec-node.ts +121 -43
  402. package/src/interfaces/block-builder.ts +2 -0
  403. package/src/interfaces/chain_tips.ts +8 -16
  404. package/src/interfaces/checkpoint_parameter.ts +3 -3
  405. package/src/interfaces/client.ts +1 -0
  406. package/src/interfaces/configs.ts +27 -6
  407. package/src/interfaces/get_tx_by_hash_options.ts +14 -0
  408. package/src/interfaces/merkle_tree_operations.ts +2 -9
  409. package/src/interfaces/p2p.ts +29 -9
  410. package/src/interfaces/private_kernel_prover.ts +10 -12
  411. package/src/interfaces/prover-client.ts +1 -3
  412. package/src/interfaces/prover-coordination.ts +17 -0
  413. package/src/interfaces/prover-node.ts +32 -17
  414. package/src/interfaces/proving-job.ts +15 -3
  415. package/src/interfaces/server.ts +1 -1
  416. package/src/interfaces/server_circuit_prover.ts +2 -2
  417. package/src/interfaces/validator.ts +11 -0
  418. package/src/interfaces/world_state.ts +14 -0
  419. package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
  420. package/src/kernel/hints/index.ts +1 -0
  421. package/src/kernel/hints/read_request.ts +1 -1
  422. package/src/kernel/hints/tree_leaf_read_request.ts +35 -0
  423. package/src/kernel/index.ts +1 -1
  424. package/src/kernel/log_hash.ts +5 -2
  425. package/src/kernel/note_hash.ts +1 -1
  426. package/src/kernel/nullifier.ts +1 -1
  427. package/src/kernel/private_circuit_public_inputs.ts +12 -1
  428. package/src/kernel/private_context_inputs.ts +10 -3
  429. package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -0
  430. package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +0 -3
  431. package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +0 -3
  432. package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
  433. package/src/kernel/private_kernel_reset_dimensions.ts +15 -5
  434. package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
  435. package/src/kernel/private_kernel_simulated_output.ts +7 -0
  436. package/src/kernel/private_log_data.ts +4 -1
  437. package/src/kernel/utils/index.ts +1 -0
  438. package/src/kernel/utils/optional_number.ts +50 -0
  439. package/src/keys/derivation.ts +69 -24
  440. package/src/logs/app_tagging_secret.ts +62 -39
  441. package/src/logs/app_tagging_secret_kind.ts +1 -1
  442. package/src/logs/contract_class_log.ts +0 -9
  443. package/src/logs/index.ts +0 -2
  444. package/src/logs/shared_secret_derivation.ts +31 -15
  445. package/src/messaging/l1_to_l2_message.ts +51 -13
  446. package/src/p2p/attestation_utils.ts +8 -1
  447. package/src/p2p/checkpoint_attestation.ts +12 -0
  448. package/src/p2p/index.ts +1 -0
  449. package/src/p2p/interface.ts +4 -0
  450. package/src/p2p/signature_utils.ts +9 -0
  451. package/src/rollup/avm_proof_data.ts +2 -2
  452. package/src/rollup/checkpoint_header.ts +16 -2
  453. package/src/stats/stats.ts +2 -2
  454. package/src/tests/factories.ts +51 -13
  455. package/src/tests/mocks.ts +7 -2
  456. package/src/timetable/README.md +609 -0
  457. package/src/timetable/budgets.ts +87 -0
  458. package/src/timetable/build_proposer_timetable.ts +42 -0
  459. package/src/timetable/consensus_timetable.ts +126 -0
  460. package/src/timetable/index.ts +4 -304
  461. package/src/timetable/proposer_timetable.ts +190 -0
  462. package/src/timetable/timetable-example.svg +108 -0
  463. package/src/trees/nullifier_membership_witness.ts +0 -11
  464. package/src/trees/public_data_witness.ts +0 -31
  465. package/src/tx/execution_payload.ts +2 -1
  466. package/src/tx/fee_provider.ts +1 -1
  467. package/src/tx/global_variable_builder.ts +1 -17
  468. package/src/tx/global_variables.ts +2 -2
  469. package/src/tx/index.ts +1 -0
  470. package/src/tx/private_tx_constant_data.ts +25 -2
  471. package/src/tx/tx.ts +17 -0
  472. package/src/tx/validator/empty_validator.ts +7 -0
  473. package/src/tx/validator/error_texts.ts +2 -1
  474. package/src/world-state/genesis_data.ts +10 -0
  475. package/src/world-state/world_state_revision.ts +33 -0
  476. package/dest/interfaces/epoch-prover.d.ts +0 -57
  477. package/dest/interfaces/epoch-prover.d.ts.map +0 -1
  478. package/dest/interfaces/epoch-prover.js +0 -1
  479. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
  480. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
  481. package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
  482. package/dest/logs/message_context.d.ts +0 -27
  483. package/dest/logs/message_context.d.ts.map +0 -1
  484. package/dest/logs/message_context.js +0 -74
  485. package/dest/logs/pending_tagged_log.d.ts +0 -13
  486. package/dest/logs/pending_tagged_log.d.ts.map +0 -1
  487. package/dest/logs/pending_tagged_log.js +0 -34
  488. package/src/interfaces/epoch-prover.ts +0 -72
  489. package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
  490. package/src/logs/message_context.ts +0 -76
  491. package/src/logs/pending_tagged_log.ts +0 -39
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/stdlib",
3
- "version": "0.0.1-commit.2f68f620",
3
+ "version": "0.0.1-commit.3100065",
4
4
  "type": "module",
5
5
  "inherits": [
6
6
  "../package.common.json",
@@ -92,13 +92,13 @@
92
92
  },
93
93
  "dependencies": {
94
94
  "@aws-sdk/client-s3": "^3.892.0",
95
- "@aztec/bb.js": "0.0.1-commit.2f68f620",
96
- "@aztec/blob-lib": "0.0.1-commit.2f68f620",
97
- "@aztec/constants": "0.0.1-commit.2f68f620",
98
- "@aztec/ethereum": "0.0.1-commit.2f68f620",
99
- "@aztec/foundation": "0.0.1-commit.2f68f620",
100
- "@aztec/l1-artifacts": "0.0.1-commit.2f68f620",
101
- "@aztec/noir-noirc_abi": "0.0.1-commit.2f68f620",
95
+ "@aztec/bb.js": "0.0.1-commit.3100065",
96
+ "@aztec/blob-lib": "0.0.1-commit.3100065",
97
+ "@aztec/constants": "0.0.1-commit.3100065",
98
+ "@aztec/ethereum": "0.0.1-commit.3100065",
99
+ "@aztec/foundation": "0.0.1-commit.3100065",
100
+ "@aztec/l1-artifacts": "0.0.1-commit.3100065",
101
+ "@aztec/noir-noirc_abi": "0.0.1-commit.3100065",
102
102
  "@google-cloud/storage": "^7.15.0",
103
103
  "axios": "^1.15.1",
104
104
  "json-stringify-deterministic": "1.0.12",
package/src/abi/buffer.ts CHANGED
@@ -38,11 +38,23 @@ export function bufferAsFields(input: Buffer, targetLength: number): Fr[] {
38
38
  * bytecode commitment computations to diverge from what the circuit produced.
39
39
  *
40
40
  * @param fields - An output from bufferAsFields: [byteLength, ...payloadFields].
41
+ * @param maxByteLength - Optional upper bound on the declared byte length. When the field array comes
42
+ * from untrusted input (e.g. a gossiped contract-class log), pass the payload capacity so an
43
+ * attacker-declared length cannot force a large `Buffer.alloc` before the value is otherwise
44
+ * rejected. Throws if the declared length exceeds it, before allocating.
41
45
  * @returns A buffer of exactly `byteLength` bytes.
42
46
  */
43
- export function bufferFromFields(fields: Fr[]): Buffer {
47
+ export function bufferFromFields(fields: Fr[], maxByteLength?: number): Buffer {
48
+ // A valid bufferAsFields output always has at least the leading byte-length field, so an empty
49
+ // input encodes no data. Guard so `length` (the destructured head) is never undefined.
50
+ if (fields.length === 0) {
51
+ return Buffer.alloc(0);
52
+ }
44
53
  const [length, ...payload] = fields;
45
54
  const byteLength = length.toNumber();
55
+ if (maxByteLength !== undefined && byteLength > maxByteLength) {
56
+ throw new Error(`Declared byte length ${byteLength} exceeds maximum ${maxByteLength}`);
57
+ }
46
58
  const raw = Buffer.concat(payload.map(f => f.toBuffer().subarray(1)));
47
59
  if (raw.length >= byteLength) {
48
60
  return raw.subarray(0, byteLength);
@@ -61,6 +61,25 @@ export function loadContractArtifact(input: NoirCompiledContract): ContractArtif
61
61
  return generateContractArtifact(input);
62
62
  }
63
63
 
64
+ /**
65
+ * Like {@link loadContractArtifact}, but fully validates an already-processed artifact against the
66
+ * contract artifact schema before returning it. Use when loading an artifact from untrusted or
67
+ * external JSON (e.g. a file path passed to the CLI), so a malformed artifact is rejected up-front
68
+ * with a clear schema error instead of surfacing as an opaque failure later during deployment.
69
+ *
70
+ * `loadContractArtifact` only runs the shallow `isContractArtifact` shape check on already-processed
71
+ * artifacts; raw nargo output is validated via `generateContractArtifact` regardless. The returned
72
+ * object is identical to `loadContractArtifact`'s; the schema parse is used purely for validation.
73
+ * @param input - Input object as generated by nargo compile, or an already-processed artifact.
74
+ * @returns A valid contract artifact instance.
75
+ */
76
+ export function loadContractArtifactWithValidation(input: NoirCompiledContract): ContractArtifact {
77
+ if (isContractArtifact(input)) {
78
+ ContractArtifactSchema.parse(input);
79
+ }
80
+ return loadContractArtifact(input);
81
+ }
82
+
64
83
  /**
65
84
  * Gets nargo build output and returns a valid contract artifact instance.
66
85
  * Differs from loadContractArtifact() by retaining all bytecode.
package/src/avm/avm.ts CHANGED
@@ -1152,7 +1152,7 @@ export class CallStackMetadata {
1152
1152
 
1153
1153
  const { stack, leaf } = failingCall;
1154
1154
  const aztecCallStack = stack.map(call => ({
1155
- contractAddress: AztecAddress.fromField(call.contractAddress),
1155
+ contractAddress: AztecAddress.fromFieldUnsafe(call.contractAddress),
1156
1156
  functionSelector: call.calldata.length > 0 ? FunctionSelector.fromFieldOrUndefined(call.calldata[0]) : undefined,
1157
1157
  }));
1158
1158
 
@@ -0,0 +1,77 @@
1
+ import { CONTRACT_STORAGE_READ_LENGTH } from '@aztec/constants';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
+
5
+ import type { AztecAddress } from '../aztec-address/index.js';
6
+
7
+ /**
8
+ * Contract storage read operation on a specific contract.
9
+ *
10
+ * Note: Similar to `PublicDataRead` but it's from the POV of contract storage so we are not working with public data
11
+ * tree leaf index but storage slot index.
12
+ */
13
+ export class ContractStorageRead {
14
+ constructor(
15
+ /**
16
+ * Storage slot we are reading from.
17
+ */
18
+ public readonly storageSlot: Fr,
19
+ /**
20
+ * Value read from the storage slot.
21
+ */
22
+ public readonly currentValue: Fr,
23
+ /**
24
+ * Side effect counter tracking position of this event in tx execution.
25
+ */
26
+ public readonly counter: number,
27
+ /**
28
+ * Contract address whose storage is being read.
29
+ */
30
+ public contractAddress?: AztecAddress, // TODO: Should not be optional. This is a temporary hack to silo the storage slot with the correct address for nested executions.
31
+ ) {}
32
+
33
+ static from(args: { storageSlot: Fr; currentValue: Fr; counter: number; contractAddress?: AztecAddress }) {
34
+ return new ContractStorageRead(args.storageSlot, args.currentValue, args.counter, args.contractAddress);
35
+ }
36
+
37
+ toBuffer() {
38
+ return serializeToBuffer(this.storageSlot, this.currentValue, new Fr(this.counter));
39
+ }
40
+
41
+ static fromBuffer(buffer: Buffer | BufferReader) {
42
+ const reader = BufferReader.asReader(buffer);
43
+ return new ContractStorageRead(Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader).toNumber());
44
+ }
45
+
46
+ static empty() {
47
+ return new ContractStorageRead(Fr.ZERO, Fr.ZERO, 0);
48
+ }
49
+
50
+ isEmpty() {
51
+ return this.storageSlot.isZero() && this.currentValue.isZero() && this.counter == 0;
52
+ }
53
+
54
+ toFriendlyJSON() {
55
+ return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.currentValue.toFriendlyJSON()}`;
56
+ }
57
+
58
+ toFields(): Fr[] {
59
+ const fields = [this.storageSlot, this.currentValue, new Fr(this.counter)];
60
+ if (fields.length !== CONTRACT_STORAGE_READ_LENGTH) {
61
+ throw new Error(
62
+ `Invalid number of fields for ContractStorageRead. Expected ${CONTRACT_STORAGE_READ_LENGTH}, got ${fields.length}`,
63
+ );
64
+ }
65
+ return fields;
66
+ }
67
+
68
+ static fromFields(fields: Fr[] | FieldReader): ContractStorageRead {
69
+ const reader = FieldReader.asReader(fields);
70
+
71
+ const storageSlot = reader.readField();
72
+ const currentValue = reader.readField();
73
+ const counter = reader.readField().toNumber();
74
+
75
+ return new ContractStorageRead(storageSlot, currentValue, counter);
76
+ }
77
+ }
@@ -0,0 +1,93 @@
1
+ import { CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH } from '@aztec/constants';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
+ import type { FieldsOf } from '@aztec/foundation/types';
5
+
6
+ import type { AztecAddress } from '../aztec-address/index.js';
7
+
8
+ /**
9
+ * Contract storage update request for a slot on a specific contract.
10
+ *
11
+ * Note: Similar to `PublicDataUpdateRequest` but it's from the POV of contract storage so we are not working with
12
+ * public data tree leaf index but storage slot index.
13
+ */
14
+ export class ContractStorageUpdateRequest {
15
+ constructor(
16
+ /**
17
+ * Storage slot we are updating.
18
+ */
19
+ public readonly storageSlot: Fr,
20
+ /**
21
+ * New value of the storage slot.
22
+ */
23
+ public readonly newValue: Fr,
24
+ /**
25
+ * Side effect counter tracking position of this event in tx execution.
26
+ */
27
+ public readonly counter: number,
28
+ /**
29
+ * Contract address whose storage is being read.
30
+ */
31
+ public contractAddress?: AztecAddress, // TODO: Should not be optional. This is a temporary hack to silo the storage slot with the correct address for nested executions.
32
+ ) {}
33
+
34
+ toBuffer() {
35
+ return serializeToBuffer(this.storageSlot, this.newValue, this.counter);
36
+ }
37
+
38
+ static fromBuffer(buffer: Buffer | BufferReader) {
39
+ const reader = BufferReader.asReader(buffer);
40
+ return new ContractStorageUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader), reader.readNumber());
41
+ }
42
+
43
+ /**
44
+ * Create ContractStorageUpdateRequest from a fields dictionary.
45
+ * @param fields - The dictionary.
46
+ * @returns A ContractStorageUpdateRequest object.
47
+ */
48
+ static from(fields: FieldsOf<ContractStorageUpdateRequest>): ContractStorageUpdateRequest {
49
+ return new ContractStorageUpdateRequest(...ContractStorageUpdateRequest.getFields(fields));
50
+ }
51
+
52
+ /**
53
+ * Serialize into a field array. Low-level utility.
54
+ * @param fields - Object with fields.
55
+ * @returns The array.
56
+ */
57
+ static getFields(fields: FieldsOf<ContractStorageUpdateRequest>) {
58
+ return [fields.storageSlot, fields.newValue, fields.counter, fields.contractAddress] as const;
59
+ }
60
+
61
+ static empty() {
62
+ return new ContractStorageUpdateRequest(Fr.ZERO, Fr.ZERO, 0);
63
+ }
64
+
65
+ isEmpty() {
66
+ return this.storageSlot.isZero() && this.newValue.isZero();
67
+ }
68
+
69
+ toFriendlyJSON() {
70
+ return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.newValue.toFriendlyJSON()}, sideEffectCounter=${
71
+ this.counter
72
+ }`;
73
+ }
74
+
75
+ toFields(): Fr[] {
76
+ const fields = [this.storageSlot, this.newValue, new Fr(this.counter)];
77
+ if (fields.length !== CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH) {
78
+ throw new Error(
79
+ `Invalid number of fields for ContractStorageUpdateRequest. Expected ${CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH}, got ${fields.length}`,
80
+ );
81
+ }
82
+ return fields;
83
+ }
84
+
85
+ static fromFields(fields: Fr[] | FieldReader): ContractStorageUpdateRequest {
86
+ const reader = FieldReader.asReader(fields);
87
+
88
+ const storageSlot = reader.readField();
89
+ const newValue = reader.readField();
90
+
91
+ return new ContractStorageUpdateRequest(storageSlot, newValue, reader.readU32());
92
+ }
93
+ }
package/src/avm/index.ts CHANGED
@@ -3,5 +3,10 @@ export * from './avm_accumulated_data.js';
3
3
  export * from './avm_circuit_public_inputs.js';
4
4
  export * from './revert_code.js';
5
5
  export * from './public_data_write.js';
6
+ export * from './public_data_update_request.js';
7
+ export * from './contract_storage_update_request.js';
8
+ export * from './contract_storage_read.js';
9
+ export * from './public_inner_call_request.js';
10
+ export * from './public_call_stack_item_compressed.js';
6
11
  export * from './avm_proving_request.js';
7
12
  export * from './message_pack.js';
@@ -0,0 +1,113 @@
1
+ import { PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH } from '@aztec/constants';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
4
+ import type { FieldsOf } from '@aztec/foundation/types';
5
+
6
+ import { AztecAddress } from '../aztec-address/index.js';
7
+ import { Gas } from '../gas/gas.js';
8
+ import { CallContext } from '../tx/call_context.js';
9
+ import { RevertCode } from './revert_code.js';
10
+
11
+ // TO BE REMOVED
12
+ /**
13
+ * Compressed call stack item on a public call.
14
+ */
15
+ export class PublicCallStackItemCompressed {
16
+ constructor(
17
+ public contractAddress: AztecAddress,
18
+ public callContext: CallContext,
19
+ public argsHash: Fr,
20
+ public returnsHash: Fr,
21
+ public revertCode: RevertCode,
22
+ /** How much gas was available for execution. */
23
+ public startGasLeft: Gas,
24
+ /** How much gas was left after execution. */
25
+ public endGasLeft: Gas,
26
+ ) {}
27
+
28
+ static getFields(fields: FieldsOf<PublicCallStackItemCompressed>) {
29
+ return [
30
+ fields.contractAddress,
31
+ fields.callContext,
32
+ fields.argsHash,
33
+ fields.returnsHash,
34
+ fields.revertCode,
35
+ fields.startGasLeft,
36
+ fields.endGasLeft,
37
+ ] as const;
38
+ }
39
+
40
+ toFields(): Fr[] {
41
+ const fields = serializeToFields(...PublicCallStackItemCompressed.getFields(this));
42
+ if (fields.length !== PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH) {
43
+ throw new Error(
44
+ `Invalid number of fields for PublicCallStackItemCompressed. Expected ${PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH}, got ${fields.length}`,
45
+ );
46
+ }
47
+ return fields;
48
+ }
49
+
50
+ toBuffer() {
51
+ return serializeToBuffer(...PublicCallStackItemCompressed.getFields(this));
52
+ }
53
+
54
+ /**
55
+ * Deserializes from a buffer or reader.
56
+ * @param buffer - Buffer or reader to read from.
57
+ * @returns The deserialized instance.
58
+ */
59
+ static fromBuffer(buffer: Buffer | BufferReader): PublicCallStackItemCompressed {
60
+ const reader = BufferReader.asReader(buffer);
61
+ return new PublicCallStackItemCompressed(
62
+ reader.readObject(AztecAddress),
63
+ reader.readObject(CallContext),
64
+ reader.readObject(Fr),
65
+ reader.readObject(Fr),
66
+ reader.readObject(RevertCode),
67
+ reader.readObject(Gas),
68
+ reader.readObject(Gas),
69
+ );
70
+ }
71
+
72
+ static fromFields(fields: Fr[] | FieldReader): PublicCallStackItemCompressed {
73
+ const reader = FieldReader.asReader(fields);
74
+
75
+ return new PublicCallStackItemCompressed(
76
+ AztecAddress.fromFields(reader),
77
+ CallContext.fromFields(reader),
78
+ reader.readField(),
79
+ reader.readField(),
80
+ RevertCode.fromFields(reader),
81
+ Gas.fromFields(reader),
82
+ Gas.fromFields(reader),
83
+ );
84
+ }
85
+
86
+ /**
87
+ * Returns a new instance of PublicCallStackItem with zero contract address, function data and public inputs.
88
+ * @returns A new instance of PublicCallStackItem with zero contract address, function data and public inputs.
89
+ */
90
+ public static empty(): PublicCallStackItemCompressed {
91
+ return new PublicCallStackItemCompressed(
92
+ AztecAddress.ZERO,
93
+ CallContext.empty(),
94
+ Fr.ZERO,
95
+ Fr.ZERO,
96
+ RevertCode.OK,
97
+ Gas.empty(),
98
+ Gas.empty(),
99
+ );
100
+ }
101
+
102
+ isEmpty() {
103
+ return (
104
+ this.contractAddress.isZero() &&
105
+ this.callContext.isEmpty() &&
106
+ this.argsHash.isEmpty() &&
107
+ this.returnsHash.isEmpty() &&
108
+ this.revertCode.equals(RevertCode.OK) &&
109
+ this.startGasLeft.isEmpty() &&
110
+ this.endGasLeft.isEmpty()
111
+ );
112
+ }
113
+ }
@@ -0,0 +1,106 @@
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
3
+
4
+ import { inspect } from 'util';
5
+
6
+ import type { AztecAddress } from '../aztec-address/index.js';
7
+ import { computePublicDataTreeLeafSlot } from '../hash/hash.js';
8
+ import type { ContractStorageUpdateRequest } from './contract_storage_update_request.js';
9
+
10
+ // TO BE REMOVED.
11
+ /**
12
+ * Write operations on the public data tree including the previous value.
13
+ */
14
+ export class PublicDataUpdateRequest {
15
+ constructor(
16
+ /**
17
+ * Index of the leaf in the public data tree which is to be updated.
18
+ */
19
+ public readonly leafSlot: Fr,
20
+ /**
21
+ * New value of the leaf.
22
+ */
23
+ public readonly newValue: Fr,
24
+ /**
25
+ * Side effect counter tracking position of this event in tx execution.
26
+ */
27
+ public readonly sideEffectCounter: number,
28
+ ) {}
29
+
30
+ static from(args: {
31
+ /**
32
+ * Index of the leaf in the public data tree which is to be updated.
33
+ */
34
+ leafIndex: Fr;
35
+ /**
36
+ * New value of the leaf.
37
+ */
38
+ newValue: Fr;
39
+
40
+ /**
41
+ * Side effect counter tracking position of this event in tx execution.
42
+ */
43
+ sideEffectCounter: number;
44
+ }) {
45
+ return new PublicDataUpdateRequest(args.leafIndex, args.newValue, args.sideEffectCounter);
46
+ }
47
+
48
+ get counter() {
49
+ return this.sideEffectCounter;
50
+ }
51
+
52
+ get position() {
53
+ return this.leafSlot;
54
+ }
55
+
56
+ toBuffer() {
57
+ return serializeToBuffer(this.leafSlot, this.newValue, this.sideEffectCounter);
58
+ }
59
+
60
+ isEmpty() {
61
+ return this.leafSlot.isZero() && this.newValue.isZero();
62
+ }
63
+
64
+ static fromFields(fields: Fr[] | FieldReader) {
65
+ const reader = FieldReader.asReader(fields);
66
+ return new PublicDataUpdateRequest(reader.readField(), reader.readField(), reader.readU32());
67
+ }
68
+
69
+ static isEmpty(x: PublicDataUpdateRequest) {
70
+ return x.isEmpty();
71
+ }
72
+
73
+ equals(other: PublicDataUpdateRequest) {
74
+ return this.leafSlot.equals(other.leafSlot) && this.newValue.equals(other.newValue);
75
+ }
76
+
77
+ static fromBuffer(buffer: Buffer | BufferReader) {
78
+ const reader = BufferReader.asReader(buffer);
79
+ return new PublicDataUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader), reader.readNumber());
80
+ }
81
+
82
+ static async fromContractStorageUpdateRequest(
83
+ contractAddress: AztecAddress,
84
+ updateRequest: ContractStorageUpdateRequest,
85
+ ) {
86
+ const leafSlot = await computePublicDataTreeLeafSlot(contractAddress, updateRequest.storageSlot);
87
+
88
+ return new PublicDataUpdateRequest(leafSlot, updateRequest.newValue, updateRequest.counter);
89
+ }
90
+
91
+ static empty() {
92
+ return new PublicDataUpdateRequest(Fr.ZERO, Fr.ZERO, 0);
93
+ }
94
+
95
+ toFriendlyJSON() {
96
+ return `Leaf=${this.leafSlot.toFriendlyJSON()}: ${this.newValue.toFriendlyJSON()}, SideEffectCounter=${
97
+ this.sideEffectCounter
98
+ }`;
99
+ }
100
+
101
+ [inspect.custom]() {
102
+ return `PublicDataUpdateRequest { leafSlot: ${this.leafSlot.toFriendlyJSON()}, newValue: ${this.newValue.toFriendlyJSON()}, sideEffectCounter: ${
103
+ this.sideEffectCounter
104
+ } }`;
105
+ }
106
+ }
@@ -0,0 +1,85 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
3
+ import type { FieldsOf } from '@aztec/foundation/types';
4
+
5
+ import { inspect } from 'util';
6
+
7
+ import { PublicCallStackItemCompressed } from './public_call_stack_item_compressed.js';
8
+
9
+ // TO BE REMOVED
10
+ /**
11
+ * Represents a request to call a public function.
12
+ */
13
+ export class PublicInnerCallRequest {
14
+ constructor(
15
+ public item: PublicCallStackItemCompressed,
16
+ /**
17
+ * The counter for this call request.
18
+ */
19
+ public counter: number,
20
+ ) {}
21
+
22
+ getSize() {
23
+ return this.isEmpty() ? 0 : this.toBuffer().length;
24
+ }
25
+
26
+ /**
27
+ * Serialize this as a buffer.
28
+ * @returns The buffer.
29
+ */
30
+ toBuffer() {
31
+ return serializeToBuffer(this.item, this.counter);
32
+ }
33
+
34
+ /**
35
+ * Deserialize this from a buffer.
36
+ * @param buffer - The bufferable type from which to deserialize.
37
+ * @returns The deserialized instance of PublicInnerCallRequest.
38
+ */
39
+ static fromBuffer(buffer: Buffer | BufferReader) {
40
+ const reader = BufferReader.asReader(buffer);
41
+ return new PublicInnerCallRequest(PublicCallStackItemCompressed.fromBuffer(reader), reader.readNumber());
42
+ }
43
+
44
+ /**
45
+ * Create PublicInnerCallRequest from a fields dictionary.
46
+ * @param fields - The dictionary.
47
+ * @returns A PublicInnerCallRequest object.
48
+ */
49
+ static from(fields: FieldsOf<PublicInnerCallRequest>): PublicInnerCallRequest {
50
+ return new PublicInnerCallRequest(...PublicInnerCallRequest.getFields(fields));
51
+ }
52
+
53
+ /**
54
+ * Serialize into a field array. Low-level utility.
55
+ * @param fields - Object with fields.
56
+ * @returns The array.
57
+ */
58
+ static getFields(fields: FieldsOf<PublicInnerCallRequest>) {
59
+ return [fields.item, fields.counter] as const;
60
+ }
61
+
62
+ toFields(): Fr[] {
63
+ return serializeToFields([this.item, this.counter]);
64
+ }
65
+
66
+ static fromFields(fields: Fr[] | FieldReader): PublicInnerCallRequest {
67
+ const reader = FieldReader.asReader(fields);
68
+ return new PublicInnerCallRequest(PublicCallStackItemCompressed.fromFields(reader), reader.readU32());
69
+ }
70
+
71
+ static empty() {
72
+ return new PublicInnerCallRequest(PublicCallStackItemCompressed.empty(), 0);
73
+ }
74
+
75
+ isEmpty(): boolean {
76
+ return this.item.isEmpty() && this.counter == 0;
77
+ }
78
+
79
+ [inspect.custom]() {
80
+ return `PublicInnerCallRequest {
81
+ item: ${this.item.toFields()}
82
+ counter: ${this.counter}
83
+ }`;
84
+ }
85
+ }
@@ -43,34 +43,64 @@ export class AztecAddress {
43
43
  static ZERO = new AztecAddress(Buffer.alloc(32, 0));
44
44
 
45
45
  /** Null msg sender address. Not part of the protocol contracts tree. */
46
- static NULL_MSG_SENDER = AztecAddress.fromBigInt(NULL_MSG_SENDER_CONTRACT_ADDRESS);
46
+ static NULL_MSG_SENDER = AztecAddress.fromBigIntUnsafe(NULL_MSG_SENDER_CONTRACT_ADDRESS);
47
47
 
48
48
  static zero(): AztecAddress {
49
49
  return AztecAddress.ZERO;
50
50
  }
51
51
 
52
- static fromField(fr: Fr) {
52
+ /**
53
+ * Builds an `AztecAddress` from a field **without checking it is a valid address** (the x-coordinate of a point on
54
+ * the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
55
+ * untrusted one, or {@link AztecAddress.random} for valid test addresses.
56
+ */
57
+ static fromFieldUnsafe(fr: Fr) {
53
58
  return new AztecAddress(fr);
54
59
  }
55
60
 
61
+ /**
62
+ * Deserializes an `AztecAddress` from a buffer. It does **not** check the value is a valid Grumpkin-curve address
63
+ * (see {@link AztecAddress.isValid}); it is meant for reading addresses from already-validated serialized data. Use
64
+ * {@link AztecAddress.random} for valid test addresses.
65
+ */
56
66
  static fromBuffer(buffer: Buffer | BufferReader) {
57
67
  return new AztecAddress(fromBuffer(buffer, Fr));
58
68
  }
59
69
 
70
+ /**
71
+ * Deserializes an `AztecAddress` from a field reader. It does **not** check the value is a valid Grumpkin-curve
72
+ * address (see {@link AztecAddress.isValid}); it is meant for reading addresses from already-validated serialized
73
+ * data. Use {@link AztecAddress.random} for valid test addresses.
74
+ */
60
75
  static fromFields(fields: Fr[] | FieldReader) {
61
76
  const reader = FieldReader.asReader(fields);
62
77
  return new AztecAddress(reader.readField());
63
78
  }
64
79
 
65
- static fromBigInt(value: bigint) {
80
+ /**
81
+ * Builds an `AztecAddress` from a bigint **without checking it is a valid address** (the x-coordinate of a point on
82
+ * the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
83
+ * untrusted one, or {@link AztecAddress.random} for valid test addresses.
84
+ */
85
+ static fromBigIntUnsafe(value: bigint) {
66
86
  return new AztecAddress(new Fr(value));
67
87
  }
68
88
 
69
- static fromNumber(value: number) {
89
+ /**
90
+ * Builds an `AztecAddress` from a number **without checking it is a valid address** (the x-coordinate of a point on
91
+ * the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to validate an
92
+ * untrusted one, or {@link AztecAddress.random} for valid test addresses.
93
+ */
94
+ static fromNumberUnsafe(value: number) {
70
95
  return new AztecAddress(new Fr(value));
71
96
  }
72
97
 
73
- static fromString(buf: string) {
98
+ /**
99
+ * Builds an `AztecAddress` from a hex string **without checking it is a valid address** (the x-coordinate of a
100
+ * point on the Grumpkin curve, which is what lets it be encrypted to). Use {@link AztecAddress.isValid} to
101
+ * validate an untrusted one, or {@link AztecAddress.random} for valid test addresses.
102
+ */
103
+ static fromStringUnsafe(buf: string) {
74
104
  return new AztecAddress(hexToBuffer(buf));
75
105
  }
76
106
 
@@ -89,7 +119,7 @@ export class AztecAddress {
89
119
  if (obj instanceof Buffer || Buffer.isBuffer(obj)) {
90
120
  return new AztecAddress(obj);
91
121
  }
92
- return AztecAddress.fromString(obj);
122
+ return AztecAddress.fromStringUnsafe(obj);
93
123
  }
94
124
 
95
125
  /**
@@ -60,9 +60,14 @@ export function getAttestationInfoFromPayload(
60
60
  return { address: attestation.address, status: 'provided-as-address' as const };
61
61
  }
62
62
 
63
- // Try to recover address from signature
63
+ // Try to recover address from signature. Recover with default opts (no allowYParityAsV): a slot
64
+ // whose recovery byte is in yParity form (v ∈ {0, 1}) is judged invalid here, matching L1 proving
65
+ // (ValidatorSelectionLib.verifyAttestations → ECDSA.recover only accepts v ∈ {27, 28}). A malicious
66
+ // proposer that lands such a slot cannot have it silently treated as valid off-chain; it is routed to
67
+ // invalid-attestation and invalidated. The gossip receipt path (recoverCoordinationSigner) stays
68
+ // lenient with allowYParityAsV; A-1351 normalizes on pool ingress and before the L1 bundle.
64
69
  try {
65
- const recoveredAddress = recoverAddress(hashedPayload, attestation.signature, { allowYParityAsV: true });
70
+ const recoveredAddress = recoverAddress(hashedPayload, attestation.signature);
66
71
  return { address: recoveredAddress, status: 'recovered-from-signature' as const };
67
72
  } catch {
68
73
  // Signature present but recovery failed