@aztec/cli 0.0.0-test.1 → 0.0.1-commit.1142ef1

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 (281) hide show
  1. package/README.md +2 -428
  2. package/dest/cmds/aztec_node/block_number.d.ts +3 -0
  3. package/dest/cmds/aztec_node/block_number.d.ts.map +1 -0
  4. package/dest/cmds/aztec_node/block_number.js +10 -0
  5. package/dest/cmds/aztec_node/get_block.d.ts +3 -0
  6. package/dest/cmds/aztec_node/get_block.d.ts.map +1 -0
  7. package/dest/cmds/aztec_node/get_block.js +10 -0
  8. package/dest/cmds/aztec_node/get_current_min_fee.d.ts +3 -0
  9. package/dest/cmds/aztec_node/get_current_min_fee.d.ts.map +1 -0
  10. package/dest/cmds/aztec_node/get_current_min_fee.js +7 -0
  11. package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +5 -0
  12. package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts.map +1 -0
  13. package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.js +12 -0
  14. package/dest/cmds/aztec_node/get_logs.d.ts +7 -0
  15. package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -0
  16. package/dest/cmds/{pxe → aztec_node}/get_logs.js +4 -4
  17. package/dest/cmds/aztec_node/get_node_info.d.ts +3 -0
  18. package/dest/cmds/aztec_node/get_node_info.d.ts.map +1 -0
  19. package/dest/cmds/{pxe → aztec_node}/get_node_info.js +14 -15
  20. package/dest/cmds/aztec_node/index.d.ts +4 -0
  21. package/dest/cmds/aztec_node/index.d.ts.map +1 -0
  22. package/dest/cmds/aztec_node/index.js +28 -0
  23. package/dest/cmds/contracts/index.d.ts +1 -1
  24. package/dest/cmds/contracts/inspect_contract.d.ts +1 -1
  25. package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
  26. package/dest/cmds/contracts/inspect_contract.js +13 -15
  27. package/dest/cmds/contracts/parse_parameter_struct.d.ts +1 -1
  28. package/dest/cmds/infrastructure/index.d.ts +3 -3
  29. package/dest/cmds/infrastructure/index.d.ts.map +1 -1
  30. package/dest/cmds/infrastructure/index.js +8 -10
  31. package/dest/cmds/infrastructure/sequencers.d.ts +5 -6
  32. package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
  33. package/dest/cmds/infrastructure/sequencers.js +38 -18
  34. package/dest/cmds/infrastructure/setup_l2_contract.d.ts +2 -2
  35. package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
  36. package/dest/cmds/infrastructure/setup_l2_contract.js +11 -24
  37. package/dest/cmds/l1/advance_epoch.d.ts +2 -2
  38. package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
  39. package/dest/cmds/l1/advance_epoch.js +8 -6
  40. package/dest/cmds/l1/assume_proven_through.d.ts +2 -2
  41. package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
  42. package/dest/cmds/l1/assume_proven_through.js +10 -8
  43. package/dest/cmds/l1/bridge_erc20.d.ts +3 -3
  44. package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
  45. package/dest/cmds/l1/bridge_erc20.js +6 -5
  46. package/dest/cmds/l1/create_l1_account.d.ts +1 -1
  47. package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts +4 -0
  48. package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts.map +1 -0
  49. package/dest/cmds/l1/deploy_l1_contracts_cmd.js +81 -0
  50. package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -3
  51. package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
  52. package/dest/cmds/l1/deploy_new_rollup.js +18 -9
  53. package/dest/cmds/l1/get_l1_addresses.d.ts +2 -2
  54. package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
  55. package/dest/cmds/l1/get_l1_addresses.js +5 -2
  56. package/dest/cmds/l1/get_l1_balance.d.ts +1 -1
  57. package/dest/cmds/l1/get_l1_balance.js +4 -2
  58. package/dest/cmds/l1/governance_utils.d.ts +5 -5
  59. package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
  60. package/dest/cmds/l1/governance_utils.js +19 -17
  61. package/dest/cmds/l1/index.d.ts +1 -1
  62. package/dest/cmds/l1/index.d.ts.map +1 -1
  63. package/dest/cmds/l1/index.js +36 -44
  64. package/dest/cmds/l1/prover_stats.d.ts +1 -1
  65. package/dest/cmds/l1/prover_stats.d.ts.map +1 -1
  66. package/dest/cmds/l1/prover_stats.js +32 -30
  67. package/dest/cmds/l1/trigger_seed_snapshot.d.ts +6 -0
  68. package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -0
  69. package/dest/cmds/l1/trigger_seed_snapshot.js +20 -0
  70. package/dest/cmds/l1/update_l1_validators.d.ts +21 -6
  71. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
  72. package/dest/cmds/l1/update_l1_validators.js +163 -103
  73. package/dest/cmds/misc/compute_selector.d.ts +1 -1
  74. package/dest/cmds/misc/example_contracts.d.ts +1 -1
  75. package/dest/cmds/misc/generate_bootnode_enr.d.ts +2 -2
  76. package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -1
  77. package/dest/cmds/misc/generate_bootnode_enr.js +2 -2
  78. package/dest/cmds/misc/generate_p2p_private_key.d.ts +1 -1
  79. package/dest/cmds/misc/generate_secret_and_hash.d.ts +2 -2
  80. package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -1
  81. package/dest/cmds/misc/generate_secret_and_hash.js +4 -4
  82. package/dest/cmds/misc/generate_secret_key.d.ts +2 -2
  83. package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -1
  84. package/dest/cmds/misc/generate_secret_key.js +1 -1
  85. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +3 -0
  86. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts.map +1 -0
  87. package/dest/cmds/misc/get_canonical_sponsored_fpc_address.js +4 -0
  88. package/dest/cmds/misc/index.d.ts +1 -1
  89. package/dest/cmds/misc/index.d.ts.map +1 -1
  90. package/dest/cmds/misc/index.js +8 -4
  91. package/dest/cmds/misc/update/common.d.ts +1 -1
  92. package/dest/cmds/misc/update/github.d.ts +1 -2
  93. package/dest/cmds/misc/update/github.d.ts.map +1 -1
  94. package/dest/cmds/misc/update/github.js +0 -1
  95. package/dest/cmds/misc/update/noir.d.ts +1 -1
  96. package/dest/cmds/misc/update/npm.d.ts +1 -1
  97. package/dest/cmds/misc/update/npm.js +1 -1
  98. package/dest/cmds/misc/update/utils.d.ts +1 -1
  99. package/dest/cmds/misc/update.d.ts +1 -1
  100. package/dest/cmds/misc/update.d.ts.map +1 -1
  101. package/dest/cmds/misc/update.js +2 -3
  102. package/dest/cmds/validator_keys/add.d.ts +5 -0
  103. package/dest/cmds/validator_keys/add.d.ts.map +1 -0
  104. package/dest/cmds/validator_keys/add.js +83 -0
  105. package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +12 -0
  106. package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -0
  107. package/dest/cmds/validator_keys/generate_bls_keypair.js +27 -0
  108. package/dest/cmds/validator_keys/index.d.ts +4 -0
  109. package/dest/cmds/validator_keys/index.d.ts.map +1 -0
  110. package/dest/cmds/validator_keys/index.js +32 -0
  111. package/dest/cmds/validator_keys/new.d.ts +29 -0
  112. package/dest/cmds/validator_keys/new.d.ts.map +1 -0
  113. package/dest/cmds/validator_keys/new.js +134 -0
  114. package/dest/cmds/validator_keys/shared.d.ts +68 -0
  115. package/dest/cmds/validator_keys/shared.d.ts.map +1 -0
  116. package/dest/cmds/validator_keys/shared.js +274 -0
  117. package/dest/cmds/validator_keys/staker.d.ts +38 -0
  118. package/dest/cmds/validator_keys/staker.d.ts.map +1 -0
  119. package/dest/cmds/validator_keys/staker.js +210 -0
  120. package/dest/cmds/validator_keys/utils.d.ts +25 -0
  121. package/dest/cmds/validator_keys/utils.d.ts.map +1 -0
  122. package/dest/cmds/validator_keys/utils.js +52 -0
  123. package/dest/config/cached_fetch.d.ts +18 -0
  124. package/dest/config/cached_fetch.d.ts.map +1 -0
  125. package/dest/config/cached_fetch.js +54 -0
  126. package/dest/config/chain_l2_config.d.ts +41 -0
  127. package/dest/config/chain_l2_config.d.ts.map +1 -0
  128. package/dest/config/chain_l2_config.js +524 -0
  129. package/dest/config/enrich_env.d.ts +4 -0
  130. package/dest/config/enrich_env.d.ts.map +1 -0
  131. package/dest/config/enrich_env.js +12 -0
  132. package/dest/config/get_l1_config.d.ts +9 -0
  133. package/dest/config/get_l1_config.d.ts.map +1 -0
  134. package/dest/config/get_l1_config.js +24 -0
  135. package/dest/config/index.d.ts +5 -0
  136. package/dest/config/index.d.ts.map +1 -0
  137. package/dest/config/index.js +4 -0
  138. package/dest/config/network_config.d.ts +22 -0
  139. package/dest/config/network_config.d.ts.map +1 -0
  140. package/dest/config/network_config.js +115 -0
  141. package/dest/utils/aztec.d.ts +15 -26
  142. package/dest/utils/aztec.d.ts.map +1 -1
  143. package/dest/utils/aztec.js +56 -72
  144. package/dest/utils/commands.d.ts +22 -13
  145. package/dest/utils/commands.d.ts.map +1 -1
  146. package/dest/utils/commands.js +43 -16
  147. package/dest/utils/encoding.d.ts +1 -1
  148. package/dest/utils/encoding.js +2 -2
  149. package/dest/utils/github.d.ts +1 -2
  150. package/dest/utils/github.d.ts.map +1 -1
  151. package/dest/utils/github.js +0 -1
  152. package/dest/utils/index.d.ts +2 -1
  153. package/dest/utils/index.d.ts.map +1 -1
  154. package/dest/utils/index.js +1 -0
  155. package/dest/utils/inspect.d.ts +5 -11
  156. package/dest/utils/inspect.d.ts.map +1 -1
  157. package/dest/utils/inspect.js +19 -109
  158. package/dest/utils/setup_contracts.d.ts +3 -0
  159. package/dest/utils/setup_contracts.d.ts.map +1 -0
  160. package/dest/utils/setup_contracts.js +16 -0
  161. package/package.json +55 -36
  162. package/public_include_metric_prefixes.json +1 -0
  163. package/src/cmds/aztec_node/block_number.ts +9 -0
  164. package/src/cmds/aztec_node/get_block.ts +11 -0
  165. package/src/cmds/aztec_node/get_current_min_fee.ts +9 -0
  166. package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +27 -0
  167. package/src/cmds/{pxe → aztec_node}/get_logs.ts +11 -9
  168. package/src/cmds/{pxe → aztec_node}/get_node_info.ts +15 -23
  169. package/src/cmds/aztec_node/index.ts +87 -0
  170. package/src/cmds/contracts/inspect_contract.ts +20 -17
  171. package/src/cmds/infrastructure/index.ts +8 -11
  172. package/src/cmds/infrastructure/sequencers.ts +41 -22
  173. package/src/cmds/infrastructure/setup_l2_contract.ts +13 -25
  174. package/src/cmds/l1/advance_epoch.ts +7 -5
  175. package/src/cmds/l1/assume_proven_through.ts +11 -7
  176. package/src/cmds/l1/bridge_erc20.ts +8 -4
  177. package/src/cmds/l1/deploy_l1_contracts_cmd.ts +107 -0
  178. package/src/cmds/l1/deploy_new_rollup.ts +24 -15
  179. package/src/cmds/l1/get_l1_addresses.ts +5 -3
  180. package/src/cmds/l1/get_l1_balance.ts +2 -2
  181. package/src/cmds/l1/governance_utils.ts +20 -24
  182. package/src/cmds/l1/index.ts +73 -110
  183. package/src/cmds/l1/prover_stats.ts +42 -31
  184. package/src/cmds/l1/trigger_seed_snapshot.ts +32 -0
  185. package/src/cmds/l1/update_l1_validators.ts +194 -99
  186. package/src/cmds/misc/generate_bootnode_enr.ts +3 -2
  187. package/src/cmds/misc/generate_secret_and_hash.ts +4 -4
  188. package/src/cmds/misc/generate_secret_key.ts +1 -1
  189. package/src/cmds/misc/get_canonical_sponsored_fpc_address.ts +7 -0
  190. package/src/cmds/misc/index.ts +14 -5
  191. package/src/cmds/misc/update/github.ts +0 -1
  192. package/src/cmds/misc/update/npm.ts +1 -1
  193. package/src/cmds/misc/update.ts +1 -7
  194. package/src/cmds/validator_keys/add.ts +123 -0
  195. package/src/cmds/validator_keys/generate_bls_keypair.ts +34 -0
  196. package/src/cmds/validator_keys/index.ts +142 -0
  197. package/src/cmds/validator_keys/new.ts +207 -0
  198. package/src/cmds/validator_keys/shared.ts +326 -0
  199. package/src/cmds/validator_keys/staker.ts +301 -0
  200. package/src/cmds/validator_keys/utils.ts +81 -0
  201. package/src/config/cached_fetch.ts +67 -0
  202. package/src/config/chain_l2_config.ts +694 -0
  203. package/src/config/enrich_env.ts +15 -0
  204. package/src/config/get_l1_config.ts +31 -0
  205. package/src/config/index.ts +4 -0
  206. package/src/config/network_config.ts +147 -0
  207. package/src/utils/aztec.ts +74 -120
  208. package/src/utils/commands.ts +57 -20
  209. package/src/utils/encoding.ts +2 -2
  210. package/src/utils/github.ts +0 -1
  211. package/src/utils/index.ts +1 -0
  212. package/src/utils/inspect.ts +24 -123
  213. package/src/utils/setup_contracts.ts +19 -0
  214. package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
  215. package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
  216. package/dest/cmds/devnet/bootstrap_network.js +0 -196
  217. package/dest/cmds/devnet/faucet.d.ts +0 -4
  218. package/dest/cmds/devnet/faucet.d.ts.map +0 -1
  219. package/dest/cmds/devnet/faucet.js +0 -26
  220. package/dest/cmds/devnet/index.d.ts +0 -4
  221. package/dest/cmds/devnet/index.d.ts.map +0 -1
  222. package/dest/cmds/devnet/index.js +0 -14
  223. package/dest/cmds/l1/deploy_l1_contracts.d.ts +0 -4
  224. package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +0 -1
  225. package/dest/cmds/l1/deploy_l1_contracts.js +0 -29
  226. package/dest/cmds/l1/deploy_l1_verifier.d.ts +0 -5
  227. package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +0 -1
  228. package/dest/cmds/l1/deploy_l1_verifier.js +0 -54
  229. package/dest/cmds/misc/setup_contracts.d.ts +0 -7
  230. package/dest/cmds/misc/setup_contracts.d.ts.map +0 -1
  231. package/dest/cmds/misc/setup_contracts.js +0 -27
  232. package/dest/cmds/pxe/add_contract.d.ts +0 -5
  233. package/dest/cmds/pxe/add_contract.d.ts.map +0 -1
  234. package/dest/cmds/pxe/add_contract.js +0 -29
  235. package/dest/cmds/pxe/block_number.d.ts +0 -3
  236. package/dest/cmds/pxe/block_number.d.ts.map +0 -1
  237. package/dest/cmds/pxe/block_number.js +0 -10
  238. package/dest/cmds/pxe/get_account.d.ts +0 -4
  239. package/dest/cmds/pxe/get_account.d.ts.map +0 -1
  240. package/dest/cmds/pxe/get_account.js +0 -10
  241. package/dest/cmds/pxe/get_accounts.d.ts +0 -3
  242. package/dest/cmds/pxe/get_accounts.d.ts.map +0 -1
  243. package/dest/cmds/pxe/get_accounts.js +0 -25
  244. package/dest/cmds/pxe/get_block.d.ts +0 -3
  245. package/dest/cmds/pxe/get_block.d.ts.map +0 -1
  246. package/dest/cmds/pxe/get_block.js +0 -9
  247. package/dest/cmds/pxe/get_contract_data.d.ts +0 -4
  248. package/dest/cmds/pxe/get_contract_data.d.ts.map +0 -1
  249. package/dest/cmds/pxe/get_contract_data.js +0 -31
  250. package/dest/cmds/pxe/get_current_base_fee.d.ts +0 -3
  251. package/dest/cmds/pxe/get_current_base_fee.d.ts.map +0 -1
  252. package/dest/cmds/pxe/get_current_base_fee.js +0 -7
  253. package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +0 -4
  254. package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +0 -1
  255. package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +0 -11
  256. package/dest/cmds/pxe/get_logs.d.ts +0 -4
  257. package/dest/cmds/pxe/get_logs.d.ts.map +0 -1
  258. package/dest/cmds/pxe/get_node_info.d.ts +0 -3
  259. package/dest/cmds/pxe/get_node_info.d.ts.map +0 -1
  260. package/dest/cmds/pxe/get_pxe_info.d.ts +0 -3
  261. package/dest/cmds/pxe/get_pxe_info.d.ts.map +0 -1
  262. package/dest/cmds/pxe/get_pxe_info.js +0 -11
  263. package/dest/cmds/pxe/index.d.ts +0 -4
  264. package/dest/cmds/pxe/index.d.ts.map +0 -1
  265. package/dest/cmds/pxe/index.js +0 -55
  266. package/src/cmds/devnet/bootstrap_network.ts +0 -318
  267. package/src/cmds/devnet/faucet.ts +0 -33
  268. package/src/cmds/devnet/index.ts +0 -60
  269. package/src/cmds/l1/deploy_l1_contracts.ts +0 -65
  270. package/src/cmds/l1/deploy_l1_verifier.ts +0 -105
  271. package/src/cmds/misc/setup_contracts.ts +0 -40
  272. package/src/cmds/pxe/add_contract.ts +0 -41
  273. package/src/cmds/pxe/block_number.ts +0 -9
  274. package/src/cmds/pxe/get_account.ts +0 -16
  275. package/src/cmds/pxe/get_accounts.ts +0 -35
  276. package/src/cmds/pxe/get_block.ts +0 -10
  277. package/src/cmds/pxe/get_contract_data.ts +0 -51
  278. package/src/cmds/pxe/get_current_base_fee.ts +0 -9
  279. package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +0 -25
  280. package/src/cmds/pxe/get_pxe_info.ts +0 -13
  281. package/src/cmds/pxe/index.ts +0 -170
@@ -1,5 +1,6 @@
1
1
  import { retrieveL2ProofVerifiedEvents } from '@aztec/archiver';
2
- import { type ViemPublicClient, createEthereumChain } from '@aztec/ethereum';
2
+ import { createEthereumChain } from '@aztec/ethereum/chain';
3
+ import type { ViemPublicClient } from '@aztec/ethereum/types';
3
4
  import { compactArray, mapValues, unique } from '@aztec/foundation/collection';
4
5
  import { EthAddress } from '@aztec/foundation/eth-address';
5
6
  import { type LogFn, type Logger, createLogger } from '@aztec/foundation/log';
@@ -46,7 +47,10 @@ export async function proverStats(opts: {
46
47
  .then(a => a.rollupAddress);
47
48
 
48
49
  const chain = createEthereumChain(l1RpcUrls, chainId).chainInfo;
49
- const publicClient = createPublicClient({ chain, transport: fallback(l1RpcUrls.map(url => http(url))) });
50
+ const publicClient = createPublicClient({
51
+ chain,
52
+ transport: fallback(l1RpcUrls.map(url => http(url, { batch: false }))),
53
+ });
50
54
  const lastBlockNum = endBlock ?? (await publicClient.getBlockNumber());
51
55
  debugLog.verbose(`Querying events on rollup at ${rollup.toString()} from ${startBlock} up to ${lastBlockNum}`);
52
56
 
@@ -55,33 +59,40 @@ export async function proverStats(opts: {
55
59
 
56
60
  // If we only care for raw logs, output them
57
61
  if (rawLogs && !provingTimeout) {
58
- log(`l1_block_number, l2_block_number, prover_id, tx_hash`);
62
+ log(`l1_block_number, checkpoint_number, prover_id, tx_hash`);
59
63
  for (const event of events) {
60
- const { l1BlockNumber, l2BlockNumber, proverId, txHash } = event;
61
- log(`${l1BlockNumber}, ${l2BlockNumber}, ${proverId}, ${txHash}`);
64
+ const { l1BlockNumber, checkpointNumber, proverId, txHash } = event;
65
+ log(`${l1BlockNumber}, ${checkpointNumber}, ${proverId}, ${txHash}`);
62
66
  }
63
67
  return;
64
68
  }
65
69
 
66
- // If we don't have a proving timeout, we can just count the number of unique blocks per prover
70
+ // If we don't have a proving timeout, we can just count the number of unique checkpoints per prover
67
71
  if (!provingTimeout) {
68
72
  const stats = groupBy(events, 'proverId');
69
- log(`prover_id, total_blocks_proven`);
73
+ log(`prover_id, total_checkpoints_proven`);
70
74
  for (const proverId in stats) {
71
- const uniqueBlocks = new Set(stats[proverId].map(e => e.l2BlockNumber));
72
- log(`${proverId}, ${uniqueBlocks.size}`);
75
+ const uniqueCheckpoints = new Set(stats[proverId].map(e => e.checkpointNumber));
76
+ log(`${proverId}, ${uniqueCheckpoints.size}`);
73
77
  }
74
78
  return;
75
79
  }
76
80
 
77
- // But if we do, fetch the events for each block submitted, so we can look up their timestamp
78
- const blockEvents = await getL2BlockEvents(startBlock, lastBlockNum, batchSize, debugLog, publicClient, rollup);
81
+ // But if we do, fetch the events for each checkpoint submitted, so we can look up their timestamp
82
+ const checkpointEvents = await getCheckpointProposedEvents(
83
+ startBlock,
84
+ lastBlockNum,
85
+ batchSize,
86
+ debugLog,
87
+ publicClient,
88
+ rollup,
89
+ );
79
90
  debugLog.verbose(
80
- `First L2 block within range is ${blockEvents[0]?.args.blockNumber} at L1 block ${blockEvents[0]?.blockNumber}`,
91
+ `First checkpoint within range is ${checkpointEvents[0]?.args.checkpointNumber} at L1 block ${checkpointEvents[0]?.blockNumber}`,
81
92
  );
82
93
 
83
94
  // Get the timestamps for every block on every log, both for proof and block submissions
84
- const l1BlockNumbers = unique([...events.map(e => e.l1BlockNumber), ...blockEvents.map(e => e.blockNumber)]);
95
+ const l1BlockNumbers = unique([...events.map(e => e.l1BlockNumber), ...checkpointEvents.map(e => e.blockNumber)]);
85
96
  const l1BlockTimestamps: Record<string, bigint> = {};
86
97
  for (const l1Batch of chunk(l1BlockNumbers, Number(batchSize))) {
87
98
  const blocks = await Promise.all(
@@ -93,44 +104,44 @@ export async function proverStats(opts: {
93
104
  }
94
105
  }
95
106
 
96
- // Map from l2 block number to the l1 block in which it was submitted
97
- const l2BlockSubmissions: Record<string, bigint> = {};
98
- for (const blockEvent of blockEvents) {
99
- l2BlockSubmissions[blockEvent.args.blockNumber!.toString()] = blockEvent.blockNumber;
107
+ // Map from checkpoint number to the l1 block in which it was submitted
108
+ const checkpointSubmissions: Record<string, bigint> = {};
109
+ for (const checkpointEvent of checkpointEvents) {
110
+ checkpointSubmissions[checkpointEvent.args.checkpointNumber!.toString()] = checkpointEvent.blockNumber;
100
111
  }
101
112
 
102
113
  // If we want raw logs, output them
103
114
  if (rawLogs) {
104
- log(`l1_block_number, l2_block_number, l2_block_submission_timestamp, proof_timestamp, prover_id, tx_hash`);
115
+ log(`l1_block_number, checkpoint_number, checkpoint_submission_timestamp, proof_timestamp, prover_id, tx_hash`);
105
116
  for (const event of events) {
106
- const { l1BlockNumber, l2BlockNumber, proverId, txHash } = event;
107
- const uploadedBlockNumber = l2BlockSubmissions[l2BlockNumber.toString()];
117
+ const { l1BlockNumber, checkpointNumber, proverId, txHash } = event;
118
+ const uploadedBlockNumber = checkpointSubmissions[checkpointNumber.toString()];
108
119
  if (!uploadedBlockNumber) {
109
120
  continue;
110
121
  }
111
122
  const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
112
123
  const provenTimestamp = l1BlockTimestamps[l1BlockNumber.toString()];
113
- log(`${l1BlockNumber}, ${l2BlockNumber}, ${uploadedTimestamp}, ${provenTimestamp}, ${proverId}, ${txHash}`);
124
+ log(`${l1BlockNumber}, ${checkpointNumber}, ${uploadedTimestamp}, ${provenTimestamp}, ${proverId}, ${txHash}`);
114
125
  }
115
126
  return;
116
127
  }
117
128
 
118
129
  // Or calculate stats per prover
119
- const stats = mapValues(groupBy(events, 'proverId'), (blocks, proverId) =>
130
+ const stats = mapValues(groupBy(events, 'proverId'), (checkpoints, proverId) =>
120
131
  compactArray(
121
- blocks.map(e => {
132
+ checkpoints.map(e => {
122
133
  const provenTimestamp = l1BlockTimestamps[e.l1BlockNumber.toString()];
123
- const uploadedBlockNumber = l2BlockSubmissions[e.l2BlockNumber.toString()];
134
+ const uploadedBlockNumber = checkpointSubmissions[e.checkpointNumber.toString()];
124
135
  if (!uploadedBlockNumber) {
125
136
  debugLog.verbose(
126
- `Skipping ${proverId}'s proof for L2 block ${e.l2BlockNumber} as it was before the start block`,
137
+ `Skipping ${proverId}'s proof for checkpoint ${e.checkpointNumber} as it was before the start block`,
127
138
  );
128
139
  return undefined;
129
140
  }
130
141
  const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
131
142
  const provingTime = provenTimestamp - uploadedTimestamp;
132
143
  debugLog.debug(
133
- `prover=${e.proverId} blockNumber=${e.l2BlockNumber} uploaded=${uploadedTimestamp} proven=${provenTimestamp} time=${provingTime}`,
144
+ `prover=${e.proverId} checkpointNumber=${e.checkpointNumber} uploaded=${uploadedTimestamp} proven=${provenTimestamp} time=${provingTime}`,
134
145
  );
135
146
  return { provenTimestamp, uploadedTimestamp, provingTime, ...e };
136
147
  }),
@@ -141,8 +152,8 @@ export async function proverStats(opts: {
141
152
  for (const proverId in stats) {
142
153
  const blocks = stats[proverId];
143
154
  const withinTimeout = blocks.filter(b => b.provingTime <= provingTimeout);
144
- const uniqueBlocksWithinTimeout = new Set(withinTimeout.map(e => e.l2BlockNumber));
145
- const uniqueBlocks = new Set(blocks.map(e => e.l2BlockNumber));
155
+ const uniqueBlocksWithinTimeout = new Set(withinTimeout.map(e => e.checkpointNumber));
156
+ const uniqueBlocks = new Set(blocks.map(e => e.checkpointNumber));
146
157
  const avgProvingTime =
147
158
  blocks.length === 0 ? 0 : Math.ceil(Number(blocks.reduce((acc, b) => acc + b.provingTime, 0n)) / blocks.length);
148
159
 
@@ -171,7 +182,7 @@ async function getL2ProofVerifiedEvents(
171
182
  return events;
172
183
  }
173
184
 
174
- async function getL2BlockEvents(
185
+ async function getCheckpointProposedEvents(
175
186
  startBlock: bigint,
176
187
  lastBlockNum: bigint,
177
188
  batchSize: bigint,
@@ -188,14 +199,14 @@ async function getL2BlockEvents(
188
199
  address: getAddress(rollup.toString()),
189
200
  event: getAbiItem({
190
201
  abi: RollupAbi,
191
- name: 'L2BlockProposed',
202
+ name: 'CheckpointProposed',
192
203
  }),
193
204
  fromBlock: blockNum,
194
205
  toBlock: end,
195
206
  });
196
207
 
197
208
  events.push(...newEvents);
198
- debugLog.verbose(`Got ${newEvents.length} events querying l2 block submitted from block ${blockNum} to ${end}`);
209
+ debugLog.verbose(`Got ${newEvents.length} events querying checkpoints submitted from block ${blockNum} to ${end}`);
199
210
  blockNum += batchSize;
200
211
  }
201
212
  return events;
@@ -0,0 +1,32 @@
1
+ import { createEthereumChain } from '@aztec/ethereum/chain';
2
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
3
+ import type { LogFn } from '@aztec/foundation/log';
4
+ import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
5
+
6
+ import { getContract } from 'viem';
7
+
8
+ import type { RollupCommandArgs } from './update_l1_validators.js';
9
+
10
+ export async function triggerSeedSnapshot({
11
+ rpcUrls,
12
+ chainId,
13
+ privateKey,
14
+ mnemonic,
15
+ rollupAddress,
16
+ log,
17
+ }: RollupCommandArgs & { log: LogFn }) {
18
+ const chain = createEthereumChain(rpcUrls, chainId);
19
+ const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic!, chain.chainInfo);
20
+
21
+ const rollup = getContract({
22
+ address: rollupAddress.toString(),
23
+ abi: RollupAbi,
24
+ client,
25
+ });
26
+
27
+ log('Triggering seed snapshot for next epoch');
28
+ const txHash = await rollup.write.checkpointRandao();
29
+ log(`Sent! | Seed snapshot setup for next epoch | tx hash: ${txHash}`);
30
+ const receipt = await client.waitForTransactionReceipt({ hash: txHash });
31
+ log(`Done! | Seed snapshot setup for next epoch | tx hash: ${txHash} | status: ${receipt.status}`);
32
+ }
@@ -1,17 +1,20 @@
1
- import {
2
- EthCheatCodes,
3
- createEthereumChain,
4
- getExpectedAddress,
5
- getL1ContractsConfigEnvVars,
6
- isAnvilTestChain,
7
- } from '@aztec/ethereum';
1
+ import { createEthereumChain, isAnvilTestChain } from '@aztec/ethereum/chain';
2
+ import { createExtendedL1Client, getPublicClient } from '@aztec/ethereum/client';
3
+ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
4
+ import { GSEContract, RollupContract } from '@aztec/ethereum/contracts';
5
+ import { createL1TxUtilsFromViemWallet } from '@aztec/ethereum/l1-tx-utils';
6
+ import { EthCheatCodes } from '@aztec/ethereum/test';
8
7
  import type { EthAddress } from '@aztec/foundation/eth-address';
9
8
  import type { LogFn, Logger } from '@aztec/foundation/log';
10
- import { ForwarderAbi, ForwarderBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
9
+ import { DateProvider } from '@aztec/foundation/timer';
10
+ import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
11
+ import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
11
12
 
12
- import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
13
+ import { encodeFunctionData, formatEther, getContract } from 'viem';
13
14
  import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
14
15
 
16
+ import { addLeadingHex } from '../../utils/aztec.js';
17
+
15
18
  export interface RollupCommandArgs {
16
19
  rpcUrls: string[];
17
20
  chainId: number;
@@ -21,6 +24,14 @@ export interface RollupCommandArgs {
21
24
  withdrawerAddress?: EthAddress;
22
25
  }
23
26
 
27
+ export interface StakingAssetHandlerCommandArgs {
28
+ rpcUrls: string[];
29
+ chainId: number;
30
+ privateKey?: string;
31
+ mnemonic?: string;
32
+ stakingAssetHandlerAddress: EthAddress;
33
+ }
34
+
24
35
  export interface LoggerArgs {
25
36
  log: LogFn;
26
37
  debugLogger: Logger;
@@ -41,56 +52,151 @@ export async function addL1Validator({
41
52
  chainId,
42
53
  privateKey,
43
54
  mnemonic,
44
- validatorAddress,
45
- rollupAddress,
55
+ attesterAddress,
56
+ stakingAssetHandlerAddress,
57
+ merkleProof,
58
+ proofParams,
59
+ blsSecretKey,
60
+ log,
61
+ debugLogger,
62
+ }: StakingAssetHandlerCommandArgs &
63
+ LoggerArgs & {
64
+ blsSecretKey: bigint; // scalar field element of BN254
65
+ attesterAddress: EthAddress;
66
+ proofParams: Buffer;
67
+ merkleProof: string[];
68
+ }) {
69
+ const dualLog = makeDualLog(log, debugLogger);
70
+ const account = getAccount(privateKey, mnemonic);
71
+ const chain = createEthereumChain(rpcUrls, chainId);
72
+ const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
73
+
74
+ const stakingAssetHandler = getContract({
75
+ address: stakingAssetHandlerAddress.toString(),
76
+ abi: StakingAssetHandlerAbi,
77
+ client: l1Client,
78
+ });
79
+
80
+ const rollupAddress = await stakingAssetHandler.read.getRollup();
81
+ dualLog(`Adding validator ${attesterAddress} to rollup ${rollupAddress.toString()}`);
82
+
83
+ const rollup = getContract({
84
+ address: rollupAddress,
85
+ abi: RollupAbi,
86
+ client: l1Client,
87
+ });
88
+
89
+ const gseAddress = await rollup.read.getGSE();
90
+
91
+ const gse = new GSEContract(l1Client, gseAddress);
92
+
93
+ const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
94
+
95
+ const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
96
+ const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
97
+ const merkleProofArray = merkleProof.map(proof => addLeadingHex(proof));
98
+
99
+ const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
100
+ to: stakingAssetHandlerAddress.toString(),
101
+ data: encodeFunctionData({
102
+ abi: StakingAssetHandlerAbi,
103
+ functionName: 'addValidator',
104
+ args: [
105
+ attesterAddress.toString(),
106
+ merkleProofArray,
107
+ proofParamsObj.toViem(),
108
+ registrationTuple.publicKeyInG1,
109
+ registrationTuple.publicKeyInG2,
110
+ registrationTuple.proofOfPossession,
111
+ ],
112
+ }),
113
+ abi: StakingAssetHandlerAbi,
114
+ });
115
+ dualLog(`Transaction hash: ${receipt.transactionHash}`);
116
+ await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
117
+ if (isAnvilTestChain(chainId)) {
118
+ dualLog(`Funding validator on L1`);
119
+ const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
120
+ await cheatCodes.setBalance(attesterAddress, 10n ** 20n);
121
+ } else {
122
+ const balance = await l1Client.getBalance({ address: attesterAddress.toString() });
123
+ dualLog(`Validator balance: ${formatEther(balance)} ETH`);
124
+ if (balance === 0n) {
125
+ dualLog(`WARNING: Proposer has no balance. Remember to fund it!`);
126
+ }
127
+ }
128
+ }
129
+
130
+ export async function addL1ValidatorViaRollup({
131
+ rpcUrls,
132
+ chainId,
133
+ privateKey,
134
+ mnemonic,
135
+ attesterAddress,
46
136
  withdrawerAddress,
137
+ blsSecretKey,
138
+ moveWithLatestRollup,
139
+ rollupAddress,
47
140
  log,
48
141
  debugLogger,
49
- }: RollupCommandArgs & LoggerArgs & { validatorAddress: EthAddress }) {
50
- const config = getL1ContractsConfigEnvVars();
142
+ }: RollupCommandArgs &
143
+ LoggerArgs & {
144
+ blsSecretKey: bigint; // scalar field element of BN254
145
+ attesterAddress: EthAddress;
146
+ moveWithLatestRollup: boolean;
147
+ }) {
51
148
  const dualLog = makeDualLog(log, debugLogger);
52
- const publicClient = getPublicClient(rpcUrls, chainId);
53
- const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
149
+ const account = getAccount(privateKey, mnemonic);
150
+ const chain = createEthereumChain(rpcUrls, chainId);
151
+ const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
152
+
153
+ dualLog(`Adding validator ${attesterAddress} to rollup ${rollupAddress.toString()} via direct deposit`);
154
+
155
+ if (!withdrawerAddress) {
156
+ throw new Error(`Withdrawer address required`);
157
+ }
158
+
54
159
  const rollup = getContract({
55
160
  address: rollupAddress.toString(),
56
161
  abi: RollupAbi,
57
- client: walletClient,
162
+ client: l1Client,
58
163
  });
59
164
 
60
- const stakingAsset = getContract({
61
- address: await rollup.read.getStakingAsset(),
62
- abi: TestERC20Abi,
63
- client: walletClient,
64
- });
165
+ const gseAddress = await rollup.read.getGSE();
166
+
167
+ const gse = new GSEContract(l1Client, gseAddress);
168
+
169
+ const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
65
170
 
66
- await Promise.all(
67
- [
68
- await stakingAsset.write.mint([walletClient.account.address, config.minimumStake], {} as any),
69
- await stakingAsset.write.approve([rollupAddress.toString(), config.minimumStake], {} as any),
70
- ].map(txHash => publicClient.waitForTransactionReceipt({ hash: txHash })),
71
- );
72
-
73
- dualLog(`Adding validator ${validatorAddress.toString()} to rollup ${rollupAddress.toString()}`);
74
- const txHash = await rollup.write.deposit([
75
- validatorAddress.toString(),
76
- // TODO(#11451): custom forwarders
77
- getExpectedAddress(ForwarderAbi, ForwarderBytecode, [validatorAddress.toString()], validatorAddress.toString())
78
- .address,
79
- withdrawerAddress?.toString() ?? validatorAddress.toString(),
80
- config.minimumStake,
81
- ]);
82
- dualLog(`Transaction hash: ${txHash}`);
83
- await publicClient.waitForTransactionReceipt({ hash: txHash });
171
+ const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
172
+
173
+ const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
174
+ to: rollupAddress.toString(),
175
+ data: encodeFunctionData({
176
+ abi: RollupAbi,
177
+ functionName: 'deposit',
178
+ args: [
179
+ attesterAddress.toString(),
180
+ withdrawerAddress.toString(),
181
+ registrationTuple.publicKeyInG1,
182
+ registrationTuple.publicKeyInG2,
183
+ registrationTuple.proofOfPossession,
184
+ moveWithLatestRollup,
185
+ ],
186
+ }),
187
+ abi: StakingAssetHandlerAbi,
188
+ });
189
+ dualLog(`Transaction hash: ${receipt.transactionHash}`);
190
+ await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
84
191
  if (isAnvilTestChain(chainId)) {
85
192
  dualLog(`Funding validator on L1`);
86
- const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
87
- await cheatCodes.setBalance(validatorAddress, 10n ** 20n);
193
+ const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
194
+ await cheatCodes.setBalance(attesterAddress, 10n ** 20n);
88
195
  } else {
89
- const balance = await publicClient.getBalance({ address: validatorAddress.toString() });
90
- const balanceInEth = Number(balance) / 10 ** 18;
91
- dualLog(`Validator balance: ${balanceInEth.toFixed(6)} ETH`);
92
- if (balanceInEth === 0) {
93
- dualLog(`WARNING: Validator has no balance. Remember to fund it!`);
196
+ const balance = await l1Client.getBalance({ address: attesterAddress.toString() });
197
+ dualLog(`Validator balance: ${formatEther(balance)} ETH`);
198
+ if (balance === 0n) {
199
+ dualLog(`WARNING: Proposer has no balance. Remember to fund it!`);
94
200
  }
95
201
  }
96
202
  }
@@ -106,18 +212,21 @@ export async function removeL1Validator({
106
212
  debugLogger,
107
213
  }: RollupCommandArgs & LoggerArgs & { validatorAddress: EthAddress }) {
108
214
  const dualLog = makeDualLog(log, debugLogger);
109
- const publicClient = getPublicClient(rpcUrls, chainId);
110
- const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
111
- const rollup = getContract({
112
- address: rollupAddress.toString(),
113
- abi: RollupAbi,
114
- client: walletClient,
115
- });
215
+ const account = getAccount(privateKey, mnemonic);
216
+ const chain = createEthereumChain(rpcUrls, chainId);
217
+ const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
218
+ const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
116
219
 
117
220
  dualLog(`Removing validator ${validatorAddress.toString()} from rollup ${rollupAddress.toString()}`);
118
- const txHash = await rollup.write.initiateWithdraw([validatorAddress.toString(), validatorAddress.toString()]);
119
- dualLog(`Transaction hash: ${txHash}`);
120
- await publicClient.waitForTransactionReceipt({ hash: txHash });
221
+ const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
222
+ to: rollupAddress.toString(),
223
+ data: encodeFunctionData({
224
+ abi: RollupAbi,
225
+ functionName: 'initiateWithdraw',
226
+ args: [validatorAddress.toString(), validatorAddress.toString()],
227
+ }),
228
+ });
229
+ dualLog(`Transaction hash: ${receipt.transactionHash}`);
121
230
  }
122
231
 
123
232
  export async function pruneRollup({
@@ -130,18 +239,20 @@ export async function pruneRollup({
130
239
  debugLogger,
131
240
  }: RollupCommandArgs & LoggerArgs) {
132
241
  const dualLog = makeDualLog(log, debugLogger);
133
- const publicClient = getPublicClient(rpcUrls, chainId);
134
- const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
135
- const rollup = getContract({
136
- address: rollupAddress.toString(),
137
- abi: RollupAbi,
138
- client: walletClient,
139
- });
242
+ const account = getAccount(privateKey, mnemonic);
243
+ const chain = createEthereumChain(rpcUrls, chainId);
244
+ const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
245
+ const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
140
246
 
141
247
  dualLog(`Trying prune`);
142
- const txHash = await rollup.write.prune();
143
- dualLog(`Transaction hash: ${txHash}`);
144
- await publicClient.waitForTransactionReceipt({ hash: txHash });
248
+ const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
249
+ to: rollupAddress.toString(),
250
+ data: encodeFunctionData({
251
+ abi: RollupAbi,
252
+ functionName: 'prune',
253
+ }),
254
+ });
255
+ dualLog(`Transaction hash: ${receipt.transactionHash}`);
145
256
  }
146
257
 
147
258
  export async function fastForwardEpochs({
@@ -153,20 +264,20 @@ export async function fastForwardEpochs({
153
264
  debugLogger,
154
265
  }: RollupCommandArgs & LoggerArgs & { numEpochs: bigint }) {
155
266
  const dualLog = makeDualLog(log, debugLogger);
156
- const publicClient = getPublicClient(rpcUrls, chainId);
267
+ const publicClient = getPublicClient({ l1RpcUrls: rpcUrls, l1ChainId: chainId });
157
268
  const rollup = getContract({
158
269
  address: rollupAddress.toString(),
159
270
  abi: RollupAbi,
160
271
  client: publicClient,
161
272
  });
162
273
 
163
- const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
274
+ const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
164
275
  const currentSlot = await rollup.read.getCurrentSlot();
165
276
  const l2SlotsInEpoch = await rollup.read.getEpochDuration();
166
277
  const timestamp = await rollup.read.getTimestampForSlot([currentSlot + l2SlotsInEpoch * numEpochs]);
167
278
  dualLog(`Fast forwarding ${numEpochs} epochs to ${timestamp}`);
168
279
  try {
169
- await cheatCodes.warp(Number(timestamp));
280
+ await cheatCodes.warp(Number(timestamp), { resetBlockInterval: true });
170
281
  dualLog(`Fast forwarded ${numEpochs} epochs to ${timestamp}`);
171
282
  } catch (error) {
172
283
  if (error instanceof Error && error.message.includes("is lower than or equal to previous block's timestamp")) {
@@ -180,31 +291,27 @@ export async function fastForwardEpochs({
180
291
 
181
292
  export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }: RollupCommandArgs & LoggerArgs) {
182
293
  const config = getL1ContractsConfigEnvVars();
183
- const publicClient = getPublicClient(rpcUrls, chainId);
184
- const rollup = getContract({
185
- address: rollupAddress.toString(),
186
- abi: RollupAbi,
187
- client: publicClient,
188
- });
294
+ const publicClient = getPublicClient({ l1RpcUrls: rpcUrls, l1ChainId: chainId });
295
+ const rollup = new RollupContract(publicClient, rollupAddress);
189
296
 
190
- const pendingNum = await rollup.read.getPendingBlockNumber();
297
+ const pendingNum = await rollup.getCheckpointNumber();
191
298
  log(`Pending block num: ${pendingNum}`);
192
- const provenNum = await rollup.read.getProvenBlockNumber();
299
+ const provenNum = await rollup.getProvenCheckpointNumber();
193
300
  log(`Proven block num: ${provenNum}`);
194
- const validators = await rollup.read.getAttesters();
301
+ const validators = await rollup.getAttesters();
195
302
  log(`Validators: ${validators.map(v => v.toString()).join(', ')}`);
196
- const committee = await rollup.read.getCurrentEpochCommittee();
197
- log(`Committee: ${committee.map(v => v.toString()).join(', ')}`);
198
- const archive = await rollup.read.archive();
303
+ const committee = await rollup.getCurrentEpochCommittee();
304
+ log(`Committee: ${committee?.map(v => v.toString()).join(', ')}`);
305
+ const archive = await rollup.archive();
199
306
  log(`Archive: ${archive}`);
200
- const epochNum = await rollup.read.getCurrentEpoch();
307
+ const epochNum = await rollup.getCurrentEpochNumber();
201
308
  log(`Current epoch: ${epochNum}`);
202
- const slot = await rollup.read.getCurrentSlot();
309
+ const slot = await rollup.getSlotNumber();
203
310
  log(`Current slot: ${slot}`);
204
- const proposerDuringPrevL1Block = await rollup.read.getCurrentProposer();
311
+ const proposerDuringPrevL1Block = await rollup.getCurrentProposer();
205
312
  log(`Proposer during previous L1 block: ${proposerDuringPrevL1Block}`);
206
313
  const nextBlockTS = BigInt((await publicClient.getBlock()).timestamp + BigInt(config.ethereumSlotDuration));
207
- const proposer = await rollup.read.getProposerAt([nextBlockTS]);
314
+ const proposer = await rollup.getProposerAt(nextBlockTS);
208
315
  log(`Proposer NOW: ${proposer.toString()}`);
209
316
  }
210
317
 
@@ -215,24 +322,12 @@ function makeDualLog(log: LogFn, debugLogger: Logger) {
215
322
  };
216
323
  }
217
324
 
218
- function getPublicClient(rpcUrls: string[], chainId: number) {
219
- const chain = createEthereumChain(rpcUrls, chainId);
220
- return createPublicClient({ chain: chain.chainInfo, transport: fallback(rpcUrls.map(url => http(url))) });
221
- }
222
-
223
- function getWalletClient(
224
- rpcUrls: string[],
225
- chainId: number,
226
- privateKey: string | undefined,
227
- mnemonic: string | undefined,
228
- ) {
325
+ function getAccount(privateKey: string | undefined, mnemonic: string | undefined) {
229
326
  if (!privateKey && !mnemonic) {
230
327
  throw new Error('Either privateKey or mnemonic must be provided to create a wallet client');
231
328
  }
232
-
233
- const chain = createEthereumChain(rpcUrls, chainId);
234
329
  const account = !privateKey
235
330
  ? mnemonicToAccount(mnemonic!)
236
331
  : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}` as `0x${string}`);
237
- return createWalletClient({ account, chain: chain.chainInfo, transport: fallback(rpcUrls.map(url => http(url))) });
332
+ return account;
238
333
  }
@@ -3,10 +3,11 @@ import { createBootnodeENRandPeerId } from '@aztec/p2p/enr';
3
3
 
4
4
  export async function generateEncodedBootnodeENR(
5
5
  privateKey: string,
6
- udpAnnounceAddress: string,
6
+ p2pIp: string,
7
+ p2pPort: number,
7
8
  l1ChainId: number,
8
9
  log: LogFn,
9
10
  ) {
10
- const { enr } = await createBootnodeENRandPeerId(privateKey, udpAnnounceAddress, l1ChainId);
11
+ const { enr } = await createBootnodeENRandPeerId(privateKey, p2pIp, p2pPort, l1ChainId);
11
12
  log(`ENR: ${enr.encodeTxt()}`);
12
13
  }
@@ -1,12 +1,12 @@
1
- import { computeSecretHash } from '@aztec/aztec.js';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { computeSecretHash } from '@aztec/aztec.js/crypto';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
4
 
5
- export function generateSecretAndHash(log: LogFn) {
5
+ export async function generateSecretAndHash(log: LogFn) {
6
6
  const secret = Fr.random();
7
7
 
8
8
  // We hash this the same way that aztec nr hash does.
9
- const secretHash = computeSecretHash(secret);
9
+ const secretHash = await computeSecretHash(secret);
10
10
 
11
11
  log(`
12
12
  Secret: ${secret}
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/aztec.js';
1
+ import { Fr } from '@aztec/aztec.js/fields';
2
2
 
3
3
  export function generateSecretKey() {
4
4
  return { secretKey: Fr.random() };
@@ -0,0 +1,7 @@
1
+ import type { LogFn } from '@aztec/foundation/log';
2
+
3
+ import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
4
+
5
+ export async function getCanonicalSponsoredFPCAddress(log: LogFn) {
6
+ log(`Canonical SponsoredFPC Address: ${(await getSponsoredFPCAddress()).toString()}`);
7
+ }