@aztec/stdlib 0.0.1-commit.35158ae7e → 0.0.1-commit.3750d92a7

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 (290) hide show
  1. package/dest/abi/authorization_selector.d.ts +3 -6
  2. package/dest/abi/authorization_selector.d.ts.map +1 -1
  3. package/dest/abi/decoder.d.ts +5 -44
  4. package/dest/abi/decoder.d.ts.map +1 -1
  5. package/dest/abi/decoder.js +12 -67
  6. package/dest/abi/event_selector.d.ts +3 -6
  7. package/dest/abi/event_selector.d.ts.map +1 -1
  8. package/dest/abi/function_selector.d.ts +3 -6
  9. package/dest/abi/function_selector.d.ts.map +1 -1
  10. package/dest/abi/function_selector.js +2 -4
  11. package/dest/abi/function_signature_decoder.d.ts +43 -0
  12. package/dest/abi/function_signature_decoder.d.ts.map +1 -0
  13. package/dest/abi/function_signature_decoder.js +66 -0
  14. package/dest/abi/index.d.ts +2 -1
  15. package/dest/abi/index.d.ts.map +1 -1
  16. package/dest/abi/index.js +1 -0
  17. package/dest/abi/note_selector.d.ts +3 -6
  18. package/dest/abi/note_selector.d.ts.map +1 -1
  19. package/dest/abi/note_selector.js +1 -3
  20. package/dest/abi/selector.d.ts +2 -2
  21. package/dest/abi/selector.d.ts.map +1 -1
  22. package/dest/abi/selector.js +1 -1
  23. package/dest/avm/avm.d.ts +300 -300
  24. package/dest/avm/revert_code.d.ts +8 -18
  25. package/dest/avm/revert_code.d.ts.map +1 -1
  26. package/dest/avm/revert_code.js +15 -30
  27. package/dest/aztec-address/index.d.ts +3 -6
  28. package/dest/aztec-address/index.d.ts.map +1 -1
  29. package/dest/aztec-address/index.js +2 -4
  30. package/dest/block/block_data.d.ts +8 -8
  31. package/dest/block/block_data.d.ts.map +1 -1
  32. package/dest/block/block_data.js +2 -2
  33. package/dest/block/block_hash.d.ts +11 -10
  34. package/dest/block/block_hash.d.ts.map +1 -1
  35. package/dest/block/block_hash.js +10 -9
  36. package/dest/block/l2_block_info.d.ts +6 -5
  37. package/dest/block/l2_block_info.d.ts.map +1 -1
  38. package/dest/block/l2_block_info.js +6 -5
  39. package/dest/block/l2_block_source.d.ts +80 -3
  40. package/dest/block/l2_block_source.d.ts.map +1 -1
  41. package/dest/block/l2_block_source.js +1 -0
  42. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
  43. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  44. package/dest/block/l2_block_stream/l2_tips_store_base.js +18 -5
  45. package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
  46. package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
  47. package/dest/block/test/l2_tips_store_test_suite.js +4 -3
  48. package/dest/checkpoint/checkpoint.d.ts +7 -1
  49. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  50. package/dest/checkpoint/checkpoint.js +9 -1
  51. package/dest/checkpoint/checkpoint_data.d.ts +71 -5
  52. package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
  53. package/dest/checkpoint/checkpoint_data.js +10 -0
  54. package/dest/config/chain-config.d.ts +1 -1
  55. package/dest/config/chain-config.d.ts.map +1 -1
  56. package/dest/config/chain-config.js +7 -1
  57. package/dest/config/sequencer-config.d.ts +2 -2
  58. package/dest/config/sequencer-config.d.ts.map +1 -1
  59. package/dest/config/sequencer-config.js +10 -3
  60. package/dest/epoch-helpers/index.d.ts +5 -1
  61. package/dest/epoch-helpers/index.d.ts.map +1 -1
  62. package/dest/epoch-helpers/index.js +6 -0
  63. package/dest/file-store/factory.d.ts +4 -3
  64. package/dest/file-store/factory.d.ts.map +1 -1
  65. package/dest/file-store/factory.js +2 -2
  66. package/dest/file-store/http.d.ts +9 -2
  67. package/dest/file-store/http.d.ts.map +1 -1
  68. package/dest/file-store/http.js +20 -9
  69. package/dest/file-store/index.d.ts +2 -1
  70. package/dest/file-store/index.d.ts.map +1 -1
  71. package/dest/gas/fee_math.d.ts +49 -0
  72. package/dest/gas/fee_math.d.ts.map +1 -0
  73. package/dest/gas/fee_math.js +80 -0
  74. package/dest/gas/gas_fees.d.ts +1 -1
  75. package/dest/gas/gas_fees.d.ts.map +1 -1
  76. package/dest/gas/gas_fees.js +10 -1
  77. package/dest/gas/gas_settings.d.ts +40 -3
  78. package/dest/gas/gas_settings.d.ts.map +1 -1
  79. package/dest/gas/gas_settings.js +50 -6
  80. package/dest/gas/index.d.ts +2 -1
  81. package/dest/gas/index.d.ts.map +1 -1
  82. package/dest/gas/index.js +1 -0
  83. package/dest/ha-signing/index.d.ts +2 -2
  84. package/dest/ha-signing/index.d.ts.map +1 -1
  85. package/dest/ha-signing/index.js +1 -1
  86. package/dest/ha-signing/local_config.js +1 -1
  87. package/dest/ha-signing/types.d.ts +37 -32
  88. package/dest/ha-signing/types.d.ts.map +1 -1
  89. package/dest/ha-signing/types.js +13 -6
  90. package/dest/hash/hash.d.ts +4 -1
  91. package/dest/hash/hash.d.ts.map +1 -1
  92. package/dest/hash/hash.js +5 -0
  93. package/dest/interfaces/archiver.d.ts +1 -1
  94. package/dest/interfaces/archiver.d.ts.map +1 -1
  95. package/dest/interfaces/archiver.js +3 -1
  96. package/dest/interfaces/aztec-node-admin.d.ts +4 -14
  97. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  98. package/dest/interfaces/aztec-node-admin.js +3 -3
  99. package/dest/interfaces/aztec-node-debug.d.ts +21 -0
  100. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
  101. package/dest/interfaces/aztec-node-debug.js +18 -0
  102. package/dest/interfaces/aztec-node.d.ts +10 -1
  103. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  104. package/dest/interfaces/aztec-node.js +2 -0
  105. package/dest/interfaces/client.d.ts +2 -1
  106. package/dest/interfaces/client.d.ts.map +1 -1
  107. package/dest/interfaces/client.js +1 -0
  108. package/dest/interfaces/merkle_tree_operations.d.ts +4 -3
  109. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  110. package/dest/interfaces/prover-client.d.ts +1 -1
  111. package/dest/interfaces/prover-client.d.ts.map +1 -1
  112. package/dest/interfaces/prover-client.js +0 -3
  113. package/dest/interfaces/slasher.d.ts +1 -10
  114. package/dest/interfaces/slasher.d.ts.map +1 -1
  115. package/dest/interfaces/slasher.js +0 -2
  116. package/dest/interfaces/validator.d.ts +9 -20
  117. package/dest/interfaces/validator.d.ts.map +1 -1
  118. package/dest/interfaces/validator.js +0 -1
  119. package/dest/l1-contracts/index.d.ts +2 -2
  120. package/dest/l1-contracts/index.d.ts.map +1 -1
  121. package/dest/l1-contracts/index.js +1 -1
  122. package/dest/logs/extended_directional_app_tagging_secret.d.ts +4 -4
  123. package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -1
  124. package/dest/logs/extended_directional_app_tagging_secret.js +12 -5
  125. package/dest/logs/log_id.d.ts +1 -1
  126. package/dest/logs/log_id.d.ts.map +1 -1
  127. package/dest/logs/log_id.js +1 -2
  128. package/dest/logs/message_context.d.ts +4 -7
  129. package/dest/logs/message_context.d.ts.map +1 -1
  130. package/dest/logs/message_context.js +23 -9
  131. package/dest/logs/pending_tagged_log.d.ts +2 -3
  132. package/dest/logs/pending_tagged_log.d.ts.map +1 -1
  133. package/dest/logs/pending_tagged_log.js +2 -2
  134. package/dest/logs/shared_secret_derivation.d.ts +11 -10
  135. package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
  136. package/dest/logs/shared_secret_derivation.js +15 -9
  137. package/dest/logs/siloed_tag.d.ts +8 -7
  138. package/dest/logs/siloed_tag.d.ts.map +1 -1
  139. package/dest/logs/siloed_tag.js +11 -3
  140. package/dest/logs/tag.d.ts +5 -6
  141. package/dest/logs/tag.d.ts.map +1 -1
  142. package/dest/logs/tag.js +4 -0
  143. package/dest/note/note_dao.d.ts +1 -1
  144. package/dest/note/note_dao.d.ts.map +1 -1
  145. package/dest/note/note_dao.js +1 -4
  146. package/dest/p2p/block_proposal.d.ts +6 -8
  147. package/dest/p2p/block_proposal.d.ts.map +1 -1
  148. package/dest/p2p/block_proposal.js +4 -9
  149. package/dest/p2p/checkpoint_attestation.d.ts +4 -6
  150. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  151. package/dest/p2p/checkpoint_attestation.js +2 -7
  152. package/dest/p2p/checkpoint_proposal.d.ts +8 -10
  153. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  154. package/dest/p2p/checkpoint_proposal.js +5 -24
  155. package/dest/p2p/gossipable.d.ts +4 -4
  156. package/dest/p2p/gossipable.d.ts.map +1 -1
  157. package/dest/slashing/index.d.ts +2 -3
  158. package/dest/slashing/index.d.ts.map +1 -1
  159. package/dest/slashing/index.js +1 -2
  160. package/dest/slashing/serialization.d.ts +2 -6
  161. package/dest/slashing/serialization.d.ts.map +1 -1
  162. package/dest/slashing/serialization.js +0 -60
  163. package/dest/slashing/types.d.ts +4 -90
  164. package/dest/slashing/types.d.ts.map +1 -1
  165. package/dest/slashing/types.js +0 -14
  166. package/dest/slashing/{tally.d.ts → votes.d.ts} +1 -1
  167. package/dest/slashing/{tally.d.ts.map → votes.d.ts.map} +1 -1
  168. package/dest/slashing/{tally.js → votes.js} +1 -1
  169. package/dest/tests/factories.d.ts +1 -1
  170. package/dest/tests/factories.d.ts.map +1 -1
  171. package/dest/tests/factories.js +11 -1
  172. package/dest/tests/mocks.d.ts +1 -1
  173. package/dest/tests/mocks.d.ts.map +1 -1
  174. package/dest/tests/mocks.js +14 -19
  175. package/dest/timetable/index.d.ts +51 -1
  176. package/dest/timetable/index.d.ts.map +1 -1
  177. package/dest/timetable/index.js +204 -14
  178. package/dest/tx/block_header.d.ts +2 -2
  179. package/dest/tx/block_header.d.ts.map +1 -1
  180. package/dest/tx/block_header.js +1 -1
  181. package/dest/tx/capsule.d.ts +6 -2
  182. package/dest/tx/capsule.d.ts.map +1 -1
  183. package/dest/tx/capsule.js +9 -3
  184. package/dest/tx/fee_provider.d.ts +10 -0
  185. package/dest/tx/fee_provider.d.ts.map +1 -0
  186. package/dest/tx/fee_provider.js +1 -0
  187. package/dest/tx/global_variable_builder.d.ts +3 -4
  188. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  189. package/dest/tx/index.d.ts +2 -1
  190. package/dest/tx/index.d.ts.map +1 -1
  191. package/dest/tx/index.js +1 -0
  192. package/dest/tx/indexed_tx_effect.d.ts +1 -1
  193. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  194. package/dest/tx/indexed_tx_effect.js +1 -2
  195. package/dest/tx/simulated_tx.d.ts +4 -4
  196. package/dest/tx/simulated_tx.d.ts.map +1 -1
  197. package/dest/tx/simulated_tx.js +3 -3
  198. package/dest/tx/tx.d.ts +3 -3
  199. package/dest/tx/tx.d.ts.map +1 -1
  200. package/dest/tx/tx_receipt.d.ts +8 -4
  201. package/dest/tx/tx_receipt.d.ts.map +1 -1
  202. package/dest/tx/tx_receipt.js +8 -15
  203. package/dest/world-state/genesis_data.d.ts +11 -0
  204. package/dest/world-state/genesis_data.d.ts.map +1 -0
  205. package/dest/world-state/genesis_data.js +4 -0
  206. package/dest/world-state/index.d.ts +2 -1
  207. package/dest/world-state/index.d.ts.map +1 -1
  208. package/dest/world-state/index.js +1 -0
  209. package/package.json +8 -8
  210. package/src/abi/authorization_selector.ts +2 -8
  211. package/src/abi/decoder.ts +23 -78
  212. package/src/abi/event_selector.ts +2 -8
  213. package/src/abi/function_selector.ts +4 -13
  214. package/src/abi/function_signature_decoder.ts +77 -0
  215. package/src/abi/index.ts +1 -0
  216. package/src/abi/note_selector.ts +3 -12
  217. package/src/abi/selector.ts +1 -1
  218. package/src/avm/revert_code.ts +25 -39
  219. package/src/aztec-address/index.ts +4 -10
  220. package/src/block/block_data.ts +3 -4
  221. package/src/block/block_hash.ts +21 -14
  222. package/src/block/l2_block_info.ts +8 -6
  223. package/src/block/l2_block_source.ts +10 -2
  224. package/src/block/l2_block_stream/l2_tips_store_base.ts +25 -13
  225. package/src/block/test/l2_tips_store_test_suite.ts +9 -2
  226. package/src/checkpoint/checkpoint.ts +11 -1
  227. package/src/checkpoint/checkpoint_data.ts +40 -4
  228. package/src/config/chain-config.ts +7 -1
  229. package/src/config/sequencer-config.ts +14 -4
  230. package/src/epoch-helpers/index.ts +13 -0
  231. package/src/file-store/factory.ts +13 -4
  232. package/src/file-store/http.ts +29 -10
  233. package/src/file-store/index.ts +1 -0
  234. package/src/gas/README.md +31 -0
  235. package/src/gas/fee_math.ts +120 -0
  236. package/src/gas/gas_fees.ts +12 -4
  237. package/src/gas/gas_settings.ts +65 -12
  238. package/src/gas/index.ts +1 -0
  239. package/src/ha-signing/index.ts +3 -1
  240. package/src/ha-signing/local_config.ts +1 -1
  241. package/src/ha-signing/types.ts +48 -34
  242. package/src/hash/hash.ts +5 -0
  243. package/src/interfaces/archiver.ts +3 -1
  244. package/src/interfaces/aztec-node-admin.ts +5 -7
  245. package/src/interfaces/aztec-node-debug.ts +40 -0
  246. package/src/interfaces/aztec-node.ts +15 -0
  247. package/src/interfaces/client.ts +1 -0
  248. package/src/interfaces/merkle_tree_operations.ts +3 -2
  249. package/src/interfaces/prover-client.ts +2 -5
  250. package/src/interfaces/slasher.ts +0 -6
  251. package/src/interfaces/validator.ts +16 -13
  252. package/src/l1-contracts/index.ts +1 -1
  253. package/src/logs/extended_directional_app_tagging_secret.ts +19 -8
  254. package/src/logs/log_id.ts +1 -2
  255. package/src/logs/message_context.ts +17 -7
  256. package/src/logs/pending_tagged_log.ts +1 -3
  257. package/src/logs/shared_secret_derivation.ts +21 -10
  258. package/src/logs/siloed_tag.ts +15 -11
  259. package/src/logs/tag.ts +8 -8
  260. package/src/note/note_dao.ts +1 -4
  261. package/src/p2p/block_proposal.ts +13 -9
  262. package/src/p2p/checkpoint_attestation.ts +5 -9
  263. package/src/p2p/checkpoint_proposal.ts +21 -36
  264. package/src/p2p/gossipable.ts +4 -4
  265. package/src/slashing/index.ts +1 -2
  266. package/src/slashing/serialization.ts +1 -81
  267. package/src/slashing/types.ts +3 -35
  268. package/src/slashing/{tally.ts → votes.ts} +1 -1
  269. package/src/tests/factories.ts +5 -1
  270. package/src/tests/mocks.ts +16 -12
  271. package/src/timetable/index.ts +293 -13
  272. package/src/tx/block_header.ts +2 -2
  273. package/src/tx/capsule.ts +10 -2
  274. package/src/tx/fee_provider.ts +10 -0
  275. package/src/tx/global_variable_builder.ts +2 -3
  276. package/src/tx/index.ts +1 -0
  277. package/src/tx/indexed_tx_effect.ts +1 -2
  278. package/src/tx/simulated_tx.ts +6 -2
  279. package/src/tx/tx.ts +2 -2
  280. package/src/tx/tx_receipt.ts +11 -14
  281. package/src/world-state/genesis_data.ts +15 -0
  282. package/src/world-state/index.ts +1 -0
  283. package/dest/l1-contracts/slash_factory.d.ts +0 -45
  284. package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
  285. package/dest/l1-contracts/slash_factory.js +0 -158
  286. package/dest/slashing/empire.d.ts +0 -31
  287. package/dest/slashing/empire.d.ts.map +0 -1
  288. package/dest/slashing/empire.js +0 -87
  289. package/src/l1-contracts/slash_factory.ts +0 -180
  290. package/src/slashing/empire.ts +0 -104
@@ -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[] {
@@ -1,26 +1,37 @@
1
+ import { DomainSeparator } from '@aztec/constants';
1
2
  import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
2
- import type { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
3
+ import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
4
+ import type { Fr } from '@aztec/foundation/curves/bn254';
5
+ import type { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
3
6
 
7
+ import type { AztecAddress } from '../aztec-address/index.js';
4
8
  import type { PublicKey } from '../keys/public_key.js';
5
9
 
6
10
  /**
7
- * Derive an Elliptic Curve Diffie-Hellman (ECDH) Shared Secret.
8
- * The function takes in an ECDH public key, a private key, and a Grumpkin instance to compute
9
- * the shared secret.
11
+ * Derives an app-siloed ECDH shared secret.
12
+ *
13
+ * Computes the raw ECDH shared secret `S = secretKey * publicKey`, then app-silos it:
14
+ * `s_app = h(DOM_SEP__APP_SILOED_ECDH_SHARED_SECRET, S.x, S.y, contractAddress)`
10
15
  *
11
16
  * @param secretKey - The secret key used to derive shared secret.
12
17
  * @param publicKey - The public key used to derive shared secret.
13
- * @returns A derived shared secret.
18
+ * @param contractAddress - The address of the calling contract, used for app-siloing.
19
+ * @returns The app-siloed shared secret as a Field.
14
20
  * @throws If the publicKey is zero.
15
- *
16
- * TODO(#12656): This function is kept around because of the utilityGetSharedSecret oracle. Nuke this once returning
17
- * the app-siloed secret.
18
21
  */
19
- export function deriveEcdhSharedSecret(secretKey: GrumpkinScalar, publicKey: PublicKey): Promise<Point> {
22
+ export async function deriveAppSiloedSharedSecret(
23
+ secretKey: GrumpkinScalar,
24
+ publicKey: PublicKey,
25
+ contractAddress: AztecAddress,
26
+ ): Promise<Fr> {
20
27
  if (publicKey.isZero()) {
21
28
  throw new Error(
22
29
  `Attempting to derive a shared secret with a zero public key. You have probably passed a zero public key in your Noir code somewhere thinking that the note won't be broadcast... but it was.`,
23
30
  );
24
31
  }
25
- return Grumpkin.mul(publicKey, secretKey);
32
+ const rawSharedSecret = await Grumpkin.mul(publicKey, secretKey);
33
+ return poseidon2HashWithSeparator(
34
+ [rawSharedSecret.x, rawSharedSecret.y, contractAddress],
35
+ DomainSeparator.APP_SILOED_ECDH_SHARED_SECRET,
36
+ );
26
37
  }
@@ -1,32 +1,32 @@
1
- import type { Fr } from '@aztec/foundation/curves/bn254';
1
+ import { DomainSeparator } from '@aztec/constants';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
3
  import type { ZodFor } from '@aztec/foundation/schemas';
3
4
 
4
5
  import type { AztecAddress } from '../aztec-address/index.js';
5
- import { computeSiloedPrivateLogFirstField } from '../hash/hash.js';
6
+ import { computeLogTag, computeSiloedPrivateLogFirstField } from '../hash/hash.js';
6
7
  import { schemas } from '../schemas/schemas.js';
7
8
  import type { PreTag } from './pre_tag.js';
8
9
  import { Tag } from './tag.js';
9
10
 
10
- /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
11
-
12
- /** Branding to ensure fields are not interchangeable types. */
13
- export interface SiloedTag {
14
- /** Brand. */
15
- _branding: 'SiloedTag';
16
- }
17
-
18
11
  /**
19
12
  * Represents a tag used in private log as it "appears on the chain" - that is the tag is siloed with a contract
20
13
  * address that emitted the log.
21
14
  */
22
15
  export class SiloedTag {
16
+ /** Branding for nominal typing. */
17
+ declare private readonly _branding: 'SiloedTag';
18
+
23
19
  constructor(public readonly value: Fr) {}
24
20
 
25
21
  static async compute(preTag: PreTag): Promise<SiloedTag> {
26
22
  const tag = await Tag.compute(preTag);
27
- return SiloedTag.computeFromTagAndApp(tag, preTag.extendedSecret.app);
23
+ const logTag = await computeLogTag(tag.value, DomainSeparator.UNCONSTRAINED_MSG_LOG_TAG);
24
+ return SiloedTag.computeFromTagAndApp(new Tag(logTag), preTag.extendedSecret.app);
28
25
  }
29
26
 
27
+ /**
28
+ * Unlike `compute`, this expects a tag whose value is already domain-separated.
29
+ */
30
30
  static async computeFromTagAndApp(tag: Tag, app: AztecAddress): Promise<SiloedTag> {
31
31
  const siloedTag = await computeSiloedPrivateLogFirstField(app, tag.value);
32
32
  return new SiloedTag(siloedTag);
@@ -44,6 +44,10 @@ export class SiloedTag {
44
44
  return this.value.equals(other.value);
45
45
  }
46
46
 
47
+ static random(): SiloedTag {
48
+ return new SiloedTag(Fr.random());
49
+ }
50
+
47
51
  static get schema(): ZodFor<SiloedTag> {
48
52
  return schemas.Fr.transform((fr: Fr) => new SiloedTag(fr));
49
53
  }
package/src/logs/tag.ts CHANGED
@@ -1,22 +1,18 @@
1
1
  import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
2
- import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import type { ZodFor } from '@aztec/foundation/schemas';
4
4
 
5
5
  import { schemas } from '../schemas/schemas.js';
6
6
  import type { PreTag } from './pre_tag.js';
7
7
 
8
- /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
9
-
10
- export interface Tag {
11
- /** Brand. */
12
- _branding: 'Tag';
13
- }
14
-
15
8
  /**
16
9
  * Represents a tag of a private log. This is not the tag that "appears" on the chain as this tag is first siloed
17
10
  * with a contract address by kernels before being included in the final log.
18
11
  */
19
12
  export class Tag {
13
+ /** Branding for nominal typing. */
14
+ declare private readonly _branding: 'Tag';
15
+
20
16
  constructor(public readonly value: Fr) {}
21
17
 
22
18
  static async compute(preTag: PreTag): Promise<Tag> {
@@ -36,6 +32,10 @@ export class Tag {
36
32
  return this.value.equals(other.value);
37
33
  }
38
34
 
35
+ static random(): Tag {
36
+ return new Tag(Fr.random());
37
+ }
38
+
39
39
  static get schema(): ZodFor<Tag> {
40
40
  return schemas.Fr.transform((fr: Fr) => new Tag(fr));
41
41
  }
@@ -1,6 +1,5 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
- import { Point } from '@aztec/foundation/curves/grumpkin';
4
3
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
6
5
  import { Note } from '@aztec/stdlib/note';
@@ -148,9 +147,7 @@ export class NoteDao {
148
147
  * @returns - Its size in bytes.
149
148
  */
150
149
  public getSize() {
151
- const noteSize = 4 + this.note.items.length * Fr.SIZE_IN_BYTES;
152
- // 2 numbers for txIndexInBlock and noteIndexInTx (4 bytes each)
153
- return noteSize + AztecAddress.SIZE_IN_BYTES * 2 + Fr.SIZE_IN_BYTES * 4 + TxHash.SIZE + Point.SIZE_IN_BYTES + 8;
150
+ return this.toBuffer().length;
154
151
  }
155
152
 
156
153
  static async random({
@@ -1,5 +1,11 @@
1
- import { BlockNumber, IndexWithinCheckpoint, SlotNumber } from '@aztec/foundation/branded-types';
2
- import { Buffer32 } from '@aztec/foundation/buffer';
1
+ import {
2
+ BlockNumber,
3
+ BlockProposalHash,
4
+ type CheckpointNumber,
5
+ IndexWithinCheckpoint,
6
+ SlotNumber,
7
+ } from '@aztec/foundation/branded-types';
8
+ import { type BaseBuffer32, Buffer32 } from '@aztec/foundation/buffer';
3
9
  import { keccak256 } from '@aztec/foundation/crypto/keccak';
4
10
  import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
5
11
  import { Fr } from '@aztec/foundation/curves/bn254';
@@ -23,11 +29,7 @@ import {
23
29
  import { SignedTxs } from './signed_txs.js';
24
30
  import { TopicType } from './topic_type.js';
25
31
 
26
- export class BlockProposalHash extends Buffer32 {
27
- constructor(hash: Buffer) {
28
- super(hash);
29
- }
30
- }
32
+ export type { BlockProposalHash } from '@aztec/foundation/branded-types';
31
33
 
32
34
  export type BlockProposalOptions = {
33
35
  /**
@@ -77,8 +79,8 @@ export class BlockProposal extends Gossipable {
77
79
  super();
78
80
  }
79
81
 
80
- override generateP2PMessageIdentifier(): Promise<Buffer32> {
81
- return Promise.resolve(new BlockProposalHash(keccak256(this.signature.toBuffer())));
82
+ override generateP2PMessageIdentifier(): Promise<BaseBuffer32> {
83
+ return Promise.resolve(BlockProposalHash.fromBuffer(keccak256(this.signature.toBuffer())));
82
84
  }
83
85
 
84
86
  get archive(): Fr {
@@ -126,6 +128,7 @@ export class BlockProposal extends Gossipable {
126
128
 
127
129
  static async createProposalFromSigner(
128
130
  blockHeader: BlockHeader,
131
+ checkpointNumber: CheckpointNumber,
129
132
  indexWithinCheckpoint: IndexWithinCheckpoint,
130
133
  inHash: Fr,
131
134
  archiveRoot: Fr,
@@ -147,6 +150,7 @@ export class BlockProposal extends Gossipable {
147
150
  const blockContext: SigningContext = {
148
151
  slot: blockHeader.globalVariables.slotNumber,
149
152
  blockNumber: blockHeader.globalVariables.blockNumber,
153
+ checkpointNumber,
150
154
  blockIndexWithinCheckpoint: indexWithinCheckpoint,
151
155
  dutyType: DutyType.BLOCK_PROPOSAL,
152
156
  };
@@ -1,5 +1,5 @@
1
- import { SlotNumber } from '@aztec/foundation/branded-types';
2
- import { Buffer32 } from '@aztec/foundation/buffer';
1
+ import { CheckpointAttestationHash, SlotNumber } from '@aztec/foundation/branded-types';
2
+ import type { BaseBuffer32 } from '@aztec/foundation/buffer';
3
3
  import { keccak256 } from '@aztec/foundation/crypto/keccak';
4
4
  import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
5
5
  import type { Fr } from '@aztec/foundation/curves/bn254';
@@ -16,11 +16,7 @@ import { Gossipable } from './gossipable.js';
16
16
  import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from './signature_utils.js';
17
17
  import { TopicType } from './topic_type.js';
18
18
 
19
- export class CheckpointAttestationHash extends Buffer32 {
20
- constructor(hash: Buffer) {
21
- super(hash);
22
- }
23
- }
19
+ export type { CheckpointAttestationHash } from '@aztec/foundation/branded-types';
24
20
 
25
21
  /**
26
22
  * CheckpointAttestation
@@ -57,8 +53,8 @@ export class CheckpointAttestation extends Gossipable {
57
53
  .transform(obj => new CheckpointAttestation(obj.payload, obj.signature, obj.proposerSignature));
58
54
  }
59
55
 
60
- override generateP2PMessageIdentifier(): Promise<Buffer32> {
61
- return Promise.resolve(new CheckpointAttestationHash(keccak256(this.signature.toBuffer())));
56
+ override generateP2PMessageIdentifier(): Promise<BaseBuffer32> {
57
+ return Promise.resolve(CheckpointAttestationHash.fromBuffer(keccak256(this.signature.toBuffer())));
62
58
  }
63
59
 
64
60
  get archive(): Fr {