@aztec/stdlib 0.0.1-commit.e588bc7e5 → 0.0.1-commit.e5a3663dd

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 (338) 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/encoder.d.ts +1 -1
  4. package/dest/abi/encoder.d.ts.map +1 -1
  5. package/dest/abi/encoder.js +32 -6
  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 +1 -3
  11. package/dest/abi/note_selector.d.ts +3 -6
  12. package/dest/abi/note_selector.d.ts.map +1 -1
  13. package/dest/abi/note_selector.js +1 -3
  14. package/dest/abi/selector.d.ts +2 -2
  15. package/dest/abi/selector.d.ts.map +1 -1
  16. package/dest/abi/selector.js +1 -1
  17. package/dest/avm/revert_code.d.ts +8 -18
  18. package/dest/avm/revert_code.d.ts.map +1 -1
  19. package/dest/avm/revert_code.js +15 -30
  20. package/dest/aztec-address/index.d.ts +3 -6
  21. package/dest/aztec-address/index.d.ts.map +1 -1
  22. package/dest/aztec-address/index.js +2 -4
  23. package/dest/block/attestation_info.d.ts +3 -2
  24. package/dest/block/attestation_info.d.ts.map +1 -1
  25. package/dest/block/attestation_info.js +7 -5
  26. package/dest/block/block_data.d.ts +297 -8
  27. package/dest/block/block_data.d.ts.map +1 -1
  28. package/dest/block/block_data.js +16 -2
  29. package/dest/block/block_hash.d.ts +11 -10
  30. package/dest/block/block_hash.d.ts.map +1 -1
  31. package/dest/block/block_hash.js +10 -9
  32. package/dest/block/block_parameter.d.ts +30 -3
  33. package/dest/block/block_parameter.d.ts.map +1 -1
  34. package/dest/block/block_parameter.js +36 -2
  35. package/dest/block/l2_block_info.d.ts +6 -5
  36. package/dest/block/l2_block_info.d.ts.map +1 -1
  37. package/dest/block/l2_block_info.js +6 -5
  38. package/dest/block/l2_block_source.d.ts +39 -4
  39. package/dest/block/l2_block_source.d.ts.map +1 -1
  40. package/dest/block/l2_block_stream/interfaces.d.ts +6 -3
  41. package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
  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 +1 -1
  45. package/dest/block/proposal/attestations_and_signers.d.ts +13 -6
  46. package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
  47. package/dest/block/proposal/attestations_and_signers.js +26 -18
  48. package/dest/block/test/l2_tips_store_test_suite.js +1 -1
  49. package/dest/checkpoint/checkpoint_data.d.ts +7 -1
  50. package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
  51. package/dest/checkpoint/checkpoint_data.js +2 -0
  52. package/dest/config/chain-config.d.ts +2 -2
  53. package/dest/config/chain-config.d.ts.map +1 -1
  54. package/dest/config/chain-config.js +9 -3
  55. package/dest/config/sequencer-config.d.ts +5 -3
  56. package/dest/config/sequencer-config.d.ts.map +1 -1
  57. package/dest/config/sequencer-config.js +18 -4
  58. package/dest/contract/contract_address.d.ts +1 -1
  59. package/dest/contract/contract_address.js +2 -2
  60. package/dest/contract/private_function.d.ts +1 -1
  61. package/dest/contract/private_function.d.ts.map +1 -1
  62. package/dest/contract/private_function.js +2 -4
  63. package/dest/gas/fee_math.d.ts +49 -0
  64. package/dest/gas/fee_math.d.ts.map +1 -0
  65. package/dest/gas/fee_math.js +80 -0
  66. package/dest/gas/gas_fees.d.ts +5 -1
  67. package/dest/gas/gas_fees.d.ts.map +1 -1
  68. package/dest/gas/gas_fees.js +10 -1
  69. package/dest/gas/gas_settings.d.ts +40 -3
  70. package/dest/gas/gas_settings.d.ts.map +1 -1
  71. package/dest/gas/gas_settings.js +50 -6
  72. package/dest/gas/index.d.ts +2 -1
  73. package/dest/gas/index.d.ts.map +1 -1
  74. package/dest/gas/index.js +1 -0
  75. package/dest/ha-signing/config.d.ts +6 -6
  76. package/dest/ha-signing/config.d.ts.map +1 -1
  77. package/dest/ha-signing/config.js +4 -3
  78. package/dest/ha-signing/index.d.ts +2 -2
  79. package/dest/ha-signing/index.d.ts.map +1 -1
  80. package/dest/ha-signing/index.js +1 -1
  81. package/dest/ha-signing/local_config.d.ts +1 -1
  82. package/dest/ha-signing/local_config.d.ts.map +1 -1
  83. package/dest/ha-signing/local_config.js +2 -2
  84. package/dest/ha-signing/types.d.ts +37 -32
  85. package/dest/ha-signing/types.d.ts.map +1 -1
  86. package/dest/ha-signing/types.js +13 -6
  87. package/dest/hash/hash.d.ts +16 -1
  88. package/dest/hash/hash.d.ts.map +1 -1
  89. package/dest/hash/hash.js +32 -0
  90. package/dest/interfaces/archiver.d.ts +11 -1
  91. package/dest/interfaces/archiver.d.ts.map +1 -1
  92. package/dest/interfaces/archiver.js +10 -4
  93. package/dest/interfaces/aztec-node-admin.d.ts +22 -14
  94. package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
  95. package/dest/interfaces/aztec-node-admin.js +5 -4
  96. package/dest/interfaces/aztec-node-debug.d.ts +21 -0
  97. package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
  98. package/dest/interfaces/aztec-node-debug.js +18 -0
  99. package/dest/interfaces/aztec-node.d.ts +54 -55
  100. package/dest/interfaces/aztec-node.d.ts.map +1 -1
  101. package/dest/interfaces/aztec-node.js +20 -16
  102. package/dest/interfaces/block_response.d.ts +156 -0
  103. package/dest/interfaces/block_response.d.ts.map +1 -0
  104. package/dest/interfaces/block_response.js +24 -0
  105. package/dest/interfaces/chain_tips.d.ts +304 -0
  106. package/dest/interfaces/chain_tips.d.ts.map +1 -0
  107. package/dest/interfaces/chain_tips.js +11 -0
  108. package/dest/interfaces/checkpoint_parameter.d.ts +27 -0
  109. package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -0
  110. package/dest/interfaces/checkpoint_parameter.js +20 -0
  111. package/dest/interfaces/checkpoint_response.d.ts +312 -0
  112. package/dest/interfaces/checkpoint_response.d.ts.map +1 -0
  113. package/dest/interfaces/checkpoint_response.js +26 -0
  114. package/dest/interfaces/client.d.ts +7 -1
  115. package/dest/interfaces/client.d.ts.map +1 -1
  116. package/dest/interfaces/client.js +6 -0
  117. package/dest/interfaces/configs.d.ts +12 -2
  118. package/dest/interfaces/configs.d.ts.map +1 -1
  119. package/dest/interfaces/configs.js +3 -1
  120. package/dest/interfaces/l1_publish_info.d.ts +43 -0
  121. package/dest/interfaces/l1_publish_info.d.ts.map +1 -0
  122. package/dest/interfaces/l1_publish_info.js +26 -0
  123. package/dest/interfaces/merkle_tree_operations.d.ts +4 -3
  124. package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
  125. package/dest/interfaces/prover-client.d.ts +1 -1
  126. package/dest/interfaces/prover-client.d.ts.map +1 -1
  127. package/dest/interfaces/prover-client.js +0 -3
  128. package/dest/interfaces/proving-job.d.ts +166 -166
  129. package/dest/interfaces/server.d.ts +6 -1
  130. package/dest/interfaces/server.d.ts.map +1 -1
  131. package/dest/interfaces/server.js +5 -0
  132. package/dest/interfaces/slasher.d.ts +1 -10
  133. package/dest/interfaces/slasher.d.ts.map +1 -1
  134. package/dest/interfaces/slasher.js +0 -2
  135. package/dest/interfaces/validator.d.ts +27 -18
  136. package/dest/interfaces/validator.d.ts.map +1 -1
  137. package/dest/interfaces/validator.js +2 -0
  138. package/dest/l1-contracts/index.d.ts +2 -2
  139. package/dest/l1-contracts/index.d.ts.map +1 -1
  140. package/dest/l1-contracts/index.js +1 -1
  141. package/dest/logs/log_id.d.ts +1 -1
  142. package/dest/logs/log_id.d.ts.map +1 -1
  143. package/dest/logs/log_id.js +1 -2
  144. package/dest/logs/siloed_tag.d.ts +5 -7
  145. package/dest/logs/siloed_tag.d.ts.map +1 -1
  146. package/dest/logs/siloed_tag.js +4 -0
  147. package/dest/logs/tag.d.ts +5 -6
  148. package/dest/logs/tag.d.ts.map +1 -1
  149. package/dest/logs/tag.js +4 -0
  150. package/dest/p2p/block_proposal.d.ts +22 -14
  151. package/dest/p2p/block_proposal.d.ts.map +1 -1
  152. package/dest/p2p/block_proposal.js +45 -40
  153. package/dest/p2p/checkpoint_attestation.d.ts +10 -8
  154. package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
  155. package/dest/p2p/checkpoint_attestation.js +17 -24
  156. package/dest/p2p/checkpoint_proposal.d.ts +20 -14
  157. package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
  158. package/dest/p2p/checkpoint_proposal.js +34 -51
  159. package/dest/p2p/consensus_payload.d.ts +18 -7
  160. package/dest/p2p/consensus_payload.d.ts.map +1 -1
  161. package/dest/p2p/consensus_payload.js +31 -19
  162. package/dest/p2p/gossipable.d.ts +4 -4
  163. package/dest/p2p/gossipable.d.ts.map +1 -1
  164. package/dest/p2p/signature_utils.d.ts +28 -19
  165. package/dest/p2p/signature_utils.d.ts.map +1 -1
  166. package/dest/p2p/signature_utils.js +118 -21
  167. package/dest/p2p/signed_txs.d.ts +15 -13
  168. package/dest/p2p/signed_txs.d.ts.map +1 -1
  169. package/dest/p2p/signed_txs.js +26 -24
  170. package/dest/parity/parity_base_private_inputs.d.ts +7 -3
  171. package/dest/parity/parity_base_private_inputs.d.ts.map +1 -1
  172. package/dest/parity/parity_base_private_inputs.js +7 -5
  173. package/dest/parity/parity_public_inputs.d.ts +7 -3
  174. package/dest/parity/parity_public_inputs.d.ts.map +1 -1
  175. package/dest/parity/parity_public_inputs.js +6 -3
  176. package/dest/rollup/block_headers_hash.d.ts +1 -1
  177. package/dest/rollup/block_headers_hash.d.ts.map +1 -1
  178. package/dest/rollup/block_headers_hash.js +8 -2
  179. package/dest/slashing/index.d.ts +2 -3
  180. package/dest/slashing/index.d.ts.map +1 -1
  181. package/dest/slashing/index.js +1 -2
  182. package/dest/slashing/serialization.d.ts +2 -6
  183. package/dest/slashing/serialization.d.ts.map +1 -1
  184. package/dest/slashing/serialization.js +0 -60
  185. package/dest/slashing/types.d.ts +4 -90
  186. package/dest/slashing/types.d.ts.map +1 -1
  187. package/dest/slashing/types.js +0 -14
  188. package/dest/slashing/{tally.d.ts → votes.d.ts} +1 -1
  189. package/dest/slashing/{tally.d.ts.map → votes.d.ts.map} +1 -1
  190. package/dest/slashing/{tally.js → votes.js} +1 -1
  191. package/dest/tests/factories.d.ts +2 -7
  192. package/dest/tests/factories.d.ts.map +1 -1
  193. package/dest/tests/factories.js +9 -19
  194. package/dest/tests/mocks.d.ts +7 -1
  195. package/dest/tests/mocks.d.ts.map +1 -1
  196. package/dest/tests/mocks.js +39 -30
  197. package/dest/timetable/index.d.ts +51 -1
  198. package/dest/timetable/index.d.ts.map +1 -1
  199. package/dest/timetable/index.js +218 -14
  200. package/dest/trees/nullifier_leaf.d.ts +2 -1
  201. package/dest/trees/nullifier_leaf.d.ts.map +1 -1
  202. package/dest/trees/nullifier_leaf.js +3 -0
  203. package/dest/tx/block_header.d.ts +2 -2
  204. package/dest/tx/block_header.d.ts.map +1 -1
  205. package/dest/tx/block_header.js +1 -1
  206. package/dest/tx/fee_provider.d.ts +10 -0
  207. package/dest/tx/fee_provider.d.ts.map +1 -0
  208. package/dest/tx/fee_provider.js +1 -0
  209. package/dest/tx/global_variable_builder.d.ts +3 -16
  210. package/dest/tx/global_variable_builder.d.ts.map +1 -1
  211. package/dest/tx/index.d.ts +2 -1
  212. package/dest/tx/index.d.ts.map +1 -1
  213. package/dest/tx/index.js +1 -0
  214. package/dest/tx/indexed_tx_effect.d.ts +1 -1
  215. package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
  216. package/dest/tx/indexed_tx_effect.js +1 -2
  217. package/dest/tx/profiling.js +4 -4
  218. package/dest/tx/simulated_tx.d.ts +4 -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/types/shared.d.ts +1 -10
  227. package/dest/types/shared.d.ts.map +1 -1
  228. package/dest/types/shared.js +0 -9
  229. package/dest/vks/verification_key.d.ts +2 -137
  230. package/dest/vks/verification_key.d.ts.map +1 -1
  231. package/dest/vks/verification_key.js +5 -126
  232. package/dest/world-state/genesis_data.d.ts +11 -0
  233. package/dest/world-state/genesis_data.d.ts.map +1 -0
  234. package/dest/world-state/genesis_data.js +4 -0
  235. package/dest/world-state/index.d.ts +2 -1
  236. package/dest/world-state/index.d.ts.map +1 -1
  237. package/dest/world-state/index.js +1 -0
  238. package/dest/world-state/world_state_revision.d.ts +8 -1
  239. package/dest/world-state/world_state_revision.d.ts.map +1 -1
  240. package/dest/world-state/world_state_revision.js +7 -1
  241. package/package.json +8 -8
  242. package/src/abi/authorization_selector.ts +2 -8
  243. package/src/abi/encoder.ts +42 -6
  244. package/src/abi/event_selector.ts +2 -8
  245. package/src/abi/function_selector.ts +3 -12
  246. package/src/abi/note_selector.ts +3 -12
  247. package/src/abi/selector.ts +1 -1
  248. package/src/avm/revert_code.ts +25 -39
  249. package/src/aztec-address/index.ts +4 -10
  250. package/src/block/attestation_info.ts +11 -11
  251. package/src/block/block_data.ts +20 -4
  252. package/src/block/block_hash.ts +21 -14
  253. package/src/block/block_parameter.ts +35 -2
  254. package/src/block/l2_block_info.ts +8 -6
  255. package/src/block/l2_block_source.ts +43 -3
  256. package/src/block/l2_block_stream/interfaces.ts +6 -2
  257. package/src/block/l2_block_stream/l2_tips_store_base.ts +1 -1
  258. package/src/block/proposal/attestations_and_signers.ts +32 -17
  259. package/src/block/test/l2_tips_store_test_suite.ts +1 -1
  260. package/src/checkpoint/checkpoint_data.ts +4 -0
  261. package/src/config/chain-config.ts +9 -4
  262. package/src/config/sequencer-config.ts +34 -6
  263. package/src/contract/contract_address.ts +2 -2
  264. package/src/contract/private_function.ts +3 -1
  265. package/src/gas/README.md +31 -0
  266. package/src/gas/fee_math.ts +120 -0
  267. package/src/gas/gas_fees.ts +17 -4
  268. package/src/gas/gas_settings.ts +65 -12
  269. package/src/gas/index.ts +1 -0
  270. package/src/ha-signing/config.ts +5 -2
  271. package/src/ha-signing/index.ts +3 -1
  272. package/src/ha-signing/local_config.ts +2 -2
  273. package/src/ha-signing/types.ts +48 -34
  274. package/src/hash/hash.ts +27 -0
  275. package/src/interfaces/archiver.ts +21 -3
  276. package/src/interfaces/aztec-node-admin.ts +8 -8
  277. package/src/interfaces/aztec-node-debug.ts +40 -0
  278. package/src/interfaces/aztec-node.ts +120 -95
  279. package/src/interfaces/block_response.ts +79 -0
  280. package/src/interfaces/chain_tips.ts +24 -0
  281. package/src/interfaces/checkpoint_parameter.ts +22 -0
  282. package/src/interfaces/checkpoint_response.ts +84 -0
  283. package/src/interfaces/client.ts +6 -0
  284. package/src/interfaces/configs.ts +8 -1
  285. package/src/interfaces/l1_publish_info.ts +40 -0
  286. package/src/interfaces/merkle_tree_operations.ts +3 -2
  287. package/src/interfaces/prover-client.ts +2 -5
  288. package/src/interfaces/server.ts +5 -0
  289. package/src/interfaces/slasher.ts +0 -6
  290. package/src/interfaces/validator.ts +22 -9
  291. package/src/l1-contracts/index.ts +1 -1
  292. package/src/logs/log_id.ts +1 -2
  293. package/src/logs/siloed_tag.ts +8 -9
  294. package/src/logs/tag.ts +8 -8
  295. package/src/p2p/block_proposal.ts +96 -36
  296. package/src/p2p/checkpoint_attestation.ts +20 -29
  297. package/src/p2p/checkpoint_proposal.ts +88 -71
  298. package/src/p2p/consensus_payload.ts +50 -28
  299. package/src/p2p/gossipable.ts +4 -4
  300. package/src/p2p/signature_utils.ts +110 -25
  301. package/src/p2p/signed_txs.ts +46 -28
  302. package/src/parity/parity_base_private_inputs.ts +10 -4
  303. package/src/parity/parity_public_inputs.ts +9 -2
  304. package/src/rollup/block_headers_hash.ts +11 -2
  305. package/src/slashing/index.ts +1 -2
  306. package/src/slashing/serialization.ts +1 -81
  307. package/src/slashing/types.ts +3 -35
  308. package/src/slashing/{tally.ts → votes.ts} +1 -1
  309. package/src/tests/factories.ts +15 -21
  310. package/src/tests/mocks.ts +63 -39
  311. package/src/timetable/index.ts +308 -13
  312. package/src/trees/nullifier_leaf.ts +4 -0
  313. package/src/tx/block_header.ts +2 -2
  314. package/src/tx/fee_provider.ts +10 -0
  315. package/src/tx/global_variable_builder.ts +2 -18
  316. package/src/tx/index.ts +1 -0
  317. package/src/tx/indexed_tx_effect.ts +1 -2
  318. package/src/tx/profiling.ts +4 -4
  319. package/src/tx/simulated_tx.ts +6 -2
  320. package/src/tx/tx.ts +2 -2
  321. package/src/tx/tx_receipt.ts +11 -14
  322. package/src/types/shared.ts +0 -10
  323. package/src/vks/verification_key.ts +5 -184
  324. package/src/world-state/genesis_data.ts +15 -0
  325. package/src/world-state/index.ts +1 -0
  326. package/src/world-state/world_state_revision.ts +9 -1
  327. package/dest/abi/mocked_keys.d.ts +0 -2
  328. package/dest/abi/mocked_keys.d.ts.map +0 -1
  329. package/dest/abi/mocked_keys.js +0 -1
  330. package/dest/l1-contracts/slash_factory.d.ts +0 -45
  331. package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
  332. package/dest/l1-contracts/slash_factory.js +0 -158
  333. package/dest/slashing/empire.d.ts +0 -31
  334. package/dest/slashing/empire.d.ts.map +0 -1
  335. package/dest/slashing/empire.js +0 -87
  336. package/src/abi/mocked_keys.ts +0 -2
  337. package/src/l1-contracts/slash_factory.ts +0 -180
  338. package/src/slashing/empire.ts +0 -104
@@ -3,7 +3,7 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
3
3
 
4
4
  import { Checkpoint } from '../checkpoint/checkpoint.js';
5
5
  import { ConsensusPayload } from '../p2p/consensus_payload.js';
6
- import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from '../p2p/signature_utils.js';
6
+ import { type CoordinationSignatureContext, getHashedSignaturePayloadTypedData } from '../p2p/signature_utils.js';
7
7
  import type { CommitteeAttestation } from './proposal/committee_attestation.js';
8
8
 
9
9
  /**
@@ -32,11 +32,14 @@ export type AttestationInfo =
32
32
  * Extracts attestation information from a published checkpoint.
33
33
  * Returns info for each attestation, preserving array indices.
34
34
  */
35
- export function getAttestationInfoFromPublishedCheckpoint(block: {
36
- attestations: CommitteeAttestation[];
37
- checkpoint: Checkpoint;
38
- }): AttestationInfo[] {
39
- const payload = ConsensusPayload.fromCheckpoint(block.checkpoint);
35
+ export function getAttestationInfoFromPublishedCheckpoint(
36
+ block: {
37
+ attestations: CommitteeAttestation[];
38
+ checkpoint: Checkpoint;
39
+ },
40
+ signatureContext: CoordinationSignatureContext,
41
+ ): AttestationInfo[] {
42
+ const payload = ConsensusPayload.fromCheckpoint(block.checkpoint, signatureContext);
40
43
  return getAttestationInfoFromPayload(payload, block.attestations);
41
44
  }
42
45
 
@@ -44,10 +47,7 @@ export function getAttestationInfoFromPayload(
44
47
  payload: ConsensusPayload,
45
48
  attestations: CommitteeAttestation[],
46
49
  ): AttestationInfo[] {
47
- const hashedPayload = getHashedSignaturePayloadEthSignedMessage(
48
- payload,
49
- SignatureDomainSeparator.checkpointAttestation,
50
- );
50
+ const hashedPayload = getHashedSignaturePayloadTypedData(payload);
51
51
 
52
52
  return attestations.map(attestation => {
53
53
  // If signature is empty, check if we have an address directly
@@ -62,7 +62,7 @@ export function getAttestationInfoFromPayload(
62
62
 
63
63
  // Try to recover address from signature
64
64
  try {
65
- const recoveredAddress = recoverAddress(hashedPayload, attestation.signature);
65
+ const recoveredAddress = recoverAddress(hashedPayload, attestation.signature, { allowYParityAsV: true });
66
66
  return { address: recoveredAddress, status: 'recovered-from-signature' as const };
67
67
  } catch {
68
68
  // Signature present but recovery failed
@@ -1,18 +1,20 @@
1
1
  import { CheckpointNumberSchema, IndexWithinCheckpointSchema } from '@aztec/foundation/branded-types';
2
2
  import type { CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
3
- import type { Fr } from '@aztec/foundation/curves/bn254';
4
- import { schemas } from '@aztec/foundation/schemas';
5
3
 
6
4
  import { z } from 'zod';
7
5
 
6
+ import { CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
7
+ import { L1PublishedData } from '../checkpoint/published_checkpoint.js';
8
8
  import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
9
9
  import { BlockHeader } from '../tx/block_header.js';
10
+ import { BlockHash } from './block_hash.js';
11
+ import { CommitteeAttestation } from './proposal/committee_attestation.js';
10
12
 
11
13
  /** L2Block metadata. Equivalent to L2Block but without block body containing tx data. */
12
14
  export type BlockData = {
13
15
  header: BlockHeader;
14
16
  archive: AppendOnlyTreeSnapshot;
15
- blockHash: Fr;
17
+ blockHash: BlockHash;
16
18
  checkpointNumber: CheckpointNumber;
17
19
  indexWithinCheckpoint: IndexWithinCheckpoint;
18
20
  };
@@ -20,7 +22,21 @@ export type BlockData = {
20
22
  export const BlockDataSchema = z.object({
21
23
  header: BlockHeader.schema,
22
24
  archive: AppendOnlyTreeSnapshot.schema,
23
- blockHash: schemas.Fr,
25
+ blockHash: BlockHash.schema,
24
26
  checkpointNumber: CheckpointNumberSchema,
25
27
  indexWithinCheckpoint: IndexWithinCheckpointSchema,
26
28
  });
29
+
30
+ export const BlockDataWithCheckpointContextSchema = z
31
+ .object({
32
+ data: BlockDataSchema,
33
+ checkpoint: CheckpointDataSchema.optional(),
34
+ l1: L1PublishedData.schema.optional(),
35
+ attestations: z.array(CommitteeAttestation.schema),
36
+ })
37
+ .transform(obj => ({
38
+ data: obj.data,
39
+ checkpoint: obj.checkpoint,
40
+ l1: obj.l1,
41
+ attestations: obj.attestations,
42
+ }));
@@ -1,21 +1,24 @@
1
- import { Fr } from '@aztec/foundation/curves/bn254';
1
+ import { GENESIS_BLOCK_HEADER_HASH as GENESIS_BLOCK_HEADER_HASH_FR } from '@aztec/constants';
2
+ import { BaseFr, Fr } from '@aztec/foundation/curves/bn254';
2
3
  import type { ZodFor } from '@aztec/foundation/schemas';
4
+ import type { BufferReader } from '@aztec/foundation/serialize';
3
5
 
4
6
  import { inspect } from 'util';
5
7
 
6
8
  import { hexSchemaFor } from '../schemas/schemas.js';
7
9
 
8
- const BLOCK_HASH_BRAND = Symbol.for('aztec.BlockHash');
9
-
10
10
  /** Hash of an L2 block. */
11
- export class BlockHash extends Fr {
12
- readonly [BLOCK_HASH_BRAND] = true as const;
11
+ export class BlockHash extends BaseFr {
12
+ /** Branding for nominal typing. */
13
+ declare private readonly _branding: 'BlockHash';
14
+
15
+ static ZERO = new BlockHash(Fr.ZERO);
13
16
 
14
17
  constructor(hash: Fr) {
15
18
  super(hash);
16
19
  }
17
20
 
18
- override [inspect.custom]() {
21
+ [inspect.custom]() {
19
22
  return `BlockHash<${this.toString()}>`;
20
23
  }
21
24
 
@@ -23,23 +26,27 @@ export class BlockHash extends Fr {
23
26
  return new Fr(this.toBigInt());
24
27
  }
25
28
 
26
- /**
27
- * Type guard that checks if a value is a BlockHash instance.
28
- * Uses Symbol.for to ensure cross-module compatibility.
29
- */
29
+ /** Type guard that checks if a value is a BlockHash instance. */
30
30
  static isBlockHash(value: unknown): value is BlockHash {
31
- return typeof value === 'object' && value !== null && BLOCK_HASH_BRAND in value;
31
+ return value instanceof BlockHash;
32
32
  }
33
33
 
34
- static override random() {
34
+ static random() {
35
35
  return new BlockHash(Fr.random());
36
36
  }
37
37
 
38
- static override fromString(str: string): BlockHash {
38
+ static fromBuffer(buffer: Buffer | BufferReader): BlockHash {
39
+ return new BlockHash(Fr.fromBuffer(buffer));
40
+ }
41
+
42
+ static fromString(str: string): BlockHash {
39
43
  return new BlockHash(Fr.fromString(str));
40
44
  }
41
45
 
42
- static override get schema() {
46
+ static get schema() {
43
47
  return hexSchemaFor(BlockHash) as ZodFor<BlockHash>;
44
48
  }
45
49
  }
50
+
51
+ /** The block header hash for the genesis block (block 0). */
52
+ export const GENESIS_BLOCK_HEADER_HASH: BlockHash = new BlockHash(GENESIS_BLOCK_HEADER_HASH_FR);
@@ -1,10 +1,43 @@
1
1
  import { BlockNumberSchema } from '@aztec/foundation/branded-types';
2
+ import { jsonStringify } from '@aztec/foundation/json-rpc';
3
+ import { schemas } from '@aztec/foundation/schemas';
2
4
 
3
5
  import { z } from 'zod';
4
6
 
7
+ import { ChainTipSchema } from '../interfaces/chain_tips.js';
5
8
  import { BlockHash } from './block_hash.js';
6
9
 
7
- export const BlockParameterSchema = z.union([BlockHash.schema, BlockNumberSchema, z.literal('latest')]);
10
+ /**
11
+ * Selector for a block in RPC calls.
12
+ *
13
+ * Accepts a block number, a {@link BlockHash}, a chain-tip name (e.g. `'proven'`, `'checkpointed'`),
14
+ * `'latest'` (alias for `'proposed'`), or the explicit object variants `{ number }`, `{ hash }`,
15
+ * and `{ archive }`.
16
+ */
17
+ export const BlockParameterSchema = z.union([
18
+ BlockHash.schema,
19
+ BlockNumberSchema,
20
+ ChainTipSchema,
21
+ z.literal('latest'),
22
+ z.object({ number: BlockNumberSchema }),
23
+ z.object({ hash: BlockHash.schema }),
24
+ z.object({ archive: schemas.Fr }),
25
+ ]);
8
26
 
9
- /** Block parameter - either a specific BlockNumber, block hash (BlockHash), or 'latest' */
10
27
  export type BlockParameter = z.infer<typeof BlockParameterSchema>;
28
+
29
+ export function inspectBlockParameter(param: BlockParameter) {
30
+ if (typeof param === 'number') {
31
+ return param.toString();
32
+ } else if (typeof param === 'string') {
33
+ return param;
34
+ } else if ('number' in param) {
35
+ return `number=${param.number.toString()}`;
36
+ } else if ('hash' in param) {
37
+ return `hash=${param.hash.toString()}`;
38
+ } else if ('archive' in param) {
39
+ return `archive=${param.archive.toString()}`;
40
+ } else {
41
+ return jsonStringify(param);
42
+ }
43
+ }
@@ -5,8 +5,10 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
5
5
 
6
6
  import { z } from 'zod';
7
7
 
8
+ import { BlockHash } from './block_hash.js';
9
+
8
10
  export type L2BlockInfo = {
9
- blockHash?: Fr;
11
+ blockHash?: BlockHash;
10
12
  archive: Fr;
11
13
  lastArchive: Fr;
12
14
  blockNumber: BlockNumber;
@@ -17,7 +19,7 @@ export type L2BlockInfo = {
17
19
 
18
20
  export function randomBlockInfo(blockNumber?: BlockNumber | number): L2BlockInfo {
19
21
  return {
20
- blockHash: Fr.random(),
22
+ blockHash: BlockHash.random(),
21
23
  archive: Fr.random(),
22
24
  lastArchive: Fr.random(),
23
25
  blockNumber: BlockNumber(blockNumber ?? Math.floor(Math.random() * 100000) + 1),
@@ -28,7 +30,7 @@ export function randomBlockInfo(blockNumber?: BlockNumber | number): L2BlockInfo
28
30
  }
29
31
 
30
32
  export const BlockInfoSchema = z.object({
31
- blockHash: schemas.Fr.optional(),
33
+ blockHash: BlockHash.schema.optional(),
32
34
  archive: schemas.Fr,
33
35
  lastArchive: schemas.Fr,
34
36
  blockNumber: BlockNumberSchema,
@@ -39,7 +41,7 @@ export const BlockInfoSchema = z.object({
39
41
 
40
42
  export function serializeBlockInfo(blockInfo: L2BlockInfo): Buffer {
41
43
  return serializeToBuffer(
42
- blockInfo.blockHash ?? Fr.ZERO,
44
+ blockInfo.blockHash ?? BlockHash.ZERO,
43
45
  blockInfo.archive,
44
46
  blockInfo.lastArchive,
45
47
  blockInfo.blockNumber,
@@ -51,9 +53,9 @@ export function serializeBlockInfo(blockInfo: L2BlockInfo): Buffer {
51
53
 
52
54
  export function deserializeBlockInfo(buffer: Buffer | BufferReader): L2BlockInfo {
53
55
  const reader = BufferReader.asReader(buffer);
54
- const blockHash = reader.readObject(Fr);
56
+ const blockHash = BlockHash.fromBuffer(reader);
55
57
  return {
56
- blockHash: blockHash.equals(Fr.ZERO) ? undefined : blockHash,
58
+ blockHash: blockHash.equals(BlockHash.ZERO) ? undefined : blockHash,
57
59
  archive: reader.readObject(Fr),
58
60
  lastArchive: reader.readObject(Fr),
59
61
  blockNumber: BlockNumber(reader.readNumber()),
@@ -14,7 +14,7 @@ import { z } from 'zod';
14
14
 
15
15
  import type { Checkpoint } from '../checkpoint/checkpoint.js';
16
16
  import type { CheckpointData, CommonCheckpointData, ProposedCheckpointData } from '../checkpoint/checkpoint_data.js';
17
- import type { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
17
+ import type { L1PublishedData, PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
18
18
  import type { L1RollupConstants } from '../epoch-helpers/index.js';
19
19
  import { CheckpointHeader } from '../rollup/checkpoint_header.js';
20
20
  import type { BlockHeader } from '../tx/block_header.js';
@@ -25,8 +25,17 @@ import type { BlockData } from './block_data.js';
25
25
  import type { BlockHash } from './block_hash.js';
26
26
  import type { CheckpointedL2Block } from './checkpointed_l2_block.js';
27
27
  import type { L2Block } from './l2_block.js';
28
+ import type { CommitteeAttestation } from './proposal/committee_attestation.js';
28
29
  import type { ValidateCheckpointNegativeResult, ValidateCheckpointResult } from './validate_block_result.js';
29
30
 
31
+ /** Block metadata plus checkpoint-derived context (L1 publish info, attestations). */
32
+ export type BlockDataWithCheckpointContext = {
33
+ data: BlockData;
34
+ checkpoint?: CheckpointData;
35
+ l1?: L1PublishedData;
36
+ attestations: CommitteeAttestation[];
37
+ };
38
+
30
39
  /**
31
40
  * Interface of classes allowing for the retrieval of L2 blocks.
32
41
  */
@@ -111,6 +120,37 @@ export interface L2BlockSource {
111
120
  */
112
121
  getCheckpointsDataForEpoch(epochNumber: EpochNumber): Promise<CheckpointData[]>;
113
122
 
123
+ /**
124
+ * Gets lightweight checkpoint metadata for a single checkpoint.
125
+ * Cheap passthrough for metadata-only queries (no block body reads).
126
+ * @param checkpointNumber - The checkpoint number to retrieve.
127
+ * @returns The requested checkpoint data (or undefined if not found).
128
+ */
129
+ getCheckpointData(checkpointNumber: CheckpointNumber): Promise<CheckpointData | undefined>;
130
+
131
+ /**
132
+ * Gets up to `limit` amount of checkpoint metadata entries starting from `from`.
133
+ * Cheap passthrough for metadata-only queries (no block body reads).
134
+ * @param from - The first checkpoint number to return (inclusive).
135
+ * @param limit - The maximum number of checkpoints to return.
136
+ */
137
+ getCheckpointDataRange(from: CheckpointNumber, limit: number): Promise<CheckpointData[]>;
138
+
139
+ /**
140
+ * Looks up the checkpoint number that contains the given slot.
141
+ * @param slot - The slot number to look up.
142
+ * @returns The checkpoint number (or undefined if not found).
143
+ */
144
+ getCheckpointNumberBySlot(slot: SlotNumber): Promise<CheckpointNumber | undefined>;
145
+
146
+ /**
147
+ * Gets block metadata plus checkpoint-derived context (L1 publish info, attestations)
148
+ * without deserializing tx bodies. Uses checkpoint-level values when the block is
149
+ * checkpointed; otherwise returns `l1: undefined` and empty attestations.
150
+ * @param number - The block number to retrieve.
151
+ */
152
+ getBlockDataWithCheckpointContext(number: BlockNumber): Promise<BlockDataWithCheckpointContext | undefined>;
153
+
114
154
  /**
115
155
  * Gets a block header by its hash.
116
156
  * @param blockHash - The block hash to retrieve.
@@ -230,10 +270,10 @@ export interface L2BlockSource {
230
270
  getPendingChainValidationStatus(): Promise<ValidateCheckpointResult>;
231
271
 
232
272
  /** Returns the checkpoint at the proposed chain tip. */
233
- getProposedCheckpoint(): Promise<CommonCheckpointData | undefined>;
273
+ getLastCheckpoint(): Promise<CommonCheckpointData | undefined>;
234
274
 
235
275
  /** Returns proposed checkpoint, if set, undefined if not*/
236
- getProposedCheckpointOnly(): Promise<ProposedCheckpointData | undefined>;
276
+ getLastProposedCheckpoint(): Promise<ProposedCheckpointData | undefined>;
237
277
 
238
278
  /** Force a sync. */
239
279
  syncImmediate(): Promise<void>;
@@ -2,10 +2,14 @@ import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.
2
2
  import type { L2Block } from '../l2_block.js';
3
3
  import type { CheckpointId, L2BlockId, L2Tips } from '../l2_block_source.js';
4
4
 
5
+ /** Provides the current chain tips. Implemented by world-state, l2-tips-store, and AztecNode. */
6
+ export interface L2TipsProvider {
7
+ getL2Tips(): Promise<L2Tips>;
8
+ }
9
+
5
10
  /** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
6
- export interface L2BlockStreamLocalDataProvider {
11
+ export interface L2BlockStreamLocalDataProvider extends L2TipsProvider {
7
12
  getL2BlockHash(number: number): Promise<string | undefined>;
8
- getL2Tips(): Promise<L2Tips>;
9
13
  }
10
14
 
11
15
  /** Interface to a handler of events emitted. */
@@ -1,7 +1,7 @@
1
- import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
2
1
  import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
2
 
4
3
  import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
4
+ import { GENESIS_BLOCK_HEADER_HASH } from '../block_hash.js';
5
5
  import type { L2Block } from '../l2_block.js';
6
6
  import {
7
7
  type CheckpointId,
@@ -4,26 +4,37 @@ import { hexToBuffer } from '@aztec/foundation/string';
4
4
  import { encodeAbiParameters, parseAbiParameters } from 'viem';
5
5
  import { z } from 'zod';
6
6
 
7
- import type { Signable, SignatureDomainSeparator } from '../../p2p/signature_utils.js';
7
+ import {
8
+ type CoordinationSignatureContext,
9
+ type CoordinationSignatureType,
10
+ type Signable,
11
+ coordinationSignatureContextSchema,
12
+ } from '../../p2p/signature_utils.js';
8
13
  import { CommitteeAttestation, EthAddress } from './committee_attestation.js';
9
14
 
10
15
  export class CommitteeAttestationsAndSigners implements Signable {
11
- constructor(public attestations: CommitteeAttestation[]) {}
16
+ readonly primaryType: CoordinationSignatureType = 'AttestationsAndSigners';
17
+
18
+ constructor(
19
+ public attestations: CommitteeAttestation[],
20
+ public readonly signatureContext: CoordinationSignatureContext,
21
+ ) {}
12
22
 
13
23
  static get schema() {
14
24
  return z
15
25
  .object({
16
26
  attestations: CommitteeAttestation.schema.array(),
27
+ signatureContext: coordinationSignatureContextSchema,
17
28
  })
18
- .transform(obj => new CommitteeAttestationsAndSigners(obj.attestations));
29
+ .transform(obj => new CommitteeAttestationsAndSigners(obj.attestations, obj.signatureContext));
19
30
  }
20
31
 
21
- getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer {
22
- const abi = parseAbiParameters('uint8,(bytes,bytes),address[]');
32
+ getPayloadToSign(): Buffer {
33
+ // Matches the L1 abi.encode(attestations, signers) in AttestationLib.sol#getAttestationsAndSignersDigest.
34
+ const abi = parseAbiParameters('(bytes,bytes),address[]');
23
35
  const packed = this.getPackedAttestations();
24
36
 
25
37
  const encodedData = encodeAbiParameters(abi, [
26
- domainSeparator,
27
38
  [packed.signatureIndices, packed.signaturesOrAddresses],
28
39
  this.getSigners().map(s => s.toString()),
29
40
  ]);
@@ -31,8 +42,8 @@ export class CommitteeAttestationsAndSigners implements Signable {
31
42
  return hexToBuffer(encodedData);
32
43
  }
33
44
 
34
- static empty(): CommitteeAttestationsAndSigners {
35
- return new CommitteeAttestationsAndSigners([]);
45
+ static empty(signatureContext: CoordinationSignatureContext): CommitteeAttestationsAndSigners {
46
+ return new CommitteeAttestationsAndSigners([], signatureContext);
36
47
  }
37
48
 
38
49
  toString() {
@@ -53,9 +64,9 @@ export class CommitteeAttestationsAndSigners implements Signable {
53
64
  * @param attestations - Array of committee attestations with addresses and signatures
54
65
  * @returns Packed attestations with bitmap and tightly packed signature/address data
55
66
  */
56
- getPackedAttestations(): ViemCommitteeAttestations {
57
- const length = this.attestations.length;
58
- const attestations = this.attestations.map(a => a.toViem());
67
+ static packAttestations(attestations: CommitteeAttestation[]): ViemCommitteeAttestations {
68
+ const length = attestations.length;
69
+ const viemAttestations = attestations.map(a => a.toViem());
59
70
 
60
71
  // Calculate bitmap size (1 bit per attestation, rounded up to nearest byte)
61
72
  const bitmapSize = Math.ceil(length / 8);
@@ -63,8 +74,8 @@ export class CommitteeAttestationsAndSigners implements Signable {
63
74
 
64
75
  // Calculate total data size needed
65
76
  let totalDataSize = 0;
66
- for (let i = 0; i < length; i++) {
67
- const signature = attestations[i].signature;
77
+ for (const attestation of viemAttestations) {
78
+ const signature = attestation.signature;
68
79
  // Check if signature is empty (v = 0)
69
80
  const isEmpty = signature.v === 0;
70
81
 
@@ -79,8 +90,7 @@ export class CommitteeAttestationsAndSigners implements Signable {
79
90
  let dataIndex = 0;
80
91
 
81
92
  // Pack the data
82
- for (let i = 0; i < length; i++) {
83
- const attestation = attestations[i];
93
+ for (const [i, attestation] of viemAttestations.entries()) {
84
94
  const signature = attestation.signature;
85
95
 
86
96
  // Check if signature is empty
@@ -90,7 +100,7 @@ export class CommitteeAttestationsAndSigners implements Signable {
90
100
  // Set bit in bitmap (bit 7-0 in each byte, left to right)
91
101
  const byteIndex = Math.floor(i / 8);
92
102
  const bitIndex = 7 - (i % 8);
93
- signatureIndices[byteIndex] |= 1 << bitIndex;
103
+ signatureIndices[byteIndex] = (signatureIndices[byteIndex] ?? 0) | (1 << bitIndex);
94
104
 
95
105
  // Pack signature: v + r + s
96
106
  signaturesOrAddresses[dataIndex] = signature.v;
@@ -118,6 +128,10 @@ export class CommitteeAttestationsAndSigners implements Signable {
118
128
  signaturesOrAddresses: `0x${Buffer.from(signaturesOrAddresses).toString('hex')}`,
119
129
  };
120
130
  }
131
+
132
+ getPackedAttestations(): ViemCommitteeAttestations {
133
+ return CommitteeAttestationsAndSigners.packAttestations(this.attestations);
134
+ }
121
135
  }
122
136
 
123
137
  /**
@@ -130,8 +144,9 @@ export class MaliciousCommitteeAttestationsAndSigners extends CommitteeAttestati
130
144
  constructor(
131
145
  attestations: CommitteeAttestation[],
132
146
  private signers: EthAddress[],
147
+ signatureContext: CoordinationSignatureContext,
133
148
  ) {
134
- super(attestations);
149
+ super(attestations, signatureContext);
135
150
  }
136
151
 
137
152
  override getSigners(): EthAddress[] {
@@ -1,4 +1,3 @@
1
- import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
2
1
  import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
3
2
  import { times } from '@aztec/foundation/collection';
4
3
  import { Fr } from '@aztec/foundation/curves/bn254';
@@ -13,6 +12,7 @@ import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/
13
12
 
14
13
  import { jestExpect as expect } from '@jest/expect';
15
14
 
15
+ import { GENESIS_BLOCK_HEADER_HASH } from '../block_hash.js';
16
16
  import type { L2TipsStore } from '../l2_block_stream/index.js';
17
17
 
18
18
  export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
@@ -32,6 +32,8 @@ export type L1EnrichedCheckpointData = {
32
32
  export type StorageEnrichedCheckpointData = {
33
33
  archive: AppendOnlyTreeSnapshot;
34
34
  checkpointOutHash: Fr;
35
+ /** Fee asset price modifier in basis points. Defaults to 0 (no change) when not explicitly set. */
36
+ feeAssetPriceModifier: bigint;
35
37
  };
36
38
 
37
39
  /** Data stored only with proposed checkpoint data */
@@ -70,6 +72,7 @@ export const CheckpointDataSchema = z
70
72
  checkpointOutHash: schemas.Fr,
71
73
  startBlock: BlockNumberSchema,
72
74
  blockCount: schemas.Integer,
75
+ feeAssetPriceModifier: schemas.BigInt,
73
76
  attestations: z.array(CommitteeAttestation.schema),
74
77
  l1: L1PublishedData.schema,
75
78
  })
@@ -81,6 +84,7 @@ export const CheckpointDataSchema = z
81
84
  checkpointOutHash: obj.checkpointOutHash,
82
85
  startBlock: obj.startBlock,
83
86
  blockCount: obj.blockCount,
87
+ feeAssetPriceModifier: obj.feeAssetPriceModifier,
84
88
  attestations: obj.attestations,
85
89
  l1: obj.l1,
86
90
  }),
@@ -1,5 +1,5 @@
1
1
  import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
2
- import type { ConfigMappingsType } from '@aztec/foundation/config';
2
+ import { type ConfigMappingsType, numberConfigHelper } from '@aztec/foundation/config';
3
3
  import { EthAddress } from '@aztec/foundation/eth-address';
4
4
 
5
5
  export { type SequencerConfig, SequencerConfigSchema } from '../interfaces/configs.js';
@@ -14,14 +14,19 @@ export const emptyChainConfig: ChainConfig = {
14
14
  export const chainConfigMappings: ConfigMappingsType<ChainConfig> = {
15
15
  l1ChainId: {
16
16
  env: 'L1_CHAIN_ID',
17
- parseEnv: (val: string) => +val,
18
- defaultValue: 31337,
17
+ ...numberConfigHelper(31337),
19
18
  description: 'The chain ID of the ethereum host.',
20
19
  },
21
20
  rollupVersion: {
22
21
  env: 'ROLLUP_VERSION',
23
22
  description: 'The version of the rollup.',
24
- parseEnv: (val: string) => (Number.isSafeInteger(parseInt(val, 10)) ? parseInt(val, 10) : undefined),
23
+ parseEnv: (val: string) => {
24
+ const parsed = parseInt(val, 10);
25
+ if (!Number.isSafeInteger(parsed)) {
26
+ throw new Error(`Invalid rollup version: ${val}`);
27
+ }
28
+ return parsed;
29
+ },
25
30
  },
26
31
  l1Contracts: {
27
32
  description: 'The deployed L1 contract addresses',
@@ -1,10 +1,19 @@
1
- import type { ConfigMappingsType } from '@aztec/foundation/config';
1
+ import {
2
+ type ConfigMappingsType,
3
+ floatConfigHelper,
4
+ numberConfigHelper,
5
+ optionalNumberConfigHelper,
6
+ } from '@aztec/foundation/config';
2
7
 
3
8
  import type { SequencerConfig } from '../interfaces/configs.js';
9
+ import { DEFAULT_P2P_PROPAGATION_TIME } from '../timetable/index.js';
4
10
 
5
11
  /** Default maximum number of transactions per block. */
6
12
  export const DEFAULT_MAX_TXS_PER_BLOCK = 32;
7
13
 
14
+ /** Default maximum number of blocks the sequencer packs into a single checkpoint. */
15
+ export const DEFAULT_MAX_BLOCKS_PER_CHECKPOINT = 24;
16
+
8
17
  /**
9
18
  * Partial sequencer config mappings for fields that need to be shared across packages.
10
19
  * The full sequencer config mappings remain in sequencer-client, but shared fields
@@ -12,26 +21,45 @@ export const DEFAULT_MAX_TXS_PER_BLOCK = 32;
12
21
  * to avoid duplication.
13
22
  */
14
23
  export const sharedSequencerConfigMappings: ConfigMappingsType<
15
- Pick<SequencerConfig, 'blockDurationMs' | 'expectedBlockProposalsPerSlot' | 'maxTxsPerBlock'>
24
+ Pick<
25
+ SequencerConfig,
26
+ | 'blockDurationMs'
27
+ | 'expectedBlockProposalsPerSlot'
28
+ | 'maxTxsPerBlock'
29
+ | 'attestationPropagationTime'
30
+ | 'maxBlocksPerCheckpoint'
31
+ >
16
32
  > = {
17
33
  blockDurationMs: {
18
34
  env: 'SEQ_BLOCK_DURATION_MS',
19
35
  description:
20
36
  'Duration per block in milliseconds when building multiple blocks per slot. ' +
21
37
  'If undefined (default), builds a single block per slot using the full slot duration.',
22
- parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
38
+ ...optionalNumberConfigHelper(),
23
39
  },
24
40
  expectedBlockProposalsPerSlot: {
25
41
  env: 'SEQ_EXPECTED_BLOCK_PROPOSALS_PER_SLOT',
26
42
  description:
27
43
  'Expected number of block proposals per slot for P2P peer scoring. ' +
28
44
  '0 (default) disables block proposal scoring. Set to a positive value to enable.',
29
- parseEnv: (val: string) => (val ? parseInt(val, 10) : 0),
30
- defaultValue: 0,
45
+ ...numberConfigHelper(0),
31
46
  },
32
47
  maxTxsPerBlock: {
33
48
  env: 'SEQ_MAX_TX_PER_BLOCK',
34
49
  description: 'The maximum number of txs to include in a block.',
35
- parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
50
+ ...optionalNumberConfigHelper(),
51
+ },
52
+ attestationPropagationTime: {
53
+ env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
54
+ description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way).',
55
+ defaultValue: DEFAULT_P2P_PROPAGATION_TIME,
56
+ ...floatConfigHelper(DEFAULT_P2P_PROPAGATION_TIME),
57
+ },
58
+ maxBlocksPerCheckpoint: {
59
+ env: 'MAX_BLOCKS_PER_CHECKPOINT',
60
+ description:
61
+ 'Maximum number of blocks the sequencer packs into a single checkpoint, and the maximum indexWithinCheckpoint accepted on inbound block proposals.',
62
+ parseEnv: (val: string) => parseInt(val, 10),
63
+ defaultValue: DEFAULT_MAX_BLOCKS_PER_CHECKPOINT,
36
64
  },
37
65
  };
@@ -13,7 +13,7 @@ import type { ContractInstance } from './interfaces/contract_instance.js';
13
13
  /**
14
14
  * Returns the deployment address for a given contract instance.
15
15
  * ```
16
- * salted_initialization_hash = poseidon2(DOM_SEP__PARTIAL_ADDRESS, [salt, initialization_hash, deployer])
16
+ * salted_initialization_hash = poseidon2(DOM_SEP__SALTED_INITIALIZATION_HASH, [salt, initialization_hash, deployer])
17
17
  * partial_address = poseidon2(DOM_SEP__PARTIAL_ADDRESS, [contract_class_id, salted_initialization_hash])
18
18
  * address = ((poseidon2(DOM_SEP__CONTRACT_ADDRESS_V1, [public_keys_hash, partial_address]) * G) + ivpk_m).x <- the x-coordinate of the address point
19
19
  * ```
@@ -57,7 +57,7 @@ export function computeSaltedInitializationHash(
57
57
  ): Promise<Fr> {
58
58
  return poseidon2HashWithSeparator(
59
59
  [instance.salt, instance.initializationHash, instance.deployer],
60
- DomainSeparator.PARTIAL_ADDRESS,
60
+ DomainSeparator.SALTED_INITIALIZATION_HASH,
61
61
  );
62
62
  }
63
63
 
@@ -3,6 +3,7 @@ import { poseidon2Hash, poseidon2HashWithSeparator } from '@aztec/foundation/cry
3
3
  import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import { type MerkleTree, MerkleTreeCalculator } from '@aztec/foundation/trees';
5
5
 
6
+ import { computeMerkleHash } from '../hash/hash.js';
6
7
  import type { PrivateFunction } from './interfaces/contract_class.js';
7
8
 
8
9
  // Memoize the merkle tree calculators to avoid re-computing the zero-hash for each level in each call
@@ -42,7 +43,8 @@ async function getPrivateFunctionTreeCalculator(): Promise<MerkleTreeCalculator>
42
43
  privateFunctionTreeCalculator = await MerkleTreeCalculator.create(
43
44
  FUNCTION_TREE_HEIGHT,
44
45
  functionTreeZeroLeaf,
45
- async (left, right) => (await poseidon2Hash([left, right])).toBuffer() as Buffer<ArrayBuffer>,
46
+ async (left, right) =>
47
+ (await computeMerkleHash(Fr.fromBuffer(left), Fr.fromBuffer(right))).toBuffer() as Buffer<ArrayBuffer>,
46
48
  );
47
49
  }
48
50
  return privateFunctionTreeCalculator;