@aztec/cli 0.0.1-commit.d3ec352c → 0.0.1-commit.f295ac2

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 (105) hide show
  1. package/dest/cmds/aztec_node/get_current_min_fee.d.ts +3 -0
  2. package/dest/cmds/aztec_node/get_current_min_fee.d.ts.map +1 -0
  3. package/dest/cmds/aztec_node/{get_current_base_fee.js → get_current_min_fee.js} +2 -2
  4. package/dest/cmds/aztec_node/index.js +3 -3
  5. package/dest/cmds/contracts/inspect_contract.js +1 -1
  6. package/dest/cmds/infrastructure/sequencers.d.ts +1 -1
  7. package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
  8. package/dest/cmds/infrastructure/sequencers.js +11 -4
  9. package/dest/cmds/l1/bridge_erc20.d.ts +1 -1
  10. package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
  11. package/dest/cmds/l1/bridge_erc20.js +2 -1
  12. package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts +4 -0
  13. package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts.map +1 -0
  14. package/dest/cmds/l1/{deploy_l1_contracts.js → deploy_l1_contracts_cmd.js} +39 -4
  15. package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -4
  16. package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
  17. package/dest/cmds/l1/deploy_new_rollup.js +3 -3
  18. package/dest/cmds/l1/get_l1_addresses.d.ts +1 -1
  19. package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
  20. package/dest/cmds/l1/get_l1_addresses.js +5 -2
  21. package/dest/cmds/l1/get_l1_balance.js +4 -2
  22. package/dest/cmds/l1/governance_utils.d.ts +1 -1
  23. package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
  24. package/dest/cmds/l1/governance_utils.js +3 -1
  25. package/dest/cmds/l1/index.d.ts +1 -2
  26. package/dest/cmds/l1/index.d.ts.map +1 -1
  27. package/dest/cmds/l1/index.js +10 -8
  28. package/dest/cmds/l1/prover_stats.d.ts +1 -1
  29. package/dest/cmds/l1/prover_stats.d.ts.map +1 -1
  30. package/dest/cmds/l1/prover_stats.js +4 -2
  31. package/dest/cmds/l1/trigger_seed_snapshot.d.ts +1 -1
  32. package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -1
  33. package/dest/cmds/l1/trigger_seed_snapshot.js +2 -1
  34. package/dest/cmds/l1/update_l1_validators.d.ts +3 -3
  35. package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
  36. package/dest/cmds/l1/update_l1_validators.js +52 -13
  37. package/dest/cmds/misc/generate_secret_and_hash.js +1 -1
  38. package/dest/cmds/misc/index.d.ts +1 -1
  39. package/dest/cmds/misc/index.d.ts.map +1 -1
  40. package/dest/cmds/misc/index.js +1 -1
  41. package/dest/cmds/validator_keys/generate_bls_keypair.js +1 -1
  42. package/dest/cmds/validator_keys/new.d.ts +1 -1
  43. package/dest/cmds/validator_keys/new.d.ts.map +1 -1
  44. package/dest/cmds/validator_keys/new.js +5 -2
  45. package/dest/cmds/validator_keys/shared.d.ts +1 -1
  46. package/dest/cmds/validator_keys/shared.d.ts.map +1 -1
  47. package/dest/cmds/validator_keys/shared.js +2 -1
  48. package/dest/cmds/validator_keys/staker.d.ts +2 -2
  49. package/dest/cmds/validator_keys/staker.d.ts.map +1 -1
  50. package/dest/cmds/validator_keys/staker.js +7 -4
  51. package/dest/cmds/validator_keys/utils.d.ts +1 -1
  52. package/dest/cmds/validator_keys/utils.d.ts.map +1 -1
  53. package/dest/cmds/validator_keys/utils.js +1 -1
  54. package/dest/config/chain_l2_config.d.ts +12 -38
  55. package/dest/config/chain_l2_config.d.ts.map +1 -1
  56. package/dest/config/chain_l2_config.js +33 -493
  57. package/dest/config/generated/networks.d.ts +202 -0
  58. package/dest/config/generated/networks.d.ts.map +1 -0
  59. package/dest/config/generated/networks.js +203 -0
  60. package/dest/config/get_l1_config.d.ts +3 -2
  61. package/dest/config/get_l1_config.d.ts.map +1 -1
  62. package/dest/config/get_l1_config.js +3 -1
  63. package/dest/config/network_config.d.ts +2 -2
  64. package/dest/config/network_config.d.ts.map +1 -1
  65. package/dest/config/network_config.js +7 -1
  66. package/dest/utils/aztec.d.ts +7 -13
  67. package/dest/utils/aztec.d.ts.map +1 -1
  68. package/dest/utils/aztec.js +19 -40
  69. package/dest/utils/commands.d.ts +7 -6
  70. package/dest/utils/commands.d.ts.map +1 -1
  71. package/dest/utils/commands.js +6 -5
  72. package/dest/utils/encoding.js +1 -1
  73. package/package.json +39 -31
  74. package/src/cmds/aztec_node/{get_current_base_fee.ts → get_current_min_fee.ts} +2 -2
  75. package/src/cmds/aztec_node/index.ts +3 -3
  76. package/src/cmds/contracts/inspect_contract.ts +1 -1
  77. package/src/cmds/infrastructure/sequencers.ts +7 -4
  78. package/src/cmds/l1/bridge_erc20.ts +2 -1
  79. package/src/cmds/l1/{deploy_l1_contracts.ts → deploy_l1_contracts_cmd.ts} +39 -22
  80. package/src/cmds/l1/deploy_new_rollup.ts +4 -9
  81. package/src/cmds/l1/get_l1_addresses.ts +4 -2
  82. package/src/cmds/l1/get_l1_balance.ts +2 -2
  83. package/src/cmds/l1/governance_utils.ts +3 -8
  84. package/src/cmds/l1/index.ts +7 -17
  85. package/src/cmds/l1/prover_stats.ts +6 -2
  86. package/src/cmds/l1/trigger_seed_snapshot.ts +2 -1
  87. package/src/cmds/l1/update_l1_validators.ts +46 -25
  88. package/src/cmds/misc/generate_secret_and_hash.ts +1 -1
  89. package/src/cmds/misc/index.ts +1 -1
  90. package/src/cmds/validator_keys/generate_bls_keypair.ts +1 -1
  91. package/src/cmds/validator_keys/new.ts +3 -2
  92. package/src/cmds/validator_keys/shared.ts +2 -1
  93. package/src/cmds/validator_keys/staker.ts +5 -4
  94. package/src/cmds/validator_keys/utils.ts +2 -1
  95. package/src/config/chain_l2_config.ts +33 -644
  96. package/src/config/generated/networks.ts +207 -0
  97. package/src/config/get_l1_config.ts +4 -1
  98. package/src/config/network_config.ts +8 -1
  99. package/src/utils/aztec.ts +24 -83
  100. package/src/utils/commands.ts +6 -5
  101. package/src/utils/encoding.ts +1 -1
  102. package/dest/cmds/aztec_node/get_current_base_fee.d.ts +0 -3
  103. package/dest/cmds/aztec_node/get_current_base_fee.d.ts.map +0 -1
  104. package/dest/cmds/l1/deploy_l1_contracts.d.ts +0 -4
  105. package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +0 -1
@@ -1,25 +1,18 @@
1
- import {
2
- GSEContract,
3
- RollupContract,
4
- createEthereumChain,
5
- createExtendedL1Client,
6
- createL1TxUtilsFromViemWallet,
7
- getL1ContractsConfigEnvVars,
8
- getPublicClient,
9
- isAnvilTestChain,
10
- } 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';
11
6
  import { EthCheatCodes } from '@aztec/ethereum/test';
12
7
  import type { EthAddress } from '@aztec/foundation/eth-address';
13
8
  import type { LogFn, Logger } from '@aztec/foundation/log';
14
9
  import { DateProvider } from '@aztec/foundation/timer';
15
- import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
10
+ import { RollupAbi, StakingAssetHandlerAbi, TestERC20Abi } from '@aztec/l1-artifacts';
16
11
  import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
17
12
 
18
- import { encodeFunctionData, formatEther, getContract } from 'viem';
13
+ import { encodeFunctionData, formatEther, getContract, maxUint256 } from 'viem';
19
14
  import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
20
15
 
21
- import { addLeadingHex } from '../../utils/aztec.js';
22
-
23
16
  export interface RollupCommandArgs {
24
17
  rpcUrls: string[];
25
18
  chainId: number;
@@ -58,8 +51,8 @@ export async function addL1Validator({
58
51
  privateKey,
59
52
  mnemonic,
60
53
  attesterAddress,
54
+ withdrawerAddress,
61
55
  stakingAssetHandlerAddress,
62
- merkleProof,
63
56
  proofParams,
64
57
  blsSecretKey,
65
58
  log,
@@ -68,8 +61,8 @@ export async function addL1Validator({
68
61
  LoggerArgs & {
69
62
  blsSecretKey: bigint; // scalar field element of BN254
70
63
  attesterAddress: EthAddress;
64
+ withdrawerAddress: EthAddress;
71
65
  proofParams: Buffer;
72
- merkleProof: string[];
73
66
  }) {
74
67
  const dualLog = makeDualLog(log, debugLogger);
75
68
  const account = getAccount(privateKey, mnemonic);
@@ -92,33 +85,61 @@ export async function addL1Validator({
92
85
  });
93
86
 
94
87
  const gseAddress = await rollup.read.getGSE();
95
-
96
88
  const gse = new GSEContract(l1Client, gseAddress);
97
-
98
89
  const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
99
90
 
100
91
  const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
101
92
  const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
102
- const merkleProofArray = merkleProof.map(proof => addLeadingHex(proof));
103
93
 
104
- const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
94
+ // Step 1: Claim STK tokens from the faucet
95
+ dualLog(`Claiming STK tokens from faucet`);
96
+ const { receipt: claimReceipt } = await l1TxUtils.sendAndMonitorTransaction({
105
97
  to: stakingAssetHandlerAddress.toString(),
106
98
  data: encodeFunctionData({
107
99
  abi: StakingAssetHandlerAbi,
108
- functionName: 'addValidator',
100
+ functionName: 'claim',
101
+ args: [proofParamsObj.toViem()],
102
+ }),
103
+ abi: StakingAssetHandlerAbi,
104
+ });
105
+ dualLog(`Claim transaction hash: ${claimReceipt.transactionHash}`);
106
+ await l1Client.waitForTransactionReceipt({ hash: claimReceipt.transactionHash });
107
+
108
+ // Step 2: Approve the rollup to spend STK tokens
109
+ const stakingAssetAddress = await stakingAssetHandler.read.STAKING_ASSET();
110
+ dualLog(`Approving rollup to spend STK tokens`);
111
+ const { receipt: approveReceipt } = await l1TxUtils.sendAndMonitorTransaction({
112
+ to: stakingAssetAddress,
113
+ data: encodeFunctionData({
114
+ abi: TestERC20Abi,
115
+ functionName: 'approve',
116
+ args: [rollupAddress, maxUint256],
117
+ }),
118
+ abi: TestERC20Abi,
119
+ });
120
+ await l1Client.waitForTransactionReceipt({ hash: approveReceipt.transactionHash });
121
+
122
+ // Step 3: Deposit into the rollup to register as a validator
123
+ dualLog(`Depositing into rollup to register validator`);
124
+ const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
125
+ to: rollupAddress,
126
+ data: encodeFunctionData({
127
+ abi: RollupAbi,
128
+ functionName: 'deposit',
109
129
  args: [
110
130
  attesterAddress.toString(),
111
- merkleProofArray,
112
- proofParamsObj.toViem(),
131
+ withdrawerAddress.toString(),
113
132
  registrationTuple.publicKeyInG1,
114
133
  registrationTuple.publicKeyInG2,
115
134
  registrationTuple.proofOfPossession,
135
+ false, // moveWithLatestRollup
116
136
  ],
117
137
  }),
118
- abi: StakingAssetHandlerAbi,
138
+ abi: RollupAbi,
119
139
  });
120
- dualLog(`Transaction hash: ${receipt.transactionHash}`);
140
+ dualLog(`Deposit transaction hash: ${receipt.transactionHash}`);
121
141
  await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
142
+
122
143
  if (isAnvilTestChain(chainId)) {
123
144
  dualLog(`Funding validator on L1`);
124
145
  const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
@@ -1,5 +1,5 @@
1
1
  import { computeSecretHash } from '@aztec/aztec.js/crypto';
2
- import { Fr } from '@aztec/foundation/fields';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
4
 
5
5
  export async function generateSecretAndHash(log: LogFn) {
@@ -1,5 +1,4 @@
1
1
  import type { LogFn } from '@aztec/foundation/log';
2
- import { printENR } from '@aztec/p2p/enr';
3
2
 
4
3
  import type { Command } from 'commander';
5
4
 
@@ -49,6 +48,7 @@ export function injectCommands(program: Command, log: LogFn) {
49
48
  .description('Decodes and ENR record')
50
49
  .argument('<enr>', 'The encoded ENR string')
51
50
  .action(async (enr: string) => {
51
+ const { printENR } = await import('@aztec/p2p/enr');
52
52
  await printENR(enr, log);
53
53
  });
54
54
 
@@ -1,4 +1,4 @@
1
- import { deriveBlsPrivateKey } from '@aztec/foundation/crypto';
1
+ import { deriveBlsPrivateKey } from '@aztec/foundation/crypto/bls';
2
2
  import type { LogFn } from '@aztec/foundation/log';
3
3
 
4
4
  import { writeFile } from 'fs/promises';
@@ -1,5 +1,6 @@
1
1
  import { prettyPrintJSON } from '@aztec/cli/utils';
2
- import { GSEContract, createEthereumChain } from '@aztec/ethereum';
2
+ import { createEthereumChain } from '@aztec/ethereum/chain';
3
+ import { GSEContract } from '@aztec/ethereum/contracts';
3
4
  import type { EthAddress } from '@aztec/foundation/eth-address';
4
5
  import type { LogFn } from '@aztec/foundation/log';
5
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -134,7 +135,7 @@ export async function newValidatorKeystore(options: NewValidatorKeystoreOptions,
134
135
  const chain = createEthereumChain(l1RpcUrls, l1ChainId);
135
136
  const publicClient = createPublicClient({
136
137
  chain: chain.chainInfo,
137
- transport: fallback(l1RpcUrls.map(url => http(url))),
138
+ transport: fallback(l1RpcUrls.map(url => http(url, { batch: false }))),
138
139
  });
139
140
  const gse = new GSEContract(publicClient, gseAddress);
140
141
 
@@ -1,6 +1,7 @@
1
1
  import { prettyPrintJSON } from '@aztec/cli/utils';
2
- import { computeBn254G1PublicKeyCompressed, deriveBlsPrivateKey } from '@aztec/foundation/crypto';
2
+ import { deriveBlsPrivateKey } from '@aztec/foundation/crypto/bls';
3
3
  import { createBn254Keystore } from '@aztec/foundation/crypto/bls/bn254_keystore';
4
+ import { computeBn254G1PublicKeyCompressed } from '@aztec/foundation/crypto/bn254';
4
5
  import type { EthAddress } from '@aztec/foundation/eth-address';
5
6
  import type { LogFn } from '@aztec/foundation/log';
6
7
  import type { EthAccount, EthPrivateKey, ValidatorKeyStore } from '@aztec/node-keystore/types';
@@ -1,9 +1,10 @@
1
1
  import { prettyPrintJSON } from '@aztec/cli/utils';
2
- import { GSEContract, createEthereumChain } from '@aztec/ethereum';
3
- import { computeBn254G1PublicKey, computeBn254G2PublicKey } from '@aztec/foundation/crypto';
2
+ import { createEthereumChain } from '@aztec/ethereum/chain';
3
+ import { GSEContract } from '@aztec/ethereum/contracts';
4
4
  import { decryptBn254Keystore } from '@aztec/foundation/crypto/bls/bn254_keystore';
5
+ import { computeBn254G1PublicKey, computeBn254G2PublicKey } from '@aztec/foundation/crypto/bn254';
6
+ import { Fr } from '@aztec/foundation/curves/bn254';
5
7
  import type { EthAddress } from '@aztec/foundation/eth-address';
6
- import { Fr } from '@aztec/foundation/fields';
7
8
  import type { LogFn } from '@aztec/foundation/log';
8
9
  import { loadKeystoreFile } from '@aztec/node-keystore/loader';
9
10
  import type {
@@ -272,7 +273,7 @@ export async function generateStakerJson(options: StakerOptions, log: LogFn): Pr
272
273
  const chain = createEthereumChain(l1RpcUrls, l1ChainId);
273
274
  const publicClient = createPublicClient({
274
275
  chain: chain.chainInfo,
275
- transport: fallback(l1RpcUrls.map(url => http(url))),
276
+ transport: fallback(l1RpcUrls.map(url => http(url, { batch: false }))),
276
277
  });
277
278
  const gse = new GSEContract(publicClient, gseAddress);
278
279
 
@@ -1,5 +1,6 @@
1
1
  import type { EthAddress } from '@aztec/foundation/eth-address';
2
- import { type EthPrivateKey, ethPrivateKeySchema } from '@aztec/node-keystore';
2
+ import { ethPrivateKeySchema } from '@aztec/node-keystore/schemas';
3
+ import type { EthPrivateKey } from '@aztec/node-keystore/types';
3
4
 
4
5
  export const defaultBlsPath = 'm/12381/3600/0/0/0';
5
6