@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
@@ -1,37 +1,122 @@
1
1
  import { Buffer32 } from '@aztec/foundation/buffer';
2
2
  import { keccak256 } from '@aztec/foundation/crypto/keccak';
3
- import { makeEthSignDigest } from '@aztec/foundation/crypto/secp256k1-signer';
3
+ import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
4
+ import { EthAddress } from '@aztec/foundation/eth-address';
5
+ import type { Signature } from '@aztec/foundation/eth-signature';
6
+ import { type BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
4
7
 
5
- export enum SignatureDomainSeparator {
6
- blockProposal = 0,
7
- checkpointAttestation = 1,
8
- attestationsAndSigners = 2,
9
- checkpointProposal = 3,
10
- signedTxs = 4,
11
- }
8
+ import { type TypedDataDefinition, hashTypedData } from 'viem';
9
+ import { z } from 'zod';
10
+
11
+ import type { ZodFor } from '../schemas/index.js';
12
+
13
+ export type CoordinationSignatureType =
14
+ | 'BlockProposal'
15
+ | 'CheckpointProposal'
16
+ | 'CheckpointAttestation'
17
+ | 'AttestationsAndSigners'
18
+ | 'SignedTxs';
19
+
20
+ export type CoordinationSignatureContext = {
21
+ chainId: number;
22
+ rollupAddress: EthAddress;
23
+ };
24
+
25
+ export const EMPTY_COORDINATION_SIGNATURE_CONTEXT: CoordinationSignatureContext = {
26
+ chainId: 0,
27
+ rollupAddress: EthAddress.ZERO,
28
+ };
29
+
30
+ export const coordinationSignatureContextSchema: ZodFor<CoordinationSignatureContext> = z.object({
31
+ chainId: z.number(),
32
+ rollupAddress: EthAddress.schema,
33
+ });
12
34
 
13
35
  export interface Signable {
14
- getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer;
36
+ readonly primaryType: CoordinationSignatureType;
37
+ readonly signatureContext: CoordinationSignatureContext;
38
+ getPayloadToSign(): Buffer;
15
39
  }
16
40
 
17
- /**
18
- * Get the hashed payload for the signature of the `Signable`
19
- * @param s - The `Signable` to sign
20
- * @returns The hashed payload for the signature of the `Signable`
21
- */
22
- export function getHashedSignaturePayload(s: Signable, domainSeparator: SignatureDomainSeparator): Buffer32 {
23
- return Buffer32.fromBuffer(keccak256(s.getPayloadToSign(domainSeparator)));
41
+ export function coordinationSignatureContextEquals(
42
+ a: CoordinationSignatureContext,
43
+ b: CoordinationSignatureContext,
44
+ ): boolean {
45
+ return a.chainId === b.chainId && a.rollupAddress.equals(b.rollupAddress);
46
+ }
47
+
48
+ export function serializeCoordinationSignatureContext(ctx: CoordinationSignatureContext): Buffer {
49
+ return serializeToBuffer([ctx.chainId, ctx.rollupAddress]);
50
+ }
51
+
52
+ export function readCoordinationSignatureContext(reader: BufferReader): CoordinationSignatureContext {
53
+ const chainId = reader.readNumber();
54
+ const rollupAddress = reader.readObject(EthAddress);
55
+ return { chainId, rollupAddress };
24
56
  }
25
57
 
26
58
  /**
27
- * Get the hashed payload for the signature of the `Signable` as an Ethereum signed message EIP-712
28
- * @param s - the `Signable` to sign
29
- * @returns The hashed payload for the signature of the `Signable` as an Ethereum signed message
59
+ * Returns true if the signable carries a context matching the node's expected context.
60
+ * Use this at the P2P ingress boundary to reject foreign-chain messages cheaply before
61
+ * performing any signature recovery.
30
62
  */
31
- export function getHashedSignaturePayloadEthSignedMessage(
32
- s: Signable,
33
- domainSeparator: SignatureDomainSeparator,
34
- ): Buffer32 {
35
- const payload = getHashedSignaturePayload(s, domainSeparator);
36
- return makeEthSignDigest(payload);
63
+ export function hasValidSignatureContext(signable: Signable, expected: CoordinationSignatureContext): boolean {
64
+ return coordinationSignatureContextEquals(signable.signatureContext, expected);
65
+ }
66
+
67
+ const COORDINATION_SIGNATURE_NAME = 'Aztec Rollup';
68
+ const COORDINATION_SIGNATURE_VERSION = '1';
69
+
70
+ const EIP712_DOMAIN_FIELDS = [
71
+ { name: 'name', type: 'string' },
72
+ { name: 'version', type: 'string' },
73
+ { name: 'chainId', type: 'uint256' },
74
+ { name: 'verifyingContract', type: 'address' },
75
+ ] as const;
76
+
77
+ const COORDINATION_SIGNATURE_TYPES = {
78
+ EIP712Domain: EIP712_DOMAIN_FIELDS,
79
+ BlockProposal: [{ name: 'payloadHash', type: 'bytes32' }],
80
+ CheckpointProposal: [{ name: 'payloadHash', type: 'bytes32' }],
81
+ CheckpointAttestation: [{ name: 'payloadHash', type: 'bytes32' }],
82
+ AttestationsAndSigners: [{ name: 'payloadHash', type: 'bytes32' }],
83
+ SignedTxs: [{ name: 'payloadHash', type: 'bytes32' }],
84
+ } as const;
85
+
86
+ export function getCoordinationSignatureTypedDataForPayloadHash(
87
+ payloadHash: Buffer32,
88
+ type: CoordinationSignatureType,
89
+ context: CoordinationSignatureContext,
90
+ ): TypedDataDefinition {
91
+ return {
92
+ domain: {
93
+ name: COORDINATION_SIGNATURE_NAME,
94
+ version: COORDINATION_SIGNATURE_VERSION,
95
+ chainId: context.chainId,
96
+ verifyingContract: context.rollupAddress.toString() as `0x${string}`,
97
+ },
98
+ types: COORDINATION_SIGNATURE_TYPES,
99
+ primaryType: type,
100
+ message: {
101
+ payloadHash: payloadHash.toString() as `0x${string}`,
102
+ },
103
+ };
104
+ }
105
+
106
+ export function getCoordinationSignatureTypedData(signable: Signable): TypedDataDefinition {
107
+ const payloadHash = getHashedSignaturePayload(signable);
108
+ return getCoordinationSignatureTypedDataForPayloadHash(payloadHash, signable.primaryType, signable.signatureContext);
109
+ }
110
+
111
+ export function getHashedSignaturePayloadTypedData(signable: Signable): Buffer32 {
112
+ return Buffer32.fromString(hashTypedData(getCoordinationSignatureTypedData(signable)));
113
+ }
114
+
115
+ export function recoverCoordinationSigner(signable: Signable, signature: Signature): EthAddress | undefined {
116
+ const digest = getHashedSignaturePayloadTypedData(signable);
117
+ return tryRecoverAddress(digest, signature, { allowYParityAsV: true });
118
+ }
119
+
120
+ export function getHashedSignaturePayload(s: Signable): Buffer32 {
121
+ return Buffer32.fromBuffer(keccak256(s.getPayloadToSign()));
37
122
  }
@@ -1,15 +1,20 @@
1
- import { Buffer32 } from '@aztec/foundation/buffer';
2
- import { tryRecoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
3
1
  import type { EthAddress } from '@aztec/foundation/eth-address';
4
2
  import { Signature } from '@aztec/foundation/eth-signature';
5
3
  import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
6
4
 
5
+ import type { TypedDataDefinition } from 'viem';
6
+
7
7
  import { MAX_TXS_PER_BLOCK } from '../deserialization/index.js';
8
8
  import { Tx } from '../tx/tx.js';
9
9
  import {
10
- SignatureDomainSeparator,
11
- getHashedSignaturePayload,
12
- getHashedSignaturePayloadEthSignedMessage,
10
+ type CoordinationSignatureContext,
11
+ type CoordinationSignatureType,
12
+ EMPTY_COORDINATION_SIGNATURE_CONTEXT,
13
+ type Signable,
14
+ getCoordinationSignatureTypedData,
15
+ readCoordinationSignatureContext,
16
+ recoverCoordinationSigner,
17
+ serializeCoordinationSignatureContext,
13
18
  } from './signature_utils.js';
14
19
 
15
20
  /**
@@ -17,50 +22,56 @@ import {
17
22
  * The signature is over the transaction objects themselves, providing
18
23
  * data availability guarantees beyond just the transaction hashes.
19
24
  */
20
- export class SignedTxs {
21
- private sender: EthAddress | undefined;
25
+ export class SignedTxs implements Signable {
26
+ readonly primaryType: CoordinationSignatureType = 'SignedTxs';
27
+
28
+ private cachedSender: EthAddress | undefined | null = undefined;
22
29
 
23
30
  constructor(
24
31
  /** The transactions */
25
32
  public readonly txs: Tx[],
26
33
  /** The proposer's signature over the transactions */
27
34
  public readonly signature: Signature,
35
+ /** The signing domain (chainId + rollupAddress) the signature is bound to */
36
+ public readonly signatureContext: CoordinationSignatureContext,
28
37
  ) {}
29
38
 
30
- /**
31
- * Get the payload to sign for this signed txs.
32
- */
33
- getPayloadToSign(domainSeparator: SignatureDomainSeparator): Buffer {
34
- return serializeToBuffer([domainSeparator, this.txs.length, this.txs]);
39
+ getPayloadToSign(): Buffer {
40
+ return serializeToBuffer([this.txs.length, this.txs]);
35
41
  }
36
42
 
37
43
  /**
38
- * Lazily evaluate the sender of the signed txs; result is cached
44
+ * Lazily evaluate the sender of the signed txs; result is cached.
39
45
  * @returns The sender address, or undefined if signature recovery fails
40
46
  */
41
47
  getSender(): EthAddress | undefined {
42
- if (!this.sender) {
43
- const hashed = getHashedSignaturePayloadEthSignedMessage(this, SignatureDomainSeparator.signedTxs);
44
- this.sender = tryRecoverAddress(hashed, this.signature);
48
+ if (this.cachedSender === undefined) {
49
+ this.cachedSender = recoverCoordinationSigner(this, this.signature) ?? null;
45
50
  }
46
- return this.sender;
51
+ return this.cachedSender ?? undefined;
47
52
  }
48
53
 
49
54
  /**
50
- * Create SignedTxs from a signer function
55
+ * Create SignedTxs from a typed-data signer function
51
56
  */
52
57
  static async createFromSigner(
53
58
  txs: Tx[],
54
- payloadSigner: (payload: Buffer32) => Promise<Signature>,
59
+ signatureContext: CoordinationSignatureContext,
60
+ typedDataSigner: (typedData: TypedDataDefinition) => Promise<Signature>,
55
61
  ): Promise<SignedTxs> {
56
- const tempSignedTxs = new SignedTxs(txs, Signature.empty());
57
- const hashed = getHashedSignaturePayload(tempSignedTxs, SignatureDomainSeparator.signedTxs);
58
- const signature = await payloadSigner(hashed);
59
- return new SignedTxs(txs, signature);
62
+ const tempSignedTxs = new SignedTxs(txs, Signature.empty(), signatureContext);
63
+ const typedData = getCoordinationSignatureTypedData(tempSignedTxs);
64
+ const signature = await typedDataSigner(typedData);
65
+ return new SignedTxs(txs, signature, signatureContext);
60
66
  }
61
67
 
62
68
  toBuffer(): Buffer {
63
- return serializeToBuffer([this.txs.length, this.txs, this.signature]);
69
+ return serializeToBuffer([
70
+ this.txs.length,
71
+ this.txs,
72
+ this.signature,
73
+ serializeCoordinationSignatureContext(this.signatureContext),
74
+ ]);
64
75
  }
65
76
 
66
77
  static fromBuffer(buf: Buffer | BufferReader): SignedTxs {
@@ -71,18 +82,25 @@ export class SignedTxs {
71
82
  }
72
83
  const txs = reader.readArray(txCount, Tx);
73
84
  const signature = reader.readObject(Signature);
74
- return new SignedTxs(txs, signature);
85
+ const signatureContext = readCoordinationSignatureContext(reader);
86
+ return new SignedTxs(txs, signature, signatureContext);
75
87
  }
76
88
 
77
89
  getSize(): number {
78
- return 4 /* txs.length */ + this.txs.reduce((acc, tx) => acc + tx.getSize(), 0) + this.signature.getSize();
90
+ return (
91
+ 4 /* txs.length */ +
92
+ this.txs.reduce((acc, tx) => acc + tx.getSize(), 0) +
93
+ this.signature.getSize() +
94
+ 4 /* chainId */ +
95
+ 20 /* rollupAddress */
96
+ );
79
97
  }
80
98
 
81
99
  static empty(): SignedTxs {
82
- return new SignedTxs([], Signature.empty());
100
+ return new SignedTxs([], Signature.empty(), EMPTY_COORDINATION_SIGNATURE_CONTEXT);
83
101
  }
84
102
 
85
103
  static random(): SignedTxs {
86
- return new SignedTxs([Tx.random(), Tx.random()], Signature.random());
104
+ return new SignedTxs([Tx.random(), Tx.random()], Signature.random(), EMPTY_COORDINATION_SIGNATURE_CONTEXT);
87
105
  }
88
106
  }
@@ -10,9 +10,11 @@ export class ParityBasePrivateInputs {
10
10
  public readonly msgs: Tuple<Fr, typeof NUM_MSGS_PER_BASE_PARITY>,
11
11
  /** Root of the VK tree */
12
12
  public readonly vkTreeRoot: Fr,
13
+ /** Prover identity committed to by the circuit, for sybil protection. */
14
+ public readonly proverId: Fr,
13
15
  ) {}
14
16
 
15
- public static fromSlice(array: Fr[], index: number, vkTreeRoot: Fr): ParityBasePrivateInputs {
17
+ public static fromSlice(array: Fr[], index: number, vkTreeRoot: Fr, proverId: Fr): ParityBasePrivateInputs {
16
18
  // Can't use Tuple<Fr, typeof NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP> due to length
17
19
  if (array.length !== NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP) {
18
20
  throw new Error(
@@ -22,12 +24,12 @@ export class ParityBasePrivateInputs {
22
24
  const start = index * NUM_MSGS_PER_BASE_PARITY;
23
25
  const end = start + NUM_MSGS_PER_BASE_PARITY;
24
26
  const msgs = array.slice(start, end);
25
- return new ParityBasePrivateInputs(msgs as Tuple<Fr, typeof NUM_MSGS_PER_BASE_PARITY>, vkTreeRoot);
27
+ return new ParityBasePrivateInputs(msgs as Tuple<Fr, typeof NUM_MSGS_PER_BASE_PARITY>, vkTreeRoot, proverId);
26
28
  }
27
29
 
28
30
  /** Serializes the inputs to a buffer. */
29
31
  toBuffer() {
30
- return serializeToBuffer(this.msgs, this.vkTreeRoot);
32
+ return serializeToBuffer(this.msgs, this.vkTreeRoot, this.proverId);
31
33
  }
32
34
 
33
35
  /** Serializes the inputs to a hex string. */
@@ -41,7 +43,11 @@ export class ParityBasePrivateInputs {
41
43
  */
42
44
  static fromBuffer(buffer: Buffer | BufferReader) {
43
45
  const reader = BufferReader.asReader(buffer);
44
- return new ParityBasePrivateInputs(reader.readArray(NUM_MSGS_PER_BASE_PARITY, Fr), Fr.fromBuffer(reader));
46
+ return new ParityBasePrivateInputs(
47
+ reader.readArray(NUM_MSGS_PER_BASE_PARITY, Fr),
48
+ Fr.fromBuffer(reader),
49
+ Fr.fromBuffer(reader),
50
+ );
45
51
  }
46
52
 
47
53
  /**
@@ -12,6 +12,8 @@ export class ParityPublicInputs {
12
12
  public convertedRoot: Fr,
13
13
  /** Root of the VK tree */
14
14
  public vkTreeRoot: Fr,
15
+ /** Prover identity committed to by the circuit, for sybil protection. */
16
+ public proverId: Fr,
15
17
  ) {
16
18
  if (shaRoot.toBuffer()[0] != 0) {
17
19
  throw new Error(`shaRoot buffer must be 31 bytes. Got 32 bytes`);
@@ -54,7 +56,7 @@ export class ParityPublicInputs {
54
56
  * @returns The instance fields.
55
57
  */
56
58
  static getFields(fields: FieldsOf<ParityPublicInputs>) {
57
- return [fields.shaRoot, fields.convertedRoot, fields.vkTreeRoot] as const;
59
+ return [fields.shaRoot, fields.convertedRoot, fields.vkTreeRoot, fields.proverId] as const;
58
60
  }
59
61
 
60
62
  /**
@@ -64,7 +66,12 @@ export class ParityPublicInputs {
64
66
  */
65
67
  static fromBuffer(buffer: Buffer | BufferReader) {
66
68
  const reader = BufferReader.asReader(buffer);
67
- return new ParityPublicInputs(reader.readObject(Fr), reader.readObject(Fr), Fr.fromBuffer(reader));
69
+ return new ParityPublicInputs(
70
+ reader.readObject(Fr),
71
+ reader.readObject(Fr),
72
+ Fr.fromBuffer(reader),
73
+ Fr.fromBuffer(reader),
74
+ );
68
75
  }
69
76
 
70
77
  /**
@@ -1,5 +1,7 @@
1
+ import { DomainSeparator } from '@aztec/constants';
2
+ import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
1
3
  import { Fr } from '@aztec/foundation/curves/bn254';
2
- import { computeUnbalancedPoseidonRoot } from '@aztec/foundation/trees';
4
+ import { computeUnbalancedMerkleTreeRootAsync } from '@aztec/foundation/trees';
3
5
 
4
6
  import type { BlockHeader } from '../tx/block_header.js';
5
7
 
@@ -7,6 +9,13 @@ export async function computeBlockHeadersHash(blockHeaders: BlockHeader[]): Prom
7
9
  const blockHeaderHashes = await Promise.all(blockHeaders.map(header => header.hash()));
8
10
  // Must match the implementation in merge_block_rollups.nr, with the **unbalanced** rollup structure
9
11
  // (see validate_consecutive_block_rollups.nr > assert_rollups_filled_greedily.nr).
10
- const blockHeadersHash = await computeUnbalancedPoseidonRoot(blockHeaderHashes.map(hash => hash.toBuffer()));
12
+ const blockHeadersHasher = async (left: Uint8Array, right: Uint8Array) =>
13
+ (
14
+ await poseidon2HashWithSeparator([Buffer.from(left), Buffer.from(right)], DomainSeparator.BLOCK_HEADERS_HASH)
15
+ ).toBuffer() as Buffer<ArrayBuffer>;
16
+ const blockHeadersHash = await computeUnbalancedMerkleTreeRootAsync(
17
+ blockHeaderHashes.map(hash => hash.toBuffer()),
18
+ blockHeadersHasher,
19
+ );
11
20
  return Fr.fromBuffer(blockHeadersHash);
12
21
  }
@@ -1,6 +1,5 @@
1
1
  export * from './types.js';
2
2
  export * from './interfaces.js';
3
3
  export * from './helpers.js';
4
- export * from './empire.js';
5
- export * from './tally.js';
4
+ export * from './votes.js';
6
5
  export * from './serialization.js';
@@ -1,15 +1,7 @@
1
- import { times } from '@aztec/foundation/collection';
2
1
  import { EthAddress } from '@aztec/foundation/eth-address';
3
2
  import { BufferReader, bigintToUInt64BE, bigintToUInt128BE, serializeToBuffer } from '@aztec/foundation/serialize';
4
3
 
5
- import type {
6
- Offense,
7
- OffenseType,
8
- SlashPayload,
9
- SlashPayloadRound,
10
- ValidatorSlash,
11
- ValidatorSlashOffense,
12
- } from './types.js';
4
+ import type { Offense, OffenseType } from './types.js';
13
5
 
14
6
  export function serializeOffense(offense: Offense): Buffer {
15
7
  return serializeToBuffer(
@@ -29,75 +21,3 @@ export function deserializeOffense(buffer: Buffer): Offense {
29
21
 
30
22
  return { validator, amount, offenseType: offense, epochOrSlot };
31
23
  }
32
-
33
- function serializeValidatorSlashOffense(offense: ValidatorSlashOffense): Buffer {
34
- return serializeToBuffer(bigintToUInt64BE(offense.epochOrSlot), offense.offenseType);
35
- }
36
-
37
- function deserializeValidatorSlashOffense(buffer: Buffer | BufferReader): ValidatorSlashOffense {
38
- const reader = BufferReader.asReader(buffer);
39
- return {
40
- epochOrSlot: reader.readUInt64(),
41
- offenseType: reader.readNumber() as OffenseType,
42
- };
43
- }
44
-
45
- function serializeValidatorSlash(slash: ValidatorSlash): Buffer {
46
- return serializeToBuffer(
47
- slash.validator,
48
- bigintToUInt128BE(slash.amount),
49
- slash.offenses.length,
50
- slash.offenses.map(serializeValidatorSlashOffense),
51
- );
52
- }
53
-
54
- function deserializeValidatorSlash(buffer: Buffer | BufferReader): ValidatorSlash {
55
- const reader = BufferReader.asReader(buffer);
56
- const validator = reader.readObject(EthAddress);
57
- const amount = reader.readUInt128();
58
- const offensesCount = reader.readNumber();
59
- const offenses = times(offensesCount, () => deserializeValidatorSlashOffense(reader));
60
-
61
- return { validator, amount, offenses };
62
- }
63
-
64
- export function serializeSlashPayload(payload: SlashPayload): Buffer {
65
- return serializeToBuffer(
66
- payload.address,
67
- payload.slashes.length,
68
- payload.slashes.map(serializeValidatorSlash),
69
- bigintToUInt64BE(payload.timestamp),
70
- );
71
- }
72
-
73
- export function deserializeSlashPayload(buffer: Buffer): SlashPayload {
74
- const reader = BufferReader.asReader(buffer);
75
- const address = reader.readObject(EthAddress);
76
- const slashesCount = reader.readNumber();
77
- const slashes = times(slashesCount, () => deserializeValidatorSlash(reader));
78
- const timestamp = reader.readUInt64();
79
- return { address, slashes, timestamp };
80
- }
81
-
82
- export function serializeSlashPayloadRound(payload: SlashPayloadRound): Buffer {
83
- return serializeToBuffer(
84
- payload.address,
85
- payload.slashes.length,
86
- payload.slashes.map(serializeValidatorSlash),
87
- bigintToUInt64BE(payload.timestamp),
88
- Number(payload.votes),
89
- bigintToUInt64BE(payload.round),
90
- );
91
- }
92
-
93
- export function deserializeSlashPayloadRound(buffer: Buffer): SlashPayloadRound {
94
- const reader = BufferReader.asReader(buffer);
95
- const address = reader.readObject(EthAddress);
96
- const slashesCount = reader.readNumber();
97
- const slashes = times(slashesCount, () => deserializeValidatorSlash(reader));
98
- const timestamp = reader.readUInt64();
99
- const votes = BigInt(reader.readNumber());
100
- const round = reader.readUInt64();
101
-
102
- return { address, slashes, timestamp, votes, round };
103
- }
@@ -126,45 +126,13 @@ export type ValidatorSlash = {
126
126
  offenses: ValidatorSlashOffense[];
127
127
  };
128
128
 
129
- /** Slash payload as published by the empire slash proposer */
130
- export type SlashPayload = {
131
- address: EthAddress;
132
- slashes: ValidatorSlash[];
133
- timestamp: bigint;
134
- };
135
-
136
- /** Slash payload with round information from empire slash proposer */
137
- export type SlashPayloadRound = SlashPayload & { votes: bigint; round: bigint };
138
-
139
- export const SlashPayloadRoundSchema = zodFor<SlashPayloadRound>()(
140
- z.object({
141
- address: schemas.EthAddress,
142
- timestamp: schemas.BigInt,
143
- votes: schemas.BigInt,
144
- round: schemas.BigInt,
145
- slashes: z.array(
146
- z.object({
147
- validator: schemas.EthAddress,
148
- amount: schemas.BigInt,
149
- offenses: z.array(z.object({ offenseType: OffenseTypeSchema, epochOrSlot: schemas.BigInt })),
150
- }),
151
- ),
152
- }),
153
- );
154
-
155
- /** Votes for a validator slash in the consensus slash proposer */
129
+ /** Votes for a validator slash in the slashing proposer */
156
130
  export type ValidatorSlashVote = number;
157
131
 
158
132
  export type ProposerSlashAction =
159
- /** Create a new slash payload on an empire-based slash proposer */
160
- | { type: 'create-empire-payload'; data: ValidatorSlash[] }
161
- /** Vote for a slashing payload on an empire-based slash proposer */
162
- | { type: 'vote-empire-payload'; payload: EthAddress }
163
- /** Execute a slashing payload on an empire-based slash proposer */
164
- | { type: 'execute-empire-payload'; round: bigint }
165
- /** Vote for offenses on a consensus slashing proposer */
133
+ /** Vote for offenses on the slashing proposer */
166
134
  | { type: 'vote-offenses'; votes: ValidatorSlashVote[]; committees: EthAddress[][]; round: bigint }
167
- /** Execute a slashing round on a consensus slashing proposer */
135
+ /** Execute a slashing round on the slashing proposer */
168
136
  | { type: 'execute-slash'; committees: EthAddress[][]; round: bigint };
169
137
 
170
138
  export type ProposerSlashActionType = ProposerSlashAction['type'];
@@ -28,7 +28,7 @@ export function getSlashConsensusVotesFromOffenses(
28
28
  targetCommitteeSize: number;
29
29
  maxSlashedValidators?: number;
30
30
  },
31
- logger: Logger = createLogger('slasher:tally'),
31
+ logger: Logger = createLogger('slasher:votes'),
32
32
  ): ValidatorSlashVote[] {
33
33
  const { slashingAmounts, targetCommitteeSize, maxSlashedValidators } = settings;
34
34
 
@@ -9,7 +9,6 @@ import {
9
9
  AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
10
10
  CHONK_PROOF_LENGTH,
11
11
  CONTRACT_CLASS_LOG_SIZE_IN_FIELDS,
12
- DomainSeparator,
13
12
  L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
14
13
  MAX_CHECKPOINTS_PER_EPOCH,
15
14
  MAX_CONTRACT_CLASS_LOGS_PER_TX,
@@ -46,7 +45,6 @@ import { type FieldsOf, makeTuple } from '@aztec/foundation/array';
46
45
  import { BlockNumber, CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
47
46
  import { compact } from '@aztec/foundation/collection';
48
47
  import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
49
- import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
50
48
  import { SchnorrSignature } from '@aztec/foundation/crypto/schnorr';
51
49
  import { sha256 } from '@aztec/foundation/crypto/sha256';
52
50
  import { Fq, Fr } from '@aztec/foundation/curves/bn254';
@@ -95,6 +93,7 @@ import {
95
93
  type PrivateFunction,
96
94
  SerializableContractInstance,
97
95
  computeContractClassId,
96
+ computePartialAddress,
98
97
  computePublicBytecodeCommitment,
99
98
  } from '../contract/index.js';
100
99
  import { Gas, GasFees, GasSettings } from '../gas/index.js';
@@ -176,7 +175,7 @@ import { TxHash } from '../tx/tx_hash.js';
176
175
  import { TxRequest } from '../tx/tx_request.js';
177
176
  import { Vector } from '../types/index.js';
178
177
  import { VkData } from '../vks/index.js';
179
- import { VerificationKey, VerificationKeyAsFields, VerificationKeyData } from '../vks/verification_key.js';
178
+ import { VerificationKeyAsFields, VerificationKeyData } from '../vks/verification_key.js';
180
179
 
181
180
  /**
182
181
  * Creates an arbitrary side effect object with the given seed.
@@ -232,7 +231,7 @@ export function makeTxContext(seed: number = 1): TxContext {
232
231
  * Creates a default instance of gas settings. No seed value is used to ensure we allocate a sensible amount of gas for testing.
233
232
  */
234
233
  export function makeGasSettings() {
235
- return GasSettings.default({ maxFeesPerGas: new GasFees(10, 10) });
234
+ return GasSettings.fallback({ maxFeesPerGas: new GasFees(10, 10) });
236
235
  }
237
236
 
238
237
  /**
@@ -573,14 +572,6 @@ export function makeVerificationKeyAsFields(size: number): VerificationKeyAsFiel
573
572
  return VerificationKeyAsFields.makeFake(size);
574
573
  }
575
574
 
576
- /**
577
- * Creates arbitrary/mocked verification key.
578
- * @returns A verification key object
579
- */
580
- export function makeVerificationKey(): VerificationKey {
581
- return VerificationKey.makeFake();
582
- }
583
-
584
575
  /**
585
576
  * Creates an arbitrary point in a curve.
586
577
  * @param seed - Seed to generate the point values.
@@ -863,11 +854,16 @@ export function makeParityPublicInputs(seed = 0): ParityPublicInputs {
863
854
  new Fr(BigInt(seed + 0x200)),
864
855
  new Fr(BigInt(seed + 0x300)),
865
856
  new Fr(BigInt(seed + 0x400)),
857
+ new Fr(BigInt(seed + 0x500)),
866
858
  );
867
859
  }
868
860
 
869
861
  export function makeParityBasePrivateInputs(seed = 0): ParityBasePrivateInputs {
870
- return new ParityBasePrivateInputs(makeTuple(NUM_MSGS_PER_BASE_PARITY, fr, seed + 0x3000), new Fr(seed + 0x4000));
862
+ return new ParityBasePrivateInputs(
863
+ makeTuple(NUM_MSGS_PER_BASE_PARITY, fr, seed + 0x3000),
864
+ new Fr(seed + 0x4000),
865
+ new Fr(seed + 0x5000),
866
+ );
871
867
  }
872
868
 
873
869
  export function makeParityRootPrivateInputs(seed = 0) {
@@ -1253,14 +1249,12 @@ export async function makeContractInstanceFromClassId(
1253
1249
  const deployer = overrides?.deployer ?? new AztecAddress(new Fr(seed + 2));
1254
1250
  const publicKeys = overrides?.publicKeys ?? (await makePublicKeys(seed + 3));
1255
1251
 
1256
- const saltedInitializationHash = await poseidon2HashWithSeparator(
1257
- [salt, initializationHash, deployer],
1258
- DomainSeparator.PARTIAL_ADDRESS,
1259
- );
1260
- const partialAddress = await poseidon2HashWithSeparator(
1261
- [classId, saltedInitializationHash],
1262
- DomainSeparator.PARTIAL_ADDRESS,
1263
- );
1252
+ const partialAddress = await computePartialAddress({
1253
+ originalContractClassId: classId,
1254
+ salt,
1255
+ initializationHash,
1256
+ deployer,
1257
+ });
1264
1258
  const address = await computeAddress(publicKeys, partialAddress);
1265
1259
  return new SerializableContractInstance({
1266
1260
  version: 1,