@aztec/cli 3.0.0-canary.a9708bd → 3.0.0-devnet.3

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 (173) hide show
  1. package/README.md +1 -427
  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 +9 -0
  8. package/dest/cmds/aztec_node/get_current_base_fee.d.ts +3 -0
  9. package/dest/cmds/aztec_node/get_current_base_fee.d.ts.map +1 -0
  10. package/dest/cmds/aztec_node/get_current_base_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 +6 -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 +3 -8
  20. package/dest/cmds/aztec_node/index.d.ts.map +1 -0
  21. package/dest/cmds/aztec_node/index.js +28 -0
  22. package/dest/cmds/infrastructure/index.d.ts +2 -2
  23. package/dest/cmds/infrastructure/index.d.ts.map +1 -1
  24. package/dest/cmds/infrastructure/index.js +7 -8
  25. package/dest/cmds/infrastructure/sequencers.d.ts +2 -3
  26. package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
  27. package/dest/cmds/infrastructure/sequencers.js +4 -3
  28. package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
  29. package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
  30. package/dest/cmds/infrastructure/setup_l2_contract.js +10 -25
  31. package/dest/cmds/l1/advance_epoch.d.ts +1 -1
  32. package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
  33. package/dest/cmds/l1/advance_epoch.js +6 -5
  34. package/dest/cmds/l1/assume_proven_through.d.ts +1 -1
  35. package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
  36. package/dest/cmds/l1/assume_proven_through.js +7 -6
  37. package/dest/cmds/l1/bridge_erc20.d.ts +1 -1
  38. package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
  39. package/dest/cmds/l1/bridge_erc20.js +1 -1
  40. package/dest/cmds/l1/deploy_l1_contracts.d.ts +2 -2
  41. package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
  42. package/dest/cmds/l1/deploy_l1_contracts.js +5 -5
  43. package/dest/cmds/l1/deploy_new_rollup.d.ts +1 -1
  44. package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
  45. package/dest/cmds/l1/deploy_new_rollup.js +4 -4
  46. package/dest/cmds/l1/get_l1_addresses.d.ts +1 -1
  47. package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
  48. package/dest/cmds/l1/index.d.ts.map +1 -1
  49. package/dest/cmds/l1/index.js +18 -34
  50. package/dest/cmds/l1/update_l1_validators.d.ts +5 -0
  51. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
  52. package/dest/cmds/l1/update_l1_validators.js +67 -6
  53. package/dest/cmds/misc/generate_secret_and_hash.js +1 -1
  54. package/dest/cmds/misc/generate_secret_key.d.ts +1 -1
  55. package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -1
  56. package/dest/cmds/misc/generate_secret_key.js +1 -1
  57. package/dest/config/cached_fetch.d.ts +18 -0
  58. package/dest/config/cached_fetch.d.ts.map +1 -0
  59. package/dest/config/cached_fetch.js +54 -0
  60. package/dest/config/chain_l2_config.d.ts +37 -0
  61. package/dest/config/chain_l2_config.d.ts.map +1 -0
  62. package/dest/config/chain_l2_config.js +444 -0
  63. package/dest/config/enrich_env.d.ts +4 -0
  64. package/dest/config/enrich_env.d.ts.map +1 -0
  65. package/dest/config/enrich_env.js +12 -0
  66. package/dest/config/get_l1_config.d.ts +8 -0
  67. package/dest/config/get_l1_config.d.ts.map +1 -0
  68. package/dest/config/get_l1_config.js +22 -0
  69. package/dest/config/index.d.ts +5 -0
  70. package/dest/config/index.d.ts.map +1 -0
  71. package/dest/config/index.js +4 -0
  72. package/dest/config/network_config.d.ts +19 -0
  73. package/dest/config/network_config.d.ts.map +1 -0
  74. package/dest/config/network_config.js +79 -0
  75. package/dest/utils/aztec.d.ts +3 -9
  76. package/dest/utils/aztec.d.ts.map +1 -1
  77. package/dest/utils/aztec.js +8 -32
  78. package/dest/utils/commands.d.ts +6 -7
  79. package/dest/utils/commands.d.ts.map +1 -1
  80. package/dest/utils/commands.js +5 -6
  81. package/dest/utils/inspect.d.ts +3 -10
  82. package/dest/utils/inspect.d.ts.map +1 -1
  83. package/dest/utils/inspect.js +13 -95
  84. package/dest/utils/setup_contracts.d.ts +1 -3
  85. package/dest/utils/setup_contracts.d.ts.map +1 -1
  86. package/dest/utils/setup_contracts.js +2 -22
  87. package/package.json +28 -25
  88. package/src/cmds/aztec_node/block_number.ts +9 -0
  89. package/src/cmds/aztec_node/get_block.ts +10 -0
  90. package/src/cmds/aztec_node/get_current_base_fee.ts +9 -0
  91. package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +27 -0
  92. package/src/cmds/{pxe → aztec_node}/get_logs.ts +8 -7
  93. package/src/cmds/{pxe → aztec_node}/get_node_info.ts +5 -16
  94. package/src/cmds/aztec_node/index.ts +87 -0
  95. package/src/cmds/infrastructure/index.ts +7 -17
  96. package/src/cmds/infrastructure/sequencers.ts +6 -6
  97. package/src/cmds/infrastructure/setup_l2_contract.ts +13 -30
  98. package/src/cmds/l1/advance_epoch.ts +6 -5
  99. package/src/cmds/l1/assume_proven_through.ts +7 -6
  100. package/src/cmds/l1/bridge_erc20.ts +3 -1
  101. package/src/cmds/l1/deploy_l1_contracts.ts +6 -3
  102. package/src/cmds/l1/deploy_new_rollup.ts +4 -2
  103. package/src/cmds/l1/get_l1_addresses.ts +1 -1
  104. package/src/cmds/l1/index.ts +25 -53
  105. package/src/cmds/l1/update_l1_validators.ts +81 -6
  106. package/src/cmds/misc/generate_secret_and_hash.ts +1 -1
  107. package/src/cmds/misc/generate_secret_key.ts +1 -1
  108. package/src/config/cached_fetch.ts +67 -0
  109. package/src/config/chain_l2_config.ts +585 -0
  110. package/src/config/enrich_env.ts +15 -0
  111. package/src/config/get_l1_config.ts +28 -0
  112. package/src/config/index.ts +4 -0
  113. package/src/config/network_config.ts +102 -0
  114. package/src/utils/aztec.ts +8 -40
  115. package/src/utils/commands.ts +8 -10
  116. package/src/utils/inspect.ts +18 -111
  117. package/src/utils/setup_contracts.ts +4 -43
  118. package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
  119. package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
  120. package/dest/cmds/devnet/bootstrap_network.js +0 -216
  121. package/dest/cmds/devnet/faucet.d.ts +0 -4
  122. package/dest/cmds/devnet/faucet.d.ts.map +0 -1
  123. package/dest/cmds/devnet/faucet.js +0 -26
  124. package/dest/cmds/devnet/index.d.ts.map +0 -1
  125. package/dest/cmds/devnet/index.js +0 -14
  126. package/dest/cmds/pxe/add_contract.d.ts +0 -5
  127. package/dest/cmds/pxe/add_contract.d.ts.map +0 -1
  128. package/dest/cmds/pxe/add_contract.js +0 -29
  129. package/dest/cmds/pxe/block_number.d.ts +0 -3
  130. package/dest/cmds/pxe/block_number.d.ts.map +0 -1
  131. package/dest/cmds/pxe/block_number.js +0 -10
  132. package/dest/cmds/pxe/get_account.d.ts +0 -4
  133. package/dest/cmds/pxe/get_account.d.ts.map +0 -1
  134. package/dest/cmds/pxe/get_account.js +0 -10
  135. package/dest/cmds/pxe/get_accounts.d.ts +0 -3
  136. package/dest/cmds/pxe/get_accounts.d.ts.map +0 -1
  137. package/dest/cmds/pxe/get_accounts.js +0 -25
  138. package/dest/cmds/pxe/get_block.d.ts +0 -3
  139. package/dest/cmds/pxe/get_block.d.ts.map +0 -1
  140. package/dest/cmds/pxe/get_block.js +0 -9
  141. package/dest/cmds/pxe/get_contract_data.d.ts +0 -4
  142. package/dest/cmds/pxe/get_contract_data.d.ts.map +0 -1
  143. package/dest/cmds/pxe/get_contract_data.js +0 -31
  144. package/dest/cmds/pxe/get_current_base_fee.d.ts +0 -3
  145. package/dest/cmds/pxe/get_current_base_fee.d.ts.map +0 -1
  146. package/dest/cmds/pxe/get_current_base_fee.js +0 -7
  147. package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +0 -4
  148. package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +0 -1
  149. package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +0 -11
  150. package/dest/cmds/pxe/get_logs.d.ts +0 -4
  151. package/dest/cmds/pxe/get_logs.d.ts.map +0 -1
  152. package/dest/cmds/pxe/get_node_info.d.ts +0 -3
  153. package/dest/cmds/pxe/get_node_info.d.ts.map +0 -1
  154. package/dest/cmds/pxe/get_pxe_info.d.ts +0 -3
  155. package/dest/cmds/pxe/get_pxe_info.d.ts.map +0 -1
  156. package/dest/cmds/pxe/get_pxe_info.js +0 -11
  157. package/dest/cmds/pxe/index.d.ts +0 -4
  158. package/dest/cmds/pxe/index.d.ts.map +0 -1
  159. package/dest/cmds/pxe/index.js +0 -55
  160. package/src/cmds/devnet/bootstrap_network.ts +0 -321
  161. package/src/cmds/devnet/faucet.ts +0 -33
  162. package/src/cmds/devnet/index.ts +0 -60
  163. package/src/cmds/pxe/add_contract.ts +0 -41
  164. package/src/cmds/pxe/block_number.ts +0 -9
  165. package/src/cmds/pxe/get_account.ts +0 -16
  166. package/src/cmds/pxe/get_accounts.ts +0 -35
  167. package/src/cmds/pxe/get_block.ts +0 -10
  168. package/src/cmds/pxe/get_contract_data.ts +0 -51
  169. package/src/cmds/pxe/get_current_base_fee.ts +0 -9
  170. package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +0 -25
  171. package/src/cmds/pxe/get_pxe_info.ts +0 -13
  172. package/src/cmds/pxe/index.ts +0 -170
  173. /package/dest/cmds/{devnet → aztec_node}/index.d.ts +0 -0
@@ -0,0 +1,27 @@
1
+ import type { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import type { Fr } from '@aztec/aztec.js/fields';
3
+ import { createAztecNodeClient } from '@aztec/aztec.js/node';
4
+ import type { LogFn } from '@aztec/foundation/log';
5
+ import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
6
+
7
+ export async function getL1ToL2MessageWitness(
8
+ nodeUrl: string,
9
+ contractAddress: AztecAddress,
10
+ messageHash: Fr,
11
+ secret: Fr,
12
+ log: LogFn,
13
+ ) {
14
+ const node = createAztecNodeClient(nodeUrl);
15
+ const messageWitness = await getNonNullifiedL1ToL2MessageWitness(node, contractAddress, messageHash, secret);
16
+
17
+ log(
18
+ messageWitness === undefined
19
+ ? `
20
+ L1 to L2 Message not found.
21
+ `
22
+ : `
23
+ L1 to L2 message index: ${messageWitness[0]}
24
+ L1 to L2 message sibling path: ${messageWitness[1]}
25
+ `,
26
+ );
27
+ }
@@ -1,6 +1,8 @@
1
- import type { AztecAddress, LogFilter, LogId, TxHash } from '@aztec/aztec.js';
2
- import { createCompatibleClient } from '@aztec/aztec.js';
3
- import type { LogFn, Logger } from '@aztec/foundation/log';
1
+ import type { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import type { LogFilter, LogId } from '@aztec/aztec.js/log';
3
+ import { createAztecNodeClient } from '@aztec/aztec.js/node';
4
+ import type { TxHash } from '@aztec/aztec.js/tx';
5
+ import type { LogFn } from '@aztec/foundation/log';
4
6
  import { sleep } from '@aztec/foundation/sleep';
5
7
 
6
8
  export async function getLogs(
@@ -9,12 +11,11 @@ export async function getLogs(
9
11
  toBlock: number,
10
12
  afterLog: LogId,
11
13
  contractAddress: AztecAddress,
12
- rpcUrl: string,
14
+ nodeUrl: string,
13
15
  follow: boolean,
14
- debugLogger: Logger,
15
16
  log: LogFn,
16
17
  ) {
17
- const pxe = await createCompatibleClient(rpcUrl, debugLogger);
18
+ const node = createAztecNodeClient(nodeUrl);
18
19
 
19
20
  if (follow) {
20
21
  if (txHash) {
@@ -28,7 +29,7 @@ export async function getLogs(
28
29
  const filter: LogFilter = { txHash, fromBlock, toBlock, afterLog, contractAddress };
29
30
 
30
31
  const fetchLogs = async () => {
31
- const response = await pxe.getPublicLogs(filter);
32
+ const response = await node.getPublicLogs(filter);
32
33
  const logs = response.logs;
33
34
 
34
35
  if (!logs.length) {
@@ -1,20 +1,9 @@
1
- import { type AztecNode, type PXE, createAztecNodeClient, createCompatibleClient } from '@aztec/aztec.js';
2
- import type { LogFn, Logger } from '@aztec/foundation/log';
1
+ import { createAztecNodeClient } from '@aztec/aztec.js/node';
2
+ import type { LogFn } from '@aztec/foundation/log';
3
+
4
+ export async function getNodeInfo(nodeUrl: string, json: boolean, log: LogFn, logJson: (output: any) => void) {
5
+ const client = createAztecNodeClient(nodeUrl);
3
6
 
4
- export async function getNodeInfo(
5
- rpcUrl: string,
6
- pxeRequest: boolean,
7
- debugLogger: Logger,
8
- json: boolean,
9
- log: LogFn,
10
- logJson: (output: any) => void,
11
- ) {
12
- let client: AztecNode | PXE;
13
- if (pxeRequest) {
14
- client = await createCompatibleClient(rpcUrl, debugLogger);
15
- } else {
16
- client = createAztecNodeClient(rpcUrl);
17
- }
18
7
  const info = await client.getNodeInfo();
19
8
  if (json) {
20
9
  logJson({
@@ -0,0 +1,87 @@
1
+ import type { LogFn, Logger } from '@aztec/foundation/log';
2
+
3
+ import type { Command } from 'commander';
4
+
5
+ import {
6
+ logJson,
7
+ nodeOption,
8
+ parseAztecAddress,
9
+ parseField,
10
+ parseOptionalAztecAddress,
11
+ parseOptionalInteger,
12
+ parseOptionalLogId,
13
+ parseOptionalTxHash,
14
+ } from '../../utils/commands.js';
15
+
16
+ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
17
+ program
18
+ .command('get-block')
19
+ .description('Gets info for a given block or latest.')
20
+ .argument('[blockNumber]', 'Block height', parseOptionalInteger)
21
+ .addOption(nodeOption)
22
+ .action(async (blockNumber, options) => {
23
+ const { getBlock } = await import('./get_block.js');
24
+ await getBlock(options.nodeUrl, blockNumber, log);
25
+ });
26
+
27
+ program
28
+ .command('get-current-base-fee')
29
+ .description('Gets the current base fee.')
30
+ .addOption(nodeOption)
31
+ .action(async options => {
32
+ const { getCurrentBaseFee } = await import('./get_current_base_fee.js');
33
+ await getCurrentBaseFee(options.rpcUrl, debugLogger, log);
34
+ });
35
+
36
+ program
37
+ .command('get-l1-to-l2-message-witness')
38
+ .description('Gets a L1 to L2 message witness.')
39
+ .requiredOption('-ca, --contract-address <address>', 'Aztec address of the contract.', parseAztecAddress)
40
+ .requiredOption('--message-hash <messageHash>', 'The L1 to L2 message hash.', parseField)
41
+ .requiredOption('--secret <secret>', 'The secret used to claim the L1 to L2 message', parseField)
42
+ .addOption(nodeOption)
43
+ .action(async ({ contractAddress, messageHash, secret, nodeUrl }) => {
44
+ const { getL1ToL2MessageWitness } = await import('./get_l1_to_l2_message_witness.js');
45
+ await getL1ToL2MessageWitness(nodeUrl, contractAddress, messageHash, secret, log);
46
+ });
47
+
48
+ program
49
+ .command('get-logs')
50
+ .description('Gets all the public logs from an intersection of all the filter params.')
51
+ .option('-tx, --tx-hash <txHash>', 'A transaction hash to get the receipt for.', parseOptionalTxHash)
52
+ .option(
53
+ '-fb, --from-block <blockNum>',
54
+ 'Initial block number for getting logs (defaults to 1).',
55
+ parseOptionalInteger,
56
+ )
57
+ .option('-tb, --to-block <blockNum>', 'Up to which block to fetch logs (defaults to latest).', parseOptionalInteger)
58
+ .option('-al --after-log <logId>', 'ID of a log after which to fetch the logs.', parseOptionalLogId)
59
+ .option('-ca, --contract-address <address>', 'Contract address to filter logs by.', parseOptionalAztecAddress)
60
+ .addOption(nodeOption)
61
+ .option('--follow', 'If set, will keep polling for new logs until interrupted.')
62
+ .action(async ({ txHash, fromBlock, toBlock, afterLog, contractAddress, aztecNodeRpcUrl: nodeUrl, follow }) => {
63
+ const { getLogs } = await import('./get_logs.js');
64
+ await getLogs(txHash, fromBlock, toBlock, afterLog, contractAddress, nodeUrl, follow, log);
65
+ });
66
+
67
+ program
68
+ .command('block-number')
69
+ .description('Gets the current Aztec L2 block number.')
70
+ .addOption(nodeOption)
71
+ .action(async (options: any) => {
72
+ const { blockNumber } = await import('./block_number.js');
73
+ await blockNumber(options.nodeUrl, log);
74
+ });
75
+
76
+ program
77
+ .command('get-node-info')
78
+ .description('Gets the information of an Aztec node from a PXE or directly from an Aztec node.')
79
+ .option('--json', 'Emit output as json')
80
+ .addOption(nodeOption)
81
+ .action(async options => {
82
+ const { getNodeInfo } = await import('./get_node_info.js');
83
+ await getNodeInfo(options.nodeUrl, options.json, log, logJson(log));
84
+ });
85
+
86
+ return program;
87
+ }
@@ -1,28 +1,19 @@
1
- import type { LogFn, Logger } from '@aztec/foundation/log';
1
+ import type { LogFn } from '@aztec/foundation/log';
2
2
 
3
3
  import type { Command } from 'commander';
4
4
 
5
- import { ETHEREUM_HOSTS, l1ChainIdOption, parseOptionalInteger, pxeOption } from '../../utils/commands.js';
5
+ import { ETHEREUM_HOSTS, l1ChainIdOption, nodeOption, parseOptionalInteger } from '../../utils/commands.js';
6
6
 
7
- export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
7
+ export function injectCommands(program: Command, log: LogFn) {
8
8
  program
9
9
  .command('setup-protocol-contracts')
10
10
  .description('Bootstrap the blockchain by initializing all the protocol contracts')
11
- .addOption(pxeOption)
11
+ .addOption(nodeOption)
12
12
  .option('--testAccounts', 'Deploy funded test accounts.')
13
- .option('--sponsoredFPC', 'Deploy a sponsored FPC.')
14
13
  .option('--json', 'Output the contract addresses in JSON format')
15
- .option('--skipProofWait', "Don't wait for proofs to land.")
16
14
  .action(async options => {
17
15
  const { setupL2Contracts } = await import('./setup_l2_contract.js');
18
- await setupL2Contracts(
19
- options.rpcUrl,
20
- options.testAccounts,
21
- options.sponsoredFPC,
22
- options.json,
23
- options.skipProofWait,
24
- log,
25
- );
16
+ await setupL2Contracts(options.nodeUrl, options.testAccounts, options.json, log);
26
17
  });
27
18
 
28
19
  program
@@ -42,7 +33,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
42
33
  'test test test test test test test test test test test junk',
43
34
  )
44
35
  .option('--block-number <number>', 'Block number to query next sequencer for', parseOptionalInteger)
45
- .addOption(pxeOption)
36
+ .addOption(nodeOption)
46
37
  .addOption(l1ChainIdOption)
47
38
  .action(async (command, who, options) => {
48
39
  const { sequencers } = await import('./sequencers.js');
@@ -50,12 +41,11 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
50
41
  command: command,
51
42
  who,
52
43
  mnemonic: options.mnemonic,
53
- rpcUrl: options.rpcUrl,
44
+ nodeUrl: options.nodeUrl,
54
45
  l1RpcUrls: options.l1RpcUrls,
55
46
  chainId: options.l1ChainId,
56
47
  blockNumber: options.blockNumber,
57
48
  log,
58
- debugLogger,
59
49
  });
60
50
  });
61
51
 
@@ -1,6 +1,7 @@
1
- import { Fr, createCompatibleClient } from '@aztec/aztec.js';
1
+ import { Fr } from '@aztec/aztec.js/fields';
2
+ import { createAztecNodeClient } from '@aztec/aztec.js/node';
2
3
  import { GSEContract, RollupContract, createEthereumChain, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
3
- import type { LogFn, Logger } from '@aztec/foundation/log';
4
+ import type { LogFn } from '@aztec/foundation/log';
4
5
  import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
5
6
 
6
7
  import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
@@ -11,15 +12,14 @@ export async function sequencers(opts: {
11
12
  who?: string;
12
13
  mnemonic?: string;
13
14
  bn254SecretKey?: bigint;
14
- rpcUrl: string;
15
+ nodeUrl: string;
15
16
  l1RpcUrls: string[];
16
17
  chainId: number;
17
18
  blockNumber?: number;
18
19
  log: LogFn;
19
- debugLogger: Logger;
20
20
  }) {
21
- const { command, who: maybeWho, mnemonic, bn254SecretKey, rpcUrl, l1RpcUrls, chainId, log, debugLogger } = opts;
22
- const client = await createCompatibleClient(rpcUrl, debugLogger);
21
+ const { command, who: maybeWho, mnemonic, bn254SecretKey, nodeUrl, l1RpcUrls, chainId, log } = opts;
22
+ const client = createAztecNodeClient(nodeUrl);
23
23
  const { l1ContractAddresses } = await client.getNodeInfo();
24
24
 
25
25
  const chain = createEthereumChain(l1RpcUrls, chainId);
@@ -1,50 +1,33 @@
1
- import { type InitialAccountData, deployFundedSchnorrAccounts, getInitialTestAccounts } from '@aztec/accounts/testing';
2
- import { type AztecAddress, type WaitForProvenOpts, type WaitOpts, createPXEClient, makeFetch } from '@aztec/aztec.js';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
+ import type { AztecAddress } from '@aztec/aztec.js/addresses';
3
+ import type { WaitOpts } from '@aztec/aztec.js/contracts';
4
+ import { createAztecNodeClient } from '@aztec/aztec.js/node';
5
+ import { AccountManager } from '@aztec/aztec.js/wallet';
3
6
  import { jsonStringify } from '@aztec/foundation/json-rpc';
4
7
  import type { LogFn } from '@aztec/foundation/log';
5
8
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
9
+ import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
6
10
 
7
- import { setupSponsoredFPC } from '../../utils/setup_contracts.js';
8
-
9
- export async function setupL2Contracts(
10
- rpcUrl: string,
11
- testAccounts: boolean,
12
- sponsoredFPC: boolean,
13
- json: boolean,
14
- skipProofWait: boolean,
15
- log: LogFn,
16
- ) {
11
+ export async function setupL2Contracts(nodeUrl: string, testAccounts: boolean, json: boolean, log: LogFn) {
17
12
  const waitOpts: WaitOpts = {
18
13
  timeout: 180,
19
14
  interval: 1,
20
15
  };
21
- const waitForProvenOptions: WaitForProvenOpts | undefined = !skipProofWait
22
- ? {
23
- provenTimeout: 600,
24
- }
25
- : undefined;
26
16
  log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
27
- if (waitForProvenOptions) {
28
- log('setupL2Contracts: Wait for proven options' + jsonStringify(waitForProvenOptions));
29
- }
30
17
  log('setupL2Contracts: Creating PXE client...');
31
- const pxe = createPXEClient(rpcUrl, {}, makeFetch([1, 1, 1, 1, 1], false));
18
+ const node = createAztecNodeClient(nodeUrl);
19
+ const wallet = await TestWallet.create(node);
32
20
 
33
- let deployedAccounts: InitialAccountData[] = [];
21
+ let deployedAccountManagers: AccountManager[] = [];
34
22
  if (testAccounts) {
35
23
  log('setupL2Contracts: Deploying test accounts...');
36
- deployedAccounts = await getInitialTestAccounts();
37
- await deployFundedSchnorrAccounts(pxe, deployedAccounts, waitOpts);
38
- }
39
-
40
- if (sponsoredFPC) {
41
- log('setupL2Contracts: Setting up sponsored FPC...');
42
- await setupSponsoredFPC(pxe, log, waitOpts, waitForProvenOptions);
24
+ const initialAccountsData = await getInitialTestAccountsData();
25
+ deployedAccountManagers = await deployFundedSchnorrAccounts(wallet, node, initialAccountsData, waitOpts);
43
26
  }
44
27
 
45
28
  if (json) {
46
29
  const toPrint: Record<string, AztecAddress> = { ...ProtocolContractAddress };
47
- deployedAccounts.forEach((a, i) => {
30
+ deployedAccountManagers.forEach((a, i) => {
48
31
  toPrint[`testAccount${i}`] = a.address;
49
32
  });
50
33
  log(JSON.stringify(toPrint, null, 2));
@@ -1,12 +1,13 @@
1
- import { createPXEClient, makeFetch } from '@aztec/aztec.js';
1
+ import { createAztecNodeClient } from '@aztec/aztec.js/node';
2
2
  import { RollupCheatCodes } from '@aztec/ethereum/test';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
+ import { DateProvider } from '@aztec/foundation/timer';
4
5
 
5
- export async function advanceEpoch(l1RpcUrls: string[], rpcUrl: string, log: LogFn) {
6
- const pxe = createPXEClient(rpcUrl, {}, makeFetch([], true));
7
- const rollupAddress = await pxe.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
6
+ export async function advanceEpoch(l1RpcUrls: string[], nodeUrl: string, log: LogFn) {
7
+ const aztecNode = createAztecNodeClient(nodeUrl);
8
+ const rollupAddress = await aztecNode.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
8
9
 
9
- const cheat = RollupCheatCodes.create(l1RpcUrls, { rollupAddress });
10
+ const cheat = RollupCheatCodes.create(l1RpcUrls, { rollupAddress }, new DateProvider());
10
11
 
11
12
  await cheat.advanceToNextEpoch();
12
13
  log(`Warped time to advance to next epoch`);
@@ -1,18 +1,19 @@
1
- import { createPXEClient, makeFetch } from '@aztec/aztec.js';
1
+ import { createAztecNodeClient } from '@aztec/aztec.js/node';
2
2
  import { RollupCheatCodes } from '@aztec/ethereum/test';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
+ import { DateProvider } from '@aztec/foundation/timer';
4
5
 
5
6
  export async function assumeProvenThrough(
6
7
  blockNumberOrLatest: number | undefined,
7
8
  l1RpcUrls: string[],
8
- rpcUrl: string,
9
+ nodeUrl: string,
9
10
  log: LogFn,
10
11
  ) {
11
- const pxe = createPXEClient(rpcUrl, {}, makeFetch([], true));
12
- const rollupAddress = await pxe.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
13
- const blockNumber = blockNumberOrLatest ?? (await pxe.getBlockNumber());
12
+ const aztecNode = createAztecNodeClient(nodeUrl);
13
+ const rollupAddress = await aztecNode.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
14
+ const blockNumber = blockNumberOrLatest ?? (await aztecNode.getBlockNumber());
14
15
 
15
- const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, { rollupAddress });
16
+ const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, { rollupAddress }, new DateProvider());
16
17
 
17
18
  await rollupCheatCodes.markAsProven(blockNumber);
18
19
  log(`Assumed proven through block ${blockNumber}`);
@@ -1,4 +1,6 @@
1
- import { type AztecAddress, type EthAddress, type Fr, L1ToL2TokenPortalManager } from '@aztec/aztec.js';
1
+ import type { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
2
+ import { L1ToL2TokenPortalManager } from '@aztec/aztec.js/ethereum';
3
+ import type { Fr } from '@aztec/aztec.js/fields';
2
4
  import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
3
5
  import type { LogFn, Logger } from '@aztec/foundation/log';
4
6
 
@@ -1,5 +1,6 @@
1
- import { getInitialTestAccounts } from '@aztec/accounts/testing';
2
- import { type EthAddress, Fr } from '@aztec/aztec.js';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
+ import type { EthAddress } from '@aztec/aztec.js/addresses';
3
+ import { Fr } from '@aztec/aztec.js/fields';
3
4
  import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
4
5
  import { SecretValue } from '@aztec/foundation/config';
5
6
  import type { LogFn, Logger } from '@aztec/foundation/log';
@@ -22,12 +23,13 @@ export async function deployL1Contracts(
22
23
  createVerificationJson: string | false,
23
24
  initialValidators: EthAddress[],
24
25
  realVerifier: boolean,
26
+ existingToken: EthAddress | undefined,
25
27
  log: LogFn,
26
28
  debugLogger: Logger,
27
29
  ) {
28
30
  const config = getL1ContractsConfigEnvVars();
29
31
 
30
- const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
32
+ const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
31
33
  const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
32
34
  const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
33
35
  const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
@@ -50,6 +52,7 @@ export async function deployL1Contracts(
50
52
  fundingNeeded,
51
53
  acceleratedTestDeployments,
52
54
  config,
55
+ existingToken,
53
56
  realVerifier,
54
57
  createVerificationJson,
55
58
  debugLogger,
@@ -1,4 +1,4 @@
1
- import { getInitialTestAccounts } from '@aztec/accounts/testing';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
2
  import { type Operator, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
3
3
  import type { EthAddress } from '@aztec/foundation/eth-address';
4
4
  import type { LogFn, Logger } from '@aztec/foundation/log';
@@ -20,12 +20,13 @@ export async function deployNewRollup(
20
20
  json: boolean,
21
21
  initialValidators: Operator[],
22
22
  realVerifier: boolean,
23
+ createVerificationJson: string | false,
23
24
  log: LogFn,
24
25
  debugLogger: Logger,
25
26
  ) {
26
27
  const config = getL1ContractsConfigEnvVars();
27
28
 
28
- const initialAccounts = testAccounts ? await getInitialTestAccounts() : [];
29
+ const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
29
30
  const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
30
31
  const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
31
32
  const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
@@ -43,6 +44,7 @@ export async function deployNewRollup(
43
44
  fundingNeeded,
44
45
  config,
45
46
  realVerifier,
47
+ createVerificationJson,
46
48
  debugLogger,
47
49
  );
48
50
 
@@ -1,4 +1,4 @@
1
- import { EthAddress } from '@aztec/aztec.js';
1
+ import { EthAddress } from '@aztec/aztec.js/addresses';
2
2
  import { RegistryContract, type ViemPublicClient, createEthereumChain } from '@aztec/ethereum';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
4
 
@@ -1,18 +1,18 @@
1
1
  import { EthAddress } from '@aztec/foundation/eth-address';
2
2
  import type { LogFn, Logger } from '@aztec/foundation/log';
3
- import { withoutHexPrefix } from '@aztec/foundation/string';
4
3
 
5
4
  import { type Command, Option } from 'commander';
6
5
 
6
+ import { getL1RollupAddressFromEnv } from '../../config/get_l1_config.js';
7
7
  import {
8
8
  ETHEREUM_HOSTS,
9
9
  MNEMONIC,
10
10
  PRIVATE_KEY,
11
11
  l1ChainIdOption,
12
+ nodeOption,
12
13
  parseAztecAddress,
13
14
  parseBigint,
14
15
  parseEthereumAddress,
15
- pxeOption,
16
16
  } from '../../utils/commands.js';
17
17
 
18
18
  export { addL1Validator } from './update_l1_validators.js';
@@ -26,6 +26,8 @@ const l1RpcUrlsOption = new Option(
26
26
  .makeOptionMandatory(true)
27
27
  .argParser((arg: string) => arg.split(',').map(url => url.trim()));
28
28
 
29
+ const networkOption = new Option('--network <string>', 'Network to execute against').env('NETWORK');
30
+
29
31
  export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
30
32
  program
31
33
  .command('deploy-l1-contracts')
@@ -46,6 +48,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
46
48
  .option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
47
49
  .option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false)
48
50
  .option('--real-verifier', 'Deploy the real verifier', false)
51
+ .option('--existing-token <address>', 'Use an existing ERC20 for both fee and staking', parseEthereumAddress)
49
52
  .option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false)
50
53
  .action(async options => {
51
54
  const { deployL1Contracts } = await import('./deploy_l1_contracts.js');
@@ -66,6 +69,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
66
69
  options.createVerificationJson,
67
70
  initialValidators,
68
71
  options.realVerifier,
72
+ options.existingToken,
69
73
  log,
70
74
  debugLogger,
71
75
  );
@@ -90,6 +94,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
90
94
  .option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts')
91
95
  .option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
92
96
  .option('--real-verifier', 'Deploy the real verifier', false)
97
+ .option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false)
93
98
  .action(async options => {
94
99
  const { deployNewRollup } = await import('./deploy_new_rollup.js');
95
100
 
@@ -108,6 +113,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
108
113
  options.json,
109
114
  initialValidators,
110
115
  options.realVerifier,
116
+ options.createVerificationJson,
111
117
  log,
112
118
  debugLogger,
113
119
  );
@@ -285,8 +291,9 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
285
291
 
286
292
  program
287
293
  .command('add-l1-validator')
288
- .description('Adds a validator to the L1 rollup contract.')
294
+ .description('Adds a validator to the L1 rollup contract via a direct deposit.')
289
295
  .addOption(l1RpcUrlsOption)
296
+ .addOption(networkOption)
290
297
  .option('-pk, --private-key <string>', 'The private key to use sending the transaction', PRIVATE_KEY)
291
298
  .option(
292
299
  '-m, --mnemonic <string>',
@@ -295,32 +302,29 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
295
302
  )
296
303
  .addOption(l1ChainIdOption)
297
304
  .option('--attester <address>', 'ethereum address of the attester', parseEthereumAddress)
305
+ .option('--withdrawer <address>', 'ethereum address of the withdrawer', parseEthereumAddress)
298
306
  .option(
299
307
  '--bls-secret-key <string>',
300
308
  'The BN254 scalar field element used as a secret key for BLS signatures. Will be associated with the attester address.',
301
309
  parseBigint,
302
310
  )
303
- .option('--staking-asset-handler <address>', 'ethereum address of the staking asset handler', parseEthereumAddress)
304
- .option('--proof <buffer>', 'The proof to use for the attestation', arg =>
305
- Buffer.from(withoutHexPrefix(arg), 'hex'),
306
- )
307
- .option(
308
- '--merkle-proof <string>',
309
- 'The merkle proof to use for the attestation (comma separated list of 32 byte buffers)',
310
- arg => arg.split(','),
311
- )
311
+ .option('--move-with-latest-rollup', 'Whether to move with the latest rollup', true)
312
+ .option('--rollup <string>', 'Rollup contract address', parseEthereumAddress)
312
313
  .action(async options => {
313
- const { addL1Validator } = await import('./update_l1_validators.js');
314
- await addL1Validator({
314
+ const { addL1ValidatorViaRollup } = await import('./update_l1_validators.js');
315
+
316
+ const rollupAddress = options.rollup ?? (await getL1RollupAddressFromEnv(options.l1RpcUrls, options.l1ChainId));
317
+
318
+ await addL1ValidatorViaRollup({
315
319
  rpcUrls: options.l1RpcUrls,
316
320
  chainId: options.l1ChainId,
317
321
  privateKey: options.privateKey,
318
322
  mnemonic: options.mnemonic,
319
323
  attesterAddress: options.attester,
320
- stakingAssetHandlerAddress: options.stakingAssetHandler,
321
- merkleProof: options.merkleProof,
322
- proofParams: options.proof,
323
324
  blsSecretKey: options.blsSecretKey,
325
+ withdrawerAddress: options.withdrawer,
326
+ rollupAddress,
327
+ moveWithLatestRollup: options.moveWithLatestRollup,
324
328
  log,
325
329
  debugLogger,
326
330
  });
@@ -507,52 +511,20 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
507
511
  )
508
512
  .argument('[blockNumber]', 'The target block number, defaults to the latest pending block number.', parseBigint)
509
513
  .addOption(l1RpcUrlsOption)
510
- .addOption(pxeOption)
514
+ .addOption(nodeOption)
511
515
  .action(async (blockNumber, options) => {
512
516
  const { assumeProvenThrough } = await import('./assume_proven_through.js');
513
- await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.rpcUrl, log);
517
+ await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.nodeUrl, log);
514
518
  });
515
519
 
516
520
  program
517
521
  .command('advance-epoch')
518
522
  .description('Use L1 cheat codes to warp time until the next epoch.')
519
523
  .addOption(l1RpcUrlsOption)
520
- .addOption(pxeOption)
524
+ .addOption(nodeOption)
521
525
  .action(async options => {
522
526
  const { advanceEpoch } = await import('./advance_epoch.js');
523
- await advanceEpoch(options.l1RpcUrls, options.rpcUrl, log);
524
- });
525
-
526
- program
527
- .command('prover-stats', { hidden: true })
528
- .addOption(l1RpcUrlsOption)
529
- .addOption(l1ChainIdOption)
530
- .option('--start-block <number>', 'The L1 block number to start from', parseBigint, 1n)
531
- .option('--end-block <number>', 'The last L1 block number to query', parseBigint)
532
- .option('--batch-size <number>', 'The number of blocks to query in each batch', parseBigint, 100n)
533
- .option('--proving-timeout <number>', 'Cutoff for proving time to consider a block', parseBigint)
534
- .option('--l1-rollup-address <string>', 'Address of the rollup contract (required if node URL is not set)')
535
- .option(
536
- '--node-url <string>',
537
- 'JSON RPC URL of an Aztec node to retrieve the rollup contract address (required if L1 rollup address is not set)',
538
- )
539
- .option('--raw-logs', 'Output raw logs instead of aggregated stats')
540
- .action(async options => {
541
- const { proverStats } = await import('./prover_stats.js');
542
- const { l1RpcUrls, chainId, l1RollupAddress, startBlock, endBlock, batchSize, nodeUrl, provingTimeout, rawLogs } =
543
- options;
544
- await proverStats({
545
- l1RpcUrls,
546
- chainId,
547
- l1RollupAddress,
548
- startBlock,
549
- endBlock,
550
- batchSize,
551
- nodeUrl,
552
- provingTimeout,
553
- rawLogs,
554
- log,
555
- });
527
+ await advanceEpoch(options.l1RpcUrls, options.nodeUrl, log);
556
528
  });
557
529
 
558
530
  return program;