@aztec/stdlib 0.0.1-commit.7035c9bd6 → 0.0.1-commit.71324e566

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 (333) hide show
  1. package/dest/abi/abi.d.ts +138 -1
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +10 -2
  4. package/dest/abi/authorization_selector.d.ts +3 -6
  5. package/dest/abi/authorization_selector.d.ts.map +1 -1
  6. package/dest/abi/buffer.d.ts +14 -4
  7. package/dest/abi/buffer.d.ts.map +1 -1
  8. package/dest/abi/buffer.js +25 -4
  9. package/dest/abi/decoder.d.ts +5 -44
  10. package/dest/abi/decoder.d.ts.map +1 -1
  11. package/dest/abi/decoder.js +12 -67
  12. package/dest/abi/encoder.d.ts +1 -1
  13. package/dest/abi/encoder.d.ts.map +1 -1
  14. package/dest/abi/encoder.js +32 -6
  15. package/dest/abi/event_selector.d.ts +3 -6
  16. package/dest/abi/event_selector.d.ts.map +1 -1
  17. package/dest/abi/function_selector.d.ts +3 -6
  18. package/dest/abi/function_selector.d.ts.map +1 -1
  19. package/dest/abi/function_selector.js +2 -4
  20. package/dest/abi/function_signature_decoder.d.ts +43 -0
  21. package/dest/abi/function_signature_decoder.d.ts.map +1 -0
  22. package/dest/abi/function_signature_decoder.js +66 -0
  23. package/dest/abi/index.d.ts +2 -1
  24. package/dest/abi/index.d.ts.map +1 -1
  25. package/dest/abi/index.js +1 -0
  26. package/dest/abi/note_selector.d.ts +3 -6
  27. package/dest/abi/note_selector.d.ts.map +1 -1
  28. package/dest/abi/note_selector.js +1 -3
  29. package/dest/abi/selector.d.ts +2 -2
  30. package/dest/abi/selector.d.ts.map +1 -1
  31. package/dest/abi/selector.js +1 -1
  32. package/dest/avm/revert_code.d.ts +8 -18
  33. package/dest/avm/revert_code.d.ts.map +1 -1
  34. package/dest/avm/revert_code.js +15 -30
  35. package/dest/aztec-address/index.d.ts +3 -6
  36. package/dest/aztec-address/index.d.ts.map +1 -1
  37. package/dest/aztec-address/index.js +2 -4
  38. package/dest/block/block_data.d.ts +8 -8
  39. package/dest/block/block_data.d.ts.map +1 -1
  40. package/dest/block/block_data.js +2 -2
  41. package/dest/block/block_hash.d.ts +11 -10
  42. package/dest/block/block_hash.d.ts.map +1 -1
  43. package/dest/block/block_hash.js +10 -9
  44. package/dest/block/l2_block_info.d.ts +6 -5
  45. package/dest/block/l2_block_info.d.ts.map +1 -1
  46. package/dest/block/l2_block_info.js +6 -5
  47. package/dest/block/l2_block_source.d.ts +84 -5
  48. package/dest/block/l2_block_source.d.ts.map +1 -1
  49. package/dest/block/l2_block_source.js +1 -0
  50. package/dest/block/l2_block_stream/interfaces.d.ts +6 -3
  51. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  52. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
  53. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  54. package/dest/block/l2_block_stream/l2_tips_store_base.js +18 -5
  55. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  56. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  57. package/dest/block/test/l2_tips_store_test_suite.js +4 -3
  58. package/dest/checkpoint/checkpoint.d.ts +7 -1
  59. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  60. package/dest/checkpoint/checkpoint.js +9 -1
  61. package/dest/checkpoint/checkpoint_data.d.ts +71 -5
  62. package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
  63. package/dest/checkpoint/checkpoint_data.js +10 -0
  64. package/dest/config/chain-config.d.ts +1 -1
  65. package/dest/config/chain-config.d.ts.map +1 -1
  66. package/dest/config/chain-config.js +7 -1
  67. package/dest/config/sequencer-config.d.ts +2 -2
  68. package/dest/config/sequencer-config.d.ts.map +1 -1
  69. package/dest/config/sequencer-config.js +10 -3
  70. package/dest/contract/index.d.ts +1 -3
  71. package/dest/contract/index.d.ts.map +1 -1
  72. package/dest/contract/index.js +0 -2
  73. package/dest/contract/interfaces/contract_class.d.ts +3 -156
  74. package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
  75. package/dest/contract/interfaces/contract_class.js +1 -28
  76. package/dest/epoch-helpers/index.d.ts +7 -1
  77. package/dest/epoch-helpers/index.d.ts.map +1 -1
  78. package/dest/epoch-helpers/index.js +12 -0
  79. package/dest/file-store/factory.d.ts +4 -3
  80. package/dest/file-store/factory.d.ts.map +1 -1
  81. package/dest/file-store/factory.js +2 -2
  82. package/dest/file-store/http.d.ts +9 -2
  83. package/dest/file-store/http.d.ts.map +1 -1
  84. package/dest/file-store/http.js +20 -9
  85. package/dest/file-store/index.d.ts +2 -1
  86. package/dest/file-store/index.d.ts.map +1 -1
  87. package/dest/gas/fee_math.d.ts +49 -0
  88. package/dest/gas/fee_math.d.ts.map +1 -0
  89. package/dest/gas/fee_math.js +80 -0
  90. package/dest/gas/gas_fees.d.ts +1 -1
  91. package/dest/gas/gas_fees.d.ts.map +1 -1
  92. package/dest/gas/gas_fees.js +10 -1
  93. package/dest/gas/gas_settings.d.ts +40 -3
  94. package/dest/gas/gas_settings.d.ts.map +1 -1
  95. package/dest/gas/gas_settings.js +50 -6
  96. package/dest/gas/index.d.ts +2 -1
  97. package/dest/gas/index.d.ts.map +1 -1
  98. package/dest/gas/index.js +1 -0
  99. package/dest/ha-signing/index.d.ts +2 -2
  100. package/dest/ha-signing/index.d.ts.map +1 -1
  101. package/dest/ha-signing/index.js +1 -1
  102. package/dest/ha-signing/local_config.js +1 -1
  103. package/dest/ha-signing/types.d.ts +37 -32
  104. package/dest/ha-signing/types.d.ts.map +1 -1
  105. package/dest/ha-signing/types.js +13 -6
  106. package/dest/hash/hash.d.ts +4 -1
  107. package/dest/hash/hash.d.ts.map +1 -1
  108. package/dest/hash/hash.js +5 -0
  109. package/dest/interfaces/archiver.d.ts +1 -1
  110. package/dest/interfaces/archiver.d.ts.map +1 -1
  111. package/dest/interfaces/archiver.js +3 -1
  112. package/dest/interfaces/aztec-node-admin.d.ts +4 -14
  113. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  114. package/dest/interfaces/aztec-node-admin.js +3 -3
  115. package/dest/interfaces/aztec-node-debug.d.ts +21 -0
  116. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
  117. package/dest/interfaces/aztec-node-debug.js +18 -0
  118. package/dest/interfaces/aztec-node.d.ts +10 -1
  119. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  120. package/dest/interfaces/aztec-node.js +2 -0
  121. package/dest/interfaces/client.d.ts +2 -1
  122. package/dest/interfaces/client.d.ts.map +1 -1
  123. package/dest/interfaces/client.js +1 -0
  124. package/dest/interfaces/merkle_tree_operations.d.ts +4 -3
  125. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  126. package/dest/interfaces/prover-client.d.ts +1 -1
  127. package/dest/interfaces/prover-client.d.ts.map +1 -1
  128. package/dest/interfaces/prover-client.js +0 -3
  129. package/dest/interfaces/proving-job.d.ts +34 -34
  130. package/dest/interfaces/slasher.d.ts +1 -10
  131. package/dest/interfaces/slasher.d.ts.map +1 -1
  132. package/dest/interfaces/slasher.js +0 -2
  133. package/dest/interfaces/validator.d.ts +9 -20
  134. package/dest/interfaces/validator.d.ts.map +1 -1
  135. package/dest/interfaces/validator.js +0 -1
  136. package/dest/l1-contracts/index.d.ts +2 -2
  137. package/dest/l1-contracts/index.d.ts.map +1 -1
  138. package/dest/l1-contracts/index.js +1 -1
  139. package/dest/logs/extended_directional_app_tagging_secret.d.ts +4 -4
  140. package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -1
  141. package/dest/logs/extended_directional_app_tagging_secret.js +12 -5
  142. package/dest/logs/log_id.d.ts +1 -1
  143. package/dest/logs/log_id.d.ts.map +1 -1
  144. package/dest/logs/log_id.js +1 -2
  145. package/dest/logs/message_context.d.ts +4 -7
  146. package/dest/logs/message_context.d.ts.map +1 -1
  147. package/dest/logs/message_context.js +23 -9
  148. package/dest/logs/pending_tagged_log.d.ts +2 -3
  149. package/dest/logs/pending_tagged_log.d.ts.map +1 -1
  150. package/dest/logs/pending_tagged_log.js +2 -2
  151. package/dest/logs/shared_secret_derivation.d.ts +11 -10
  152. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  153. package/dest/logs/shared_secret_derivation.js +15 -9
  154. package/dest/logs/siloed_tag.d.ts +8 -7
  155. package/dest/logs/siloed_tag.d.ts.map +1 -1
  156. package/dest/logs/siloed_tag.js +11 -3
  157. package/dest/logs/tag.d.ts +5 -6
  158. package/dest/logs/tag.d.ts.map +1 -1
  159. package/dest/logs/tag.js +4 -0
  160. package/dest/messaging/l1_to_l2_message.d.ts +3 -2
  161. package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
  162. package/dest/messaging/l1_to_l2_message.js +11 -13
  163. package/dest/note/note_dao.d.ts +1 -1
  164. package/dest/note/note_dao.d.ts.map +1 -1
  165. package/dest/note/note_dao.js +1 -4
  166. package/dest/p2p/block_proposal.d.ts +6 -8
  167. package/dest/p2p/block_proposal.d.ts.map +1 -1
  168. package/dest/p2p/block_proposal.js +4 -9
  169. package/dest/p2p/checkpoint_attestation.d.ts +4 -6
  170. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  171. package/dest/p2p/checkpoint_attestation.js +2 -7
  172. package/dest/p2p/checkpoint_proposal.d.ts +8 -10
  173. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  174. package/dest/p2p/checkpoint_proposal.js +5 -24
  175. package/dest/p2p/gossipable.d.ts +4 -4
  176. package/dest/p2p/gossipable.d.ts.map +1 -1
  177. package/dest/proofs/chonk_proof.d.ts +46 -2
  178. package/dest/proofs/chonk_proof.d.ts.map +1 -1
  179. package/dest/proofs/chonk_proof.js +85 -10
  180. package/dest/slashing/index.d.ts +2 -3
  181. package/dest/slashing/index.d.ts.map +1 -1
  182. package/dest/slashing/index.js +1 -2
  183. package/dest/slashing/serialization.d.ts +2 -6
  184. package/dest/slashing/serialization.d.ts.map +1 -1
  185. package/dest/slashing/serialization.js +0 -60
  186. package/dest/slashing/types.d.ts +4 -90
  187. package/dest/slashing/types.d.ts.map +1 -1
  188. package/dest/slashing/types.js +0 -14
  189. package/dest/slashing/{tally.d.ts → votes.d.ts} +1 -1
  190. package/dest/slashing/{tally.d.ts.map → votes.d.ts.map} +1 -1
  191. package/dest/slashing/{tally.js → votes.js} +1 -1
  192. package/dest/tests/factories.d.ts +2 -4
  193. package/dest/tests/factories.d.ts.map +1 -1
  194. package/dest/tests/factories.js +11 -28
  195. package/dest/tests/mocks.d.ts +1 -1
  196. package/dest/tests/mocks.d.ts.map +1 -1
  197. package/dest/tests/mocks.js +14 -19
  198. package/dest/timetable/index.d.ts +51 -1
  199. package/dest/timetable/index.d.ts.map +1 -1
  200. package/dest/timetable/index.js +204 -14
  201. package/dest/tx/block_header.d.ts +2 -2
  202. package/dest/tx/block_header.d.ts.map +1 -1
  203. package/dest/tx/block_header.js +1 -1
  204. package/dest/tx/capsule.d.ts +6 -2
  205. package/dest/tx/capsule.d.ts.map +1 -1
  206. package/dest/tx/capsule.js +9 -3
  207. package/dest/tx/fee_provider.d.ts +10 -0
  208. package/dest/tx/fee_provider.d.ts.map +1 -0
  209. package/dest/tx/fee_provider.js +1 -0
  210. package/dest/tx/global_variable_builder.d.ts +3 -4
  211. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  212. package/dest/tx/index.d.ts +2 -1
  213. package/dest/tx/index.d.ts.map +1 -1
  214. package/dest/tx/index.js +1 -0
  215. package/dest/tx/indexed_tx_effect.d.ts +1 -1
  216. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  217. package/dest/tx/indexed_tx_effect.js +1 -2
  218. package/dest/tx/simulated_tx.d.ts +112 -4
  219. package/dest/tx/simulated_tx.d.ts.map +1 -1
  220. package/dest/tx/simulated_tx.js +3 -3
  221. package/dest/tx/tx.d.ts +3 -3
  222. package/dest/tx/tx.d.ts.map +1 -1
  223. package/dest/tx/tx_receipt.d.ts +8 -4
  224. package/dest/tx/tx_receipt.d.ts.map +1 -1
  225. package/dest/tx/tx_receipt.js +8 -15
  226. package/dest/tx/validator/error_texts.d.ts +5 -1
  227. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  228. package/dest/tx/validator/error_texts.js +6 -0
  229. package/dest/world-state/genesis_data.d.ts +11 -0
  230. package/dest/world-state/genesis_data.d.ts.map +1 -0
  231. package/dest/world-state/genesis_data.js +4 -0
  232. package/dest/world-state/index.d.ts +2 -1
  233. package/dest/world-state/index.d.ts.map +1 -1
  234. package/dest/world-state/index.js +1 -0
  235. package/package.json +8 -8
  236. package/src/abi/abi.ts +25 -2
  237. package/src/abi/authorization_selector.ts +2 -8
  238. package/src/abi/buffer.ts +25 -4
  239. package/src/abi/decoder.ts +23 -78
  240. package/src/abi/encoder.ts +42 -6
  241. package/src/abi/event_selector.ts +2 -8
  242. package/src/abi/function_selector.ts +4 -13
  243. package/src/abi/function_signature_decoder.ts +77 -0
  244. package/src/abi/index.ts +1 -0
  245. package/src/abi/note_selector.ts +3 -12
  246. package/src/abi/selector.ts +1 -1
  247. package/src/avm/revert_code.ts +25 -39
  248. package/src/aztec-address/index.ts +4 -10
  249. package/src/block/block_data.ts +3 -4
  250. package/src/block/block_hash.ts +21 -14
  251. package/src/block/l2_block_info.ts +8 -6
  252. package/src/block/l2_block_source.ts +14 -4
  253. package/src/block/l2_block_stream/interfaces.ts +6 -2
  254. package/src/block/l2_block_stream/l2_tips_store_base.ts +25 -13
  255. package/src/block/test/l2_tips_store_test_suite.ts +9 -2
  256. package/src/checkpoint/checkpoint.ts +11 -1
  257. package/src/checkpoint/checkpoint_data.ts +40 -4
  258. package/src/config/chain-config.ts +7 -1
  259. package/src/config/sequencer-config.ts +14 -4
  260. package/src/contract/index.ts +0 -2
  261. package/src/contract/interfaces/contract_class.ts +2 -82
  262. package/src/epoch-helpers/index.ts +24 -0
  263. package/src/file-store/factory.ts +13 -4
  264. package/src/file-store/http.ts +29 -10
  265. package/src/file-store/index.ts +1 -0
  266. package/src/gas/README.md +31 -0
  267. package/src/gas/fee_math.ts +120 -0
  268. package/src/gas/gas_fees.ts +12 -4
  269. package/src/gas/gas_settings.ts +65 -12
  270. package/src/gas/index.ts +1 -0
  271. package/src/ha-signing/index.ts +3 -1
  272. package/src/ha-signing/local_config.ts +1 -1
  273. package/src/ha-signing/types.ts +48 -34
  274. package/src/hash/hash.ts +5 -0
  275. package/src/interfaces/archiver.ts +3 -1
  276. package/src/interfaces/aztec-node-admin.ts +5 -7
  277. package/src/interfaces/aztec-node-debug.ts +40 -0
  278. package/src/interfaces/aztec-node.ts +15 -0
  279. package/src/interfaces/client.ts +1 -0
  280. package/src/interfaces/merkle_tree_operations.ts +3 -2
  281. package/src/interfaces/prover-client.ts +2 -5
  282. package/src/interfaces/slasher.ts +0 -6
  283. package/src/interfaces/validator.ts +16 -13
  284. package/src/l1-contracts/index.ts +1 -1
  285. package/src/logs/extended_directional_app_tagging_secret.ts +19 -8
  286. package/src/logs/log_id.ts +1 -2
  287. package/src/logs/message_context.ts +17 -7
  288. package/src/logs/pending_tagged_log.ts +1 -3
  289. package/src/logs/shared_secret_derivation.ts +21 -10
  290. package/src/logs/siloed_tag.ts +15 -11
  291. package/src/logs/tag.ts +8 -8
  292. package/src/messaging/l1_to_l2_message.ts +12 -9
  293. package/src/note/note_dao.ts +1 -4
  294. package/src/p2p/block_proposal.ts +13 -9
  295. package/src/p2p/checkpoint_attestation.ts +5 -9
  296. package/src/p2p/checkpoint_proposal.ts +21 -36
  297. package/src/p2p/gossipable.ts +4 -4
  298. package/src/proofs/chonk_proof.ts +91 -5
  299. package/src/slashing/index.ts +1 -2
  300. package/src/slashing/serialization.ts +1 -81
  301. package/src/slashing/types.ts +3 -35
  302. package/src/slashing/{tally.ts → votes.ts} +1 -1
  303. package/src/tests/factories.ts +5 -34
  304. package/src/tests/mocks.ts +16 -12
  305. package/src/timetable/index.ts +293 -13
  306. package/src/tx/block_header.ts +2 -2
  307. package/src/tx/capsule.ts +10 -2
  308. package/src/tx/fee_provider.ts +10 -0
  309. package/src/tx/global_variable_builder.ts +2 -3
  310. package/src/tx/index.ts +1 -0
  311. package/src/tx/indexed_tx_effect.ts +1 -2
  312. package/src/tx/simulated_tx.ts +6 -2
  313. package/src/tx/tx.ts +2 -2
  314. package/src/tx/tx_receipt.ts +11 -14
  315. package/src/tx/validator/error_texts.ts +8 -0
  316. package/src/world-state/genesis_data.ts +15 -0
  317. package/src/world-state/index.ts +1 -0
  318. package/dest/contract/private_function_membership_proof.d.ts +0 -32
  319. package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
  320. package/dest/contract/private_function_membership_proof.js +0 -124
  321. package/dest/contract/utility_function_membership_proof.d.ts +0 -27
  322. package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
  323. package/dest/contract/utility_function_membership_proof.js +0 -87
  324. package/dest/l1-contracts/slash_factory.d.ts +0 -45
  325. package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
  326. package/dest/l1-contracts/slash_factory.js +0 -158
  327. package/dest/slashing/empire.d.ts +0 -31
  328. package/dest/slashing/empire.d.ts.map +0 -1
  329. package/dest/slashing/empire.js +0 -87
  330. package/src/contract/private_function_membership_proof.ts +0 -167
  331. package/src/contract/utility_function_membership_proof.ts +0 -118
  332. package/src/l1-contracts/slash_factory.ts +0 -180
  333. package/src/slashing/empire.ts +0 -104
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BlockNumber,
3
- type CheckpointNumber,
3
+ CheckpointNumber,
4
4
  type IndexWithinCheckpoint,
5
5
  type SlotNumber,
6
6
  } from '@aztec/foundation/branded-types';
@@ -20,40 +20,40 @@ export enum DutyType {
20
20
  }
21
21
 
22
22
  /**
23
- * Base context for signing operations
23
+ * Signing context for block proposals.
24
+ * Includes both the block number and the checkpoint number the block belongs to.
24
25
  */
25
- interface BaseSigningContext {
26
- /** Slot number for this duty */
26
+ export interface BlockProposalSigningContext {
27
27
  slot: SlotNumber;
28
- /**
29
- * Block or checkpoint number for this duty.
30
- * For block proposals, this is the block number.
31
- * For checkpoint proposals, this is the checkpoint number.
32
- */
33
- blockNumber: BlockNumber | CheckpointNumber;
28
+ blockNumber: BlockNumber;
29
+ checkpointNumber: CheckpointNumber;
30
+ /** Block index within checkpoint (0, 1, 2...). Required for block proposals. */
31
+ blockIndexWithinCheckpoint: IndexWithinCheckpoint;
32
+ dutyType: DutyType.BLOCK_PROPOSAL;
34
33
  }
35
34
 
36
35
  /**
37
- * Signing context for block proposals.
38
- * blockIndexWithinCheckpoint is REQUIRED and must be >= 0.
36
+ * Signing context for checkpoint proposals.
37
+ * Includes the checkpoint number being proposed, but not a block number.
39
38
  */
40
- export interface BlockProposalSigningContext extends BaseSigningContext {
41
- /** Block index within checkpoint (0, 1, 2...). Required for block proposals. */
42
- blockIndexWithinCheckpoint: IndexWithinCheckpoint;
43
- dutyType: DutyType.BLOCK_PROPOSAL;
39
+ export interface CheckpointProposalSigningContext {
40
+ slot: SlotNumber;
41
+ checkpointNumber: CheckpointNumber;
42
+ dutyType: DutyType.CHECKPOINT_PROPOSAL;
44
43
  }
45
44
 
46
45
  /**
47
- * Signing context for non-block-proposal duties that require HA protection.
48
- * blockIndexWithinCheckpoint is not applicable (internally always -1).
46
+ * Signing context for attestation duties (checkpoint attestations).
47
+ * Includes the checkpoint number when available (from proposal validation).
49
48
  */
50
- export interface OtherSigningContext extends BaseSigningContext {
51
- dutyType: DutyType.CHECKPOINT_PROPOSAL | DutyType.ATTESTATION | DutyType.ATTESTATIONS_AND_SIGNERS;
49
+ export interface AttestationSigningContext {
50
+ slot: SlotNumber;
51
+ checkpointNumber: CheckpointNumber;
52
+ dutyType: DutyType.ATTESTATION | DutyType.ATTESTATIONS_AND_SIGNERS;
52
53
  }
53
54
 
54
55
  /**
55
56
  * Signing context for governance/slashing votes which only need slot for HA protection.
56
- * blockNumber is not applicable (internally always 0).
57
57
  */
58
58
  export interface VoteSigningContext {
59
59
  slot: SlotNumber;
@@ -69,18 +69,23 @@ export interface NoHAProtectionSigningContext {
69
69
  }
70
70
 
71
71
  /**
72
- * Signing contexts that require HA protection (excludes AUTH_REQUEST).
72
+ * Signing contexts that require HA protection (excludes AUTH_REQUEST and TXS).
73
73
  * Used by the HA signer's signWithProtection method.
74
74
  */
75
- export type HAProtectedSigningContext = BlockProposalSigningContext | OtherSigningContext | VoteSigningContext;
75
+ export type HAProtectedSigningContext =
76
+ | BlockProposalSigningContext
77
+ | CheckpointProposalSigningContext
78
+ | AttestationSigningContext
79
+ | VoteSigningContext;
76
80
 
77
81
  /**
78
82
  * Context required for slashing protection during signing operations.
79
83
  * Uses discriminated union to enforce type safety:
80
- * - BLOCK_PROPOSAL duties MUST have blockIndexWithinCheckpoint >= 0
81
- * - Other duty types do NOT have blockIndexWithinCheckpoint (internally -1)
82
- * - Vote duties only need slot (blockNumber is internally 0)
83
- * - AUTH_REQUEST and TXS duties don't need slot/blockNumber (no HA protection needed)
84
+ * - BLOCK_PROPOSAL duties have blockNumber, checkpointNumber, and blockIndexWithinCheckpoint
85
+ * - CHECKPOINT_PROPOSAL duties have checkpointNumber
86
+ * - ATTESTATION/ATTESTATIONS_AND_SIGNERS duties have only slot
87
+ * - Vote duties have only slot
88
+ * - AUTH_REQUEST and TXS duties don't need HA protection
84
89
  */
85
90
  export type SigningContext = HAProtectedSigningContext | NoHAProtectionSigningContext;
86
91
 
@@ -94,19 +99,28 @@ export function isHAProtectedContext(context: SigningContext): context is HAProt
94
99
 
95
100
  /**
96
101
  * Gets the block number from a signing context.
97
- * - Vote duties (GOVERNANCE_VOTE, SLASHING_VOTE): returns BlockNumber(0)
98
- * - Other duties: returns the blockNumber from the context
102
+ * Only BLOCK_PROPOSAL duties carry a block number; all others return BlockNumber(0).
99
103
  */
100
- export function getBlockNumberFromSigningContext(context: HAProtectedSigningContext): BlockNumber | CheckpointNumber {
101
- // Check for duty types that have blockNumber
104
+ export function getBlockNumberFromSigningContext(context: HAProtectedSigningContext): BlockNumber {
105
+ if (context.dutyType === DutyType.BLOCK_PROPOSAL) {
106
+ return context.blockNumber;
107
+ }
108
+ return BlockNumber(0);
109
+ }
110
+
111
+ /**
112
+ * Gets the checkpoint number from a signing context.
113
+ * BLOCK_PROPOSAL, CHECKPOINT_PROPOSAL, ATTESTATION, and ATTESTATIONS_AND_SIGNERS duties carry a checkpoint number;
114
+ * vote duties return CheckpointNumber(0).
115
+ */
116
+ export function getCheckpointNumberFromSigningContext(context: HAProtectedSigningContext): CheckpointNumber {
102
117
  if (
103
118
  context.dutyType === DutyType.BLOCK_PROPOSAL ||
104
119
  context.dutyType === DutyType.CHECKPOINT_PROPOSAL ||
105
120
  context.dutyType === DutyType.ATTESTATION ||
106
121
  context.dutyType === DutyType.ATTESTATIONS_AND_SIGNERS
107
122
  ) {
108
- return context.blockNumber;
123
+ return context.checkpointNumber;
109
124
  }
110
- // Vote duties (GOVERNANCE_VOTE, SLASHING_VOTE) don't have blockNumber
111
- return BlockNumber(0);
125
+ return CheckpointNumber(0);
112
126
  }
package/src/hash/hash.ts CHANGED
@@ -98,6 +98,11 @@ export function computeProtocolNullifier(txRequestHash: Fr): Promise<Fr> {
98
98
  return siloNullifier(AztecAddress.fromBigInt(NULL_MSG_SENDER_CONTRACT_ADDRESS), txRequestHash);
99
99
  }
100
100
 
101
+ /** Domain-separates a raw log tag with the given domain separator. */
102
+ export function computeLogTag(rawTag: number | bigint | boolean | Fr | Buffer, domSep: DomainSeparator): Promise<Fr> {
103
+ return poseidon2HashWithSeparator([new Fr(rawTag)], domSep);
104
+ }
105
+
101
106
  export function computeSiloedPrivateLogFirstField(contract: AztecAddress, field: Fr): Promise<Fr> {
102
107
  return poseidon2HashWithSeparator([contract, field], DomainSeparator.PRIVATE_LOG_FIRST_FIELD);
103
108
  }
@@ -11,7 +11,7 @@ import { L2Block } from '../block/l2_block.js';
11
11
  import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
12
12
  import { ValidateCheckpointResultSchema } from '../block/validate_block_result.js';
13
13
  import { Checkpoint } from '../checkpoint/checkpoint.js';
14
- import { CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
14
+ import { CheckpointDataSchema, ProposedCheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
15
15
  import { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
16
16
  import {
17
17
  ContractClassPublicSchema,
@@ -150,6 +150,8 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
150
150
  .args()
151
151
  .returns(z.object({ genesisArchiveRoot: schemas.Fr })),
152
152
  getL1Timestamp: z.function().args().returns(schemas.BigInt.optional()),
153
+ getProposedCheckpoint: z.function().args().returns(ProposedCheckpointDataSchema.optional()),
154
+ getProposedCheckpointOnly: z.function().args().returns(ProposedCheckpointDataSchema.optional()),
153
155
  syncImmediate: z.function().args().returns(z.void()),
154
156
  isPendingChainInvalid: z.function().args().returns(z.boolean()),
155
157
  getPendingChainValidationStatus: z.function().args().returns(ValidateCheckpointResultSchema),
@@ -3,7 +3,8 @@ import { createSafeJsonRpcClient, defaultFetch } from '@aztec/foundation/json-rp
3
3
  import { z } from 'zod';
4
4
 
5
5
  import type { ApiSchemaFor } from '../schemas/schemas.js';
6
- import { type Offense, OffenseSchema, type SlashPayloadRound, SlashPayloadRoundSchema } from '../slashing/index.js';
6
+ import { optional } from '../schemas/schemas.js';
7
+ import { type Offense, OffenseSchema } from '../slashing/index.js';
7
8
  import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
8
9
  import { type ArchiverSpecificConfig, ArchiverSpecificConfigSchema } from './archiver.js';
9
10
  import { type SequencerConfig, SequencerConfigSchema } from './configs.js';
@@ -36,8 +37,9 @@ export interface AztecNodeAdmin {
36
37
  * Pauses syncing and rolls back the database to the target L2 block number.
37
38
  * @param targetBlockNumber - The block number to roll back to.
38
39
  * @param force - If true, clears the world state db and p2p dbs if rolling back to behind the finalized block.
40
+ * @param resumeSync - If true (default), resumes archiver and world state sync after rollback.
39
41
  */
40
- rollbackTo(targetBlockNumber: number, force?: boolean): Promise<void>;
42
+ rollbackTo(targetBlockNumber: number, force?: boolean, resumeSync?: boolean): Promise<void>;
41
43
 
42
44
  /** Pauses archiver and world state syncing. */
43
45
  pauseSync(): Promise<void>;
@@ -45,9 +47,6 @@ export interface AztecNodeAdmin {
45
47
  /** Resumes archiver and world state syncing. */
46
48
  resumeSync(): Promise<void>;
47
49
 
48
- /** Returns all monitored payloads by the slasher for the current round. */
49
- getSlashPayloads(): Promise<SlashPayloadRound[]>;
50
-
51
50
  /** Returns all offenses applicable for the given round. */
52
51
  getSlashOffenses(round: bigint | 'all' | 'current'): Promise<Offense[]>;
53
52
 
@@ -100,10 +99,9 @@ export const AztecNodeAdminApiSchema: ApiSchemaFor<AztecNodeAdmin> = {
100
99
  getConfig: z.function().returns(AztecNodeAdminConfigSchema),
101
100
  setConfig: z.function().args(AztecNodeAdminConfigSchema.partial()).returns(z.void()),
102
101
  startSnapshotUpload: z.function().args(z.string()).returns(z.void()),
103
- rollbackTo: z.function().args(z.number()).returns(z.void()),
102
+ rollbackTo: z.function().args(z.number(), optional(z.boolean()), optional(z.boolean())).returns(z.void()),
104
103
  pauseSync: z.function().returns(z.void()),
105
104
  resumeSync: z.function().returns(z.void()),
106
- getSlashPayloads: z.function().returns(z.array(SlashPayloadRoundSchema)),
107
105
  getSlashOffenses: z
108
106
  .function()
109
107
  .args(z.union([z.bigint(), z.literal('all'), z.literal('current')]))
@@ -0,0 +1,40 @@
1
+ import { createSafeJsonRpcClient, defaultFetch } from '@aztec/foundation/json-rpc/client';
2
+
3
+ import { z } from 'zod';
4
+
5
+ import type { ApiSchemaFor } from '../schemas/schemas.js';
6
+ import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
7
+
8
+ /**
9
+ * Debug interface for Aztec node available in sandbox/local-network mode.
10
+ */
11
+ export interface AztecNodeDebug {
12
+ /**
13
+ * Triggers the sequencer to produce an L2 block and waits for it to appear.
14
+ *
15
+ * **Precondition**: The current L2 slot must not already contain a block. Callers must ensure L1 time has been
16
+ * advanced to a slot with no existing block before calling this method (e.g. via `EthCheatCodes.warp()`).
17
+ * If the slot is already taken, the sequencer will fail to propose and this call will time out.
18
+ *
19
+ * @throws If no sequencer is running.
20
+ */
21
+ mineBlock(): Promise<void>;
22
+ }
23
+
24
+ export const AztecNodeDebugApiSchema: ApiSchemaFor<AztecNodeDebug> = {
25
+ mineBlock: z.function().returns(z.void()),
26
+ };
27
+
28
+ export function createAztecNodeDebugClient(
29
+ url: string,
30
+ versions: Partial<ComponentsVersions> = {},
31
+ fetch = defaultFetch,
32
+ apiKey?: string,
33
+ ): AztecNodeDebug {
34
+ return createSafeJsonRpcClient<AztecNodeDebug>(url, AztecNodeDebugApiSchema, {
35
+ namespaceMethods: 'nodeDebug',
36
+ fetch,
37
+ onResponse: getVersioningResponseHandler(versions),
38
+ ...(apiKey ? { extraHeaders: { 'x-api-key': apiKey } } : {}),
39
+ });
40
+ }
@@ -37,6 +37,7 @@ import {
37
37
  type ProtocolContractAddresses,
38
38
  ProtocolContractAddressesSchema,
39
39
  } from '../contract/index.js';
40
+ import { ManaUsageEstimate } from '../gas/fee_math.js';
40
41
  import { GasFees } from '../gas/gas_fees.js';
41
42
  import { SiloedTag, Tag, TxScopedL2Log } from '../logs/index.js';
42
43
  import { type LogFilter, LogFilterSchema } from '../logs/log_filter.js';
@@ -272,6 +273,15 @@ export interface AztecNode
272
273
  */
273
274
  getCurrentMinFees(): Promise<GasFees>;
274
275
 
276
+ /**
277
+ * Returns predicted min fees for the current slot and next N slots.
278
+ * Each entry accounts for the L1 gas oracle transition and congestion growth based on the
279
+ * given mana usage estimate. Defaults to target usage (steady state).
280
+ * @param manaUsage - Expected mana usage per checkpoint (none, target, or limit).
281
+ * @returns An array of GasFees, one per slot in the prediction window.
282
+ */
283
+ getPredictedMinFees(manaUsage?: ManaUsageEstimate): Promise<GasFees[]>;
284
+
275
285
  /**
276
286
  * Method to fetch the current max priority fee of txs in the mempool.
277
287
  * @returns The current max priority fees.
@@ -578,6 +588,11 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
578
588
 
579
589
  getCurrentMinFees: z.function().returns(GasFees.schema),
580
590
 
591
+ getPredictedMinFees: z
592
+ .function()
593
+ .args(optional(z.nativeEnum(ManaUsageEstimate)))
594
+ .returns(z.array(GasFees.schema)),
595
+
581
596
  getMaxPriorityFees: z.function().returns(GasFees.schema),
582
597
 
583
598
  getNodeVersion: z.function().returns(z.string()),
@@ -1,5 +1,6 @@
1
1
  export * from './aztec-node.js';
2
2
  export * from './aztec-node-admin.js';
3
+ export * from './aztec-node-debug.js';
3
4
  export * from './private_kernel_prover.js';
4
5
  export * from './get_logs_response.js';
5
6
  export * from './api_limit.js';
@@ -3,6 +3,7 @@ import type { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { type IndexedTreeLeafPreimage, SiblingPath } from '@aztec/foundation/trees';
5
5
 
6
+ import type { BlockHash } from '../block/block_hash.js';
6
7
  import type { MerkleTreeId, TreeHeights } from '../trees/merkle_tree_id.js';
7
8
  import type { NullifierLeaf } from '../trees/nullifier_leaf.js';
8
9
  import type { PublicDataTreeLeaf } from '../trees/public_data_leaf.js';
@@ -99,7 +100,7 @@ type LeafTypes = {
99
100
  [MerkleTreeId.NOTE_HASH_TREE]: Fr;
100
101
  [MerkleTreeId.PUBLIC_DATA_TREE]: Buffer;
101
102
  [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: Fr;
102
- [MerkleTreeId.ARCHIVE]: Fr;
103
+ [MerkleTreeId.ARCHIVE]: BlockHash;
103
104
  };
104
105
 
105
106
  type LeafValueTypes = {
@@ -107,7 +108,7 @@ type LeafValueTypes = {
107
108
  [MerkleTreeId.NOTE_HASH_TREE]: Fr;
108
109
  [MerkleTreeId.PUBLIC_DATA_TREE]: PublicDataTreeLeaf;
109
110
  [MerkleTreeId.L1_TO_L2_MESSAGE_TREE]: Fr;
110
- [MerkleTreeId.ARCHIVE]: Fr;
111
+ [MerkleTreeId.ARCHIVE]: BlockHash;
111
112
  };
112
113
 
113
114
  export type MerkleTreeLeafType<ID extends MerkleTreeId> = LeafTypes[ID];
@@ -71,7 +71,7 @@ export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
71
71
  },
72
72
  proverId: {
73
73
  env: 'PROVER_ID',
74
- parseEnv: (val?: string) => parseProverId(val),
74
+ parseEnv: (val: string) => parseProverId(val),
75
75
  description: 'Hex value that identifies the prover. Defaults to the address used for submitting proofs if not set.',
76
76
  },
77
77
  proverTestDelayType: {
@@ -117,10 +117,7 @@ export const proverConfigMappings: ConfigMappingsType<ProverConfig> = {
117
117
  },
118
118
  };
119
119
 
120
- function parseProverId(str?: string) {
121
- if (!str) {
122
- return undefined;
123
- }
120
+ function parseProverId(str: string) {
124
121
  return EthAddress.fromString(str);
125
122
  }
126
123
 
@@ -3,12 +3,8 @@ import { schemas, zodFor } from '@aztec/foundation/schemas';
3
3
 
4
4
  import { z } from 'zod';
5
5
 
6
- export type SlasherClientType = 'empire' | 'tally';
7
-
8
6
  export interface SlasherConfig {
9
7
  slashOverridePayload?: EthAddress;
10
- slashMinPenaltyPercentage: number;
11
- slashMaxPenaltyPercentage: number;
12
8
  slashSelfAllowed?: boolean; // Whether to allow slashes to own validators
13
9
  slashValidatorsAlways: EthAddress[]; // Array of validator addresses
14
10
  slashValidatorsNever: EthAddress[]; // Array of validator addresses
@@ -32,8 +28,6 @@ export interface SlasherConfig {
32
28
  export const SlasherConfigSchema = zodFor<SlasherConfig>()(
33
29
  z.object({
34
30
  slashOverridePayload: schemas.EthAddress.optional(),
35
- slashMinPenaltyPercentage: z.number(),
36
- slashMaxPenaltyPercentage: z.number(),
37
31
  slashValidatorsAlways: z.array(schemas.EthAddress),
38
32
  slashValidatorsNever: z.array(schemas.EthAddress),
39
33
  slashPrunePenalty: schemas.BigInt,
@@ -1,4 +1,4 @@
1
- import type { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
1
+ import type { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
2
2
  import type { SecretValue } from '@aztec/foundation/config';
3
3
  import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import type { EthAddress } from '@aztec/foundation/eth-address';
@@ -9,7 +9,6 @@ import type {
9
9
  BlockProposal,
10
10
  BlockProposalOptions,
11
11
  CheckpointAttestation,
12
- CheckpointLastBlockData,
13
12
  CheckpointProposal,
14
13
  CheckpointProposalOptions,
15
14
  } from '@aztec/stdlib/p2p';
@@ -48,10 +47,7 @@ export type ValidatorClientConfig = ValidatorHASignerConfig &
48
47
  /** Interval between polling for new attestations from peers */
49
48
  attestationPollingIntervalMs: number;
50
49
 
51
- /** Whether to re-execute transactions in a block proposal before attesting */
52
- validatorReexecute: boolean;
53
-
54
- /** Whether to always reexecute block proposals, even for non-validator nodes or when out of the currnet committee */
50
+ /** Whether to always reexecute block proposals, even for non-validator nodes or when out of the current committee */
55
51
  alwaysReexecuteBlockProposals?: boolean;
56
52
 
57
53
  /** Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus */
@@ -98,7 +94,6 @@ export const ValidatorClientConfigSchema = zodFor<Omit<ValidatorClientConfig, 'v
98
94
  disableValidator: z.boolean(),
99
95
  disabledValidators: z.array(schemas.EthAddress),
100
96
  attestationPollingIntervalMs: z.number().min(0),
101
- validatorReexecute: z.boolean(),
102
97
  alwaysReexecuteBlockProposals: z.boolean().optional(),
103
98
  fishermanMode: z.boolean().optional(),
104
99
  skipCheckpointProposalValidation: z.boolean().optional(),
@@ -122,8 +117,6 @@ export const ValidatorClientFullConfigSchema = zodFor<Omit<ValidatorClientFullCo
122
117
  }),
123
118
  );
124
119
 
125
- export type CreateCheckpointProposalLastBlockData = Omit<CheckpointLastBlockData, 'txHashes'> & { txs: Tx[] };
126
-
127
120
  export interface Validator {
128
121
  start(): Promise<void>;
129
122
  updateConfig(config: Partial<ValidatorClientFullConfig>): void;
@@ -131,6 +124,7 @@ export interface Validator {
131
124
  // Block validation responsibilities
132
125
  createBlockProposal(
133
126
  blockHeader: BlockHeader,
127
+ checkpointNumber: CheckpointNumber,
134
128
  indexWithinCheckpoint: number,
135
129
  inHash: Fr,
136
130
  archive: Fr,
@@ -143,8 +137,9 @@ export interface Validator {
143
137
  createCheckpointProposal(
144
138
  checkpointHeader: CheckpointHeader,
145
139
  archive: Fr,
140
+ checkpointNumber: CheckpointNumber,
146
141
  feeAssetPriceModifier: bigint,
147
- lastBlockInfo: CreateCheckpointProposalLastBlockData | undefined,
142
+ lastBlockProposal: BlockProposal | undefined,
148
143
  proposerAddress: EthAddress | undefined,
149
144
  options: CheckpointProposalOptions,
150
145
  ): Promise<CheckpointProposal>;
@@ -168,15 +163,23 @@ export interface Validator {
168
163
  broadcastBlockProposal(proposal: BlockProposal): Promise<void>;
169
164
 
170
165
  /** Collect own attestations for a checkpoint proposal (used when skipping p2p attestation collection) */
171
- collectOwnAttestations(proposal: CheckpointProposal): Promise<CheckpointAttestation[]>;
166
+ collectOwnAttestations(
167
+ proposal: CheckpointProposal,
168
+ checkpointNumber: CheckpointNumber,
169
+ ): Promise<CheckpointAttestation[]>;
172
170
 
173
171
  /** Collect attestations from the p2p network for a checkpoint proposal */
174
- collectAttestations(proposal: CheckpointProposal, required: number, deadline: Date): Promise<CheckpointAttestation[]>;
172
+ collectAttestations(
173
+ proposal: CheckpointProposal,
174
+ required: number,
175
+ deadline: Date,
176
+ checkpointNumber: CheckpointNumber,
177
+ ): Promise<CheckpointAttestation[]>;
175
178
 
176
179
  signAttestationsAndSigners(
177
180
  attestationsAndSigners: CommitteeAttestationsAndSigners,
178
181
  proposer: EthAddress,
179
182
  slot: SlotNumber,
180
- blockNumber: BlockNumber | CheckpointNumber,
183
+ checkpointNumber: CheckpointNumber,
181
184
  ): Promise<Signature>;
182
185
  }
@@ -1 +1 @@
1
- export * from './slash_factory.js';
1
+ // No exports.
@@ -23,14 +23,14 @@ import { computeAddressSecret, computePreaddress } from '../keys/derivation.js';
23
23
  * doesn't seem to be a good way around this.
24
24
  */
25
25
  export class ExtendedDirectionalAppTaggingSecret {
26
- private constructor(
26
+ constructor(
27
27
  public readonly secret: Fr,
28
28
  public readonly app: AztecAddress,
29
29
  ) {}
30
30
 
31
31
  /**
32
32
  * Derives shared tagging secret and from that, the app address and recipient derives the directional app tagging
33
- * secret.
33
+ * secret. Returns undefined if `externalAddress` is an invalid address.
34
34
  *
35
35
  * @param localAddress - The complete address of entity A in the shared tagging secret derivation scheme
36
36
  * @param localIvsk - The incoming viewing secret key of entity A
@@ -45,8 +45,12 @@ export class ExtendedDirectionalAppTaggingSecret {
45
45
  externalAddress: AztecAddress,
46
46
  app: AztecAddress,
47
47
  recipient: AztecAddress,
48
- ): Promise<ExtendedDirectionalAppTaggingSecret> {
48
+ ): Promise<ExtendedDirectionalAppTaggingSecret | undefined> {
49
49
  const taggingSecretPoint = await computeSharedTaggingSecret(localAddress, localIvsk, externalAddress);
50
+ if (!taggingSecretPoint) {
51
+ return undefined;
52
+ }
53
+
50
54
  const appTaggingSecret = await poseidon2Hash([taggingSecretPoint.x, taggingSecretPoint.y, app]);
51
55
  const directionalAppTaggingSecret = await poseidon2Hash([appTaggingSecret, recipient]);
52
56
 
@@ -63,18 +67,25 @@ export class ExtendedDirectionalAppTaggingSecret {
63
67
  }
64
68
  }
65
69
 
66
- // Returns shared tagging secret computed with Diffie-Hellman key exchange.
70
+ // Returns shared tagging secret computed with Diffie-Hellman key exchange, or undefined if `externalAddress` is an
71
+ // invalid address.
67
72
  async function computeSharedTaggingSecret(
68
73
  localAddress: CompleteAddress,
69
74
  localIvsk: Fq,
70
75
  externalAddress: AztecAddress,
71
- ): Promise<Point> {
72
- const knownPreaddress = await computePreaddress(await localAddress.publicKeys.hash(), localAddress.partialAddress);
73
- // TODO: #8970 - Computation of address point from x coordinate might fail
74
- const externalAddressPoint = await externalAddress.toAddressPoint();
76
+ ): Promise<Point | undefined> {
75
77
  // Given A (local complete address) -> B (external address) and h == preaddress
76
78
  // Compute shared secret as S = (h_A + local_ivsk_A) * Addr_Point_B
77
79
 
80
+ const knownPreaddress = await computePreaddress(await localAddress.publicKeys.hash(), localAddress.partialAddress);
81
+
82
+ // An invalid address has no corresponding address point
83
+ if (!(await externalAddress.isValid())) {
84
+ return undefined;
85
+ }
86
+
87
+ const externalAddressPoint = await externalAddress.toAddressPoint();
88
+
78
89
  // Beware! h_a + local_ivsk_a (also known as the address secret) can lead to an address point with a negative
79
90
  // y-coordinate, since there's two possible candidates computeAddressSecret takes care of selecting the one that
80
91
  // leads to a positive y-coordinate, which is the only valid address point
@@ -1,7 +1,6 @@
1
1
  import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
2
2
  import { toBufferBE } from '@aztec/foundation/bigint-buffer';
3
3
  import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types';
4
- import { Fr } from '@aztec/foundation/curves/bn254';
5
4
  import { BufferReader } from '@aztec/foundation/serialize';
6
5
 
7
6
  import { z } from 'zod';
@@ -83,7 +82,7 @@ export class LogId {
83
82
  const reader = BufferReader.asReader(buffer);
84
83
 
85
84
  const blockNumber = BlockNumber(reader.readNumber());
86
- const blockHash = new BlockHash(reader.readObject(Fr));
85
+ const blockHash = BlockHash.fromBuffer(reader);
87
86
  const txHash = reader.readObject(TxHash);
88
87
  const txIndex = reader.readNumber();
89
88
  const logIndex = reader.readNumber();
@@ -1,8 +1,7 @@
1
1
  import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
2
+ import { range } from '@aztec/foundation/array';
2
3
  import { Fr } from '@aztec/foundation/curves/bn254';
3
4
 
4
- import type { AztecAddress } from '../aztec-address/index.js';
5
- import type { TxEffect } from '../tx/tx_effect.js';
6
5
  import type { TxHash } from '../tx/tx_hash.js';
7
6
 
8
7
  /**
@@ -19,7 +18,6 @@ export class MessageContext {
19
18
  public txHash: TxHash,
20
19
  public uniqueNoteHashesInTx: Fr[],
21
20
  public firstNullifierInTx: Fr,
22
- public recipient: AztecAddress,
23
21
  ) {}
24
22
 
25
23
  toFields(): Fr[] {
@@ -27,7 +25,6 @@ export class MessageContext {
27
25
  this.txHash.hash,
28
26
  ...serializeBoundedVec(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
29
27
  this.firstNullifierInTx,
30
- this.recipient.toField(),
31
28
  ];
32
29
  }
33
30
 
@@ -37,13 +34,22 @@ export class MessageContext {
37
34
  tx_hash: this.txHash.hash,
38
35
  unique_note_hashes_in_tx: this.uniqueNoteHashesInTx,
39
36
  first_nullifier_in_tx: this.firstNullifierInTx,
40
- recipient: this.recipient,
41
37
  };
42
38
  /* eslint-enable camelcase */
43
39
  }
44
40
 
45
- static fromTxEffectAndRecipient(txEffect: TxEffect, recipient: AztecAddress): MessageContext {
46
- return new MessageContext(txEffect.txHash, txEffect.noteHashes, txEffect.nullifiers[0], recipient);
41
+ static toEmptyFields(): Fr[] {
42
+ const serializationLen =
43
+ 1 /* txHash */ + MAX_NOTE_HASHES_PER_TX + 1 /* uniqueNoteHashesInTx BVec */ + 1; /* firstNullifierInTx */
44
+ return range(serializationLen).map(_ => Fr.zero());
45
+ }
46
+
47
+ static toSerializedOption(response: MessageContext | null): Fr[] {
48
+ if (response) {
49
+ return [new Fr(1), ...response.toFields()];
50
+ } else {
51
+ return [new Fr(0), ...MessageContext.toEmptyFields()];
52
+ }
47
53
  }
48
54
  }
49
55
 
@@ -55,6 +61,10 @@ export class MessageContext {
55
61
  * @dev Copied over from pending_tagged_log.ts.
56
62
  */
57
63
  function serializeBoundedVec(values: Fr[], maxLength: number): Fr[] {
64
+ if (values.length > maxLength) {
65
+ throw new Error(`Attempted to serialize ${values} values into a BoundedVec with max length ${maxLength}`);
66
+ }
67
+
58
68
  const lengthDiff = maxLength - values.length;
59
69
  const zeroPaddingArray = Array(lengthDiff).fill(Fr.ZERO);
60
70
  const storage = values.concat(zeroPaddingArray);
@@ -1,7 +1,6 @@
1
1
  import { PRIVATE_LOG_SIZE_IN_FIELDS } from '@aztec/constants';
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
3
 
4
- import type { AztecAddress } from '../aztec-address/index.js';
5
4
  import type { TxHash } from '../tx/tx_hash.js';
6
5
  import { MessageContext } from './message_context.js';
7
6
 
@@ -17,9 +16,8 @@ export class PendingTaggedLog {
17
16
  txHash: TxHash,
18
17
  uniqueNoteHashesInTx: Fr[],
19
18
  firstNullifierInTx: Fr,
20
- recipient: AztecAddress,
21
19
  ) {
22
- this.context = new MessageContext(txHash, uniqueNoteHashesInTx, firstNullifierInTx, recipient);
20
+ this.context = new MessageContext(txHash, uniqueNoteHashesInTx, firstNullifierInTx);
23
21
  }
24
22
 
25
23
  toFields(): Fr[] {