@aztec/cli 0.0.1-fake-ceab37513c → 0.0.6-commit.a2d1860fe9
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.
- package/README.md +2 -428
- package/dest/cmds/aztec_node/block_number.d.ts +3 -0
- package/dest/cmds/aztec_node/block_number.d.ts.map +1 -0
- package/dest/cmds/aztec_node/block_number.js +10 -0
- package/dest/cmds/aztec_node/get_block.d.ts +3 -0
- package/dest/cmds/aztec_node/get_block.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_block.js +10 -0
- package/dest/cmds/aztec_node/get_current_min_fee.d.ts +3 -0
- package/dest/cmds/aztec_node/get_current_min_fee.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_current_min_fee.js +7 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +5 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.js +12 -0
- package/dest/cmds/aztec_node/get_logs.d.ts +7 -0
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_logs.js +4 -4
- package/dest/cmds/aztec_node/get_node_info.d.ts +3 -0
- package/dest/cmds/aztec_node/get_node_info.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_node_info.js +3 -8
- package/dest/cmds/aztec_node/index.d.ts +4 -0
- package/dest/cmds/aztec_node/index.d.ts.map +1 -0
- package/dest/cmds/aztec_node/index.js +28 -0
- package/dest/cmds/contracts/index.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
- package/dest/cmds/contracts/inspect_contract.js +4 -10
- package/dest/cmds/contracts/parse_parameter_struct.d.ts +1 -1
- package/dest/cmds/infrastructure/index.d.ts +3 -3
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +7 -9
- package/dest/cmds/infrastructure/sequencers.d.ts +3 -5
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +15 -7
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +2 -2
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +11 -25
- package/dest/cmds/l1/advance_epoch.d.ts +2 -2
- package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
- package/dest/cmds/l1/advance_epoch.js +6 -5
- package/dest/cmds/l1/assume_proven_through.d.ts +3 -2
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +8 -8
- package/dest/cmds/l1/bridge_erc20.d.ts +2 -2
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +3 -2
- package/dest/cmds/l1/compute_genesis_values.d.ts +4 -0
- package/dest/cmds/l1/compute_genesis_values.d.ts.map +1 -0
- package/dest/cmds/l1/compute_genesis_values.js +17 -0
- package/dest/cmds/l1/create_l1_account.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts +4 -0
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts.map +1 -0
- package/dest/cmds/l1/{deploy_l1_contracts.js → deploy_l1_contracts_cmd.js} +42 -7
- package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -4
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +5 -5
- package/dest/cmds/l1/get_l1_addresses.d.ts +2 -2
- package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
- package/dest/cmds/l1/get_l1_addresses.js +5 -2
- package/dest/cmds/l1/get_l1_balance.d.ts +1 -1
- package/dest/cmds/l1/get_l1_balance.js +4 -2
- package/dest/cmds/l1/governance_utils.d.ts +5 -5
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.js +3 -1
- package/dest/cmds/l1/index.d.ts +1 -2
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +20 -13
- package/dest/cmds/l1/prover_stats.d.ts +1 -1
- package/dest/cmds/l1/prover_stats.d.ts.map +1 -1
- package/dest/cmds/l1/prover_stats.js +32 -30
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts +2 -2
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -1
- package/dest/cmds/l1/trigger_seed_snapshot.js +2 -1
- package/dest/cmds/l1/update_l1_validators.d.ts +7 -7
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +62 -22
- package/dest/cmds/misc/compute_selector.d.ts +1 -1
- package/dest/cmds/misc/example_contracts.d.ts +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
- package/dest/cmds/misc/generate_p2p_private_key.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.js +2 -2
- package/dest/cmds/misc/generate_secret_key.d.ts +2 -2
- package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -1
- package/dest/cmds/misc/generate_secret_key.js +1 -1
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +1 -1
- package/dest/cmds/misc/index.d.ts +1 -1
- package/dest/cmds/misc/index.d.ts.map +1 -1
- package/dest/cmds/misc/index.js +1 -1
- package/dest/cmds/misc/update/common.d.ts +1 -1
- package/dest/cmds/misc/update/github.d.ts +1 -1
- package/dest/cmds/misc/update/noir.d.ts +1 -1
- package/dest/cmds/misc/update/npm.d.ts +1 -1
- package/dest/cmds/misc/update/npm.js +1 -1
- package/dest/cmds/misc/update/utils.d.ts +1 -1
- package/dest/cmds/misc/update.d.ts +1 -1
- package/dest/cmds/validator_keys/add.d.ts +5 -0
- package/dest/cmds/validator_keys/add.d.ts.map +1 -0
- package/dest/cmds/validator_keys/add.js +83 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +12 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.js +27 -0
- package/dest/cmds/validator_keys/index.d.ts +4 -0
- package/dest/cmds/validator_keys/index.d.ts.map +1 -0
- package/dest/cmds/validator_keys/index.js +32 -0
- package/dest/cmds/validator_keys/new.d.ts +29 -0
- package/dest/cmds/validator_keys/new.d.ts.map +1 -0
- package/dest/cmds/validator_keys/new.js +134 -0
- package/dest/cmds/validator_keys/shared.d.ts +68 -0
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -0
- package/dest/cmds/validator_keys/shared.js +274 -0
- package/dest/cmds/validator_keys/staker.d.ts +38 -0
- package/dest/cmds/validator_keys/staker.d.ts.map +1 -0
- package/dest/cmds/validator_keys/staker.js +210 -0
- package/dest/cmds/validator_keys/utils.d.ts +25 -0
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -0
- package/dest/cmds/validator_keys/utils.js +52 -0
- package/dest/config/cached_fetch.d.ts +2 -2
- package/dest/config/cached_fetch.d.ts.map +1 -1
- package/dest/config/cached_fetch.js +1 -1
- package/dest/config/chain_l2_config.d.ts +13 -37
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +34 -363
- package/dest/config/enrich_env.d.ts +1 -1
- package/dest/config/enrich_env.js +1 -1
- package/dest/config/generated/networks.d.ts +211 -0
- package/dest/config/generated/networks.d.ts.map +1 -0
- package/dest/config/generated/networks.js +212 -0
- package/dest/config/get_l1_config.d.ts +3 -2
- package/dest/config/get_l1_config.d.ts.map +1 -1
- package/dest/config/get_l1_config.js +3 -1
- package/dest/config/index.d.ts +1 -1
- package/dest/config/network_config.d.ts +7 -4
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +65 -29
- package/dest/utils/aztec.d.ts +8 -20
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +22 -68
- package/dest/utils/commands.d.ts +21 -12
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +38 -11
- package/dest/utils/encoding.d.ts +1 -1
- package/dest/utils/encoding.js +1 -1
- package/dest/utils/github.d.ts +1 -1
- package/dest/utils/index.d.ts +1 -1
- package/dest/utils/inspect.d.ts +5 -11
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +17 -96
- package/dest/utils/setup_contracts.d.ts +2 -4
- package/dest/utils/setup_contracts.d.ts.map +1 -1
- package/dest/utils/setup_contracts.js +2 -22
- package/package.json +48 -30
- package/public_include_metric_prefixes.json +1 -0
- package/src/cmds/aztec_node/block_number.ts +9 -0
- package/src/cmds/aztec_node/get_block.ts +11 -0
- package/src/cmds/aztec_node/get_current_min_fee.ts +9 -0
- package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +27 -0
- package/src/cmds/{pxe → aztec_node}/get_logs.ts +11 -9
- package/src/cmds/{pxe → aztec_node}/get_node_info.ts +5 -16
- package/src/cmds/aztec_node/index.ts +87 -0
- package/src/cmds/contracts/inspect_contract.ts +4 -11
- package/src/cmds/infrastructure/index.ts +7 -18
- package/src/cmds/infrastructure/sequencers.ts +13 -11
- package/src/cmds/infrastructure/setup_l2_contract.ts +14 -30
- package/src/cmds/l1/advance_epoch.ts +6 -5
- package/src/cmds/l1/assume_proven_through.ts +10 -9
- package/src/cmds/l1/bridge_erc20.ts +5 -2
- package/src/cmds/l1/compute_genesis_values.ts +29 -0
- package/src/cmds/l1/{deploy_l1_contracts.ts → deploy_l1_contracts_cmd.ts} +43 -25
- package/src/cmds/l1/deploy_new_rollup.ts +6 -11
- package/src/cmds/l1/get_l1_addresses.ts +5 -3
- package/src/cmds/l1/get_l1_balance.ts +2 -2
- package/src/cmds/l1/governance_utils.ts +3 -8
- package/src/cmds/l1/index.ts +34 -25
- package/src/cmds/l1/prover_stats.ts +42 -31
- package/src/cmds/l1/trigger_seed_snapshot.ts +2 -1
- package/src/cmds/l1/update_l1_validators.ts +56 -34
- package/src/cmds/misc/generate_secret_and_hash.ts +2 -2
- package/src/cmds/misc/generate_secret_key.ts +1 -1
- package/src/cmds/misc/index.ts +1 -1
- package/src/cmds/misc/update/npm.ts +1 -1
- package/src/cmds/validator_keys/add.ts +123 -0
- package/src/cmds/validator_keys/generate_bls_keypair.ts +34 -0
- package/src/cmds/validator_keys/index.ts +142 -0
- package/src/cmds/validator_keys/new.ts +207 -0
- package/src/cmds/validator_keys/shared.ts +326 -0
- package/src/cmds/validator_keys/staker.ts +301 -0
- package/src/cmds/validator_keys/utils.ts +81 -0
- package/src/config/cached_fetch.ts +1 -1
- package/src/config/chain_l2_config.ts +36 -470
- package/src/config/enrich_env.ts +1 -1
- package/src/config/generated/networks.ts +216 -0
- package/src/config/get_l1_config.ts +4 -1
- package/src/config/network_config.ts +75 -30
- package/src/utils/aztec.ts +27 -122
- package/src/utils/commands.ts +52 -15
- package/src/utils/encoding.ts +1 -1
- package/src/utils/inspect.ts +23 -112
- package/src/utils/setup_contracts.ts +4 -43
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +0 -4
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/cmds/pxe/add_contract.d.ts +0 -5
- package/dest/cmds/pxe/add_contract.d.ts.map +0 -1
- package/dest/cmds/pxe/add_contract.js +0 -29
- package/dest/cmds/pxe/block_number.d.ts +0 -3
- package/dest/cmds/pxe/block_number.d.ts.map +0 -1
- package/dest/cmds/pxe/block_number.js +0 -10
- package/dest/cmds/pxe/get_account.d.ts +0 -4
- package/dest/cmds/pxe/get_account.d.ts.map +0 -1
- package/dest/cmds/pxe/get_account.js +0 -10
- package/dest/cmds/pxe/get_accounts.d.ts +0 -3
- package/dest/cmds/pxe/get_accounts.d.ts.map +0 -1
- package/dest/cmds/pxe/get_accounts.js +0 -25
- package/dest/cmds/pxe/get_block.d.ts +0 -3
- package/dest/cmds/pxe/get_block.d.ts.map +0 -1
- package/dest/cmds/pxe/get_block.js +0 -9
- package/dest/cmds/pxe/get_contract_data.d.ts +0 -4
- package/dest/cmds/pxe/get_contract_data.d.ts.map +0 -1
- package/dest/cmds/pxe/get_contract_data.js +0 -31
- package/dest/cmds/pxe/get_current_base_fee.d.ts +0 -3
- package/dest/cmds/pxe/get_current_base_fee.d.ts.map +0 -1
- package/dest/cmds/pxe/get_current_base_fee.js +0 -7
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +0 -4
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +0 -1
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +0 -11
- package/dest/cmds/pxe/get_logs.d.ts +0 -4
- package/dest/cmds/pxe/get_logs.d.ts.map +0 -1
- package/dest/cmds/pxe/get_node_info.d.ts +0 -3
- package/dest/cmds/pxe/get_node_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.d.ts +0 -3
- package/dest/cmds/pxe/get_pxe_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.js +0 -11
- package/dest/cmds/pxe/index.d.ts +0 -4
- package/dest/cmds/pxe/index.d.ts.map +0 -1
- package/dest/cmds/pxe/index.js +0 -55
- package/src/cmds/pxe/add_contract.ts +0 -41
- package/src/cmds/pxe/block_number.ts +0 -9
- package/src/cmds/pxe/get_account.ts +0 -16
- package/src/cmds/pxe/get_accounts.ts +0 -35
- package/src/cmds/pxe/get_block.ts +0 -10
- package/src/cmds/pxe/get_contract_data.ts +0 -51
- package/src/cmds/pxe/get_current_base_fee.ts +0 -9
- package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +0 -25
- package/src/cmds/pxe/get_pxe_info.ts +0 -13
- package/src/cmds/pxe/index.ts +0 -170
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 { createL1TxUtils } 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
|
-
import {
|
|
9
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
10
|
+
import { RollupAbi, StakingAssetHandlerAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
15
11
|
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
|
|
16
12
|
|
|
17
|
-
import { encodeFunctionData, formatEther, getContract } from 'viem';
|
|
13
|
+
import { encodeFunctionData, formatEther, getContract, maxUint256 } from 'viem';
|
|
18
14
|
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
19
15
|
|
|
20
|
-
import { addLeadingHex } from '../../utils/aztec.js';
|
|
21
|
-
|
|
22
16
|
export interface RollupCommandArgs {
|
|
23
17
|
rpcUrls: string[];
|
|
24
18
|
chainId: number;
|
|
@@ -57,8 +51,8 @@ export async function addL1Validator({
|
|
|
57
51
|
privateKey,
|
|
58
52
|
mnemonic,
|
|
59
53
|
attesterAddress,
|
|
54
|
+
withdrawerAddress,
|
|
60
55
|
stakingAssetHandlerAddress,
|
|
61
|
-
merkleProof,
|
|
62
56
|
proofParams,
|
|
63
57
|
blsSecretKey,
|
|
64
58
|
log,
|
|
@@ -67,8 +61,8 @@ export async function addL1Validator({
|
|
|
67
61
|
LoggerArgs & {
|
|
68
62
|
blsSecretKey: bigint; // scalar field element of BN254
|
|
69
63
|
attesterAddress: EthAddress;
|
|
64
|
+
withdrawerAddress: EthAddress;
|
|
70
65
|
proofParams: Buffer;
|
|
71
|
-
merkleProof: string[];
|
|
72
66
|
}) {
|
|
73
67
|
const dualLog = makeDualLog(log, debugLogger);
|
|
74
68
|
const account = getAccount(privateKey, mnemonic);
|
|
@@ -91,36 +85,64 @@ export async function addL1Validator({
|
|
|
91
85
|
});
|
|
92
86
|
|
|
93
87
|
const gseAddress = await rollup.read.getGSE();
|
|
94
|
-
|
|
95
88
|
const gse = new GSEContract(l1Client, gseAddress);
|
|
96
|
-
|
|
97
89
|
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
98
90
|
|
|
99
|
-
const l1TxUtils =
|
|
91
|
+
const l1TxUtils = createL1TxUtils(l1Client, { logger: debugLogger });
|
|
100
92
|
const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
|
|
101
|
-
const merkleProofArray = merkleProof.map(proof => addLeadingHex(proof));
|
|
102
93
|
|
|
103
|
-
|
|
94
|
+
// Step 1: Claim STK tokens from the faucet
|
|
95
|
+
dualLog(`Claiming STK tokens from faucet`);
|
|
96
|
+
const { receipt: claimReceipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
104
97
|
to: stakingAssetHandlerAddress.toString(),
|
|
105
98
|
data: encodeFunctionData({
|
|
106
99
|
abi: StakingAssetHandlerAbi,
|
|
107
|
-
functionName: '
|
|
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',
|
|
108
129
|
args: [
|
|
109
130
|
attesterAddress.toString(),
|
|
110
|
-
|
|
111
|
-
proofParamsObj.toViem(),
|
|
131
|
+
withdrawerAddress.toString(),
|
|
112
132
|
registrationTuple.publicKeyInG1,
|
|
113
133
|
registrationTuple.publicKeyInG2,
|
|
114
134
|
registrationTuple.proofOfPossession,
|
|
135
|
+
false, // moveWithLatestRollup
|
|
115
136
|
],
|
|
116
137
|
}),
|
|
117
|
-
abi:
|
|
138
|
+
abi: RollupAbi,
|
|
118
139
|
});
|
|
119
|
-
dualLog(`
|
|
140
|
+
dualLog(`Deposit transaction hash: ${receipt.transactionHash}`);
|
|
120
141
|
await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
|
|
142
|
+
|
|
121
143
|
if (isAnvilTestChain(chainId)) {
|
|
122
144
|
dualLog(`Funding validator on L1`);
|
|
123
|
-
const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
|
|
145
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
|
|
124
146
|
await cheatCodes.setBalance(attesterAddress, 10n ** 20n);
|
|
125
147
|
} else {
|
|
126
148
|
const balance = await l1Client.getBalance({ address: attesterAddress.toString() });
|
|
@@ -172,7 +194,7 @@ export async function addL1ValidatorViaRollup({
|
|
|
172
194
|
|
|
173
195
|
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
174
196
|
|
|
175
|
-
const l1TxUtils =
|
|
197
|
+
const l1TxUtils = createL1TxUtils(l1Client, { logger: debugLogger });
|
|
176
198
|
|
|
177
199
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
178
200
|
to: rollupAddress.toString(),
|
|
@@ -194,7 +216,7 @@ export async function addL1ValidatorViaRollup({
|
|
|
194
216
|
await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
|
|
195
217
|
if (isAnvilTestChain(chainId)) {
|
|
196
218
|
dualLog(`Funding validator on L1`);
|
|
197
|
-
const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
|
|
219
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
|
|
198
220
|
await cheatCodes.setBalance(attesterAddress, 10n ** 20n);
|
|
199
221
|
} else {
|
|
200
222
|
const balance = await l1Client.getBalance({ address: attesterAddress.toString() });
|
|
@@ -219,7 +241,7 @@ export async function removeL1Validator({
|
|
|
219
241
|
const account = getAccount(privateKey, mnemonic);
|
|
220
242
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
221
243
|
const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
|
|
222
|
-
const l1TxUtils =
|
|
244
|
+
const l1TxUtils = createL1TxUtils(l1Client, { logger: debugLogger });
|
|
223
245
|
|
|
224
246
|
dualLog(`Removing validator ${validatorAddress.toString()} from rollup ${rollupAddress.toString()}`);
|
|
225
247
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
@@ -246,7 +268,7 @@ export async function pruneRollup({
|
|
|
246
268
|
const account = getAccount(privateKey, mnemonic);
|
|
247
269
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
248
270
|
const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
|
|
249
|
-
const l1TxUtils =
|
|
271
|
+
const l1TxUtils = createL1TxUtils(l1Client, { logger: debugLogger });
|
|
250
272
|
|
|
251
273
|
dualLog(`Trying prune`);
|
|
252
274
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
@@ -275,7 +297,7 @@ export async function fastForwardEpochs({
|
|
|
275
297
|
client: publicClient,
|
|
276
298
|
});
|
|
277
299
|
|
|
278
|
-
const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
|
|
300
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
|
|
279
301
|
const currentSlot = await rollup.read.getCurrentSlot();
|
|
280
302
|
const l2SlotsInEpoch = await rollup.read.getEpochDuration();
|
|
281
303
|
const timestamp = await rollup.read.getTimestampForSlot([currentSlot + l2SlotsInEpoch * numEpochs]);
|
|
@@ -298,9 +320,9 @@ export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }: Roll
|
|
|
298
320
|
const publicClient = getPublicClient({ l1RpcUrls: rpcUrls, l1ChainId: chainId });
|
|
299
321
|
const rollup = new RollupContract(publicClient, rollupAddress);
|
|
300
322
|
|
|
301
|
-
const pendingNum = await rollup.
|
|
323
|
+
const pendingNum = await rollup.getCheckpointNumber();
|
|
302
324
|
log(`Pending block num: ${pendingNum}`);
|
|
303
|
-
const provenNum = await rollup.
|
|
325
|
+
const provenNum = await rollup.getProvenCheckpointNumber();
|
|
304
326
|
log(`Proven block num: ${provenNum}`);
|
|
305
327
|
const validators = await rollup.getAttesters();
|
|
306
328
|
log(`Validators: ${validators.map(v => v.toString()).join(', ')}`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { computeSecretHash } from '@aztec/aztec.js';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { computeSecretHash } from '@aztec/aztec.js/crypto';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
|
|
5
5
|
export async function generateSecretAndHash(log: LogFn) {
|
package/src/cmds/misc/index.ts
CHANGED
|
@@ -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
|
|
|
@@ -9,7 +9,7 @@ import { type SemVer, parse } from 'semver';
|
|
|
9
9
|
import type { DependencyChanges } from './common.js';
|
|
10
10
|
import { atomicUpdateFile } from './utils.js';
|
|
11
11
|
|
|
12
|
-
const deprecatedNpmPackages = new Set<string>(['@aztec/cli', '@aztec/aztec-
|
|
12
|
+
const deprecatedNpmPackages = new Set<string>(['@aztec/cli', '@aztec/aztec-local-network']);
|
|
13
13
|
const npmDeprecationMessage = `
|
|
14
14
|
The following packages have been deprecated and will no longer be updated on the npm registry:
|
|
15
15
|
${Array.from(deprecatedNpmPackages)
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
+
import { loadKeystoreFile } from '@aztec/node-keystore/loader';
|
|
4
|
+
import type { KeyStore } from '@aztec/node-keystore/types';
|
|
5
|
+
|
|
6
|
+
import { wordlist } from '@scure/bip39/wordlists/english.js';
|
|
7
|
+
import { dirname, isAbsolute, join } from 'path';
|
|
8
|
+
import { generateMnemonic } from 'viem/accounts';
|
|
9
|
+
|
|
10
|
+
import type { NewValidatorKeystoreOptions } from './new.js';
|
|
11
|
+
import {
|
|
12
|
+
buildValidatorEntries,
|
|
13
|
+
logValidatorSummaries,
|
|
14
|
+
maybePrintJson,
|
|
15
|
+
writeBlsBn254ToFile,
|
|
16
|
+
writeEthJsonV3ToFile,
|
|
17
|
+
writeKeystoreFile,
|
|
18
|
+
} from './shared.js';
|
|
19
|
+
import { validateBlsPathOptions, validatePublisherOptions, validateRemoteSignerOptions } from './utils.js';
|
|
20
|
+
|
|
21
|
+
export type AddValidatorKeysOptions = NewValidatorKeystoreOptions;
|
|
22
|
+
|
|
23
|
+
export async function addValidatorKeys(existing: string, options: AddValidatorKeysOptions, log: LogFn) {
|
|
24
|
+
// validate bls-path inputs before proceeding with key generation
|
|
25
|
+
validateBlsPathOptions(options);
|
|
26
|
+
// validate publisher options
|
|
27
|
+
validatePublisherOptions(options);
|
|
28
|
+
// validate remote signer options
|
|
29
|
+
validateRemoteSignerOptions(options);
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
dataDir,
|
|
33
|
+
file,
|
|
34
|
+
count,
|
|
35
|
+
publisherCount = 0,
|
|
36
|
+
publishers,
|
|
37
|
+
mnemonic,
|
|
38
|
+
accountIndex = 0,
|
|
39
|
+
addressIndex,
|
|
40
|
+
ikm,
|
|
41
|
+
blsPath,
|
|
42
|
+
json,
|
|
43
|
+
feeRecipient: feeRecipientOpt,
|
|
44
|
+
coinbase: coinbaseOpt,
|
|
45
|
+
remoteSigner: remoteSignerOpt,
|
|
46
|
+
password,
|
|
47
|
+
encryptedKeystoreDir,
|
|
48
|
+
} = options;
|
|
49
|
+
|
|
50
|
+
const validatorCount = typeof count === 'number' && Number.isFinite(count) && count > 0 ? Math.floor(count) : 1;
|
|
51
|
+
const baseAddressIndex = addressIndex ?? 0;
|
|
52
|
+
|
|
53
|
+
const keystore: KeyStore = loadKeystoreFile(existing);
|
|
54
|
+
|
|
55
|
+
if (!keystore.validators || !Array.isArray(keystore.validators)) {
|
|
56
|
+
throw new Error('Invalid keystore: missing validators array');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const first = keystore.validators[0] ?? {};
|
|
60
|
+
const feeRecipient = feeRecipientOpt ?? first.feeRecipient;
|
|
61
|
+
if (!feeRecipient) {
|
|
62
|
+
throw new Error('feeRecipient is required (either present in existing file or via --fee-recipient)');
|
|
63
|
+
}
|
|
64
|
+
const coinbase = (coinbaseOpt as EthAddress | undefined) ?? (first.coinbase as EthAddress | undefined);
|
|
65
|
+
const derivedRemoteSigner = (first.attester as any)?.remoteSignerUrl || (first.attester as any)?.eth?.remoteSignerUrl;
|
|
66
|
+
const remoteSigner = remoteSignerOpt ?? derivedRemoteSigner;
|
|
67
|
+
|
|
68
|
+
// Ensure we always have a mnemonic for key derivation if none was provided
|
|
69
|
+
const mnemonicToUse = mnemonic ?? generateMnemonic(wordlist);
|
|
70
|
+
|
|
71
|
+
// If user explicitly provided --address-index, use it as-is. Otherwise, append after existing validators.
|
|
72
|
+
const effectiveBaseAddressIndex =
|
|
73
|
+
addressIndex === undefined ? baseAddressIndex + keystore.validators.length : baseAddressIndex;
|
|
74
|
+
|
|
75
|
+
const { validators, summaries } = await buildValidatorEntries({
|
|
76
|
+
validatorCount,
|
|
77
|
+
publisherCount,
|
|
78
|
+
publishers,
|
|
79
|
+
accountIndex,
|
|
80
|
+
baseAddressIndex: effectiveBaseAddressIndex,
|
|
81
|
+
mnemonic: mnemonicToUse,
|
|
82
|
+
ikm,
|
|
83
|
+
blsPath,
|
|
84
|
+
feeRecipient,
|
|
85
|
+
coinbase,
|
|
86
|
+
remoteSigner,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
keystore.validators.push(...validators);
|
|
90
|
+
|
|
91
|
+
// If password provided, write ETH JSON V3 and BLS BN254 keystores and replace plaintext
|
|
92
|
+
if (password !== undefined) {
|
|
93
|
+
let targetDir: string;
|
|
94
|
+
if (encryptedKeystoreDir && encryptedKeystoreDir.length > 0) {
|
|
95
|
+
targetDir = encryptedKeystoreDir;
|
|
96
|
+
} else if (dataDir && dataDir.length > 0) {
|
|
97
|
+
targetDir = dataDir;
|
|
98
|
+
} else {
|
|
99
|
+
targetDir = dirname(existing);
|
|
100
|
+
}
|
|
101
|
+
await writeEthJsonV3ToFile(keystore.validators, { outDir: targetDir, password });
|
|
102
|
+
await writeBlsBn254ToFile(keystore.validators, { outDir: targetDir, password, blsPath });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let outputPath = existing;
|
|
106
|
+
if (file && file.length > 0) {
|
|
107
|
+
if (isAbsolute(file)) {
|
|
108
|
+
outputPath = file;
|
|
109
|
+
} else if (dataDir && dataDir.length > 0) {
|
|
110
|
+
outputPath = join(dataDir, file);
|
|
111
|
+
} else {
|
|
112
|
+
outputPath = join(dirname(existing), file);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
await writeKeystoreFile(outputPath, keystore);
|
|
117
|
+
|
|
118
|
+
if (!json) {
|
|
119
|
+
log(`Updated keystore ${outputPath} with ${validators.length} new validator(s)`);
|
|
120
|
+
logValidatorSummaries(log, summaries);
|
|
121
|
+
}
|
|
122
|
+
maybePrintJson(log, !!json, keystore as unknown as Record<string, any>);
|
|
123
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { deriveBlsPrivateKey } from '@aztec/foundation/crypto/bls';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
+
|
|
4
|
+
import { writeFile } from 'fs/promises';
|
|
5
|
+
|
|
6
|
+
import { computeBlsPublicKeyCompressed, withValidatorIndex } from './shared.js';
|
|
7
|
+
import { defaultBlsPath } from './utils.js';
|
|
8
|
+
|
|
9
|
+
export type GenerateBlsKeypairOptions = {
|
|
10
|
+
mnemonic?: string;
|
|
11
|
+
ikm?: string;
|
|
12
|
+
blsPath?: string;
|
|
13
|
+
g2?: boolean;
|
|
14
|
+
compressed?: boolean;
|
|
15
|
+
json?: boolean;
|
|
16
|
+
out?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export async function generateBlsKeypair(options: GenerateBlsKeypairOptions, log: LogFn) {
|
|
20
|
+
const { mnemonic, ikm, blsPath, compressed = true, json, out } = options;
|
|
21
|
+
const path = withValidatorIndex(blsPath ?? defaultBlsPath, 0);
|
|
22
|
+
const priv = deriveBlsPrivateKey(mnemonic, ikm, path);
|
|
23
|
+
const pub = await computeBlsPublicKeyCompressed(priv);
|
|
24
|
+
const result = { path, privateKey: priv, publicKey: pub, format: compressed ? 'compressed' : 'uncompressed' };
|
|
25
|
+
if (out) {
|
|
26
|
+
await writeFile(out, JSON.stringify(result, null, 2), { encoding: 'utf-8' });
|
|
27
|
+
if (!json) {
|
|
28
|
+
log(`Wrote BLS keypair to ${out}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (json || !out) {
|
|
32
|
+
log(JSON.stringify(result, null, 2));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
|
|
5
|
+
import { parseAztecAddress, parseEthereumAddress, parseHex, parseOptionalInteger } from '../../utils/commands.js';
|
|
6
|
+
import { defaultBlsPath } from './utils.js';
|
|
7
|
+
|
|
8
|
+
export function injectCommands(program: Command, log: LogFn) {
|
|
9
|
+
const group = program
|
|
10
|
+
.command('validator-keys')
|
|
11
|
+
.aliases(['valKeys', 'valkeys'])
|
|
12
|
+
.description('Manage validator keystores for node operators');
|
|
13
|
+
|
|
14
|
+
group
|
|
15
|
+
.command('new')
|
|
16
|
+
.summary('Generate a new validator keystore JSON')
|
|
17
|
+
.description('Generates a new validator keystore with ETH secp256k1 accounts and optional BLS accounts')
|
|
18
|
+
.option('--data-dir <path>', 'Directory to store keystore(s). Defaults to ~/.aztec/keystore')
|
|
19
|
+
.option('--file <name>', 'Keystore file name. Defaults to key1.json (or keyN.json if key1.json exists)')
|
|
20
|
+
.option('--count <N>', 'Number of validators to generate', parseOptionalInteger)
|
|
21
|
+
.option('--publisher-count <N>', 'Number of publisher accounts per validator (default 0)', value =>
|
|
22
|
+
parseOptionalInteger(value, 0),
|
|
23
|
+
)
|
|
24
|
+
.option('--publishers <privateKeys>', 'Comma-separated list of publisher private keys for all validators.', value =>
|
|
25
|
+
value.split(',').map((key: string) => key.trim()),
|
|
26
|
+
)
|
|
27
|
+
.option('--mnemonic <mnemonic>', 'Mnemonic for ETH/BLS derivation')
|
|
28
|
+
.option('--passphrase <str>', 'Optional passphrase for mnemonic')
|
|
29
|
+
.option('--account-index <N>', 'Base account index for ETH/BLS derivation', parseOptionalInteger)
|
|
30
|
+
.option('--address-index <N>', 'Base address index for ETH/BLS derivation', parseOptionalInteger)
|
|
31
|
+
.option(
|
|
32
|
+
'--coinbase <address>',
|
|
33
|
+
'Coinbase ETH address to use when proposing. Defaults to attester address.',
|
|
34
|
+
parseEthereumAddress,
|
|
35
|
+
)
|
|
36
|
+
// TODO: add funding account back in when implemented
|
|
37
|
+
// .option('--funding-account <privateKey|address>', 'ETH private key (or address for remote signer setup) to fund publishers')
|
|
38
|
+
.option('--remote-signer <url>', 'Default remote signer URL for accounts in this file')
|
|
39
|
+
.option('--ikm <hex>', 'Initial keying material for BLS (alternative to mnemonic)', value => parseHex(value, 32))
|
|
40
|
+
.option('--bls-path <path>', `EIP-2334 path (default ${defaultBlsPath})`)
|
|
41
|
+
.option(
|
|
42
|
+
'--password <str>',
|
|
43
|
+
'Password for writing keystore files (ETH JSON V3 and BLS EIP-2335). Empty string allowed',
|
|
44
|
+
)
|
|
45
|
+
.option('--encrypted-keystore-dir <dir>', 'Output directory for encrypted keystore file(s)')
|
|
46
|
+
.option('--json', 'Echo resulting JSON to stdout')
|
|
47
|
+
.option('--staker-output', 'Generate a single staker output JSON file with an array of validator entries')
|
|
48
|
+
.option('--gse-address <address>', 'GSE contract address (required with --staker-output)', parseEthereumAddress)
|
|
49
|
+
.option('--l1-rpc-urls <urls>', 'L1 RPC URLs (comma-separated, required with --staker-output)', value =>
|
|
50
|
+
value.split(','),
|
|
51
|
+
)
|
|
52
|
+
.option(
|
|
53
|
+
'-c, --l1-chain-id <number>',
|
|
54
|
+
'L1 chain ID (required with --staker-output)',
|
|
55
|
+
value => parseInt(value),
|
|
56
|
+
31337,
|
|
57
|
+
)
|
|
58
|
+
.requiredOption('--fee-recipient <address>', 'Aztec address that will receive fees', parseAztecAddress)
|
|
59
|
+
.action(async options => {
|
|
60
|
+
const { newValidatorKeystore } = await import('./new.js');
|
|
61
|
+
|
|
62
|
+
await newValidatorKeystore(options, log);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
group
|
|
66
|
+
.command('add')
|
|
67
|
+
.summary('Augment an existing validator keystore JSON')
|
|
68
|
+
.description('Adds attester/publisher/BLS entries to an existing keystore using the same flags as new')
|
|
69
|
+
.argument('<existing>', 'Path to existing keystore JSON')
|
|
70
|
+
.option('--data-dir <path>', 'Directory where keystore(s) live. (default: ~/.aztec/keystore)')
|
|
71
|
+
.option('--file <name>', 'Override output file name. (default: key<N>.json)')
|
|
72
|
+
.option('--count <N>', 'Number of validators to add. (default: 1)', parseOptionalInteger)
|
|
73
|
+
.option('--publisher-count <N>', 'Number of publisher accounts per validator (default 0)', value =>
|
|
74
|
+
parseOptionalInteger(value, 0),
|
|
75
|
+
)
|
|
76
|
+
.option('--publishers <privateKeys>', 'Comma-separated list of publisher private keys for all validators.', value =>
|
|
77
|
+
value.split(',').map((key: string) => key.trim()),
|
|
78
|
+
)
|
|
79
|
+
.option('--mnemonic <mnemonic>', 'Mnemonic for ETH/BLS derivation')
|
|
80
|
+
.option('--passphrase <str>', 'Optional passphrase for mnemonic')
|
|
81
|
+
.option('--account-index <N>', 'Base account index for ETH/BLS derivation', parseOptionalInteger)
|
|
82
|
+
.option('--address-index <N>', 'Base address index for ETH/BLS derivation', parseOptionalInteger)
|
|
83
|
+
.option(
|
|
84
|
+
'--coinbase <address>',
|
|
85
|
+
'Coinbase ETH address to use when proposing. Defaults to attester address.',
|
|
86
|
+
parseEthereumAddress,
|
|
87
|
+
)
|
|
88
|
+
// TODO: add funding account back in when implemented
|
|
89
|
+
// .option('--funding-account <privateKey|address>', 'ETH private key (or address for remote signer setup) to fund publishers')
|
|
90
|
+
.option('--remote-signer <url>', 'Default remote signer URL for accounts in this file')
|
|
91
|
+
.option('--ikm <hex>', 'Initial keying material for BLS (alternative to mnemonic)', value => parseHex(value, 32))
|
|
92
|
+
.option('--bls-path <path>', `EIP-2334 path (default ${defaultBlsPath})`)
|
|
93
|
+
.option('--empty', 'Generate an empty skeleton without keys')
|
|
94
|
+
.option(
|
|
95
|
+
'--password <str>',
|
|
96
|
+
'Password for writing keystore files (ETH JSON V3 and BLS EIP-2335). Empty string allowed',
|
|
97
|
+
)
|
|
98
|
+
.option('--encrypted-keystore-dir <dir>', 'Output directory for encrypted keystore file(s)')
|
|
99
|
+
.option('--json', 'Echo resulting JSON to stdout')
|
|
100
|
+
.requiredOption('--fee-recipient <address>', 'Aztec address that will receive fees', parseAztecAddress)
|
|
101
|
+
.action(async (existing: string, options) => {
|
|
102
|
+
const { addValidatorKeys } = await import('./add.js');
|
|
103
|
+
await addValidatorKeys(existing, options, log);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
group
|
|
107
|
+
.command('staker')
|
|
108
|
+
.summary('Generate staking JSON from keystore')
|
|
109
|
+
.description(
|
|
110
|
+
'Reads a validator keystore and outputs staking data with BLS public keys for each attester (skips mnemonics)',
|
|
111
|
+
)
|
|
112
|
+
.requiredOption('--from <keystore>', 'Path to keystore JSON file')
|
|
113
|
+
.option('--password <password>', 'Password for decrypting encrypted keystores (if not specified in keystore file)')
|
|
114
|
+
.requiredOption('--gse-address <address>', 'GSE contract address', parseEthereumAddress)
|
|
115
|
+
.option('--l1-rpc-urls <urls>', 'L1 RPC URLs (comma-separated)', value => value.split(','), [
|
|
116
|
+
'http://localhost:8545',
|
|
117
|
+
])
|
|
118
|
+
.option('-c, --l1-chain-id <number>', 'L1 chain ID', value => parseInt(value), 31337)
|
|
119
|
+
.option('--output <file>', 'Output file path (if not specified, JSON is written to stdout)')
|
|
120
|
+
.action(async options => {
|
|
121
|
+
const { generateStakerJson } = await import('./staker.js');
|
|
122
|
+
await generateStakerJson(options, log);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// top-level convenience: aztec generate-bls-keypair
|
|
126
|
+
program
|
|
127
|
+
.command('generate-bls-keypair')
|
|
128
|
+
.description('Generate a BLS keypair with convenience flags')
|
|
129
|
+
.option('--mnemonic <mnemonic>', 'Mnemonic for BLS derivation')
|
|
130
|
+
.option('--ikm <hex>', 'Initial keying material for BLS (alternative to mnemonic)', value => parseHex(value, 32))
|
|
131
|
+
.option('--bls-path <path>', `EIP-2334 path (default ${defaultBlsPath})`)
|
|
132
|
+
.option('--g2', 'Derive on G2 subgroup')
|
|
133
|
+
.option('--compressed', 'Output compressed public key')
|
|
134
|
+
.option('--json', 'Print JSON output to stdout')
|
|
135
|
+
.option('--out <file>', 'Write output to file')
|
|
136
|
+
.action(async options => {
|
|
137
|
+
const { generateBlsKeypair } = await import('./generate_bls_keypair.js');
|
|
138
|
+
await generateBlsKeypair(options, log);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
return program;
|
|
142
|
+
}
|