@aztec/cli 0.17.0 → 0.77.0-testnet-ignition.17

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 (325) hide show
  1. package/README.md +10 -16
  2. package/dest/cmds/contracts/index.d.ts +4 -0
  3. package/dest/cmds/contracts/index.d.ts.map +1 -0
  4. package/dest/cmds/contracts/index.js +12 -0
  5. package/dest/cmds/contracts/inspect_contract.d.ts +3 -0
  6. package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -0
  7. package/dest/cmds/contracts/inspect_contract.js +37 -0
  8. package/dest/cmds/{parse_parameter_struct.d.ts → contracts/parse_parameter_struct.d.ts} +1 -4
  9. package/dest/cmds/contracts/parse_parameter_struct.d.ts.map +1 -0
  10. package/dest/cmds/contracts/parse_parameter_struct.js +13 -0
  11. package/dest/cmds/devnet/bootstrap_network.d.ts +3 -0
  12. package/dest/cmds/devnet/bootstrap_network.d.ts.map +1 -0
  13. package/dest/cmds/devnet/bootstrap_network.js +196 -0
  14. package/dest/cmds/devnet/faucet.d.ts +4 -0
  15. package/dest/cmds/devnet/faucet.d.ts.map +1 -0
  16. package/dest/cmds/devnet/faucet.js +26 -0
  17. package/dest/cmds/devnet/index.d.ts +4 -0
  18. package/dest/cmds/devnet/index.d.ts.map +1 -0
  19. package/dest/cmds/devnet/index.js +14 -0
  20. package/dest/cmds/infrastructure/index.d.ts +4 -0
  21. package/dest/cmds/infrastructure/index.d.ts.map +1 -0
  22. package/dest/cmds/infrastructure/index.js +24 -0
  23. package/dest/cmds/infrastructure/sequencers.d.ts +13 -0
  24. package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -0
  25. package/dest/cmds/infrastructure/sequencers.js +93 -0
  26. package/dest/cmds/infrastructure/setup_l2_contract.d.ts +3 -0
  27. package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -0
  28. package/dest/cmds/infrastructure/setup_l2_contract.js +43 -0
  29. package/dest/cmds/l1/advance_epoch.d.ts +3 -0
  30. package/dest/cmds/l1/advance_epoch.d.ts.map +1 -0
  31. package/dest/cmds/l1/advance_epoch.js +10 -0
  32. package/dest/cmds/l1/assume_proven_through.d.ts +3 -0
  33. package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -0
  34. package/dest/cmds/l1/assume_proven_through.js +12 -0
  35. package/dest/cmds/l1/bridge_erc20.d.ts +4 -0
  36. package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -0
  37. package/dest/cmds/l1/bridge_erc20.js +31 -0
  38. package/dest/cmds/l1/create_l1_account.d.ts +3 -0
  39. package/dest/cmds/l1/create_l1_account.d.ts.map +1 -0
  40. package/dest/cmds/l1/create_l1_account.js +15 -0
  41. package/dest/cmds/l1/deploy_l1_contracts.d.ts +4 -0
  42. package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -0
  43. package/dest/cmds/l1/deploy_l1_contracts.js +29 -0
  44. package/dest/cmds/l1/deploy_l1_verifier.d.ts +5 -0
  45. package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +1 -0
  46. package/dest/cmds/l1/deploy_l1_verifier.js +54 -0
  47. package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -0
  48. package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -0
  49. package/dest/cmds/l1/deploy_new_rollup.js +19 -0
  50. package/dest/cmds/l1/get_l1_addresses.d.ts +4 -0
  51. package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -0
  52. package/dest/cmds/l1/get_l1_addresses.js +18 -0
  53. package/dest/cmds/l1/get_l1_balance.d.ts +4 -0
  54. package/dest/cmds/l1/get_l1_balance.d.ts.map +1 -0
  55. package/dest/cmds/l1/get_l1_balance.js +33 -0
  56. package/dest/cmds/l1/governance_utils.d.ts +50 -0
  57. package/dest/cmds/l1/governance_utils.d.ts.map +1 -0
  58. package/dest/cmds/l1/governance_utils.js +85 -0
  59. package/dest/cmds/l1/index.d.ts +4 -0
  60. package/dest/cmds/l1/index.d.ts.map +1 -0
  61. package/dest/cmds/l1/index.js +208 -0
  62. package/dest/cmds/l1/prover_stats.d.ts +14 -0
  63. package/dest/cmds/l1/prover_stats.d.ts.map +1 -0
  64. package/dest/cmds/l1/prover_stats.js +145 -0
  65. package/dest/cmds/l1/update_l1_validators.d.ts +30 -0
  66. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -0
  67. package/dest/cmds/l1/update_l1_validators.js +186 -0
  68. package/dest/cmds/misc/compute_selector.d.ts +3 -0
  69. package/dest/cmds/misc/compute_selector.d.ts.map +1 -0
  70. package/dest/cmds/misc/compute_selector.js +5 -0
  71. package/dest/cmds/misc/example_contracts.d.ts +3 -0
  72. package/dest/cmds/misc/example_contracts.d.ts.map +1 -0
  73. package/dest/cmds/misc/example_contracts.js +6 -0
  74. package/dest/cmds/misc/generate_bootnode_enr.d.ts +3 -0
  75. package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -0
  76. package/dest/cmds/misc/generate_bootnode_enr.js +5 -0
  77. package/dest/cmds/misc/generate_p2p_private_key.d.ts +3 -0
  78. package/dest/cmds/misc/generate_p2p_private_key.d.ts.map +1 -0
  79. package/dest/cmds/misc/generate_p2p_private_key.js +7 -0
  80. package/dest/cmds/misc/generate_secret_and_hash.d.ts +3 -0
  81. package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -0
  82. package/dest/cmds/misc/generate_secret_and_hash.js +11 -0
  83. package/dest/cmds/misc/generate_secret_key.d.ts +5 -0
  84. package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -0
  85. package/dest/cmds/misc/generate_secret_key.js +6 -0
  86. package/dest/cmds/misc/index.d.ts +4 -0
  87. package/dest/cmds/misc/index.d.ts.map +1 -0
  88. package/dest/cmds/misc/index.js +44 -0
  89. package/dest/cmds/misc/setup_contracts.d.ts +7 -0
  90. package/dest/cmds/misc/setup_contracts.d.ts.map +1 -0
  91. package/dest/cmds/misc/setup_contracts.js +27 -0
  92. package/dest/cmds/misc/update/common.d.ts.map +1 -0
  93. package/dest/cmds/misc/update/common.js +3 -0
  94. package/dest/cmds/misc/update/github.d.ts.map +1 -0
  95. package/dest/cmds/misc/update/github.js +3 -0
  96. package/dest/{update → cmds/misc/update}/noir.d.ts +2 -2
  97. package/dest/cmds/misc/update/noir.d.ts.map +1 -0
  98. package/dest/cmds/misc/update/noir.js +45 -0
  99. package/dest/{update → cmds/misc/update}/npm.d.ts +3 -3
  100. package/dest/cmds/misc/update/npm.d.ts.map +1 -0
  101. package/dest/cmds/misc/update/npm.js +127 -0
  102. package/dest/cmds/misc/update/utils.d.ts +14 -0
  103. package/dest/cmds/misc/update/utils.d.ts.map +1 -0
  104. package/dest/cmds/misc/update/utils.js +38 -0
  105. package/dest/cmds/misc/update.d.ts +3 -0
  106. package/dest/cmds/misc/update.d.ts.map +1 -0
  107. package/dest/cmds/misc/update.js +52 -0
  108. package/dest/cmds/pxe/add_contract.d.ts +5 -0
  109. package/dest/cmds/pxe/add_contract.d.ts.map +1 -0
  110. package/dest/cmds/pxe/add_contract.js +29 -0
  111. package/dest/cmds/pxe/block_number.d.ts +3 -0
  112. package/dest/cmds/pxe/block_number.d.ts.map +1 -0
  113. package/dest/cmds/pxe/block_number.js +10 -0
  114. package/dest/cmds/pxe/get_account.d.ts +4 -0
  115. package/dest/cmds/pxe/get_account.d.ts.map +1 -0
  116. package/dest/cmds/pxe/get_account.js +10 -0
  117. package/dest/cmds/pxe/get_accounts.d.ts +3 -0
  118. package/dest/cmds/pxe/get_accounts.d.ts.map +1 -0
  119. package/dest/cmds/pxe/get_accounts.js +25 -0
  120. package/dest/cmds/pxe/get_block.d.ts +3 -0
  121. package/dest/cmds/pxe/get_block.d.ts.map +1 -0
  122. package/dest/cmds/pxe/get_block.js +9 -0
  123. package/dest/cmds/pxe/get_contract_data.d.ts +4 -0
  124. package/dest/cmds/pxe/get_contract_data.d.ts.map +1 -0
  125. package/dest/cmds/pxe/get_contract_data.js +31 -0
  126. package/dest/cmds/pxe/get_current_base_fee.d.ts +3 -0
  127. package/dest/cmds/pxe/get_current_base_fee.d.ts.map +1 -0
  128. package/dest/cmds/pxe/get_current_base_fee.js +7 -0
  129. package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +4 -0
  130. package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +1 -0
  131. package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +11 -0
  132. package/dest/cmds/pxe/get_logs.d.ts +4 -0
  133. package/dest/cmds/pxe/get_logs.d.ts.map +1 -0
  134. package/dest/cmds/pxe/get_logs.js +51 -0
  135. package/dest/cmds/pxe/get_node_info.d.ts +3 -0
  136. package/dest/cmds/pxe/get_node_info.d.ts.map +1 -0
  137. package/dest/cmds/pxe/get_node_info.js +61 -0
  138. package/dest/cmds/pxe/get_pxe_info.d.ts +3 -0
  139. package/dest/cmds/pxe/get_pxe_info.d.ts.map +1 -0
  140. package/dest/cmds/pxe/get_pxe_info.js +11 -0
  141. package/dest/cmds/pxe/index.d.ts +4 -0
  142. package/dest/cmds/pxe/index.d.ts.map +1 -0
  143. package/dest/cmds/pxe/index.js +55 -0
  144. package/dest/utils/aztec.d.ts +68 -0
  145. package/dest/utils/aztec.d.ts.map +1 -0
  146. package/dest/utils/aztec.js +173 -0
  147. package/dest/{parse_args.d.ts → utils/commands.d.ts} +50 -12
  148. package/dest/utils/commands.d.ts.map +1 -0
  149. package/dest/utils/commands.js +303 -0
  150. package/dest/{encoding.d.ts → utils/encoding.d.ts} +1 -1
  151. package/dest/utils/encoding.d.ts.map +1 -0
  152. package/dest/utils/encoding.js +103 -0
  153. package/dest/utils/github.d.ts +4 -0
  154. package/dest/utils/github.d.ts.map +1 -0
  155. package/dest/utils/github.js +3 -0
  156. package/dest/utils/index.d.ts +5 -0
  157. package/dest/utils/index.d.ts.map +1 -0
  158. package/dest/utils/index.js +4 -0
  159. package/dest/utils/inspect.d.ts +17 -0
  160. package/dest/utils/inspect.d.ts.map +1 -0
  161. package/dest/utils/inspect.js +177 -0
  162. package/package.json +68 -22
  163. package/src/cmds/contracts/index.ts +34 -0
  164. package/src/cmds/contracts/inspect_contract.ts +51 -0
  165. package/src/cmds/contracts/parse_parameter_struct.ts +27 -0
  166. package/src/cmds/devnet/bootstrap_network.ts +318 -0
  167. package/src/cmds/devnet/faucet.ts +33 -0
  168. package/src/cmds/devnet/index.ts +60 -0
  169. package/src/cmds/infrastructure/index.ts +55 -0
  170. package/src/cmds/infrastructure/sequencers.ts +103 -0
  171. package/src/cmds/infrastructure/setup_l2_contract.ts +47 -0
  172. package/src/cmds/l1/advance_epoch.ts +12 -0
  173. package/src/cmds/l1/assume_proven_through.ts +19 -0
  174. package/src/cmds/l1/bridge_erc20.ts +52 -0
  175. package/src/cmds/l1/create_l1_account.ts +17 -0
  176. package/src/cmds/l1/deploy_l1_contracts.ts +63 -0
  177. package/src/cmds/l1/deploy_l1_verifier.ts +105 -0
  178. package/src/cmds/l1/deploy_new_rollup.ts +58 -0
  179. package/src/cmds/l1/get_l1_addresses.ts +30 -0
  180. package/src/cmds/l1/get_l1_balance.ts +44 -0
  181. package/src/cmds/l1/governance_utils.ts +187 -0
  182. package/src/cmds/l1/index.ts +556 -0
  183. package/src/cmds/l1/prover_stats.ts +202 -0
  184. package/src/cmds/l1/update_l1_validators.ts +238 -0
  185. package/src/cmds/misc/compute_selector.ts +7 -0
  186. package/src/cmds/misc/example_contracts.ts +12 -0
  187. package/src/cmds/misc/generate_bootnode_enr.ts +12 -0
  188. package/src/cmds/misc/generate_p2p_private_key.ts +10 -0
  189. package/src/cmds/misc/generate_secret_and_hash.ts +15 -0
  190. package/src/cmds/misc/generate_secret_key.ts +5 -0
  191. package/src/cmds/misc/index.ts +92 -0
  192. package/src/cmds/misc/setup_contracts.ts +40 -0
  193. package/src/cmds/misc/update/common.ts +16 -0
  194. package/src/cmds/misc/update/github.ts +3 -0
  195. package/src/cmds/misc/update/noir.ts +57 -0
  196. package/src/cmds/misc/update/npm.ts +154 -0
  197. package/src/cmds/misc/update/utils.ts +50 -0
  198. package/src/cmds/misc/update.ts +78 -0
  199. package/src/cmds/pxe/add_contract.ts +41 -0
  200. package/src/cmds/pxe/block_number.ts +9 -0
  201. package/src/cmds/pxe/get_account.ts +16 -0
  202. package/src/cmds/pxe/get_accounts.ts +35 -0
  203. package/src/cmds/pxe/get_block.ts +10 -0
  204. package/src/cmds/pxe/get_contract_data.ts +51 -0
  205. package/src/cmds/pxe/get_current_base_fee.ts +9 -0
  206. package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +25 -0
  207. package/src/cmds/pxe/get_logs.ts +66 -0
  208. package/src/cmds/pxe/get_node_info.ts +71 -0
  209. package/src/cmds/pxe/get_pxe_info.ts +13 -0
  210. package/src/cmds/pxe/index.ts +170 -0
  211. package/src/utils/aztec.ts +248 -0
  212. package/src/utils/commands.ts +384 -0
  213. package/src/utils/encoding.ts +117 -0
  214. package/src/utils/github.ts +3 -0
  215. package/src/utils/index.ts +4 -0
  216. package/src/utils/inspect.ts +208 -0
  217. package/dest/bin/index.d.ts +0 -3
  218. package/dest/bin/index.d.ts.map +0 -1
  219. package/dest/bin/index.js +0 -19
  220. package/dest/client.d.ts +0 -17
  221. package/dest/client.d.ts.map +0 -1
  222. package/dest/client.js +0 -60
  223. package/dest/cmds/add_contract.d.ts +0 -7
  224. package/dest/cmds/add_contract.d.ts.map +0 -1
  225. package/dest/cmds/add_contract.js +0 -15
  226. package/dest/cmds/add_note.d.ts +0 -8
  227. package/dest/cmds/add_note.d.ts.map +0 -1
  228. package/dest/cmds/add_note.js +0 -13
  229. package/dest/cmds/block_number.d.ts +0 -6
  230. package/dest/cmds/block_number.d.ts.map +0 -1
  231. package/dest/cmds/block_number.js +0 -10
  232. package/dest/cmds/call.d.ts +0 -7
  233. package/dest/cmds/call.d.ts.map +0 -1
  234. package/dest/cmds/call.js +0 -18
  235. package/dest/cmds/check_deploy.d.ts +0 -7
  236. package/dest/cmds/check_deploy.d.ts.map +0 -1
  237. package/dest/cmds/check_deploy.js +0 -16
  238. package/dest/cmds/compute_selector.d.ts +0 -6
  239. package/dest/cmds/compute_selector.d.ts.map +0 -1
  240. package/dest/cmds/compute_selector.js +0 -9
  241. package/dest/cmds/create_account.d.ts +0 -7
  242. package/dest/cmds/create_account.d.ts.map +0 -1
  243. package/dest/cmds/create_account.js +0 -31
  244. package/dest/cmds/deploy.d.ts +0 -7
  245. package/dest/cmds/deploy.d.ts.map +0 -1
  246. package/dest/cmds/deploy.js +0 -58
  247. package/dest/cmds/deploy_l1_contracts.d.ts +0 -6
  248. package/dest/cmds/deploy_l1_contracts.d.ts.map +0 -1
  249. package/dest/cmds/deploy_l1_contracts.js +0 -15
  250. package/dest/cmds/example_contracts.d.ts +0 -6
  251. package/dest/cmds/example_contracts.d.ts.map +0 -1
  252. package/dest/cmds/example_contracts.js +0 -10
  253. package/dest/cmds/generate_p2p_private_key.d.ts +0 -6
  254. package/dest/cmds/generate_p2p_private_key.d.ts.map +0 -1
  255. package/dest/cmds/generate_p2p_private_key.js +0 -11
  256. package/dest/cmds/generate_private_key.d.ts +0 -6
  257. package/dest/cmds/generate_private_key.d.ts.map +0 -1
  258. package/dest/cmds/generate_private_key.js +0 -22
  259. package/dest/cmds/get_account.d.ts +0 -7
  260. package/dest/cmds/get_account.d.ts.map +0 -1
  261. package/dest/cmds/get_account.js +0 -15
  262. package/dest/cmds/get_accounts.d.ts +0 -6
  263. package/dest/cmds/get_accounts.d.ts.map +0 -1
  264. package/dest/cmds/get_accounts.js +0 -18
  265. package/dest/cmds/get_contract_data.d.ts +0 -7
  266. package/dest/cmds/get_contract_data.d.ts.map +0 -1
  267. package/dest/cmds/get_contract_data.js +0 -28
  268. package/dest/cmds/get_logs.d.ts +0 -7
  269. package/dest/cmds/get_logs.d.ts.map +0 -1
  270. package/dest/cmds/get_logs.js +0 -54
  271. package/dest/cmds/get_node_info.d.ts +0 -6
  272. package/dest/cmds/get_node_info.d.ts.map +0 -1
  273. package/dest/cmds/get_node_info.js +0 -15
  274. package/dest/cmds/get_recipient.d.ts +0 -7
  275. package/dest/cmds/get_recipient.d.ts.map +0 -1
  276. package/dest/cmds/get_recipient.js +0 -15
  277. package/dest/cmds/get_recipients.d.ts +0 -6
  278. package/dest/cmds/get_recipients.d.ts.map +0 -1
  279. package/dest/cmds/get_recipients.js +0 -18
  280. package/dest/cmds/get_tx_receipt.d.ts +0 -7
  281. package/dest/cmds/get_tx_receipt.d.ts.map +0 -1
  282. package/dest/cmds/get_tx_receipt.js +0 -16
  283. package/dest/cmds/inspect_contract.d.ts +0 -6
  284. package/dest/cmds/inspect_contract.d.ts.map +0 -1
  285. package/dest/cmds/inspect_contract.js +0 -19
  286. package/dest/cmds/parse_parameter_struct.d.ts.map +0 -1
  287. package/dest/cmds/parse_parameter_struct.js +0 -20
  288. package/dest/cmds/register_account.d.ts +0 -7
  289. package/dest/cmds/register_account.d.ts.map +0 -1
  290. package/dest/cmds/register_account.js +0 -13
  291. package/dest/cmds/register_recipient.d.ts +0 -7
  292. package/dest/cmds/register_recipient.d.ts.map +0 -1
  293. package/dest/cmds/register_recipient.js +0 -11
  294. package/dest/cmds/send.d.ts +0 -7
  295. package/dest/cmds/send.d.ts.map +0 -1
  296. package/dest/cmds/send.js +0 -27
  297. package/dest/cmds/unbox.d.ts +0 -7
  298. package/dest/cmds/unbox.d.ts.map +0 -1
  299. package/dest/cmds/unbox.js +0 -133
  300. package/dest/encoding.d.ts.map +0 -1
  301. package/dest/encoding.js +0 -114
  302. package/dest/github.d.ts.map +0 -1
  303. package/dest/github.js +0 -4
  304. package/dest/index.d.ts +0 -10
  305. package/dest/index.d.ts.map +0 -1
  306. package/dest/index.js +0 -321
  307. package/dest/parse_args.d.ts.map +0 -1
  308. package/dest/parse_args.js +0 -233
  309. package/dest/test/mocks.d.ts +0 -3
  310. package/dest/test/mocks.d.ts.map +0 -1
  311. package/dest/test/mocks.js +0 -65
  312. package/dest/update/common.d.ts.map +0 -1
  313. package/dest/update/common.js +0 -2
  314. package/dest/update/noir.d.ts.map +0 -1
  315. package/dest/update/noir.js +0 -63
  316. package/dest/update/npm.d.ts.map +0 -1
  317. package/dest/update/npm.js +0 -125
  318. package/dest/update/update.d.ts +0 -3
  319. package/dest/update/update.d.ts.map +0 -1
  320. package/dest/update/update.js +0 -58
  321. package/dest/utils.d.ts +0 -70
  322. package/dest/utils.d.ts.map +0 -1
  323. package/dest/utils.js +0 -168
  324. /package/dest/{update → cmds/misc/update}/common.d.ts +0 -0
  325. /package/dest/{github.d.ts → cmds/misc/update/github.d.ts} +0 -0
@@ -0,0 +1,202 @@
1
+ import { retrieveL2ProofVerifiedEvents } from '@aztec/archiver';
2
+ import { type ViemPublicClient, createEthereumChain } from '@aztec/ethereum';
3
+ import { compactArray, mapValues, unique } from '@aztec/foundation/collection';
4
+ import { EthAddress } from '@aztec/foundation/eth-address';
5
+ import { type LogFn, type Logger, createLogger } from '@aztec/foundation/log';
6
+ import { RollupAbi } from '@aztec/l1-artifacts';
7
+ import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
8
+
9
+ import chunk from 'lodash.chunk';
10
+ import groupBy from 'lodash.groupby';
11
+ import { createPublicClient, fallback, getAbiItem, getAddress, http } from 'viem';
12
+
13
+ export async function proverStats(opts: {
14
+ l1RpcUrls: string[];
15
+ chainId: number;
16
+ l1RollupAddress: string | undefined;
17
+ nodeUrl: string | undefined;
18
+ log: LogFn;
19
+ startBlock: bigint;
20
+ endBlock: bigint | undefined;
21
+ batchSize: bigint;
22
+ provingTimeout: bigint | undefined;
23
+ rawLogs: boolean;
24
+ }) {
25
+ const debugLog = createLogger('cli:prover_stats');
26
+ const {
27
+ startBlock,
28
+ chainId,
29
+ l1RpcUrls,
30
+ l1RollupAddress,
31
+ batchSize,
32
+ nodeUrl,
33
+ provingTimeout,
34
+ endBlock,
35
+ rawLogs,
36
+ log,
37
+ } = opts;
38
+ if (!l1RollupAddress && !nodeUrl) {
39
+ throw new Error('Either L1 rollup address or node URL must be set');
40
+ }
41
+
42
+ const rollup = l1RollupAddress
43
+ ? EthAddress.fromString(l1RollupAddress)
44
+ : await createAztecNodeClient(nodeUrl!)
45
+ .getL1ContractAddresses()
46
+ .then(a => a.rollupAddress);
47
+
48
+ const chain = createEthereumChain(l1RpcUrls, chainId).chainInfo;
49
+ const publicClient = createPublicClient({ chain, transport: fallback(l1RpcUrls.map(url => http(url))) });
50
+ const lastBlockNum = endBlock ?? (await publicClient.getBlockNumber());
51
+ debugLog.verbose(`Querying events on rollup at ${rollup.toString()} from ${startBlock} up to ${lastBlockNum}`);
52
+
53
+ // Get all events for L2 proof submissions
54
+ const events = await getL2ProofVerifiedEvents(startBlock, lastBlockNum, batchSize, debugLog, publicClient, rollup);
55
+
56
+ // If we only care for raw logs, output them
57
+ if (rawLogs && !provingTimeout) {
58
+ log(`l1_block_number, l2_block_number, prover_id, tx_hash`);
59
+ for (const event of events) {
60
+ const { l1BlockNumber, l2BlockNumber, proverId, txHash } = event;
61
+ log(`${l1BlockNumber}, ${l2BlockNumber}, ${proverId}, ${txHash}`);
62
+ }
63
+ return;
64
+ }
65
+
66
+ // If we don't have a proving timeout, we can just count the number of unique blocks per prover
67
+ if (!provingTimeout) {
68
+ const stats = groupBy(events, 'proverId');
69
+ log(`prover_id, total_blocks_proven`);
70
+ for (const proverId in stats) {
71
+ const uniqueBlocks = new Set(stats[proverId].map(e => e.l2BlockNumber));
72
+ log(`${proverId}, ${uniqueBlocks.size}`);
73
+ }
74
+ return;
75
+ }
76
+
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);
79
+ debugLog.verbose(
80
+ `First L2 block within range is ${blockEvents[0]?.args.blockNumber} at L1 block ${blockEvents[0]?.blockNumber}`,
81
+ );
82
+
83
+ // 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)]);
85
+ const l1BlockTimestamps: Record<string, bigint> = {};
86
+ for (const l1Batch of chunk(l1BlockNumbers, Number(batchSize))) {
87
+ const blocks = await Promise.all(
88
+ l1Batch.map(blockNumber => publicClient.getBlock({ includeTransactions: false, blockNumber })),
89
+ );
90
+ debugLog.verbose(`Queried ${blocks.length} L1 blocks between ${l1Batch[0]} and ${l1Batch[l1Batch.length - 1]}`);
91
+ for (const block of blocks) {
92
+ l1BlockTimestamps[block.number.toString()] = block.timestamp;
93
+ }
94
+ }
95
+
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;
100
+ }
101
+
102
+ // If we want raw logs, output them
103
+ if (rawLogs) {
104
+ log(`l1_block_number, l2_block_number, l2_block_submission_timestamp, proof_timestamp, prover_id, tx_hash`);
105
+ for (const event of events) {
106
+ const { l1BlockNumber, l2BlockNumber, proverId, txHash } = event;
107
+ const uploadedBlockNumber = l2BlockSubmissions[l2BlockNumber.toString()];
108
+ if (!uploadedBlockNumber) {
109
+ continue;
110
+ }
111
+ const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
112
+ const provenTimestamp = l1BlockTimestamps[l1BlockNumber.toString()];
113
+ log(`${l1BlockNumber}, ${l2BlockNumber}, ${uploadedTimestamp}, ${provenTimestamp}, ${proverId}, ${txHash}`);
114
+ }
115
+ return;
116
+ }
117
+
118
+ // Or calculate stats per prover
119
+ const stats = mapValues(groupBy(events, 'proverId'), (blocks, proverId) =>
120
+ compactArray(
121
+ blocks.map(e => {
122
+ const provenTimestamp = l1BlockTimestamps[e.l1BlockNumber.toString()];
123
+ const uploadedBlockNumber = l2BlockSubmissions[e.l2BlockNumber.toString()];
124
+ if (!uploadedBlockNumber) {
125
+ debugLog.verbose(
126
+ `Skipping ${proverId}'s proof for L2 block ${e.l2BlockNumber} as it was before the start block`,
127
+ );
128
+ return undefined;
129
+ }
130
+ const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
131
+ const provingTime = provenTimestamp - uploadedTimestamp;
132
+ debugLog.debug(
133
+ `prover=${e.proverId} blockNumber=${e.l2BlockNumber} uploaded=${uploadedTimestamp} proven=${provenTimestamp} time=${provingTime}`,
134
+ );
135
+ return { provenTimestamp, uploadedTimestamp, provingTime, ...e };
136
+ }),
137
+ ),
138
+ );
139
+
140
+ log(`prover_id, blocks_proven_within_timeout, total_blocks_proven, avg_proving_time`);
141
+ for (const proverId in stats) {
142
+ const blocks = stats[proverId];
143
+ 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));
146
+ const avgProvingTime =
147
+ blocks.length === 0 ? 0 : Math.ceil(Number(blocks.reduce((acc, b) => acc + b.provingTime, 0n)) / blocks.length);
148
+
149
+ log(`${proverId}, ${uniqueBlocksWithinTimeout.size}, ${uniqueBlocks.size}, ${avgProvingTime}`);
150
+ }
151
+ return;
152
+ }
153
+
154
+ async function getL2ProofVerifiedEvents(
155
+ startBlock: bigint,
156
+ lastBlockNum: bigint,
157
+ batchSize: bigint,
158
+ debugLog: Logger,
159
+ publicClient: ViemPublicClient,
160
+ rollup: EthAddress,
161
+ ) {
162
+ let blockNum = startBlock;
163
+ const events = [];
164
+ while (blockNum <= lastBlockNum) {
165
+ const end = blockNum + batchSize > lastBlockNum + 1n ? lastBlockNum + 1n : blockNum + batchSize;
166
+ const newEvents = await retrieveL2ProofVerifiedEvents(publicClient, rollup, blockNum, end);
167
+ events.push(...newEvents);
168
+ debugLog.verbose(`Got ${newEvents.length} events querying l2 proof verified from block ${blockNum} to ${end}`);
169
+ blockNum += batchSize;
170
+ }
171
+ return events;
172
+ }
173
+
174
+ async function getL2BlockEvents(
175
+ startBlock: bigint,
176
+ lastBlockNum: bigint,
177
+ batchSize: bigint,
178
+ debugLog: Logger,
179
+ publicClient: ViemPublicClient,
180
+ rollup: EthAddress,
181
+ ) {
182
+ let blockNum = startBlock;
183
+ const events = [];
184
+ while (blockNum <= lastBlockNum) {
185
+ const end = blockNum + batchSize > lastBlockNum + 1n ? lastBlockNum + 1n : blockNum + batchSize;
186
+
187
+ const newEvents = await publicClient.getLogs({
188
+ address: getAddress(rollup.toString()),
189
+ event: getAbiItem({
190
+ abi: RollupAbi,
191
+ name: 'L2BlockProposed',
192
+ }),
193
+ fromBlock: blockNum,
194
+ toBlock: end,
195
+ });
196
+
197
+ events.push(...newEvents);
198
+ debugLog.verbose(`Got ${newEvents.length} events querying l2 block submitted from block ${blockNum} to ${end}`);
199
+ blockNum += batchSize;
200
+ }
201
+ return events;
202
+ }
@@ -0,0 +1,238 @@
1
+ import {
2
+ EthCheatCodes,
3
+ createEthereumChain,
4
+ getExpectedAddress,
5
+ getL1ContractsConfigEnvVars,
6
+ isAnvilTestChain,
7
+ } from '@aztec/ethereum';
8
+ import type { EthAddress } from '@aztec/foundation/eth-address';
9
+ import type { LogFn, Logger } from '@aztec/foundation/log';
10
+ import { ForwarderAbi, ForwarderBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
11
+
12
+ import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
13
+ import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
14
+
15
+ export interface RollupCommandArgs {
16
+ rpcUrls: string[];
17
+ chainId: number;
18
+ privateKey?: string;
19
+ mnemonic?: string;
20
+ rollupAddress: EthAddress;
21
+ withdrawerAddress?: EthAddress;
22
+ }
23
+
24
+ export interface LoggerArgs {
25
+ log: LogFn;
26
+ debugLogger: Logger;
27
+ }
28
+
29
+ export function generateL1Account() {
30
+ const privateKey = generatePrivateKey();
31
+ const account = privateKeyToAccount(privateKey);
32
+ account.address;
33
+ return {
34
+ privateKey,
35
+ address: account.address,
36
+ };
37
+ }
38
+
39
+ export async function addL1Validator({
40
+ rpcUrls,
41
+ chainId,
42
+ privateKey,
43
+ mnemonic,
44
+ validatorAddress,
45
+ rollupAddress,
46
+ withdrawerAddress,
47
+ log,
48
+ debugLogger,
49
+ }: RollupCommandArgs & LoggerArgs & { validatorAddress: EthAddress }) {
50
+ const config = getL1ContractsConfigEnvVars();
51
+ const dualLog = makeDualLog(log, debugLogger);
52
+ const publicClient = getPublicClient(rpcUrls, chainId);
53
+ const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
54
+ const rollup = getContract({
55
+ address: rollupAddress.toString(),
56
+ abi: RollupAbi,
57
+ client: walletClient,
58
+ });
59
+
60
+ const stakingAsset = getContract({
61
+ address: await rollup.read.getStakingAsset(),
62
+ abi: TestERC20Abi,
63
+ client: walletClient,
64
+ });
65
+
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 });
84
+ if (isAnvilTestChain(chainId)) {
85
+ dualLog(`Funding validator on L1`);
86
+ const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
87
+ await cheatCodes.setBalance(validatorAddress, 10n ** 20n);
88
+ } 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!`);
94
+ }
95
+ }
96
+ }
97
+
98
+ export async function removeL1Validator({
99
+ rpcUrls,
100
+ chainId,
101
+ privateKey,
102
+ mnemonic,
103
+ validatorAddress,
104
+ rollupAddress,
105
+ log,
106
+ debugLogger,
107
+ }: RollupCommandArgs & LoggerArgs & { validatorAddress: EthAddress }) {
108
+ 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
+ });
116
+
117
+ 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 });
121
+ }
122
+
123
+ export async function pruneRollup({
124
+ rpcUrls,
125
+ chainId,
126
+ privateKey,
127
+ mnemonic,
128
+ rollupAddress,
129
+ log,
130
+ debugLogger,
131
+ }: RollupCommandArgs & LoggerArgs) {
132
+ 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
+ });
140
+
141
+ dualLog(`Trying prune`);
142
+ const txHash = await rollup.write.prune();
143
+ dualLog(`Transaction hash: ${txHash}`);
144
+ await publicClient.waitForTransactionReceipt({ hash: txHash });
145
+ }
146
+
147
+ export async function fastForwardEpochs({
148
+ rpcUrls,
149
+ chainId,
150
+ rollupAddress,
151
+ numEpochs,
152
+ log,
153
+ debugLogger,
154
+ }: RollupCommandArgs & LoggerArgs & { numEpochs: bigint }) {
155
+ const dualLog = makeDualLog(log, debugLogger);
156
+ const publicClient = getPublicClient(rpcUrls, chainId);
157
+ const rollup = getContract({
158
+ address: rollupAddress.toString(),
159
+ abi: RollupAbi,
160
+ client: publicClient,
161
+ });
162
+
163
+ const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
164
+ const currentSlot = await rollup.read.getCurrentSlot();
165
+ const l2SlotsInEpoch = await rollup.read.getEpochDuration();
166
+ const timestamp = await rollup.read.getTimestampForSlot([currentSlot + l2SlotsInEpoch * numEpochs]);
167
+ dualLog(`Fast forwarding ${numEpochs} epochs to ${timestamp}`);
168
+ try {
169
+ await cheatCodes.warp(Number(timestamp));
170
+ dualLog(`Fast forwarded ${numEpochs} epochs to ${timestamp}`);
171
+ } catch (error) {
172
+ if (error instanceof Error && error.message.includes("is lower than or equal to previous block's timestamp")) {
173
+ dualLog(`Someone else fast forwarded the chain to a point after/equal to the target time`);
174
+ } else {
175
+ // Re-throw other errors
176
+ throw error;
177
+ }
178
+ }
179
+ }
180
+
181
+ export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }: RollupCommandArgs & LoggerArgs) {
182
+ const config = getL1ContractsConfigEnvVars();
183
+ const publicClient = getPublicClient(rpcUrls, chainId);
184
+ const rollup = getContract({
185
+ address: rollupAddress.toString(),
186
+ abi: RollupAbi,
187
+ client: publicClient,
188
+ });
189
+
190
+ const pendingNum = await rollup.read.getPendingBlockNumber();
191
+ log(`Pending block num: ${pendingNum}`);
192
+ const provenNum = await rollup.read.getProvenBlockNumber();
193
+ log(`Proven block num: ${provenNum}`);
194
+ const validators = await rollup.read.getAttesters();
195
+ 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();
199
+ log(`Archive: ${archive}`);
200
+ const epochNum = await rollup.read.getCurrentEpoch();
201
+ log(`Current epoch: ${epochNum}`);
202
+ const slot = await rollup.read.getCurrentSlot();
203
+ log(`Current slot: ${slot}`);
204
+ const proposerDuringPrevL1Block = await rollup.read.getCurrentProposer();
205
+ log(`Proposer during previous L1 block: ${proposerDuringPrevL1Block}`);
206
+ const nextBlockTS = BigInt((await publicClient.getBlock()).timestamp + BigInt(config.ethereumSlotDuration));
207
+ const proposer = await rollup.read.getProposerAt([nextBlockTS]);
208
+ log(`Proposer NOW: ${proposer.toString()}`);
209
+ }
210
+
211
+ function makeDualLog(log: LogFn, debugLogger: Logger) {
212
+ return (msg: string) => {
213
+ log(msg);
214
+ debugLogger.info(msg);
215
+ };
216
+ }
217
+
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
+ ) {
229
+ if (!privateKey && !mnemonic) {
230
+ throw new Error('Either privateKey or mnemonic must be provided to create a wallet client');
231
+ }
232
+
233
+ const chain = createEthereumChain(rpcUrls, chainId);
234
+ const account = !privateKey
235
+ ? mnemonicToAccount(mnemonic!)
236
+ : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}` as `0x${string}`);
237
+ return createWalletClient({ account, chain: chain.chainInfo, transport: fallback(rpcUrls.map(url => http(url))) });
238
+ }
@@ -0,0 +1,7 @@
1
+ import type { LogFn } from '@aztec/foundation/log';
2
+ import { FunctionSelector } from '@aztec/stdlib/abi';
3
+
4
+ export async function computeSelector(functionSignature: string, log: LogFn) {
5
+ const selector = await FunctionSelector.fromSignature(functionSignature);
6
+ log(`${selector}`);
7
+ }
@@ -0,0 +1,12 @@
1
+ import type { LogFn } from '@aztec/foundation/log';
2
+
3
+ import { getExampleContractNames } from '../../utils/aztec.js';
4
+
5
+ export async function exampleContracts(log: LogFn) {
6
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
7
+ // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
8
+ return (await getExampleContractNames())
9
+ .filter(name => name !== 'AvmTest')
10
+ .sort()
11
+ .forEach(name => log(name));
12
+ }
@@ -0,0 +1,12 @@
1
+ import type { LogFn } from '@aztec/foundation/log';
2
+ import { createBootnodeENRandPeerId } from '@aztec/p2p/enr';
3
+
4
+ export async function generateEncodedBootnodeENR(
5
+ privateKey: string,
6
+ udpAnnounceAddress: string,
7
+ l1ChainId: number,
8
+ log: LogFn,
9
+ ) {
10
+ const { enr } = await createBootnodeENRandPeerId(privateKey, udpAnnounceAddress, l1ChainId);
11
+ log(`ENR: ${enr.encodeTxt()}`);
12
+ }
@@ -0,0 +1,10 @@
1
+ import type { LogFn } from '@aztec/foundation/log';
2
+
3
+ import { createSecp256k1PeerId } from '@libp2p/peer-id-factory';
4
+
5
+ export async function generateP2PPrivateKey(log: LogFn) {
6
+ const peerId = await createSecp256k1PeerId();
7
+ const exportedPeerId = Buffer.from(peerId.privateKey!).toString('hex');
8
+ log(`Private key: ${exportedPeerId}`);
9
+ log(`Peer Id: ${peerId}`);
10
+ }
@@ -0,0 +1,15 @@
1
+ import { computeSecretHash } from '@aztec/aztec.js';
2
+ import { Fr } from '@aztec/foundation/fields';
3
+ import type { LogFn } from '@aztec/foundation/log';
4
+
5
+ export function generateSecretAndHash(log: LogFn) {
6
+ const secret = Fr.random();
7
+
8
+ // We hash this the same way that aztec nr hash does.
9
+ const secretHash = computeSecretHash(secret);
10
+
11
+ log(`
12
+ Secret: ${secret}
13
+ Secret hash: ${secretHash}
14
+ `);
15
+ }
@@ -0,0 +1,5 @@
1
+ import { Fr } from '@aztec/aztec.js';
2
+
3
+ export function generateSecretKey() {
4
+ return { secretKey: Fr.random() };
5
+ }
@@ -0,0 +1,92 @@
1
+ import type { LogFn } from '@aztec/foundation/log';
2
+ import { printENR } from '@aztec/p2p/enr';
3
+
4
+ import type { Command } from 'commander';
5
+
6
+ import { l1ChainIdOption, prettyPrintJSON } from '../../utils/commands.js';
7
+
8
+ export function injectCommands(program: Command, log: LogFn) {
9
+ program
10
+ .command('generate-keys')
11
+ .summary('Generates encryption and signing private keys.')
12
+ .description('Generates and encryption and signing private key pair.')
13
+ .option('--json', 'Output the keys in JSON format')
14
+ .action(async ({ json }) => {
15
+ const { generateSecretKey } = await import('./generate_secret_key.js');
16
+ const { secretKey } = generateSecretKey();
17
+ if (json) {
18
+ log(prettyPrintJSON({ secretKey: secretKey.toString() }));
19
+ } else {
20
+ log(`Secret Key: ${secretKey}`);
21
+ }
22
+ });
23
+
24
+ program
25
+ .command('generate-p2p-private-key')
26
+ .summary('Generates a LibP2P peer private key.')
27
+ .description('Generates a private key that can be used for running a node on a LibP2P network.')
28
+ .action(async () => {
29
+ const { generateP2PPrivateKey } = await import('./generate_p2p_private_key.js');
30
+ await generateP2PPrivateKey(log);
31
+ });
32
+
33
+ program
34
+ .command('generate-bootnode-enr')
35
+ .summary('Generates the encoded ENR record for a bootnode.')
36
+ .description('Generates the encoded ENR record for a bootnode.')
37
+ .argument('<privateKey>', 'The peer id private key of the bootnode')
38
+ .argument('<udpAnnounceAddress>', 'The bootnode UDP announce address')
39
+ .addOption(l1ChainIdOption)
40
+ .action(async (privateKey: string, udpAnnounceAddress: string, options) => {
41
+ const { generateEncodedBootnodeENR } = await import('./generate_bootnode_enr.js');
42
+ await generateEncodedBootnodeENR(privateKey, udpAnnounceAddress, options.l1ChainId, log);
43
+ });
44
+
45
+ program
46
+ .command('decode-enr')
47
+ .summary('Decodes an ENR record')
48
+ .description('Decodes and ENR record')
49
+ .argument('<enr>', 'The encoded ENR string')
50
+ .action(async (enr: string) => {
51
+ await printENR(enr, log);
52
+ });
53
+
54
+ program
55
+ .command('example-contracts')
56
+ .description('Lists the example contracts available to deploy from @aztec/noir-contracts.js')
57
+ .action(async () => {
58
+ const { exampleContracts } = await import('./example_contracts.js');
59
+ await exampleContracts(log);
60
+ });
61
+
62
+ program
63
+ .command('compute-selector')
64
+ .description('Given a function signature, it computes a selector')
65
+ .argument('<functionSignature>', 'Function signature to compute selector for e.g. foo(Field)')
66
+ .action(async (functionSignature: string) => {
67
+ const { computeSelector } = await import('./compute_selector.js');
68
+ await computeSelector(functionSignature, log);
69
+ });
70
+
71
+ program
72
+ .command('generate-secret-and-hash')
73
+ .description('Generates an arbitrary secret (Fr), and its hash (using aztec-nr defaults)')
74
+ .action(async () => {
75
+ const { generateSecretAndHash } = await import('./generate_secret_and_hash.js');
76
+ generateSecretAndHash(log);
77
+ });
78
+
79
+ program
80
+ .command('update')
81
+ .description('Updates Nodejs and Noir dependencies')
82
+ .argument('[projectPath]', 'Path to the project directory', process.cwd())
83
+ .option('--contract [paths...]', 'Paths to contracts to update dependencies', [])
84
+ .option('--aztec-version <semver>', 'The version to update Aztec packages to. Defaults to latest', 'latest')
85
+ .action(async (projectPath: string, options) => {
86
+ const { updateProject } = await import('./update.js');
87
+ const { contract, aztecVersion } = options;
88
+ await updateProject(projectPath, contract, aztecVersion, log);
89
+ });
90
+
91
+ return program;
92
+ }
@@ -0,0 +1,40 @@
1
+ import { DefaultWaitOpts, type EthAddress, FeeJuicePaymentMethod, type Wallet } from '@aztec/aztec.js';
2
+ import { FEE_JUICE_INITIAL_MINT } from '@aztec/constants';
3
+ import type { LogFn } from '@aztec/foundation/log';
4
+ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
5
+ import { Gas } from '@aztec/stdlib/gas';
6
+
7
+ /**
8
+ * Deploys the contract to pay for gas on L2.
9
+ */
10
+ export async function setupCanonicalL2FeeJuice(
11
+ deployer: Wallet,
12
+ feeJuicePortalAddress: EthAddress,
13
+ waitOpts = DefaultWaitOpts,
14
+ log: LogFn,
15
+ ) {
16
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
17
+ // @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
18
+ const { FeeJuiceContract } = await import('@aztec/noir-contracts.js/FeeJuice');
19
+
20
+ const feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, deployer);
21
+
22
+ const portalAddress = await deployer.getPublicStorageAt(
23
+ feeJuiceContract.address,
24
+ feeJuiceContract.artifact.storageLayout.portal_address.slot,
25
+ );
26
+
27
+ if (portalAddress.isZero()) {
28
+ log('setupCanonicalL2FeeJuice: Calling initialize on fee juice contract...');
29
+ const paymentMethod = new FeeJuicePaymentMethod(ProtocolContractAddress.FeeJuice);
30
+ await feeJuiceContract.methods
31
+ .initialize(feeJuicePortalAddress, FEE_JUICE_INITIAL_MINT)
32
+ .send({ fee: { paymentMethod, gasSettings: { teardownGasLimits: Gas.empty() } } })
33
+ .wait(waitOpts);
34
+ } else {
35
+ log(
36
+ 'setupCanonicalL2FeeJuice: Fee juice contract already initialized. Fee Juice Portal address: ' +
37
+ portalAddress.toString(),
38
+ );
39
+ }
40
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Tracks changes to dependencies
3
+ */
4
+ export type DependencyChanges = {
5
+ /** Which file was changed */
6
+ file: string;
7
+ /** changes done to the file */
8
+ dependencies: Array<{
9
+ /** Name of the dependency being changed */
10
+ name: string;
11
+ /** Previous version of the dependency */
12
+ from: string;
13
+ /** New version of the dependency (after the update) */
14
+ to: string;
15
+ }>;
16
+ };
@@ -0,0 +1,3 @@
1
+ export const GITHUB_OWNER = 'AztecProtocol';
2
+ export const GITHUB_REPO = 'aztec-packages';
3
+ export const GITHUB_TAG_PREFIX = 'aztec-packages';