@aztec/stdlib 1.2.0 → 2.0.0-nightly.20250813

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/dest/abi/abi.d.ts +0 -67
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +1 -14
  4. package/dest/abi/authorization_selector.d.ts +52 -0
  5. package/dest/abi/authorization_selector.d.ts.map +1 -0
  6. package/dest/abi/authorization_selector.js +70 -0
  7. package/dest/abi/contract_artifact.d.ts.map +1 -1
  8. package/dest/abi/contract_artifact.js +0 -40
  9. package/dest/abi/decoder.d.ts.map +1 -1
  10. package/dest/abi/decoder.js +3 -6
  11. package/dest/abi/index.d.ts +1 -0
  12. package/dest/abi/index.d.ts.map +1 -1
  13. package/dest/abi/index.js +1 -0
  14. package/dest/avm/avm.d.ts +278 -412
  15. package/dest/avm/avm.d.ts.map +1 -1
  16. package/dest/avm/avm.js +12 -12
  17. package/dest/avm/avm_proving_request.d.ts +160 -186
  18. package/dest/avm/avm_proving_request.d.ts.map +1 -1
  19. package/dest/block/l2_block.d.ts +8 -0
  20. package/dest/block/l2_block.d.ts.map +1 -1
  21. package/dest/block/l2_block.js +9 -0
  22. package/dest/block/l2_block_source.d.ts +446 -2
  23. package/dest/block/l2_block_source.d.ts.map +1 -1
  24. package/dest/block/l2_block_source.js +29 -0
  25. package/dest/block/proposal/committee_attestation.d.ts +3 -1
  26. package/dest/block/proposal/committee_attestation.d.ts.map +1 -1
  27. package/dest/block/proposal/committee_attestation.js +3 -0
  28. package/dest/block/published_l2_block.d.ts +2 -1
  29. package/dest/block/published_l2_block.d.ts.map +1 -1
  30. package/dest/block/published_l2_block.js +6 -1
  31. package/dest/contract/contract_instance.d.ts +3 -3
  32. package/dest/contract/contract_instance.d.ts.map +1 -1
  33. package/dest/contract/contract_instance.js +3 -3
  34. package/dest/contract/interfaces/contract_class.d.ts +2 -2
  35. package/dest/contract/interfaces/protocol_contract_addresses.d.ts +9 -9
  36. package/dest/contract/interfaces/protocol_contract_addresses.d.ts.map +1 -1
  37. package/dest/contract/interfaces/protocol_contract_addresses.js +4 -4
  38. package/dest/contract/private_function_membership_proof.d.ts +1 -1
  39. package/dest/contract/private_function_membership_proof.js +1 -1
  40. package/dest/contract/utility_function_membership_proof.d.ts +1 -1
  41. package/dest/contract/utility_function_membership_proof.js +1 -1
  42. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +20 -0
  43. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -0
  44. package/dest/{shared_mutable/shared_mutable_values.js → delayed_public_mutable/delayed_public_mutable_values.js} +9 -9
  45. package/dest/{shared_mutable/shared_mutable_values_with_hash.d.ts → delayed_public_mutable/delayed_public_mutable_values_with_hash.d.ts} +6 -6
  46. package/dest/delayed_public_mutable/delayed_public_mutable_values_with_hash.d.ts.map +1 -0
  47. package/dest/delayed_public_mutable/delayed_public_mutable_values_with_hash.js +30 -0
  48. package/dest/delayed_public_mutable/index.d.ts +5 -0
  49. package/dest/delayed_public_mutable/index.d.ts.map +1 -0
  50. package/dest/delayed_public_mutable/index.js +4 -0
  51. package/dest/delayed_public_mutable/scheduled_delay_change.d.ts.map +1 -0
  52. package/dest/delayed_public_mutable/scheduled_value_change.d.ts.map +1 -0
  53. package/dest/gas/gas.d.ts +1 -0
  54. package/dest/gas/gas.d.ts.map +1 -1
  55. package/dest/gas/gas.js +3 -0
  56. package/dest/hash/hash.d.ts.map +1 -1
  57. package/dest/hash/hash.js +1 -4
  58. package/dest/interfaces/archiver.d.ts.map +1 -1
  59. package/dest/interfaces/archiver.js +4 -2
  60. package/dest/interfaces/aztec-node-admin.d.ts +211 -8
  61. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  62. package/dest/interfaces/aztec-node-admin.js +9 -3
  63. package/dest/interfaces/configs.d.ts +27 -0
  64. package/dest/interfaces/configs.d.ts.map +1 -1
  65. package/dest/interfaces/configs.js +6 -1
  66. package/dest/interfaces/get_logs_response.d.ts +1 -1
  67. package/dest/interfaces/proving-job.d.ts +166 -192
  68. package/dest/interfaces/proving-job.d.ts.map +1 -1
  69. package/dest/interfaces/pxe.d.ts +3 -1
  70. package/dest/interfaces/pxe.d.ts.map +1 -1
  71. package/dest/interfaces/pxe.js +1 -1
  72. package/dest/interfaces/server.d.ts +4 -2
  73. package/dest/interfaces/server.d.ts.map +1 -1
  74. package/dest/interfaces/server.js +4 -2
  75. package/dest/interfaces/slasher.d.ts +86 -0
  76. package/dest/interfaces/slasher.d.ts.map +1 -0
  77. package/dest/interfaces/slasher.js +23 -0
  78. package/dest/interfaces/tx_provider.d.ts +24 -0
  79. package/dest/interfaces/tx_provider.d.ts.map +1 -0
  80. package/dest/kernel/claimed_length_array.d.ts +34 -0
  81. package/dest/kernel/claimed_length_array.d.ts.map +1 -0
  82. package/dest/kernel/claimed_length_array.js +58 -0
  83. package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -6
  84. package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
  85. package/dest/kernel/hints/build_note_hash_read_request_hints.js +18 -20
  86. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +7 -10
  87. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  88. package/dest/kernel/hints/build_nullifier_read_request_hints.js +17 -32
  89. package/dest/kernel/hints/build_transient_data_hints.d.ts +4 -3
  90. package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
  91. package/dest/kernel/hints/build_transient_data_hints.js +9 -10
  92. package/dest/kernel/hints/index.d.ts +1 -2
  93. package/dest/kernel/hints/index.d.ts.map +1 -1
  94. package/dest/kernel/hints/index.js +1 -2
  95. package/dest/kernel/hints/note_hash_read_request_hints.d.ts.map +1 -1
  96. package/dest/kernel/hints/note_hash_read_request_hints.js +4 -4
  97. package/dest/kernel/hints/nullifier_read_request_hints.d.ts.map +1 -1
  98. package/dest/kernel/hints/nullifier_read_request_hints.js +4 -4
  99. package/dest/kernel/hints/private_kernel_reset_hints.d.ts +5 -5
  100. package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
  101. package/dest/kernel/hints/private_kernel_reset_hints.js +9 -9
  102. package/dest/kernel/hints/read_request_hints.d.ts +17 -17
  103. package/dest/kernel/hints/read_request_hints.d.ts.map +1 -1
  104. package/dest/kernel/hints/read_request_hints.js +28 -28
  105. package/dest/kernel/hints/{transient_data_index_hint.d.ts → transient_data_squashing_hint.d.ts} +5 -5
  106. package/dest/kernel/hints/transient_data_squashing_hint.d.ts.map +1 -0
  107. package/dest/kernel/hints/{transient_data_index_hint.js → transient_data_squashing_hint.js} +5 -5
  108. package/dest/kernel/index.d.ts +1 -0
  109. package/dest/kernel/index.d.ts.map +1 -1
  110. package/dest/kernel/index.js +1 -0
  111. package/dest/kernel/private_accumulated_data.d.ts +16 -15
  112. package/dest/kernel/private_accumulated_data.d.ts.map +1 -1
  113. package/dest/kernel/private_accumulated_data.js +3 -3
  114. package/dest/kernel/private_call_data.d.ts +4 -4
  115. package/dest/kernel/private_call_data.d.ts.map +1 -1
  116. package/dest/kernel/private_call_data.js +2 -2
  117. package/dest/kernel/private_circuit_public_inputs.d.ts +26 -25
  118. package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
  119. package/dest/kernel/private_circuit_public_inputs.js +33 -15
  120. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +9 -0
  121. package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
  122. package/dest/kernel/private_kernel_circuit_public_inputs.js +8 -4
  123. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +10 -1
  124. package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
  125. package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +9 -6
  126. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +11 -4
  127. package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
  128. package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +20 -18
  129. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts +4 -4
  130. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts.map +1 -1
  131. package/dest/kernel/private_to_public_kernel_circuit_public_inputs.js +9 -10
  132. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +11 -11
  133. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
  134. package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.js +11 -12
  135. package/dest/kernel/private_validation_requests.d.ts +8 -20
  136. package/dest/kernel/private_validation_requests.d.ts.map +1 -1
  137. package/dest/kernel/private_validation_requests.js +9 -21
  138. package/dest/kernel/utils/order_and_comparison.d.ts +0 -3
  139. package/dest/kernel/utils/order_and_comparison.d.ts.map +1 -1
  140. package/dest/kernel/utils/order_and_comparison.js +0 -19
  141. package/dest/logs/extended_public_log.d.ts +1 -1
  142. package/dest/logs/shared_secret_derivation.d.ts +1 -1
  143. package/dest/logs/shared_secret_derivation.js +1 -1
  144. package/dest/messaging/l2_to_l1_membership.d.ts +4 -1
  145. package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
  146. package/dest/messaging/l2_to_l1_membership.js +49 -54
  147. package/dest/messaging/l2_to_l1_message.d.ts +2 -0
  148. package/dest/messaging/l2_to_l1_message.d.ts.map +1 -1
  149. package/dest/messaging/l2_to_l1_message.js +7 -0
  150. package/dest/note/notes_filter.d.ts +5 -2
  151. package/dest/note/notes_filter.d.ts.map +1 -1
  152. package/dest/note/notes_filter.js +1 -1
  153. package/dest/p2p/attestation_utils.d.ts +10 -0
  154. package/dest/p2p/attestation_utils.d.ts.map +1 -0
  155. package/dest/p2p/attestation_utils.js +21 -0
  156. package/dest/p2p/block_attestation.d.ts +3 -4
  157. package/dest/p2p/block_attestation.d.ts.map +1 -1
  158. package/dest/p2p/block_attestation.js +3 -4
  159. package/dest/p2p/block_proposal.d.ts +8 -1
  160. package/dest/p2p/block_proposal.d.ts.map +1 -1
  161. package/dest/p2p/block_proposal.js +21 -8
  162. package/dest/p2p/consensus_payload.d.ts +3 -11
  163. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  164. package/dest/p2p/consensus_payload.js +13 -22
  165. package/dest/p2p/index.d.ts +1 -0
  166. package/dest/p2p/index.d.ts.map +1 -1
  167. package/dest/p2p/index.js +1 -0
  168. package/dest/p2p/topic_type.d.ts.map +1 -1
  169. package/dest/p2p/topic_type.js +5 -3
  170. package/dest/rollup/block_root_rollup.d.ts +1 -1
  171. package/dest/slashing/index.d.ts +51 -0
  172. package/dest/slashing/index.d.ts.map +1 -0
  173. package/dest/slashing/index.js +54 -0
  174. package/dest/stats/stats.d.ts +2 -2
  175. package/dest/stats/stats.d.ts.map +1 -1
  176. package/dest/tests/factories.d.ts +0 -2
  177. package/dest/tests/factories.d.ts.map +1 -1
  178. package/dest/tests/factories.js +25 -24
  179. package/dest/tests/mocks.d.ts +2 -0
  180. package/dest/tests/mocks.d.ts.map +1 -1
  181. package/dest/tests/mocks.js +31 -22
  182. package/dest/tx/index.d.ts +0 -1
  183. package/dest/tx/index.d.ts.map +1 -1
  184. package/dest/tx/index.js +0 -1
  185. package/dest/tx/private_execution_result.d.ts +2 -2
  186. package/dest/tx/private_execution_result.d.ts.map +1 -1
  187. package/dest/tx/private_execution_result.js +11 -11
  188. package/dest/tx/processed_tx.d.ts +2 -2
  189. package/dest/tx/processed_tx.d.ts.map +1 -1
  190. package/dest/tx/processed_tx.js +4 -4
  191. package/dest/tx/proven_tx.d.ts +1 -1
  192. package/dest/tx/proven_tx.d.ts.map +1 -1
  193. package/dest/tx/proven_tx.js +7 -3
  194. package/dest/tx/simulated_tx.d.ts +11 -17
  195. package/dest/tx/simulated_tx.d.ts.map +1 -1
  196. package/dest/tx/simulated_tx.js +12 -12
  197. package/dest/tx/tx.d.ts +25 -25
  198. package/dest/tx/tx.d.ts.map +1 -1
  199. package/dest/tx/tx.js +60 -48
  200. package/dest/tx/tx_effect.d.ts +2 -2
  201. package/dest/tx/tx_effect.d.ts.map +1 -1
  202. package/dest/tx/tx_effect.js +3 -18
  203. package/dest/tx/tx_execution_request.js +2 -2
  204. package/dest/tx/tx_hash.d.ts +7 -0
  205. package/dest/tx/tx_hash.d.ts.map +1 -1
  206. package/dest/tx/tx_hash.js +19 -1
  207. package/dest/tx/tx_request.d.ts +5 -5
  208. package/dest/tx/tx_request.d.ts.map +1 -1
  209. package/dest/tx/tx_request.js +7 -7
  210. package/dest/tx/validator/error_texts.d.ts +1 -0
  211. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  212. package/dest/tx/validator/error_texts.js +1 -0
  213. package/dest/tx/validator/tx_validator.d.ts +6 -4
  214. package/dest/tx/validator/tx_validator.d.ts.map +1 -1
  215. package/dest/tx/validator/tx_validator.js +3 -0
  216. package/dest/versioning/versioning.d.ts.map +1 -1
  217. package/dest/vks/verification_key.d.ts.map +1 -1
  218. package/dest/vks/verification_key.js +4 -4
  219. package/package.json +10 -9
  220. package/src/abi/abi.ts +0 -38
  221. package/src/abi/authorization_selector.ts +95 -0
  222. package/src/abi/contract_artifact.ts +0 -49
  223. package/src/abi/decoder.ts +3 -6
  224. package/src/abi/index.ts +1 -0
  225. package/src/avm/avm.ts +7 -9
  226. package/src/block/l2_block.ts +18 -0
  227. package/src/block/l2_block_source.ts +70 -1
  228. package/src/block/proposal/committee_attestation.ts +5 -1
  229. package/src/block/published_l2_block.ts +14 -5
  230. package/src/contract/contract_instance.ts +3 -3
  231. package/src/contract/interfaces/protocol_contract_addresses.ts +5 -10
  232. package/src/contract/private_function_membership_proof.ts +1 -1
  233. package/src/contract/utility_function_membership_proof.ts +1 -1
  234. package/src/{shared_mutable/shared_mutable_values.ts → delayed_public_mutable/delayed_public_mutable_values.ts} +10 -10
  235. package/src/delayed_public_mutable/delayed_public_mutable_values_with_hash.ts +38 -0
  236. package/src/delayed_public_mutable/index.ts +4 -0
  237. package/src/gas/gas.ts +4 -0
  238. package/src/hash/hash.ts +1 -4
  239. package/src/interfaces/archiver.ts +3 -1
  240. package/src/interfaces/aztec-node-admin.ts +19 -8
  241. package/src/interfaces/configs.ts +17 -0
  242. package/src/interfaces/pxe.ts +4 -2
  243. package/src/interfaces/server.ts +4 -2
  244. package/src/interfaces/slasher.ts +49 -0
  245. package/src/interfaces/tx_provider.ts +16 -0
  246. package/src/kernel/claimed_length_array.ts +104 -0
  247. package/src/kernel/hints/build_note_hash_read_request_hints.ts +28 -30
  248. package/src/kernel/hints/build_nullifier_read_request_hints.ts +28 -59
  249. package/src/kernel/hints/build_transient_data_hints.ts +12 -14
  250. package/src/kernel/hints/index.ts +1 -2
  251. package/src/kernel/hints/note_hash_read_request_hints.ts +4 -16
  252. package/src/kernel/hints/nullifier_read_request_hints.ts +4 -16
  253. package/src/kernel/hints/private_kernel_reset_hints.ts +7 -7
  254. package/src/kernel/hints/read_request_hints.ts +22 -22
  255. package/src/kernel/hints/{transient_data_index_hint.ts → transient_data_squashing_hint.ts} +5 -5
  256. package/src/kernel/index.ts +1 -0
  257. package/src/kernel/private_accumulated_data.ts +23 -23
  258. package/src/kernel/private_call_data.ts +3 -3
  259. package/src/kernel/private_circuit_public_inputs.ts +92 -68
  260. package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -1
  261. package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +13 -4
  262. package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +20 -20
  263. package/src/kernel/private_to_public_kernel_circuit_public_inputs.ts +7 -7
  264. package/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts +16 -10
  265. package/src/kernel/private_validation_requests.ts +19 -50
  266. package/src/kernel/utils/order_and_comparison.ts +0 -25
  267. package/src/logs/shared_secret_derivation.ts +1 -1
  268. package/src/messaging/l2_to_l1_membership.ts +76 -85
  269. package/src/messaging/l2_to_l1_message.ts +9 -0
  270. package/src/note/notes_filter.ts +6 -3
  271. package/src/p2p/attestation_utils.ts +35 -0
  272. package/src/p2p/block_attestation.ts +3 -4
  273. package/src/p2p/block_proposal.ts +23 -5
  274. package/src/p2p/consensus_payload.ts +10 -29
  275. package/src/p2p/index.ts +1 -0
  276. package/src/p2p/topic_type.ts +3 -1
  277. package/src/slashing/index.ts +74 -0
  278. package/src/stats/stats.ts +2 -2
  279. package/src/tests/factories.ts +37 -27
  280. package/src/tests/mocks.ts +24 -22
  281. package/src/tx/index.ts +0 -1
  282. package/src/tx/private_execution_result.ts +11 -9
  283. package/src/tx/processed_tx.ts +6 -6
  284. package/src/tx/proven_tx.ts +7 -8
  285. package/src/tx/simulated_tx.ts +13 -19
  286. package/src/tx/tx.ts +70 -57
  287. package/src/tx/tx_effect.ts +5 -20
  288. package/src/tx/tx_execution_request.ts +2 -2
  289. package/src/tx/tx_hash.ts +21 -1
  290. package/src/tx/tx_request.ts +7 -6
  291. package/src/tx/validator/error_texts.ts +1 -0
  292. package/src/tx/validator/tx_validator.ts +5 -0
  293. package/src/versioning/versioning.ts +0 -3
  294. package/src/vks/verification_key.ts +4 -7
  295. package/dest/interfaces/tx-collector.d.ts +0 -15
  296. package/dest/interfaces/tx-collector.d.ts.map +0 -1
  297. package/dest/kernel/hints/rollup_validation_requests.d.ts +0 -34
  298. package/dest/kernel/hints/rollup_validation_requests.d.ts.map +0 -1
  299. package/dest/kernel/hints/rollup_validation_requests.js +0 -55
  300. package/dest/kernel/hints/transient_data_index_hint.d.ts.map +0 -1
  301. package/dest/shared_mutable/index.d.ts +0 -5
  302. package/dest/shared_mutable/index.d.ts.map +0 -1
  303. package/dest/shared_mutable/index.js +0 -4
  304. package/dest/shared_mutable/scheduled_delay_change.d.ts.map +0 -1
  305. package/dest/shared_mutable/scheduled_value_change.d.ts.map +0 -1
  306. package/dest/shared_mutable/shared_mutable_values.d.ts +0 -20
  307. package/dest/shared_mutable/shared_mutable_values.d.ts.map +0 -1
  308. package/dest/shared_mutable/shared_mutable_values_with_hash.d.ts.map +0 -1
  309. package/dest/shared_mutable/shared_mutable_values_with_hash.js +0 -30
  310. package/dest/tx/include_by_timestamp.d.ts +0 -54
  311. package/dest/tx/include_by_timestamp.d.ts.map +0 -1
  312. package/dest/tx/include_by_timestamp.js +0 -72
  313. package/src/interfaces/tx-collector.ts +0 -17
  314. package/src/kernel/hints/rollup_validation_requests.ts +0 -71
  315. package/src/shared_mutable/index.ts +0 -4
  316. package/src/shared_mutable/shared_mutable_values_with_hash.ts +0 -38
  317. package/src/tx/include_by_timestamp.ts +0 -90
  318. /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.d.ts +0 -0
  319. /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.js +0 -0
  320. /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_value_change.d.ts +0 -0
  321. /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_value_change.js +0 -0
  322. /package/dest/interfaces/{tx-collector.js → tx_provider.js} +0 -0
  323. /package/src/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.ts +0 -0
  324. /package/src/{shared_mutable → delayed_public_mutable}/scheduled_value_change.ts +0 -0
@@ -1,32 +1,26 @@
1
1
  import { MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX } from '@aztec/constants';
2
- import type { Fr } from '@aztec/foundation/fields';
3
- import { BufferReader, FieldReader, type Tuple } from '@aztec/foundation/serialize';
2
+ import { BufferReader } from '@aztec/foundation/serialize';
4
3
  import { inspect } from 'util';
5
4
  import { ScopedKeyValidationRequestAndGenerator } from '../kernel/hints/scoped_key_validation_request_and_generator.js';
5
+ import { ClaimedLengthArray } from './claimed_length_array.js';
6
6
  import { ScopedReadRequest } from './hints/read_request.js';
7
- import { RollupValidationRequests } from './hints/rollup_validation_requests.js';
8
7
  import { OptionalNumber } from './utils/optional_number.js';
9
8
  /**
10
9
  * Validation requests accumulated during the execution of the transaction.
11
10
  */
12
11
  export declare class PrivateValidationRequests {
13
- /**
14
- * Validation requests that cannot be fulfilled in the current context (private or public), and must be instead be
15
- * forwarded to the rollup for it to take care of them.
16
- */
17
- forRollup: RollupValidationRequests;
18
12
  /**
19
13
  * All the read requests made in this transaction.
20
14
  */
21
- noteHashReadRequests: Tuple<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>;
15
+ noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>;
22
16
  /**
23
17
  * All the nullifier read requests made in this transaction.
24
18
  */
25
- nullifierReadRequests: Tuple<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>;
19
+ nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>;
26
20
  /**
27
21
  * All the key validation requests made in this transaction.
28
22
  */
29
- scopedKeyValidationRequestsAndGenerators: Tuple<ScopedKeyValidationRequestAndGenerator, typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX>;
23
+ scopedKeyValidationRequestsAndGenerators: ClaimedLengthArray<ScopedKeyValidationRequestAndGenerator, typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX>;
30
24
  /**
31
25
  * The counter to split the data for squashing.
32
26
  * A revertible nullifier and a non-revertible note hash will not be squashed.
@@ -34,23 +28,18 @@ export declare class PrivateValidationRequests {
34
28
  */
35
29
  splitCounter: OptionalNumber;
36
30
  constructor(
37
- /**
38
- * Validation requests that cannot be fulfilled in the current context (private or public), and must be instead be
39
- * forwarded to the rollup for it to take care of them.
40
- */
41
- forRollup: RollupValidationRequests,
42
31
  /**
43
32
  * All the read requests made in this transaction.
44
33
  */
45
- noteHashReadRequests: Tuple<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>,
34
+ noteHashReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_TX>,
46
35
  /**
47
36
  * All the nullifier read requests made in this transaction.
48
37
  */
49
- nullifierReadRequests: Tuple<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>,
38
+ nullifierReadRequests: ClaimedLengthArray<ScopedReadRequest, typeof MAX_NULLIFIER_READ_REQUESTS_PER_TX>,
50
39
  /**
51
40
  * All the key validation requests made in this transaction.
52
41
  */
53
- scopedKeyValidationRequestsAndGenerators: Tuple<ScopedKeyValidationRequestAndGenerator, typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX>,
42
+ scopedKeyValidationRequestsAndGenerators: ClaimedLengthArray<ScopedKeyValidationRequestAndGenerator, typeof MAX_KEY_VALIDATION_REQUESTS_PER_TX>,
54
43
  /**
55
44
  * The counter to split the data for squashing.
56
45
  * A revertible nullifier and a non-revertible note hash will not be squashed.
@@ -60,7 +49,6 @@ export declare class PrivateValidationRequests {
60
49
  getSize(): number;
61
50
  toBuffer(): Buffer<ArrayBufferLike>;
62
51
  toString(): `0x${string}`;
63
- static fromFields(fields: Fr[] | FieldReader): PrivateValidationRequests;
64
52
  /**
65
53
  * Deserializes from a buffer or reader, corresponding to a write in cpp.
66
54
  * @param buffer - Buffer or reader to read from.
@@ -1 +1 @@
1
- {"version":3,"file":"private_validation_requests.d.ts","sourceRoot":"","sources":["../../src/kernel/private_validation_requests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,KAAK,EAAqB,MAAM,6BAA6B,CAAC;AAGvG,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,sCAAsC,EAAE,MAAM,gEAAgE,CAAC;AACxH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;GAEG;AACH,qBAAa,yBAAyB;IAElC;;;OAGG;IACI,SAAS,EAAE,wBAAwB;IAC1C;;OAEG;IACI,oBAAoB,EAAE,KAAK,CAAC,iBAAiB,EAAE,OAAO,kCAAkC,CAAC;IAChG;;OAEG;IACI,qBAAqB,EAAE,KAAK,CAAC,iBAAiB,EAAE,OAAO,kCAAkC,CAAC;IACjG;;OAEG;IACI,wCAAwC,EAAE,KAAK,CACpD,sCAAsC,EACtC,OAAO,kCAAkC,CAC1C;IACD;;;;OAIG;IACI,YAAY,EAAE,cAAc;;IAzBnC;;;OAGG;IACI,SAAS,EAAE,wBAAwB;IAC1C;;OAEG;IACI,oBAAoB,EAAE,KAAK,CAAC,iBAAiB,EAAE,OAAO,kCAAkC,CAAC;IAChG;;OAEG;IACI,qBAAqB,EAAE,KAAK,CAAC,iBAAiB,EAAE,OAAO,kCAAkC,CAAC;IACjG;;OAEG;IACI,wCAAwC,EAAE,KAAK,CACpD,sCAAsC,EACtC,OAAO,kCAAkC,CAC1C;IACD;;;;OAIG;IACI,YAAY,EAAE,cAAc;IAGrC,OAAO;IAUP,QAAQ;IAUR,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;IAW5C;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAW/C;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,MAAM,CAAC,KAAK;IAUZ,CAAC,OAAO,CAAC,MAAM,CAAC;CAkBjB"}
1
+ {"version":3,"file":"private_validation_requests.d.ts","sourceRoot":"","sources":["../../src/kernel/private_validation_requests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,kB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QUESTS_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_TX } from '@aztec/constants';
2
- import { makeTuple } from '@aztec/foundation/array';
3
- import { arraySerializedSizeOfNonEmpty } from '@aztec/foundation/collection';
4
- import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
2
+ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
3
  import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
6
4
  import { inspect } from 'util';
7
5
  import { ScopedKeyValidationRequestAndGenerator } from '../kernel/hints/scoped_key_validation_request_and_generator.js';
6
+ import { ClaimedLengthArray, ClaimedLengthArrayFromBuffer } from './claimed_length_array.js';
8
7
  import { ScopedReadRequest } from './hints/read_request.js';
9
- import { RollupValidationRequests } from './hints/rollup_validation_requests.js';
10
8
  import { OptionalNumber } from './utils/optional_number.js';
11
9
  /**
12
10
  * Validation requests accumulated during the execution of the transaction.
13
11
  */ export class PrivateValidationRequests {
14
- forRollup;
15
12
  noteHashReadRequests;
16
13
  nullifierReadRequests;
17
14
  scopedKeyValidationRequestsAndGenerators;
18
15
  splitCounter;
19
16
  constructor(/**
20
- * Validation requests that cannot be fulfilled in the current context (private or public), and must be instead be
21
- * forwarded to the rollup for it to take care of them.
22
- */ forRollup, /**
23
17
  * All the read requests made in this transaction.
24
18
  */ noteHashReadRequests, /**
25
19
  * All the nullifier read requests made in this transaction.
@@ -30,32 +24,27 @@ import { OptionalNumber } from './utils/optional_number.js';
30
24
  * A revertible nullifier and a non-revertible note hash will not be squashed.
31
25
  * It should be the "final" minRevertibleSideEffectCounter of a tx.
32
26
  */ splitCounter){
33
- this.forRollup = forRollup;
34
27
  this.noteHashReadRequests = noteHashReadRequests;
35
28
  this.nullifierReadRequests = nullifierReadRequests;
36
29
  this.scopedKeyValidationRequestsAndGenerators = scopedKeyValidationRequestsAndGenerators;
37
30
  this.splitCounter = splitCounter;
38
31
  }
39
32
  getSize() {
40
- return this.forRollup.getSize() + arraySerializedSizeOfNonEmpty(this.noteHashReadRequests) + arraySerializedSizeOfNonEmpty(this.nullifierReadRequests) + arraySerializedSizeOfNonEmpty(this.scopedKeyValidationRequestsAndGenerators) + this.splitCounter.getSize();
33
+ return this.noteHashReadRequests.getSize() + this.nullifierReadRequests.getSize() + this.scopedKeyValidationRequestsAndGenerators.getSize() + this.splitCounter.getSize();
41
34
  }
42
35
  toBuffer() {
43
- return serializeToBuffer(this.forRollup, this.noteHashReadRequests, this.nullifierReadRequests, this.scopedKeyValidationRequestsAndGenerators, this.splitCounter);
36
+ return serializeToBuffer(this.noteHashReadRequests, this.nullifierReadRequests, this.scopedKeyValidationRequestsAndGenerators, this.splitCounter);
44
37
  }
45
38
  toString() {
46
39
  return bufferToHex(this.toBuffer());
47
40
  }
48
- static fromFields(fields) {
49
- const reader = FieldReader.asReader(fields);
50
- return new PrivateValidationRequests(reader.readObject(RollupValidationRequests), reader.readArray(MAX_NOTE_HASH_READ_REQUESTS_PER_TX, ScopedReadRequest), reader.readArray(MAX_NULLIFIER_READ_REQUESTS_PER_TX, ScopedReadRequest), reader.readArray(MAX_KEY_VALIDATION_REQUESTS_PER_TX, ScopedKeyValidationRequestAndGenerator), reader.readObject(OptionalNumber));
51
- }
52
41
  /**
53
42
  * Deserializes from a buffer or reader, corresponding to a write in cpp.
54
43
  * @param buffer - Buffer or reader to read from.
55
44
  * @returns Deserialized object.
56
45
  */ static fromBuffer(buffer) {
57
46
  const reader = BufferReader.asReader(buffer);
58
- return new PrivateValidationRequests(reader.readObject(RollupValidationRequests), reader.readArray(MAX_NOTE_HASH_READ_REQUESTS_PER_TX, ScopedReadRequest), reader.readArray(MAX_NULLIFIER_READ_REQUESTS_PER_TX, ScopedReadRequest), reader.readArray(MAX_KEY_VALIDATION_REQUESTS_PER_TX, ScopedKeyValidationRequestAndGenerator), reader.readObject(OptionalNumber));
47
+ return new PrivateValidationRequests(reader.readObject(ClaimedLengthArrayFromBuffer(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_TX)), reader.readObject(ClaimedLengthArrayFromBuffer(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_TX)), reader.readObject(ClaimedLengthArrayFromBuffer(ScopedKeyValidationRequestAndGenerator, MAX_KEY_VALIDATION_REQUESTS_PER_TX)), reader.readObject(OptionalNumber));
59
48
  }
60
49
  /**
61
50
  * Deserializes from a string, corresponding to a write in cpp.
@@ -65,14 +54,13 @@ import { OptionalNumber } from './utils/optional_number.js';
65
54
  return PrivateValidationRequests.fromBuffer(hexToBuffer(str));
66
55
  }
67
56
  static empty() {
68
- return new PrivateValidationRequests(RollupValidationRequests.empty(), makeTuple(MAX_NOTE_HASH_READ_REQUESTS_PER_TX, ScopedReadRequest.empty), makeTuple(MAX_NULLIFIER_READ_REQUESTS_PER_TX, ScopedReadRequest.empty), makeTuple(MAX_KEY_VALIDATION_REQUESTS_PER_TX, ScopedKeyValidationRequestAndGenerator.empty), OptionalNumber.empty());
57
+ return new PrivateValidationRequests(ClaimedLengthArray.empty(ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_TX), ClaimedLengthArray.empty(ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_TX), ClaimedLengthArray.empty(ScopedKeyValidationRequestAndGenerator, MAX_KEY_VALIDATION_REQUESTS_PER_TX), OptionalNumber.empty());
69
58
  }
70
59
  [inspect.custom]() {
71
60
  return `PrivateValidationRequests {
72
- forRollup: ${inspect(this.forRollup)},
73
- noteHashReadRequests: [${this.noteHashReadRequests.filter((x)=>!x.isEmpty()).map((h)=>inspect(h)).join(', ')}],
74
- nullifierReadRequests: [${this.nullifierReadRequests.filter((x)=>!x.isEmpty()).map((h)=>inspect(h)).join(', ')}],
75
- scopedKeyValidationRequestsAndGenerators: [${this.scopedKeyValidationRequestsAndGenerators.filter((x)=>!x.isEmpty()).map((h)=>inspect(h)).join(', ')}],
61
+ noteHashReadRequests: ${inspect(this.noteHashReadRequests)},
62
+ nullifierReadRequests: ${inspect(this.nullifierReadRequests)},
63
+ scopedKeyValidationRequestsAndGenerators: ${inspect(this.scopedKeyValidationRequestsAndGenerators)},
76
64
  splitCounter: ${this.splitCounter.getSize()}
77
65
  `;
78
66
  }
@@ -1,8 +1,5 @@
1
1
  import type { Tuple } from '@aztec/foundation/serialize';
2
2
  import type { IsEmpty, Ordered } from './interfaces.js';
3
3
  export declare function countAccumulatedItems<T extends IsEmpty>(arr: T[]): number;
4
- export declare function mergeAccumulatedData<T extends IsEmpty, N extends number>(arr0: Tuple<T, N>, arr1: Tuple<T, N>, length?: N): Tuple<T, N>;
5
4
  export declare function sortByCounter<T extends Ordered & IsEmpty, N extends number>(arr: Tuple<T, N>, ascending?: boolean): Tuple<T, N>;
6
- export declare function isEmptyArray<T extends IsEmpty>(arr: T[]): boolean;
7
- export declare function getNonEmptyItems<T extends IsEmpty>(arr: T[]): T[];
8
5
  //# sourceMappingURL=order_and_comparison.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"order_and_comparison.d.ts","sourceRoot":"","sources":["../../../src/kernel/utils/order_and_comparison.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAKxD,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,UAUhE;AAGD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,MAAM,EACtE,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EACjB,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EACjB,MAAM,GAAE,CAAoB,GAC3B,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAUb;AAuBD,wBAAgB,aAAa,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,MAAM,EACzE,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAChB,SAAS,GAAE,OAAc,GACxB,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAEb;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,OAAO,CAEjE;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEjE"}
1
+ {"version":3,"file":"order_and_comparison.d.ts","sourceRoot":"","sources":["../../../src/kernel/utils/order_and_comparison.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAKxD,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,UAUhE;AAuBD,wBAAgB,aAAa,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,CAAC,SAAS,MAAM,EACzE,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAChB,SAAS,GAAE,OAAc,GACxB,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAEb"}
@@ -11,19 +11,6 @@ export function countAccumulatedItems(arr) {
11
11
  return num;
12
12
  }, 0);
13
13
  }
14
- // Merges two arrays of length N into an array of length N.
15
- export function mergeAccumulatedData(arr0, arr1, length = arr0.length) {
16
- const numNonEmptyItems0 = countAccumulatedItems(arr0);
17
- const numNonEmptyItems1 = countAccumulatedItems(arr1);
18
- if (numNonEmptyItems0 + numNonEmptyItems1 > length) {
19
- throw new Error('Combined non-empty items exceeded the maximum allowed.');
20
- }
21
- const arr = [
22
- ...arr0
23
- ];
24
- arr1.slice(0, numNonEmptyItems1).forEach((item, i)=>arr[i + numNonEmptyItems0] = item);
25
- return arr;
26
- }
27
14
  // Sort items by a provided compare function. All empty items are padded to the right.
28
15
  function genericSort(arr, compareFn, ascending = true) {
29
16
  return [
@@ -44,9 +31,3 @@ function compareByCounter(a, b) {
44
31
  export function sortByCounter(arr, ascending = true) {
45
32
  return genericSort(arr, compareByCounter, ascending);
46
33
  }
47
- export function isEmptyArray(arr) {
48
- return arr.every((item)=>item.isEmpty());
49
- }
50
- export function getNonEmptyItems(arr) {
51
- return arr.filter((item)=>!item.isEmpty());
52
- }
@@ -37,8 +37,8 @@ export declare class ExtendedPublicLog {
37
37
  }>;
38
38
  log: import("@aztec/foundation/schemas").ZodFor<PublicLog>;
39
39
  }, "strip", z.ZodTypeAny, {
40
- id: LogId;
41
40
  log: PublicLog;
41
+ id: LogId;
42
42
  }, {
43
43
  id: {
44
44
  blockNumber: string | number | bigint;
@@ -10,7 +10,7 @@ import type { PublicKey } from '../keys/public_key.js';
10
10
  * @returns A derived shared secret.
11
11
  * @throws If the publicKey is zero.
12
12
  *
13
- * TODO(#12656): This function is kept around because of the getSharedSecret oracle. Nuke this once returning
13
+ * TODO(#12656): This function is kept around because of the utilityGetSharedSecret oracle. Nuke this once returning
14
14
  * the app-siloed secret.
15
15
  */
16
16
  export declare function deriveEcdhSharedSecret(secretKey: GrumpkinScalar, publicKey: PublicKey): Promise<Point>;
@@ -9,7 +9,7 @@ import { Grumpkin } from '@aztec/foundation/crypto';
9
9
  * @returns A derived shared secret.
10
10
  * @throws If the publicKey is zero.
11
11
  *
12
- * TODO(#12656): This function is kept around because of the getSharedSecret oracle. Nuke this once returning
12
+ * TODO(#12656): This function is kept around because of the utilityGetSharedSecret oracle. Nuke this once returning
13
13
  * the app-siloed secret.
14
14
  */ export async function deriveEcdhSharedSecret(secretKey, publicKey) {
15
15
  if (publicKey.isZero()) {
@@ -4,8 +4,11 @@ export interface MessageRetrieval {
4
4
  getL2ToL1Messages(l2BlockNumber: number): Promise<Fr[][] | undefined>;
5
5
  }
6
6
  export type L2ToL1MembershipWitness = {
7
- l2MessageIndex: bigint;
7
+ root: Fr;
8
+ leafIndex: bigint;
8
9
  siblingPath: SiblingPath<number>;
9
10
  };
10
11
  export declare function computeL2ToL1MembershipWitness(messageRetriever: MessageRetrieval, l2BlockNumber: number, message: Fr): Promise<L2ToL1MembershipWitness | undefined>;
12
+ export declare function computeL2ToL1MembershipWitnessFromMessagesForAllTxs(messagesForAllTxs: Fr[][], message: Fr): Promise<L2ToL1MembershipWitness>;
13
+ export declare function getL2ToL1MessageLeafId(membershipWitness: Pick<L2ToL1MembershipWitness, 'leafIndex' | 'siblingPath'>): bigint;
11
14
  //# sourceMappingURL=l2_to_l1_membership.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"l2_to_l1_membership.d.ts","sourceRoot":"","sources":["../../src/messaging/l2_to_l1_membership.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAwB,WAAW,EAAkC,MAAM,yBAAyB,CAAC;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC,CAAC;CACvE;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,wBAAsB,8BAA8B,CAClD,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,EAAE,GACV,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CA+F9C"}
1
+ {"version":3,"file":"l2_to_l1_membership.d.ts","sourceRoot":"","sources":["../../src/messaging/l2_to_l1_membership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EACL,WAAW,EAKZ,MAAM,yBAAyB,CAAC;AASjC,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC,CAAC;CACvE;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,EAAE,CAAC;IACT,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAClC,CAAC;AAEF,wBAAsB,8BAA8B,CAClD,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,EAAE,GACV,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAO9C;AAED,wBAAsB,mDAAmD,CACvE,iBAAiB,EAAE,EAAE,EAAE,EAAE,EACzB,OAAO,EAAE,EAAE,GACV,OAAO,CAAC,uBAAuB,CAAC,CAuDlC;AAED,wBAAgB,sBAAsB,CACpC,iBAAiB,EAAE,IAAI,CAAC,uBAAuB,EAAE,WAAW,GAAG,aAAa,CAAC,GAC5E,MAAM,CAER"}
@@ -1,70 +1,65 @@
1
- import { SHA256Trunc } from '@aztec/foundation/crypto';
2
1
  import { Fr } from '@aztec/foundation/fields';
3
- import { MerkleTreeCalculator, SiblingPath, UnbalancedMerkleTreeCalculator } from '@aztec/foundation/trees';
2
+ import { SiblingPath, UnbalancedMerkleTreeCalculator, computeUnbalancedMerkleTreeRoot, findLeafLevelAndIndex, getMaxUnbalancedTreeDepth } from '@aztec/foundation/trees';
3
+ async function createOutHashTree(messages) {
4
+ const messageSubtreeHeight = getMaxUnbalancedTreeDepth(messages.length);
5
+ const calculator = UnbalancedMerkleTreeCalculator.create(messageSubtreeHeight);
6
+ await calculator.appendLeaves(messages.map((msg)=>msg.toBuffer()));
7
+ return calculator;
8
+ }
4
9
  export async function computeL2ToL1MembershipWitness(messageRetriever, l2BlockNumber, message) {
5
- const messagesPerTx = await messageRetriever.getL2ToL1Messages(l2BlockNumber);
6
- if (!messagesPerTx) {
10
+ const messagesForAllTxs = await messageRetriever.getL2ToL1Messages(l2BlockNumber);
11
+ if (!messagesForAllTxs) {
7
12
  return undefined;
8
13
  }
9
- // Find index of message in subtree and index of tx in a block
10
- let messageIndexInTx = -1, txIndex = -1;
11
- {
12
- txIndex = messagesPerTx.findIndex((messages)=>{
13
- const idx = messages.findIndex((msg)=>msg.equals(message));
14
- messageIndexInTx = Math.max(messageIndexInTx, idx);
15
- return idx !== -1;
16
- });
17
- }
14
+ return computeL2ToL1MembershipWitnessFromMessagesForAllTxs(messagesForAllTxs, message);
15
+ }
16
+ export async function computeL2ToL1MembershipWitnessFromMessagesForAllTxs(messagesForAllTxs, message) {
17
+ // Find index of message in subtree and index of tx in a block.
18
+ let messageIndexInTx = -1;
19
+ const txIndex = messagesForAllTxs.findIndex((messages)=>{
20
+ messageIndexInTx = messages.findIndex((msg)=>msg.equals(message));
21
+ return messageIndexInTx !== -1;
22
+ });
18
23
  if (txIndex === -1) {
19
24
  throw new Error('The L2ToL1Message you are trying to prove inclusion of does not exist');
20
25
  }
21
- const hasher = new SHA256Trunc();
22
- // Get the message path in subtree and message subtree height
23
- let messagePathInSubtree;
24
- let messageSubtreeHeight;
25
- {
26
- const txMessages = messagesPerTx[txIndex];
27
- messageSubtreeHeight = txMessages.length <= 1 ? 1 : Math.ceil(Math.log2(txMessages.length));
28
- const calculator = await MerkleTreeCalculator.create(messageSubtreeHeight, Buffer.alloc(32, 0), (lhs, rhs)=>Promise.resolve(hasher.hash(lhs, rhs)));
29
- const tree = await calculator.computeTree(txMessages.map((msg)=>msg.toBuffer()));
30
- const tempPath = tree.getSiblingPath(messageIndexInTx);
31
- messagePathInSubtree = new SiblingPath(tempPath.length, tempPath);
32
- }
33
- // If the number of txs is 1 we are dealing with a special case where the tx subtree itself is the whole block's
34
- // l2 to l1 message tree.
35
- const numTransactions = messagesPerTx.length;
36
- if (numTransactions === 1) {
37
- return {
38
- l2MessageIndex: BigInt(messageIndexInTx),
39
- siblingPath: messagePathInSubtree
40
- };
41
- }
42
- // Calculate roots for all tx subtrees
43
- const txSubtreeRoots = await Promise.all(messagesPerTx.map(async (messages, _)=>{
26
+ // Get the txOutHash and the sibling path of the message in the tx subtree.
27
+ const txMessages = messagesForAllTxs[txIndex];
28
+ const txOutHashTree = await createOutHashTree(txMessages);
29
+ const txOutHash = txOutHashTree.getRoot();
30
+ const messagePathInSubtree = await txOutHashTree.getSiblingPath(message);
31
+ // Calculate txOutHash for all txs.
32
+ const txSubtreeRoots = messagesForAllTxs.map((messages, i)=>{
44
33
  // For a tx with no messages, we have to set an out hash of 0 to match what the circuit does.
45
34
  if (messages.length === 0) {
46
35
  return Fr.ZERO;
47
36
  }
48
- const txTreeHeight = messages.length <= 1 ? 1 : Math.ceil(Math.log2(messages.length));
49
- const calculator = await MerkleTreeCalculator.create(txTreeHeight, Buffer.alloc(32, 0), (lhs, rhs)=>Promise.resolve(hasher.hash(lhs, rhs)));
50
- const root = await calculator.computeTreeRoot(messages.map((msg)=>msg.toBuffer()));
37
+ if (i === txIndex) {
38
+ return Fr.fromBuffer(txOutHash);
39
+ }
40
+ const root = computeUnbalancedMerkleTreeRoot(messages.map((msg)=>msg.toBuffer()));
51
41
  return Fr.fromBuffer(root);
52
- }));
53
- // Construct the top tree and compute the combined path
54
- let combinedPath;
55
- {
56
- const topTreeHeight = Math.ceil(Math.log2(txSubtreeRoots.length));
57
- // The root of this tree is the out_hash calculated in Noir => we truncate to match Noir's SHA
58
- const topTree = UnbalancedMerkleTreeCalculator.create(topTreeHeight, (lhs, rhs)=>Promise.resolve(hasher.hash(lhs, rhs)));
59
- await topTree.appendLeaves(txSubtreeRoots.map((f)=>f.toBuffer()));
60
- const txPathInTopTree = await topTree.getSiblingPath(txSubtreeRoots[txIndex].toBigInt());
61
- // Append subtree path to top tree path
62
- combinedPath = messagePathInSubtree.toBufferArray().concat(txPathInTopTree.toBufferArray());
63
- }
64
- // Append binary index of subtree path to binary index of top tree path
65
- const combinedIndex = parseInt(txIndex.toString(2).concat(messageIndexInTx.toString(2).padStart(messageSubtreeHeight, '0')), 2);
42
+ });
43
+ // Construct the top tree.
44
+ // The leaves of this tree are the txOutHashes.
45
+ // The root of this tree is the out_hash calculated in the circuit.
46
+ const topTree = await createOutHashTree(txSubtreeRoots);
47
+ const root = Fr.fromBuffer(topTree.getRoot());
48
+ // Compute the combined sibling path by appending the tx subtree path to the top tree path.
49
+ const txPathInTopTree = await topTree.getSiblingPath(txOutHash);
50
+ const combinedPath = messagePathInSubtree.toBufferArray().concat(txPathInTopTree.toBufferArray());
51
+ // Compute the combined index.
52
+ // It is the index of the message in the balanced tree at its current height.
53
+ const txLeafPosition = findLeafLevelAndIndex(messagesForAllTxs.length, txIndex);
54
+ const messageLeafPosition = findLeafLevelAndIndex(txMessages.length, messageIndexInTx);
55
+ const numLeavesInLeftSubtrees = txLeafPosition.indexAtLevel * (1 << messageLeafPosition.level);
56
+ const combinedIndex = numLeavesInLeftSubtrees + messageLeafPosition.indexAtLevel;
66
57
  return {
67
- l2MessageIndex: BigInt(combinedIndex),
58
+ root,
59
+ leafIndex: BigInt(combinedIndex),
68
60
  siblingPath: new SiblingPath(combinedPath.length, combinedPath)
69
61
  };
70
62
  }
63
+ export function getL2ToL1MessageLeafId(membershipWitness) {
64
+ return 2n ** BigInt(membershipWitness.siblingPath.pathSize) + membershipWitness.leafIndex;
65
+ }
@@ -207,5 +207,7 @@ export declare class ScopedCountedL2ToL1Message {
207
207
  isEmpty(): boolean;
208
208
  static fromBuffer(buffer: Buffer | BufferReader): ScopedCountedL2ToL1Message;
209
209
  toBuffer(): Buffer;
210
+ static fromFields(fields: Fr[] | FieldReader): ScopedCountedL2ToL1Message;
211
+ toFields(): Fr[];
210
212
  }
211
213
  //# sourceMappingURL=l2_to_l1_message.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"l2_to_l1_message.d.ts","sourceRoot":"","sources":["../../src/messaging/l2_to_l1_message.ts"],"names":[],"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KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAOhB;IAED,MAAM,CAAC,KAAK;IAIZ,OAAO,IAAI,OAAO;IAIlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAK/C,QAAQ,IAAI,MAAM;IAIlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;IAK5C,QAAQ,IAAI,EAAE,EAAE;CAGjB;AAED,qBAAa,0BAA0B;IAE5B,KAAK,EAAE,oBAAoB;IAC3B,eAAe,EAAE,YAAY;gBAD7B,KAAK,EAAE,oBAAoB,EAC3B,eAAe,EAAE,YAAY;IAGtC,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAOhB;IAED,MAAM,CAAC,KAAK;IAIZ,OAAO,IAAI,OAAO;IAIlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAK/C,QAAQ,IAAI,MAAM;IAIlB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW;IAK5C,QAAQ,IAAI,EAAE,EAAE;CAGjB"}
@@ -165,4 +165,11 @@ export class ScopedCountedL2ToL1Message {
165
165
  toBuffer() {
166
166
  return serializeToBuffer(this.inner, this.contractAddress);
167
167
  }
168
+ static fromFields(fields) {
169
+ const reader = FieldReader.asReader(fields);
170
+ return new ScopedCountedL2ToL1Message(reader.readObject(CountedL2ToL1Message), reader.readObject(AztecAddress));
171
+ }
172
+ toFields() {
173
+ return serializeToFields(this.inner, this.contractAddress);
174
+ }
168
175
  }
@@ -8,10 +8,13 @@ import { NoteStatus } from './note_status.js';
8
8
  * @remarks This filter is applied as an intersection of all its params.
9
9
  */
10
10
  export type NotesFilter = {
11
+ /**
12
+ * The contract address the note belongs to.
13
+ * @remarks Providing a contract address is required as we need that information to trigger private state sync.
14
+ */
15
+ contractAddress: AztecAddress;
11
16
  /** Hash of a transaction from which to fetch the notes. */
12
17
  txHash?: TxHash;
13
- /** The contract address the note belongs to. */
14
- contractAddress?: AztecAddress;
15
18
  /** The specific storage location of the note on the contract. */
16
19
  storageSlot?: Fr;
17
20
  /** The recipient of the note (whose public key was used to encrypt the note). */
@@ -1 +1 @@
1
- {"version":3,"file":"notes_filter.d.ts","sourceRoot":"","sources":["../../src/note/notes_filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAInD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,iEAAiE;IACjE,WAAW,CAAC,EAAE,EAAE,CAAC;IACjB,iFAAiF;IACjF,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,oDAAoD;IACpD,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,yCAAyC;IACzC,eAAe,CAAC,EAAE,EAAE,CAAC;IACrB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,WAAW,CAQhD,CAAC"}
1
+ {"version":3,"file":"notes_filter.d.ts","sourceRoot":"","sources":["../../src/note/notes_filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAInD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,eAAe,EAAE,YAAY,CAAC;IAC9B,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,WAAW,CAAC,EAAE,EAAE,CAAC;IACjB,iFAAiF;IACjF,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,oDAAoD;IACpD,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,yCAAyC;IACzC,eAAe,CAAC,EAAE,EAAE,CAAC;IACrB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,WAAW,CAQhD,CAAC"}
@@ -3,8 +3,8 @@ import { schemas } from '../schemas/index.js';
3
3
  import { TxHash } from '../tx/tx_hash.js';
4
4
  import { NoteStatus } from './note_status.js';
5
5
  export const NotesFilterSchema = z.object({
6
+ contractAddress: schemas.AztecAddress,
6
7
  txHash: TxHash.schema.optional(),
7
- contractAddress: schemas.AztecAddress.optional(),
8
8
  storageSlot: schemas.Fr.optional(),
9
9
  recipient: schemas.AztecAddress.optional(),
10
10
  status: z.nativeEnum(NoteStatus).optional(),
@@ -0,0 +1,10 @@
1
+ import type { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { CommitteeAttestation } from '../block/index.js';
3
+ import type { BlockAttestation } from './block_attestation.js';
4
+ /**
5
+ * Returns attestation signatures in the order of a series of provided ethereum addresses
6
+ * The rollup smart contract expects attestations to appear in the order of the committee
7
+ * @todo: perform this logic within the memory attestation store instead?
8
+ */
9
+ export declare function orderAttestations(attestations: BlockAttestation[], orderAddresses: EthAddress[]): CommitteeAttestation[];
10
+ //# sourceMappingURL=attestation_utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attestation_utils.d.ts","sourceRoot":"","sources":["../../src/p2p/attestation_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,gBAAgB,EAAE,EAChC,cAAc,EAAE,UAAU,EAAE,GAC3B,oBAAoB,EAAE,CAqBxB"}
@@ -0,0 +1,21 @@
1
+ import { CommitteeAttestation } from '../block/index.js';
2
+ /**
3
+ * Returns attestation signatures in the order of a series of provided ethereum addresses
4
+ * The rollup smart contract expects attestations to appear in the order of the committee
5
+ * @todo: perform this logic within the memory attestation store instead?
6
+ */ export function orderAttestations(attestations, orderAddresses) {
7
+ // Create a map of sender addresses to BlockAttestations
8
+ const attestationMap = new Map();
9
+ for (const attestation of attestations){
10
+ const sender = attestation.getSender();
11
+ if (sender) {
12
+ attestationMap.set(sender.toString(), CommitteeAttestation.fromAddressAndSignature(sender, attestation.signature));
13
+ }
14
+ }
15
+ // Create the ordered array based on the orderAddresses, else return an empty attestation
16
+ const orderedAttestations = orderAddresses.map((address)=>{
17
+ const addressString = address.toString();
18
+ return attestationMap.get(addressString) || CommitteeAttestation.fromAddress(address);
19
+ });
20
+ return orderedAttestations;
21
+ }
@@ -37,10 +37,9 @@ export declare class BlockAttestation extends Gossipable {
37
37
  generateP2PMessageIdentifier(): Promise<Buffer32>;
38
38
  get archive(): Fr;
39
39
  get slotNumber(): Fr;
40
- /**Get sender
41
- *
42
- * Lazily evaluate and cache the sender of the attestation
43
- * @returns The sender of the attestation
40
+ /**
41
+ * Lazily evaluate and cache the signer of the attestation
42
+ * @returns The signer of the attestation
44
43
  */
45
44
  getSender(): EthAddress;
46
45
  getPayload(): Buffer;
@@ -1 +1 @@
1
- {"version":3,"file":"block_attestation.d.ts","sourceRoot":"","sources":["../../src/p2p/block_attestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAI9E,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,oBAAqB,SAAQ,QAAQ;gBACpC,IAAI,EAAE,MAAM;CAGzB;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAM5C,2CAA2C;aAC3B,WAAW,EAAE,MAAM;IAEnC,iEAAiE;aACjD,OAAO,EAAE,gBAAgB;IAEzC,0CAA0C;aAC1B,SAAS,EAAE,SAAS;IAZtC,OAAgB,QAAQ,YAA+B;IAEvD,OAAO,CAAC,MAAM,CAAyB;;IAGrC,2CAA2C;IAC3B,WAAW,EAAE,MAAM;IAEnC,iEAAiE;IACjD,OAAO,EAAE,gBAAgB;IAEzC,0CAA0C;IAC1B,SAAS,EAAE,SAAS;IAKtC,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAQ5C;IAEQ,4BAA4B,IAAI,OAAO,CAAC,QAAQ,CAAC;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yB;;IAGrC,2CAA2C;IAC3B,WAAW,EAAE,MAAM;IAEnC,iEAAiE;IACjD,OAAO,EAAE,gBAAgB;IAEzC,0CAA0C;IAC1B,SAAS,EAAE,SAAS;IAKtC,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAQ5C;IAEQ,4BAA4B,IAAI,OAAO,CAAC,QAAQ,CAAC;IAI1D,IAAI,OAAO,IAAI,EAAE,CAEhB;IAED,IAAI,UAAU,IAAI,EAAE,CAEnB;IAED;;;OAGG;IACH,SAAS,IAAI,UAAU;IAWvB,UAAU,IAAI,MAAM;IAIpB,QAAQ,IAAI,MAAM;IAIlB,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,gBAAgB;IAK/D,MAAM,CAAC,KAAK,IAAI,gBAAgB;IAIhC,OAAO,IAAI,MAAM;CAGlB"}
@@ -43,10 +43,9 @@ export class BlockAttestationHash extends Buffer32 {
43
43
  get slotNumber() {
44
44
  return this.payload.header.slotNumber;
45
45
  }
46
- /**Get sender
47
- *
48
- * Lazily evaluate and cache the sender of the attestation
49
- * @returns The sender of the attestation
46
+ /**
47
+ * Lazily evaluate and cache the signer of the attestation
48
+ * @returns The signer of the attestation
50
49
  */ getSender() {
51
50
  if (!this.sender) {
52
51
  // Recover the sender from the attestation
@@ -3,6 +3,8 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
3
3
  import { Signature } from '@aztec/foundation/eth-signature';
4
4
  import { Fr } from '@aztec/foundation/fields';
5
5
  import { BufferReader } from '@aztec/foundation/serialize';
6
+ import type { BlockInfo } from '../block/l2_block.js';
7
+ import { TxHash } from '../tx/index.js';
6
8
  import { Tx } from '../tx/tx.js';
7
9
  import type { UInt32 } from '../types/index.js';
8
10
  import { ConsensusPayload } from './consensus_payload.js';
@@ -27,6 +29,8 @@ export declare class BlockProposal extends Gossipable {
27
29
  readonly payload: ConsensusPayload;
28
30
  /** The signer of the BlockProposal over the header of the new block*/
29
31
  readonly signature: Signature;
32
+ /** The sequence of transactions in the block */
33
+ readonly txHashes: TxHash[];
30
34
  /** The transactions in the block */
31
35
  readonly txs?: Tx[] | undefined;
32
36
  static p2pTopic: TopicType;
@@ -38,12 +42,15 @@ export declare class BlockProposal extends Gossipable {
38
42
  payload: ConsensusPayload,
39
43
  /** The signer of the BlockProposal over the header of the new block*/
40
44
  signature: Signature,
45
+ /** The sequence of transactions in the block */
46
+ txHashes: TxHash[],
41
47
  /** The transactions in the block */
42
48
  txs?: Tx[] | undefined);
43
49
  generateP2PMessageIdentifier(): Promise<Buffer32>;
44
50
  get archive(): Fr;
45
51
  get slotNumber(): Fr;
46
- static createProposalFromSigner(blockNumber: UInt32, payload: ConsensusPayload, txs: Tx[] | undefined, payloadSigner: (payload: Buffer32) => Promise<Signature>): Promise<BlockProposal>;
52
+ toBlockInfo(): BlockInfo;
53
+ static createProposalFromSigner(blockNumber: UInt32, payload: ConsensusPayload, txHashes: TxHash[], txs: Tx[] | undefined, payloadSigner: (payload: Buffer32) => Promise<Signature>): Promise<BlockProposal>;
47
54
  /**Get Sender
48
55
  * Lazily evaluate the sender of the proposal; result is cached
49
56
  */
@@ -1 +1 @@
1
- {"version":3,"file":"block_proposal.d.ts","sourceRoot":"","sources":["../../src/p2p/block_proposal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAA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