@aztec/stdlib 0.0.1-commit.f295ac2 → 0.0.1-commit.f8ca9b2f3

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 (276) hide show
  1. package/dest/abi/function_call.d.ts +39 -9
  2. package/dest/abi/function_call.d.ts.map +1 -1
  3. package/dest/abi/function_call.js +20 -3
  4. package/dest/block/block_hash.d.ts +16 -18
  5. package/dest/block/block_hash.d.ts.map +1 -1
  6. package/dest/block/block_hash.js +21 -31
  7. package/dest/block/block_parameter.d.ts +4 -4
  8. package/dest/block/block_parameter.d.ts.map +1 -1
  9. package/dest/block/block_parameter.js +2 -2
  10. package/dest/block/checkpointed_l2_block.d.ts +6 -6
  11. package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
  12. package/dest/block/checkpointed_l2_block.js +3 -3
  13. package/dest/block/in_block.d.ts +11 -11
  14. package/dest/block/in_block.d.ts.map +1 -1
  15. package/dest/block/in_block.js +5 -5
  16. package/dest/block/index.d.ts +2 -2
  17. package/dest/block/index.d.ts.map +1 -1
  18. package/dest/block/index.js +1 -1
  19. package/dest/block/{l2_block_new.d.ts → l2_block.d.ts} +8 -7
  20. package/dest/block/l2_block.d.ts.map +1 -0
  21. package/dest/block/{l2_block_new.js → l2_block.js} +5 -9
  22. package/dest/block/l2_block_source.d.ts +39 -30
  23. package/dest/block/l2_block_source.d.ts.map +1 -1
  24. package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
  25. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  26. package/dest/block/l2_block_stream/l2_block_stream.d.ts +6 -3
  27. package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
  28. package/dest/block/l2_block_stream/l2_block_stream.js +37 -25
  29. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
  30. package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
  31. package/dest/block/test/l2_tips_store_test_suite.js +2 -2
  32. package/dest/checkpoint/checkpoint.d.ts +8 -8
  33. package/dest/checkpoint/checkpoint.d.ts.map +1 -1
  34. package/dest/checkpoint/checkpoint.js +4 -4
  35. package/dest/checkpoint/published_checkpoint.d.ts +2 -2
  36. package/dest/config/index.d.ts +2 -1
  37. package/dest/config/index.d.ts.map +1 -1
  38. package/dest/config/index.js +1 -0
  39. package/dest/config/node-rpc-config.js +1 -1
  40. package/dest/config/sequencer-config.d.ts +10 -0
  41. package/dest/config/sequencer-config.d.ts.map +1 -0
  42. package/dest/config/sequencer-config.js +12 -0
  43. package/dest/contract/contract_address.js +1 -1
  44. package/dest/contract/contract_class_id.d.ts +1 -1
  45. package/dest/contract/contract_class_id.js +1 -1
  46. package/dest/contract/interfaces/node-info.d.ts +3 -1
  47. package/dest/contract/interfaces/node-info.d.ts.map +1 -1
  48. package/dest/contract/interfaces/node-info.js +2 -1
  49. package/dest/contract/private_function.d.ts +1 -1
  50. package/dest/contract/private_function.d.ts.map +1 -1
  51. package/dest/contract/private_function.js +2 -3
  52. package/dest/contract/private_function_membership_proof.d.ts +1 -1
  53. package/dest/contract/private_function_membership_proof.js +1 -1
  54. package/dest/database-version/database_version.d.ts +58 -0
  55. package/dest/database-version/database_version.d.ts.map +1 -0
  56. package/dest/database-version/database_version.js +69 -0
  57. package/dest/database-version/version_manager.d.ts +2 -50
  58. package/dest/database-version/version_manager.d.ts.map +1 -1
  59. package/dest/database-version/version_manager.js +1 -66
  60. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
  61. package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
  62. package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
  63. package/dest/epoch-helpers/index.d.ts +7 -1
  64. package/dest/epoch-helpers/index.d.ts.map +1 -1
  65. package/dest/epoch-helpers/index.js +9 -3
  66. package/dest/hash/hash.js +2 -2
  67. package/dest/hash/map_slot.d.ts +1 -1
  68. package/dest/hash/map_slot.d.ts.map +1 -1
  69. package/dest/hash/map_slot.js +4 -3
  70. package/dest/interfaces/api_limit.d.ts +2 -1
  71. package/dest/interfaces/api_limit.d.ts.map +1 -1
  72. package/dest/interfaces/api_limit.js +1 -0
  73. package/dest/interfaces/archiver.d.ts +1 -1
  74. package/dest/interfaces/archiver.d.ts.map +1 -1
  75. package/dest/interfaces/archiver.js +19 -18
  76. package/dest/interfaces/aztec-node-admin.d.ts +20 -2
  77. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  78. package/dest/interfaces/aztec-node-admin.js +3 -1
  79. package/dest/interfaces/aztec-node.d.ts +64 -62
  80. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  81. package/dest/interfaces/aztec-node.js +13 -17
  82. package/dest/interfaces/block-builder.d.ts +13 -7
  83. package/dest/interfaces/block-builder.d.ts.map +1 -1
  84. package/dest/interfaces/block-builder.js +7 -0
  85. package/dest/interfaces/configs.d.ts +2 -2
  86. package/dest/interfaces/configs.d.ts.map +1 -1
  87. package/dest/interfaces/get_logs_response.d.ts +15 -8
  88. package/dest/interfaces/get_logs_response.d.ts.map +1 -1
  89. package/dest/interfaces/l2_logs_source.d.ts +14 -5
  90. package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
  91. package/dest/interfaces/p2p.d.ts +2 -2
  92. package/dest/interfaces/p2p.d.ts.map +1 -1
  93. package/dest/interfaces/prover-broker.d.ts +16 -1
  94. package/dest/interfaces/prover-broker.d.ts.map +1 -1
  95. package/dest/interfaces/prover-broker.js +4 -1
  96. package/dest/interfaces/prover-client.d.ts +15 -1
  97. package/dest/interfaces/prover-client.d.ts.map +1 -1
  98. package/dest/interfaces/prover-client.js +12 -1
  99. package/dest/interfaces/proving-job.d.ts +200 -200
  100. package/dest/interfaces/slasher.d.ts +9 -1
  101. package/dest/interfaces/slasher.d.ts.map +1 -1
  102. package/dest/interfaces/slasher.js +2 -0
  103. package/dest/interfaces/tx_provider.d.ts +3 -3
  104. package/dest/interfaces/tx_provider.d.ts.map +1 -1
  105. package/dest/interfaces/validator.d.ts +50 -4
  106. package/dest/interfaces/validator.d.ts.map +1 -1
  107. package/dest/interfaces/validator.js +4 -1
  108. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
  109. package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
  110. package/dest/kernel/hints/build_nullifier_read_request_hints.js +4 -6
  111. package/dest/keys/derivation.d.ts +3 -3
  112. package/dest/keys/derivation.js +8 -8
  113. package/dest/keys/key_types.d.ts +1 -1
  114. package/dest/keys/utils.d.ts +1 -1
  115. package/dest/keys/utils.d.ts.map +1 -1
  116. package/dest/keys/utils.js +7 -3
  117. package/dest/l1-contracts/slash_factory.d.ts +1 -1
  118. package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
  119. package/dest/l1-contracts/slash_factory.js +1 -0
  120. package/dest/logs/extended_public_log.d.ts +13 -7
  121. package/dest/logs/extended_public_log.d.ts.map +1 -1
  122. package/dest/logs/log_id.d.ts +17 -14
  123. package/dest/logs/log_id.d.ts.map +1 -1
  124. package/dest/logs/log_id.js +20 -17
  125. package/dest/logs/siloed_tag.d.ts +1 -1
  126. package/dest/logs/siloed_tag.d.ts.map +1 -1
  127. package/dest/logs/siloed_tag.js +4 -3
  128. package/dest/messaging/l2_to_l1_membership.d.ts +2 -2
  129. package/dest/messaging/l2_to_l1_membership.js +3 -3
  130. package/dest/p2p/block_proposal.d.ts +13 -6
  131. package/dest/p2p/block_proposal.d.ts.map +1 -1
  132. package/dest/p2p/block_proposal.js +1 -1
  133. package/dest/p2p/checkpoint_proposal.d.ts +17 -3
  134. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  135. package/dest/p2p/checkpoint_proposal.js +9 -0
  136. package/dest/p2p/constants.d.ts +5 -0
  137. package/dest/p2p/constants.d.ts.map +1 -0
  138. package/dest/p2p/constants.js +3 -0
  139. package/dest/p2p/index.d.ts +2 -1
  140. package/dest/p2p/index.d.ts.map +1 -1
  141. package/dest/p2p/index.js +1 -0
  142. package/dest/p2p/message_validator.d.ts +18 -3
  143. package/dest/p2p/message_validator.d.ts.map +1 -1
  144. package/dest/p2p/message_validator.js +2 -1
  145. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +6 -6
  146. package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
  147. package/dest/rollup/checkpoint_rollup_public_inputs.js +2 -2
  148. package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +2 -2
  149. package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
  150. package/dest/rollup/root_rollup_public_inputs.d.ts +6 -6
  151. package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
  152. package/dest/rollup/root_rollup_public_inputs.js +3 -3
  153. package/dest/slashing/empire.d.ts +1 -1
  154. package/dest/slashing/empire.d.ts.map +1 -1
  155. package/dest/slashing/empire.js +2 -0
  156. package/dest/slashing/helpers.d.ts +2 -2
  157. package/dest/slashing/helpers.d.ts.map +1 -1
  158. package/dest/slashing/helpers.js +6 -0
  159. package/dest/slashing/tally.d.ts +2 -1
  160. package/dest/slashing/tally.d.ts.map +1 -1
  161. package/dest/slashing/tally.js +6 -2
  162. package/dest/slashing/types.d.ts +7 -3
  163. package/dest/slashing/types.d.ts.map +1 -1
  164. package/dest/slashing/types.js +13 -1
  165. package/dest/stats/stats.d.ts +1 -3
  166. package/dest/stats/stats.d.ts.map +1 -1
  167. package/dest/tests/factories.js +4 -4
  168. package/dest/tests/jest.d.ts +4 -4
  169. package/dest/tests/jest.js +9 -9
  170. package/dest/tests/mocks.d.ts +15 -10
  171. package/dest/tests/mocks.d.ts.map +1 -1
  172. package/dest/tests/mocks.js +19 -13
  173. package/dest/timetable/index.d.ts +37 -0
  174. package/dest/timetable/index.d.ts.map +1 -0
  175. package/dest/timetable/index.js +39 -0
  176. package/dest/trees/public_data_leaf.d.ts +2 -1
  177. package/dest/trees/public_data_leaf.d.ts.map +1 -1
  178. package/dest/trees/public_data_leaf.js +7 -6
  179. package/dest/tx/block_header.d.ts +3 -2
  180. package/dest/tx/block_header.d.ts.map +1 -1
  181. package/dest/tx/block_header.js +3 -2
  182. package/dest/tx/in_tx.d.ts +3 -3
  183. package/dest/tx/indexed_tx_effect.d.ts +5 -5
  184. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  185. package/dest/tx/indexed_tx_effect.js +3 -2
  186. package/dest/tx/tx.d.ts +2 -1
  187. package/dest/tx/tx.d.ts.map +1 -1
  188. package/dest/tx/tx.js +6 -3
  189. package/dest/tx/tx_receipt.d.ts +42 -14
  190. package/dest/tx/tx_receipt.d.ts.map +1 -1
  191. package/dest/tx/tx_receipt.js +46 -15
  192. package/dest/tx/validator/empty_validator.d.ts +2 -2
  193. package/dest/tx/validator/empty_validator.d.ts.map +1 -1
  194. package/dest/tx/validator/error_texts.d.ts +2 -1
  195. package/dest/tx/validator/error_texts.d.ts.map +1 -1
  196. package/dest/tx/validator/error_texts.js +2 -0
  197. package/dest/tx/validator/tx_validator.d.ts +2 -2
  198. package/dest/tx/validator/tx_validator.d.ts.map +1 -1
  199. package/package.json +24 -12
  200. package/src/abi/function_call.ts +25 -3
  201. package/src/block/block_hash.ts +26 -47
  202. package/src/block/block_parameter.ts +3 -3
  203. package/src/block/checkpointed_l2_block.ts +4 -4
  204. package/src/block/in_block.ts +8 -8
  205. package/src/block/index.ts +1 -1
  206. package/src/block/{l2_block_new.ts → l2_block.ts} +8 -12
  207. package/src/block/l2_block_source.ts +40 -31
  208. package/src/block/l2_block_stream/interfaces.ts +2 -2
  209. package/src/block/l2_block_stream/l2_block_stream.ts +44 -27
  210. package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
  211. package/src/block/test/l2_tips_store_test_suite.ts +4 -4
  212. package/src/checkpoint/checkpoint.ts +7 -7
  213. package/src/config/index.ts +1 -0
  214. package/src/config/node-rpc-config.ts +1 -1
  215. package/src/config/sequencer-config.ts +19 -0
  216. package/src/contract/contract_address.ts +1 -1
  217. package/src/contract/contract_class_id.ts +1 -1
  218. package/src/contract/interfaces/node-info.ts +3 -0
  219. package/src/contract/private_function.ts +2 -3
  220. package/src/contract/private_function_membership_proof.ts +1 -1
  221. package/src/database-version/database_version.ts +87 -0
  222. package/src/database-version/version_manager.ts +1 -77
  223. package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
  224. package/src/epoch-helpers/index.ts +13 -1
  225. package/src/hash/hash.ts +2 -2
  226. package/src/hash/map_slot.ts +3 -2
  227. package/src/interfaces/api_limit.ts +1 -0
  228. package/src/interfaces/archiver.ts +19 -27
  229. package/src/interfaces/aztec-node-admin.ts +3 -2
  230. package/src/interfaces/aztec-node.ts +89 -120
  231. package/src/interfaces/block-builder.ts +15 -5
  232. package/src/interfaces/configs.ts +1 -3
  233. package/src/interfaces/l2_logs_source.ts +17 -4
  234. package/src/interfaces/p2p.ts +1 -1
  235. package/src/interfaces/prover-broker.ts +22 -0
  236. package/src/interfaces/prover-client.ts +22 -0
  237. package/src/interfaces/slasher.ts +4 -0
  238. package/src/interfaces/tx_provider.ts +2 -2
  239. package/src/interfaces/validator.ts +12 -5
  240. package/src/kernel/hints/build_nullifier_read_request_hints.ts +1 -10
  241. package/src/keys/derivation.ts +8 -8
  242. package/src/keys/key_types.ts +1 -1
  243. package/src/keys/utils.ts +7 -3
  244. package/src/l1-contracts/slash_factory.ts +1 -0
  245. package/src/logs/log_id.ts +22 -18
  246. package/src/logs/siloed_tag.ts +3 -2
  247. package/src/messaging/l2_to_l1_membership.ts +3 -3
  248. package/src/p2p/block_proposal.ts +12 -5
  249. package/src/p2p/checkpoint_proposal.ts +19 -2
  250. package/src/p2p/constants.ts +6 -0
  251. package/src/p2p/index.ts +1 -0
  252. package/src/p2p/message_validator.ts +14 -2
  253. package/src/rollup/checkpoint_rollup_public_inputs.ts +5 -5
  254. package/src/rollup/root_rollup_public_inputs.ts +7 -7
  255. package/src/slashing/empire.ts +3 -1
  256. package/src/slashing/helpers.ts +8 -0
  257. package/src/slashing/tally.ts +8 -2
  258. package/src/slashing/types.ts +14 -0
  259. package/src/stats/stats.ts +0 -2
  260. package/src/tests/factories.ts +6 -6
  261. package/src/tests/jest.ts +9 -9
  262. package/src/tests/mocks.ts +26 -17
  263. package/src/timetable/index.ts +66 -0
  264. package/src/trees/public_data_leaf.ts +11 -5
  265. package/src/tx/block_header.ts +7 -4
  266. package/src/tx/indexed_tx_effect.ts +3 -2
  267. package/src/tx/tx.ts +8 -9
  268. package/src/tx/tx_receipt.ts +75 -18
  269. package/src/tx/validator/empty_validator.ts +1 -1
  270. package/src/tx/validator/error_texts.ts +3 -0
  271. package/src/tx/validator/tx_validator.ts +1 -1
  272. package/dest/block/l2_block_new.d.ts.map +0 -1
  273. package/dest/database-version/index.d.ts +0 -2
  274. package/dest/database-version/index.d.ts.map +0 -1
  275. package/dest/database-version/index.js +0 -1
  276. package/src/database-version/index.ts +0 -1
@@ -15,18 +15,14 @@ import { z } from 'zod';
15
15
  import type { PrivateLog } from '../logs/private_log.js';
16
16
  import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
17
17
  import { BlockHeader } from '../tx/block_header.js';
18
+ import type { BlockHash } from './block_hash.js';
18
19
  import { Body } from './body.js';
19
20
  import type { L2BlockInfo } from './l2_block_info.js';
20
21
 
21
- // TODO(palla/mbps): Delete the existing `L2Block` class and rename this to `L2Block`.
22
- // TODO(palla/mbps): Consider moving the checkpointNumber and indexWithinCheckpoint to the header:
23
- // if the blockNumber is there, why not these as well? Consider whether they should be part of the
24
- // circuits structs though.
25
-
26
22
  /**
27
23
  * An L2 block with a header and a body.
28
24
  */
29
- export class L2BlockNew {
25
+ export class L2Block {
30
26
  constructor(
31
27
  /** Snapshot of archive tree after the block is applied. */
32
28
  public archive: AppendOnlyTreeSnapshot,
@@ -63,7 +59,7 @@ export class L2BlockNew {
63
59
  })
64
60
  .transform(
65
61
  ({ archive, header, body, checkpointNumber, indexWithinCheckpoint }) =>
66
- new L2BlockNew(archive, header, body, checkpointNumber, indexWithinCheckpoint),
62
+ new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint),
67
63
  );
68
64
  }
69
65
 
@@ -79,7 +75,7 @@ export class L2BlockNew {
79
75
  const checkpointNumber = CheckpointNumber(reader.readNumber());
80
76
  const indexWithinCheckpoint = IndexWithinCheckpoint(reader.readNumber());
81
77
 
82
- return new L2BlockNew(archive, header, body, checkpointNumber, indexWithinCheckpoint);
78
+ return new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint);
83
79
  }
84
80
 
85
81
  /**
@@ -94,7 +90,7 @@ export class L2BlockNew {
94
90
  * Returns the block's hash (hash of block header).
95
91
  * @returns The block's hash.
96
92
  */
97
- public hash(): Promise<Fr> {
93
+ public hash(): Promise<BlockHash> {
98
94
  return this.header.hash();
99
95
  }
100
96
 
@@ -143,7 +139,7 @@ export class L2BlockNew {
143
139
  }
144
140
 
145
141
  static empty(header?: BlockHeader) {
146
- return new L2BlockNew(
142
+ return new L2Block(
147
143
  AppendOnlyTreeSnapshot.empty(),
148
144
  header ?? BlockHeader.empty(),
149
145
  Body.empty(),
@@ -177,11 +173,11 @@ export class L2BlockNew {
177
173
  txOptions?: Partial<Parameters<typeof Body.random>[0]>;
178
174
  makeTxOptions?: (txIndex: number) => Partial<Parameters<typeof Body.random>[0]>;
179
175
  } & Partial<Parameters<typeof BlockHeader.random>[0]> = {},
180
- ): Promise<L2BlockNew> {
176
+ ): Promise<L2Block> {
181
177
  const archive = new AppendOnlyTreeSnapshot(Fr.random(), blockNumber + 1);
182
178
  const header = BlockHeader.random({ blockNumber, ...blockHeaderOverrides });
183
179
  const body = await Body.random({ txsPerBlock, makeTxOptions, ...txOptions });
184
- return new L2BlockNew(archive, header, body, checkpointNumber, indexWithinCheckpoint);
180
+ return new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint);
185
181
  }
186
182
 
187
183
  /**
@@ -20,8 +20,9 @@ import type { BlockHeader } from '../tx/block_header.js';
20
20
  import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
21
21
  import type { TxHash } from '../tx/tx_hash.js';
22
22
  import type { TxReceipt } from '../tx/tx_receipt.js';
23
+ import type { BlockHash } from './block_hash.js';
23
24
  import type { CheckpointedL2Block } from './checkpointed_l2_block.js';
24
- import type { L2BlockNew } from './l2_block_new.js';
25
+ import type { L2Block } from './l2_block.js';
25
26
  import type { ValidateCheckpointNegativeResult, ValidateCheckpointResult } from './validate_block_result.js';
26
27
 
27
28
  /**
@@ -52,6 +53,20 @@ export interface L2BlockSource {
52
53
  */
53
54
  getProvenBlockNumber(): Promise<BlockNumber>;
54
55
 
56
+ /**
57
+ * Gets the number of the latest L2 block checkpointed seen by the block source implementation.
58
+ * @returns The number of the latest L2 block checkpointed seen by the block source implementation.
59
+ */
60
+ getCheckpointedL2BlockNumber(): Promise<BlockNumber>;
61
+
62
+ /**
63
+ * Computes the finalized block number based on the proven block number.
64
+ * A block is considered finalized when it's 2 epochs behind the proven block.
65
+ * TODO(#13569): Compute proper finalized block number based on L1 finalized block.
66
+ * @returns The finalized block number.
67
+ */
68
+ getFinalizedL2BlockNumber(): Promise<BlockNumber>;
69
+
55
70
  /**
56
71
  * Gets an l2 block header.
57
72
  * @param number - The block number to return or 'latest' for the most recent one.
@@ -67,15 +82,15 @@ export interface L2BlockSource {
67
82
  */
68
83
  getCheckpointedBlock(number: BlockNumber): Promise<CheckpointedL2Block | undefined>;
69
84
 
70
- getCheckpointedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]>;
85
+ getCheckpointedBlocks(from: BlockNumber, limit: number): Promise<CheckpointedL2Block[]>;
71
86
 
72
87
  /**
73
- * Retrieves a collection of published checkpoints
74
- * @param checkpointNumber The first checkpoint to be retrieved
75
- * @param limit The number of checkpoints to be retrieved
76
- * @returns The collection of complete checkpoints
88
+ * Retrieves a collection of checkpoints.
89
+ * @param checkpointNumber The first checkpoint to be retrieved.
90
+ * @param limit The number of checkpoints to be retrieved.
91
+ * @returns The collection of complete checkpoints.
77
92
  */
78
- getPublishedCheckpoints(checkpointNumber: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]>;
93
+ getCheckpoints(checkpointNumber: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]>;
79
94
 
80
95
  /**
81
96
  * Gets the checkpoints for a given epoch
@@ -88,7 +103,7 @@ export interface L2BlockSource {
88
103
  * @param blockHash - The block hash to retrieve.
89
104
  * @returns The requested block header (or undefined if not found).
90
105
  */
91
- getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined>;
106
+ getBlockHeaderByHash(blockHash: BlockHash): Promise<BlockHeader | undefined>;
92
107
 
93
108
  /**
94
109
  * Gets a block header by its archive root.
@@ -102,21 +117,21 @@ export interface L2BlockSource {
102
117
  * @param number - The block number to return.
103
118
  * @returns The requested L2 block (or undefined if not found).
104
119
  */
105
- getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined>;
120
+ getL2Block(number: BlockNumber): Promise<L2Block | undefined>;
106
121
 
107
122
  /**
108
123
  * Gets an L2 block by its hash.
109
124
  * @param blockHash - The block hash to retrieve.
110
125
  * @returns The requested L2 block (or undefined if not found).
111
126
  */
112
- getL2BlockNewByHash(blockHash: Fr): Promise<L2BlockNew | undefined>;
127
+ getL2BlockByHash(blockHash: BlockHash): Promise<L2Block | undefined>;
113
128
 
114
129
  /**
115
130
  * Gets an L2 block by its archive root.
116
131
  * @param archive - The archive root to retrieve.
117
132
  * @returns The requested L2 block (or undefined if not found).
118
133
  */
119
- getL2BlockNewByArchive(archive: Fr): Promise<L2BlockNew | undefined>;
134
+ getL2BlockByArchive(archive: Fr): Promise<L2Block | undefined>;
120
135
 
121
136
  /**
122
137
  * Gets a tx effect.
@@ -143,11 +158,11 @@ export interface L2BlockSource {
143
158
  getL2EpochNumber(): Promise<EpochNumber | undefined>;
144
159
 
145
160
  /**
146
- * Returns all block headers for a given epoch.
161
+ * Returns all checkpointed block headers for a given epoch.
147
162
  * @dev Use this method only with recent epochs, since it walks the block list backwards.
148
163
  * @param epochNumber - The epoch number to return headers for.
149
164
  */
150
- getBlockHeadersForEpoch(epochNumber: EpochNumber): Promise<BlockHeader[]>;
165
+ getCheckpointedBlockHeadersForEpoch(epochNumber: EpochNumber): Promise<BlockHeader[]>;
151
166
 
152
167
  /**
153
168
  * Returns whether the given epoch is completed on L1, based on the current L1 and L2 block numbers.
@@ -193,49 +208,43 @@ export interface L2BlockSource {
193
208
  * @param number - The block number to return (inclusive).
194
209
  * @returns The requested L2 block.
195
210
  */
196
- getBlock(number: BlockNumber): Promise<L2BlockNew | undefined>;
197
-
198
- getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
211
+ getBlock(number: BlockNumber): Promise<L2Block | undefined>;
199
212
 
200
213
  /**
201
- * Returns all blocks for a given epoch.
214
+ * Returns all checkpointed blocks for a given epoch.
202
215
  * @dev Use this method only with recent epochs, since it walks the block list backwards.
203
216
  * @param epochNumber - The epoch number to return blocks for.
204
217
  */
205
- getBlocksForEpoch(epochNumber: EpochNumber): Promise<L2BlockNew[]>;
218
+ getCheckpointedBlocksForEpoch(epochNumber: EpochNumber): Promise<CheckpointedL2Block[]>;
206
219
 
207
220
  /**
208
221
  * Returns all blocks for a given slot.
209
222
  * @dev Use this method only with recent slots, since it walks the block list backwards.
210
223
  * @param slotNumber - The slot number to return blocks for.
211
224
  */
212
- getBlocksForSlot(slotNumber: SlotNumber): Promise<L2BlockNew[]>;
225
+ getBlocksForSlot(slotNumber: SlotNumber): Promise<L2Block[]>;
213
226
 
214
227
  /**
215
- * Gets a published block by its block hash.
228
+ * Gets a checkpointed block by its block hash.
216
229
  * @param blockHash - The block hash to retrieve.
217
230
  * @returns The requested block (or undefined if not found).
218
231
  */
219
- getPublishedBlockByHash(blockHash: Fr): Promise<CheckpointedL2Block | undefined>;
232
+ getCheckpointedBlockByHash(blockHash: BlockHash): Promise<CheckpointedL2Block | undefined>;
220
233
 
221
234
  /**
222
- * Gets a published block by its archive root.
235
+ * Gets a checkpointed block by its archive root.
223
236
  * @param archive - The archive root to retrieve.
224
237
  * @returns The requested block (or undefined if not found).
225
238
  */
226
- getPublishedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined>;
239
+ getCheckpointedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined>;
227
240
 
228
241
  /**
229
242
  * Gets up to `limit` amount of L2 blocks starting from `from`.
230
243
  * @param from - Number of the first block to return (inclusive).
231
244
  * @param limit - The maximum number of blocks to return.
232
- * @param proven - If true, only return blocks that have been proven.
233
245
  * @returns The requested L2 blocks.
234
246
  */
235
- getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
236
-
237
- /** Equivalent to getBlocks but includes publish data. */
238
- getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]>;
247
+ getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
239
248
  }
240
249
 
241
250
  /**
@@ -247,7 +256,7 @@ export interface L2BlockSink {
247
256
  * @param block - The L2 block to add.
248
257
  * @throws If block number is not incremental (i.e., not exactly one more than the last stored block).
249
258
  */
250
- addBlock(block: L2BlockNew): Promise<void>;
259
+ addBlock(block: L2Block): Promise<void>;
251
260
  }
252
261
 
253
262
  /**
@@ -344,13 +353,13 @@ export type L2BlockProvenEvent = {
344
353
  export type L2PruneUnprovenEvent = {
345
354
  type: 'l2PruneUnproven';
346
355
  epochNumber: EpochNumber;
347
- blocks: L2BlockNew[];
356
+ blocks: L2Block[];
348
357
  };
349
358
 
350
359
  export type L2PruneUncheckpointedEvent = {
351
360
  type: 'l2PruneUncheckpointed';
352
361
  slotNumber: SlotNumber;
353
- blocks: L2BlockNew[];
362
+ blocks: L2Block[];
354
363
  };
355
364
 
356
365
  export type L2CheckpointEvent = {
@@ -1,5 +1,5 @@
1
1
  import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
2
- import type { L2BlockNew } from '../l2_block_new.js';
2
+ import type { L2Block } from '../l2_block.js';
3
3
  import type { CheckpointId, L2BlockId, L2Tips } from '../l2_block_source.js';
4
4
 
5
5
  /** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
@@ -16,7 +16,7 @@ export interface L2BlockStreamEventHandler {
16
16
  export type L2BlockStreamEvent =
17
17
  | /** Emits blocks added to the chain. */ {
18
18
  type: 'blocks-added';
19
- blocks: L2BlockNew[];
19
+ blocks: L2Block[];
20
20
  }
21
21
  | /** Emits checkpoints published to L1. */ {
22
22
  type: 'chain-checkpointed';
@@ -7,6 +7,9 @@ import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.
7
7
  import { type L2BlockId, type L2BlockSource, makeL2BlockId } from '../l2_block_source.js';
8
8
  import type { L2BlockStreamEvent, L2BlockStreamEventHandler, L2BlockStreamLocalDataProvider } from './interfaces.js';
9
9
 
10
+ /** Maximum number of checkpoints to prefetch at once during sync. Matches MAX_RPC_CHECKPOINTS_LEN. */
11
+ export const CHECKPOINT_PREFETCH_LIMIT = 50;
12
+
10
13
  /** Creates a stream of events for new blocks, chain tips updates, and reorgs, out of polling an archiver or a node. */
11
14
  export class L2BlockStream {
12
15
  private readonly runningPromise: RunningPromise;
@@ -16,13 +19,12 @@ export class L2BlockStream {
16
19
  constructor(
17
20
  private l2BlockSource: Pick<
18
21
  L2BlockSource,
19
- 'getL2BlocksNew' | 'getBlockHeader' | 'getL2Tips' | 'getPublishedCheckpoints' | 'getCheckpointedBlocks'
22
+ 'getBlocks' | 'getBlockHeader' | 'getL2Tips' | 'getCheckpoints' | 'getCheckpointedBlocks'
20
23
  >,
21
24
  private localData: L2BlockStreamLocalDataProvider,
22
25
  private handler: L2BlockStreamEventHandler,
23
26
  private readonly log = createLogger('types:block_stream'),
24
27
  private opts: {
25
- proven?: boolean;
26
28
  pollIntervalMS?: number;
27
29
  batchSize?: number;
28
30
  startingBlock?: number;
@@ -30,6 +32,8 @@ export class L2BlockStream {
30
32
  skipFinalized?: boolean;
31
33
  /** When true, checkpoint events will not be emitted. Blocks are still fetched via checkpoints but only blocks-added events are emitted. */
32
34
  ignoreCheckpoints?: boolean;
35
+ /** Maximum number of checkpoints to prefetch at once during sync. Defaults to CHECKPOINT_PREFETCH_LIMIT (50). */
36
+ checkpointPrefetchLimit?: number;
33
37
  } = {},
34
38
  ) {
35
39
  // Note that RunningPromise is in stopped state by default. This promise won't run until someone invokes `start`,
@@ -124,7 +128,7 @@ export class L2BlockStream {
124
128
  if (!this.opts.ignoreCheckpoints) {
125
129
  let loop1Iterations = 0;
126
130
  while (nextCheckpointToEmit <= sourceTips.checkpointed.checkpoint.number) {
127
- const checkpoints = await this.l2BlockSource.getPublishedCheckpoints(nextCheckpointToEmit, 1);
131
+ const checkpoints = await this.l2BlockSource.getCheckpoints(nextCheckpointToEmit, 1);
128
132
  if (checkpoints.length === 0) {
129
133
  break;
130
134
  }
@@ -150,27 +154,36 @@ export class L2BlockStream {
150
154
  }
151
155
  }
152
156
 
153
- // Loop 2: Fetch new checkpointed blocks. For each block, get its checkpoint, emit all blocks
157
+ // Loop 2: Fetch new checkpointed blocks. For each checkpoint, emit all blocks
154
158
  // from that checkpoint that we need, then emit the checkpoint event.
155
- // We cache the current checkpoint to avoid redundant fetches when batchSize < checkpoint size.
156
- let checkpoint: PublishedCheckpoint | undefined;
157
- while (nextBlockNumber <= sourceTips.checkpointed.block.number) {
158
- const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.checkpointed.block.number - nextBlockNumber + 1);
159
+ // We prefetch multiple checkpoints, then process them one by one.
160
+ let prefetchedCheckpoints: PublishedCheckpoint[] = [];
161
+ let prefetchIdx = 0;
162
+ let nextCheckpointNumber: CheckpointNumber | undefined;
159
163
 
160
- // Check if we need to fetch a new checkpoint (nextBlockNumber is beyond the cached one)
161
- if (!checkpoint || nextBlockNumber > checkpoint.checkpoint.blocks.at(-1)!.number) {
162
- const blocks = await this.l2BlockSource.getCheckpointedBlocks(BlockNumber(nextBlockNumber), 1);
163
- if (blocks.length === 0) {
164
- break;
165
- }
166
- const checkpoints = await this.l2BlockSource.getPublishedCheckpoints(blocks[0].checkpointNumber, 1);
167
- if (checkpoints.length === 0) {
164
+ // Find the starting checkpoint number
165
+ if (nextBlockNumber <= sourceTips.checkpointed.block.number) {
166
+ const blocks = await this.l2BlockSource.getCheckpointedBlocks(BlockNumber(nextBlockNumber), 1);
167
+ if (blocks.length > 0) {
168
+ nextCheckpointNumber = blocks[0].checkpointNumber;
169
+ }
170
+ }
171
+
172
+ while (nextBlockNumber <= sourceTips.checkpointed.block.number && nextCheckpointNumber !== undefined) {
173
+ // Refill the prefetch buffer when exhausted
174
+ if (prefetchIdx >= prefetchedCheckpoints.length) {
175
+ const prefetchLimit = this.opts.checkpointPrefetchLimit ?? CHECKPOINT_PREFETCH_LIMIT;
176
+ prefetchedCheckpoints = await this.l2BlockSource.getCheckpoints(nextCheckpointNumber, prefetchLimit);
177
+ prefetchIdx = 0;
178
+ if (prefetchedCheckpoints.length === 0) {
168
179
  break;
169
180
  }
170
- checkpoint = checkpoints[0];
171
181
  }
172
182
 
183
+ const checkpoint = prefetchedCheckpoints[prefetchIdx]!;
184
+
173
185
  // Get all blocks from this checkpoint that we need, respecting batchSize
186
+ const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.checkpointed.block.number - nextBlockNumber + 1);
174
187
  const blocksForCheckpoint = checkpoint.checkpoint.blocks
175
188
  .filter(b => b.number >= nextBlockNumber)
176
189
  .slice(0, limit);
@@ -180,23 +193,27 @@ export class L2BlockStream {
180
193
  await this.emitEvent({ type: 'blocks-added', blocks: blocksForCheckpoint });
181
194
  nextBlockNumber = blocksForCheckpoint.at(-1)!.number + 1;
182
195
 
183
- // If we've reached the end of this checkpoint, emit the checkpoint event
196
+ // If we've reached the end of this checkpoint, emit the checkpoint event and move to next
184
197
  const lastBlockInCheckpoint = checkpoint.checkpoint.blocks.at(-1)!;
185
- if (!this.opts.ignoreCheckpoints && nextBlockNumber > lastBlockInCheckpoint.number) {
186
- const lastBlockHash = await lastBlockInCheckpoint.hash();
187
- await this.emitEvent({
188
- type: 'chain-checkpointed',
189
- checkpoint,
190
- block: makeL2BlockId(lastBlockInCheckpoint.number, lastBlockHash.toString()),
191
- });
198
+ if (nextBlockNumber > lastBlockInCheckpoint.number) {
199
+ if (!this.opts.ignoreCheckpoints) {
200
+ const lastBlockHash = await lastBlockInCheckpoint.hash();
201
+ await this.emitEvent({
202
+ type: 'chain-checkpointed',
203
+ checkpoint,
204
+ block: makeL2BlockId(lastBlockInCheckpoint.number, lastBlockHash.toString()),
205
+ });
206
+ }
207
+ prefetchIdx++;
208
+ nextCheckpointNumber = CheckpointNumber(nextCheckpointNumber + 1);
192
209
  }
193
210
  }
194
211
 
195
212
  // Loop 3: Fetch any remaining uncheckpointed (proposed) blocks.
196
213
  while (nextBlockNumber <= sourceTips.proposed.number) {
197
214
  const limit = Math.min(this.opts.batchSize ?? 50, sourceTips.proposed.number - nextBlockNumber + 1);
198
- this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit} proven=${this.opts.proven}`);
199
- const blocks = await this.l2BlockSource.getL2BlocksNew(BlockNumber(nextBlockNumber), limit, this.opts.proven);
215
+ this.log.trace(`Requesting blocks from ${nextBlockNumber} limit ${limit}`);
216
+ const blocks = await this.l2BlockSource.getBlocks(BlockNumber(nextBlockNumber), BlockNumber(limit));
200
217
  if (blocks.length === 0) {
201
218
  break;
202
219
  }
@@ -2,7 +2,7 @@ import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
2
2
  import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
3
 
4
4
  import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
5
- import type { L2BlockNew } from '../l2_block_new.js';
5
+ import type { L2Block } from '../l2_block.js';
6
6
  import {
7
7
  type CheckpointId,
8
8
  GENESIS_CHECKPOINT_HEADER_HASH,
@@ -109,7 +109,7 @@ export abstract class L2TipsStoreBase implements L2BlockStreamEventHandler, L2Bl
109
109
  }
110
110
 
111
111
  // Protected helper that subclasses can override for block hash computation
112
- protected computeBlockHash(block: L2BlockNew): Promise<string> {
112
+ protected computeBlockHash(block: L2Block): Promise<string> {
113
113
  return block.hash().then(hash => hash.toString());
114
114
  }
115
115
 
@@ -5,8 +5,8 @@ import { Fr } from '@aztec/foundation/curves/bn254';
5
5
  import {
6
6
  type CheckpointId,
7
7
  GENESIS_CHECKPOINT_HEADER_HASH,
8
+ L2Block,
8
9
  type L2BlockId,
9
- L2BlockNew,
10
10
  type L2TipId,
11
11
  } from '@aztec/stdlib/block';
12
12
  import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
@@ -31,8 +31,8 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
31
31
  blockToCheckpoint.clear();
32
32
  });
33
33
 
34
- const makeBlock = async (number: number): Promise<L2BlockNew> => {
35
- const block = await L2BlockNew.random(BlockNumber(number));
34
+ const makeBlock = async (number: number): Promise<L2Block> => {
35
+ const block = await L2Block.random(BlockNumber(number));
36
36
  blockHashes.set(number, (await block.hash()).toString());
37
37
  return block;
38
38
  };
@@ -74,7 +74,7 @@ export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
74
74
  checkpointed: makeTipId(checkpointed),
75
75
  });
76
76
 
77
- const makeCheckpoint = async (checkpointNumber: number, blocks: L2BlockNew[]): Promise<PublishedCheckpoint> => {
77
+ const makeCheckpoint = async (checkpointNumber: number, blocks: L2Block[]): Promise<PublishedCheckpoint> => {
78
78
  const checkpoint = await Checkpoint.random(CheckpointNumber(checkpointNumber), {
79
79
  numBlocks: blocks.length,
80
80
  startBlockNumber: blocks[0].number,
@@ -13,7 +13,7 @@ import type { FieldsOf } from '@aztec/foundation/types';
13
13
 
14
14
  import { z } from 'zod';
15
15
 
16
- import { L2BlockNew } from '../block/l2_block_new.js';
16
+ import { L2Block } from '../block/l2_block.js';
17
17
  import { MAX_BLOCKS_PER_CHECKPOINT } from '../deserialization/index.js';
18
18
  import { computeCheckpointOutHash } from '../messaging/out_hash.js';
19
19
  import { CheckpointHeader } from '../rollup/checkpoint_header.js';
@@ -29,7 +29,7 @@ export class Checkpoint {
29
29
  /** Header of the checkpoint. */
30
30
  public header: CheckpointHeader,
31
31
  /** L2 blocks in the checkpoint. */
32
- public blocks: L2BlockNew[],
32
+ public blocks: L2Block[],
33
33
  /** Number of the checkpoint. */
34
34
  public number: CheckpointNumber,
35
35
  ) {}
@@ -43,7 +43,7 @@ export class Checkpoint {
43
43
  .object({
44
44
  archive: AppendOnlyTreeSnapshot.schema,
45
45
  header: CheckpointHeader.schema,
46
- blocks: z.array(L2BlockNew.schema),
46
+ blocks: z.array(L2Block.schema),
47
47
  number: CheckpointNumberSchema,
48
48
  })
49
49
  .transform(({ archive, header, blocks, number }) => new Checkpoint(archive, header, blocks, number));
@@ -62,7 +62,7 @@ export class Checkpoint {
62
62
  return new Checkpoint(
63
63
  reader.readObject(AppendOnlyTreeSnapshot),
64
64
  reader.readObject(CheckpointHeader),
65
- reader.readVector(L2BlockNew, MAX_BLOCKS_PER_CHECKPOINT),
65
+ reader.readVector(L2Block, MAX_BLOCKS_PER_CHECKPOINT),
66
66
  CheckpointNumber(reader.readNumber()),
67
67
  );
68
68
  }
@@ -135,16 +135,16 @@ export class Checkpoint {
135
135
  startBlockNumber?: number;
136
136
  previousArchive?: AppendOnlyTreeSnapshot;
137
137
  } & Partial<Parameters<typeof CheckpointHeader.random>[0]> &
138
- Partial<Parameters<typeof L2BlockNew.random>[1]> = {},
138
+ Partial<Parameters<typeof L2Block.random>[1]> = {},
139
139
  ) {
140
140
  const header = CheckpointHeader.random(options);
141
141
 
142
142
  // Create blocks sequentially to chain archive roots properly.
143
143
  // Each block's header.lastArchive must equal the previous block's archive.
144
- const blocks: L2BlockNew[] = [];
144
+ const blocks: L2Block[] = [];
145
145
  let lastArchive = previousArchive;
146
146
  for (let i = 0; i < numBlocks; i++) {
147
- const block = await L2BlockNew.random(BlockNumber(startBlockNumber + i), {
147
+ const block = await L2Block.random(BlockNumber(startBlockNumber + i), {
148
148
  indexWithinCheckpoint: IndexWithinCheckpoint(i),
149
149
  ...options,
150
150
  ...(lastArchive ? { lastArchive } : {}),
@@ -1,2 +1,3 @@
1
1
  export * from './chain-config.js';
2
2
  export * from './node-rpc-config.js';
3
+ export * from './sequencer-config.js';
@@ -21,7 +21,7 @@ export const nodeRpcConfigMappings: ConfigMappingsType<NodeRPCConfig> = {
21
21
  rpcMaxBodySize: {
22
22
  env: 'RPC_MAX_BODY_SIZE',
23
23
  description: 'Maximum allowed batch size for JSON RPC batch requests.',
24
- defaultValue: '50mb',
24
+ defaultValue: '1mb',
25
25
  },
26
26
  };
27
27
 
@@ -0,0 +1,19 @@
1
+ import type { ConfigMappingsType } from '@aztec/foundation/config';
2
+
3
+ import type { SequencerConfig } from '../interfaces/configs.js';
4
+
5
+ /**
6
+ * Partial sequencer config mappings for fields that need to be shared across packages.
7
+ * The full sequencer config mappings remain in sequencer-client, but shared fields
8
+ * (like blockDurationMs needed by both p2p and sequencer-client) are defined here
9
+ * to avoid duplication.
10
+ */
11
+ export const sharedSequencerConfigMappings: ConfigMappingsType<Pick<SequencerConfig, 'blockDurationMs'>> = {
12
+ blockDurationMs: {
13
+ env: 'SEQ_BLOCK_DURATION_MS',
14
+ description:
15
+ 'Duration per block in milliseconds when building multiple blocks per slot. ' +
16
+ 'If undefined (default), builds a single block per slot using the full slot duration.',
17
+ parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
18
+ },
19
+ };
@@ -87,5 +87,5 @@ export async function computeInitializationHashFromEncodedArgs(
87
87
  encodedArgs: Fr[],
88
88
  ): Promise<Fr> {
89
89
  const argsHash = await computeVarArgsHash(encodedArgs);
90
- return poseidon2HashWithSeparator([initFn, argsHash], GeneratorIndex.CONSTRUCTOR);
90
+ return poseidon2HashWithSeparator([initFn, argsHash], GeneratorIndex.INITIALIZER);
91
91
  }
@@ -13,7 +13,7 @@ import { computePrivateFunctionsRoot } from './private_function.js';
13
13
  *
14
14
  * ```
15
15
  * version = 1
16
- * private_function_leaves = private_functions.map(fn => pedersen([fn.function_selector as Field, fn.vk_hash], GENERATOR__FUNCTION_LEAF))
16
+ * private_function_leaves = private_functions.map(fn => pedersen([fn.function_selector as Field, fn.vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF))
17
17
  * private_functions_root = merkleize(private_function_leaves)
18
18
  * bytecode_commitment = calculate_commitment(packed_bytecode)
19
19
  * contract_class_id = pedersen([version, artifact_hash, private_functions_root, bytecode_commitment], GENERATOR__CLASS_IDENTIFIER)
@@ -19,6 +19,8 @@ export interface NodeInfo {
19
19
  l1ContractAddresses: L1ContractAddresses;
20
20
  /** Protocol contract addresses */
21
21
  protocolContractAddresses: ProtocolContractAddresses;
22
+ /** Whether the node requires real proofs for transaction submission. */
23
+ realProofs: boolean;
22
24
  }
23
25
 
24
26
  export const NodeInfoSchema: ZodFor<NodeInfo> = z
@@ -29,5 +31,6 @@ export const NodeInfoSchema: ZodFor<NodeInfo> = z
29
31
  enr: z.string().optional(),
30
32
  l1ContractAddresses: L1ContractAddressesSchema,
31
33
  protocolContractAddresses: ProtocolContractAddressesSchema,
34
+ realProofs: z.boolean(),
32
35
  })
33
36
  .transform(obj => ({ enr: undefined, ...obj }));
@@ -1,5 +1,4 @@
1
1
  import { FUNCTION_TREE_HEIGHT, GeneratorIndex } from '@aztec/constants';
2
- import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
3
2
  import { poseidon2Hash, poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
4
3
  import { Fr } from '@aztec/foundation/curves/bn254';
5
4
  import { type MerkleTree, MerkleTreeCalculator } from '@aztec/foundation/trees';
@@ -32,13 +31,13 @@ function computePrivateFunctionLeaves(fns: PrivateFunction[]): Promise<Buffer[]>
32
31
 
33
32
  /** Returns the leaf for a given private function. */
34
33
  export async function computePrivateFunctionLeaf(fn: PrivateFunction): Promise<Buffer> {
35
- return (await poseidon2HashWithSeparator([fn.selector, fn.vkHash], GeneratorIndex.FUNCTION_LEAF)).toBuffer();
34
+ return (await poseidon2HashWithSeparator([fn.selector, fn.vkHash], GeneratorIndex.PRIVATE_FUNCTION_LEAF)).toBuffer();
36
35
  }
37
36
 
38
37
  async function getPrivateFunctionTreeCalculator(): Promise<MerkleTreeCalculator> {
39
38
  if (!privateFunctionTreeCalculator) {
40
39
  const functionTreeZeroLeaf = (
41
- await pedersenHash(new Array(PRIVATE_FUNCTION_SIZE).fill(0))
40
+ await poseidon2Hash(new Array(PRIVATE_FUNCTION_SIZE).fill(0))
42
41
  ).toBuffer() as Buffer<ArrayBuffer>;
43
42
  privateFunctionTreeCalculator = await MerkleTreeCalculator.create(
44
43
  FUNCTION_TREE_HEIGHT,
@@ -99,7 +99,7 @@ export async function createPrivateFunctionMembershipProof(
99
99
  * contract_class = db.get_contract_class(contract_class_id)
100
100
  *
101
101
  * // Compute function leaf and assert it belongs to the private functions tree
102
- * function_leaf = pedersen([selector as Field, vk_hash], GENERATOR__FUNCTION_LEAF)
102
+ * function_leaf = pedersen([selector as Field, vk_hash], GENERATOR__PRIVATE_FUNCTION_LEAF)
103
103
  * computed_private_function_tree_root = compute_root(function_leaf, private_function_tree_sibling_path)
104
104
  * assert computed_private_function_tree_root == contract_class.private_functions_root
105
105
  *