@aztec/cli 3.0.0-canary.a9708bd → 3.0.0-devnet.20251212
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_base_fee.d.ts +3 -0
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_current_base_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 +7 -4
- 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 +10 -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 +2 -2
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +8 -6
- 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/create_l1_account.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +3 -3
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +6 -6
- package/dest/cmds/l1/deploy_new_rollup.d.ts +3 -3
- 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 +2 -1
- package/dest/cmds/l1/get_l1_balance.d.ts +1 -1
- package/dest/cmds/l1/get_l1_balance.js +1 -1
- 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 -1
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +18 -34
- 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 +29 -29
- 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 +10 -5
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +74 -9
- 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/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 +132 -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 +208 -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 +18 -0
- package/dest/config/cached_fetch.d.ts.map +1 -0
- package/dest/config/cached_fetch.js +54 -0
- package/dest/config/chain_l2_config.d.ts +41 -0
- package/dest/config/chain_l2_config.d.ts.map +1 -0
- package/dest/config/chain_l2_config.js +505 -0
- package/dest/config/enrich_env.d.ts +4 -0
- package/dest/config/enrich_env.d.ts.map +1 -0
- package/dest/config/enrich_env.js +12 -0
- package/dest/config/get_l1_config.d.ts +9 -0
- package/dest/config/get_l1_config.d.ts.map +1 -0
- package/dest/config/get_l1_config.js +24 -0
- package/dest/config/index.d.ts +5 -0
- package/dest/config/index.d.ts.map +1 -0
- package/dest/config/index.js +4 -0
- package/dest/config/network_config.d.ts +22 -0
- package/dest/config/network_config.d.ts.map +1 -0
- package/dest/config/network_config.js +109 -0
- package/dest/utils/aztec.d.ts +8 -12
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +14 -35
- package/dest/utils/commands.d.ts +18 -10
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +35 -9
- 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 +13 -95
- 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 +40 -28
- 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_base_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 +9 -8
- package/src/cmds/infrastructure/setup_l2_contract.ts +13 -30
- package/src/cmds/l1/advance_epoch.ts +6 -5
- package/src/cmds/l1/assume_proven_through.ts +10 -6
- package/src/cmds/l1/bridge_erc20.ts +5 -2
- package/src/cmds/l1/deploy_l1_contracts.ts +7 -4
- package/src/cmds/l1/deploy_new_rollup.ts +6 -3
- package/src/cmds/l1/get_l1_addresses.ts +4 -2
- package/src/cmds/l1/get_l1_balance.ts +1 -1
- package/src/cmds/l1/governance_utils.ts +3 -8
- package/src/cmds/l1/index.ts +25 -53
- package/src/cmds/l1/prover_stats.ts +38 -30
- package/src/cmds/l1/trigger_seed_snapshot.ts +2 -1
- package/src/cmds/l1/update_l1_validators.ts +88 -18
- 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/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 +80 -0
- package/src/config/cached_fetch.ts +67 -0
- package/src/config/chain_l2_config.ts +669 -0
- package/src/config/enrich_env.ts +15 -0
- package/src/config/get_l1_config.ts +31 -0
- package/src/config/index.ts +4 -0
- package/src/config/network_config.ts +140 -0
- package/src/utils/aztec.ts +17 -49
- package/src/utils/commands.ts +49 -13
- package/src/utils/encoding.ts +1 -1
- package/src/utils/inspect.ts +19 -111
- package/src/utils/setup_contracts.ts +4 -43
- package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
- package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
- package/dest/cmds/devnet/bootstrap_network.js +0 -216
- package/dest/cmds/devnet/faucet.d.ts +0 -4
- package/dest/cmds/devnet/faucet.d.ts.map +0 -1
- package/dest/cmds/devnet/faucet.js +0 -26
- package/dest/cmds/devnet/index.d.ts +0 -4
- package/dest/cmds/devnet/index.d.ts.map +0 -1
- package/dest/cmds/devnet/index.js +0 -14
- 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/devnet/bootstrap_network.ts +0 -321
- package/src/cmds/devnet/faucet.ts +0 -33
- package/src/cmds/devnet/index.ts +0 -60
- 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,16 +1,12 @@
|
|
|
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 { 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';
|
|
9
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
14
10
|
import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
15
11
|
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
|
|
16
12
|
|
|
@@ -96,7 +92,7 @@ export async function addL1Validator({
|
|
|
96
92
|
|
|
97
93
|
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
98
94
|
|
|
99
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
|
|
95
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
|
|
100
96
|
const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
|
|
101
97
|
const merkleProofArray = merkleProof.map(proof => addLeadingHex(proof));
|
|
102
98
|
|
|
@@ -120,7 +116,81 @@ export async function addL1Validator({
|
|
|
120
116
|
await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
|
|
121
117
|
if (isAnvilTestChain(chainId)) {
|
|
122
118
|
dualLog(`Funding validator on L1`);
|
|
123
|
-
const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
|
|
119
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
|
|
120
|
+
await cheatCodes.setBalance(attesterAddress, 10n ** 20n);
|
|
121
|
+
} else {
|
|
122
|
+
const balance = await l1Client.getBalance({ address: attesterAddress.toString() });
|
|
123
|
+
dualLog(`Validator balance: ${formatEther(balance)} ETH`);
|
|
124
|
+
if (balance === 0n) {
|
|
125
|
+
dualLog(`WARNING: Proposer has no balance. Remember to fund it!`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export async function addL1ValidatorViaRollup({
|
|
131
|
+
rpcUrls,
|
|
132
|
+
chainId,
|
|
133
|
+
privateKey,
|
|
134
|
+
mnemonic,
|
|
135
|
+
attesterAddress,
|
|
136
|
+
withdrawerAddress,
|
|
137
|
+
blsSecretKey,
|
|
138
|
+
moveWithLatestRollup,
|
|
139
|
+
rollupAddress,
|
|
140
|
+
log,
|
|
141
|
+
debugLogger,
|
|
142
|
+
}: RollupCommandArgs &
|
|
143
|
+
LoggerArgs & {
|
|
144
|
+
blsSecretKey: bigint; // scalar field element of BN254
|
|
145
|
+
attesterAddress: EthAddress;
|
|
146
|
+
moveWithLatestRollup: boolean;
|
|
147
|
+
}) {
|
|
148
|
+
const dualLog = makeDualLog(log, debugLogger);
|
|
149
|
+
const account = getAccount(privateKey, mnemonic);
|
|
150
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
151
|
+
const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
|
|
152
|
+
|
|
153
|
+
dualLog(`Adding validator ${attesterAddress} to rollup ${rollupAddress.toString()} via direct deposit`);
|
|
154
|
+
|
|
155
|
+
if (!withdrawerAddress) {
|
|
156
|
+
throw new Error(`Withdrawer address required`);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const rollup = getContract({
|
|
160
|
+
address: rollupAddress.toString(),
|
|
161
|
+
abi: RollupAbi,
|
|
162
|
+
client: l1Client,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const gseAddress = await rollup.read.getGSE();
|
|
166
|
+
|
|
167
|
+
const gse = new GSEContract(l1Client, gseAddress);
|
|
168
|
+
|
|
169
|
+
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
170
|
+
|
|
171
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
|
|
172
|
+
|
|
173
|
+
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
174
|
+
to: rollupAddress.toString(),
|
|
175
|
+
data: encodeFunctionData({
|
|
176
|
+
abi: RollupAbi,
|
|
177
|
+
functionName: 'deposit',
|
|
178
|
+
args: [
|
|
179
|
+
attesterAddress.toString(),
|
|
180
|
+
withdrawerAddress.toString(),
|
|
181
|
+
registrationTuple.publicKeyInG1,
|
|
182
|
+
registrationTuple.publicKeyInG2,
|
|
183
|
+
registrationTuple.proofOfPossession,
|
|
184
|
+
moveWithLatestRollup,
|
|
185
|
+
],
|
|
186
|
+
}),
|
|
187
|
+
abi: StakingAssetHandlerAbi,
|
|
188
|
+
});
|
|
189
|
+
dualLog(`Transaction hash: ${receipt.transactionHash}`);
|
|
190
|
+
await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
|
|
191
|
+
if (isAnvilTestChain(chainId)) {
|
|
192
|
+
dualLog(`Funding validator on L1`);
|
|
193
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
|
|
124
194
|
await cheatCodes.setBalance(attesterAddress, 10n ** 20n);
|
|
125
195
|
} else {
|
|
126
196
|
const balance = await l1Client.getBalance({ address: attesterAddress.toString() });
|
|
@@ -145,7 +215,7 @@ export async function removeL1Validator({
|
|
|
145
215
|
const account = getAccount(privateKey, mnemonic);
|
|
146
216
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
147
217
|
const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
|
|
148
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
|
|
218
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
|
|
149
219
|
|
|
150
220
|
dualLog(`Removing validator ${validatorAddress.toString()} from rollup ${rollupAddress.toString()}`);
|
|
151
221
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
@@ -172,7 +242,7 @@ export async function pruneRollup({
|
|
|
172
242
|
const account = getAccount(privateKey, mnemonic);
|
|
173
243
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
174
244
|
const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
|
|
175
|
-
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
|
|
245
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
|
|
176
246
|
|
|
177
247
|
dualLog(`Trying prune`);
|
|
178
248
|
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
@@ -201,7 +271,7 @@ export async function fastForwardEpochs({
|
|
|
201
271
|
client: publicClient,
|
|
202
272
|
});
|
|
203
273
|
|
|
204
|
-
const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
|
|
274
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
|
|
205
275
|
const currentSlot = await rollup.read.getCurrentSlot();
|
|
206
276
|
const l2SlotsInEpoch = await rollup.read.getEpochDuration();
|
|
207
277
|
const timestamp = await rollup.read.getTimestampForSlot([currentSlot + l2SlotsInEpoch * numEpochs]);
|
|
@@ -224,9 +294,9 @@ export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }: Roll
|
|
|
224
294
|
const publicClient = getPublicClient({ l1RpcUrls: rpcUrls, l1ChainId: chainId });
|
|
225
295
|
const rollup = new RollupContract(publicClient, rollupAddress);
|
|
226
296
|
|
|
227
|
-
const pendingNum = await rollup.
|
|
297
|
+
const pendingNum = await rollup.getCheckpointNumber();
|
|
228
298
|
log(`Pending block num: ${pendingNum}`);
|
|
229
|
-
const provenNum = await rollup.
|
|
299
|
+
const provenNum = await rollup.getProvenCheckpointNumber();
|
|
230
300
|
log(`Proven block num: ${provenNum}`);
|
|
231
301
|
const validators = await rollup.getAttesters();
|
|
232
302
|
log(`Validators: ${validators.map(v => v.toString()).join(', ')}`);
|
|
@@ -234,7 +304,7 @@ export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }: Roll
|
|
|
234
304
|
log(`Committee: ${committee?.map(v => v.toString()).join(', ')}`);
|
|
235
305
|
const archive = await rollup.archive();
|
|
236
306
|
log(`Archive: ${archive}`);
|
|
237
|
-
const epochNum = await rollup.
|
|
307
|
+
const epochNum = await rollup.getCurrentEpochNumber();
|
|
238
308
|
log(`Current epoch: ${epochNum}`);
|
|
239
309
|
const slot = await rollup.getSlotNumber();
|
|
240
310
|
log(`Current slot: ${slot}`);
|
|
@@ -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) {
|
|
@@ -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
|
+
}
|