@aztec/cli 0.0.1-commit.fce3e4f → 0.0.1-commit.fffb133c
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/dest/cmds/aztec_node/get_block.d.ts +1 -1
- package/dest/cmds/aztec_node/get_block.d.ts.map +1 -1
- package/dest/cmds/aztec_node/get_block.js +2 -1
- 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_base_fee.js → get_current_min_fee.js} +2 -2
- package/dest/cmds/aztec_node/get_logs.d.ts +3 -2
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -1
- package/dest/cmds/aztec_node/index.js +3 -3
- package/dest/cmds/contracts/inspect_contract.js +1 -1
- package/dest/cmds/infrastructure/index.d.ts +1 -1
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +0 -1
- package/dest/cmds/infrastructure/sequencers.d.ts +1 -2
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +11 -4
- package/dest/cmds/infrastructure/setup_l2_contract.js +1 -1
- 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 +3 -4
- package/dest/cmds/l1/bridge_erc20.d.ts +1 -1
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +2 -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} +39 -4
- 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 +3 -3
- package/dest/cmds/l1/get_l1_addresses.d.ts +1 -1
- 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.js +4 -2
- package/dest/cmds/l1/governance_utils.d.ts +1 -1
- 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 +13 -10
- 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 +4 -2
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts +1 -1
- 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 +3 -3
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +52 -13
- package/dest/cmds/misc/generate_secret_and_hash.js +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/validator_keys/generate_bls_keypair.js +1 -1
- package/dest/cmds/validator_keys/new.d.ts +1 -1
- package/dest/cmds/validator_keys/new.d.ts.map +1 -1
- package/dest/cmds/validator_keys/new.js +5 -2
- package/dest/cmds/validator_keys/shared.d.ts +1 -1
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -1
- package/dest/cmds/validator_keys/shared.js +2 -1
- package/dest/cmds/validator_keys/staker.d.ts +2 -2
- package/dest/cmds/validator_keys/staker.d.ts.map +1 -1
- package/dest/cmds/validator_keys/staker.js +7 -4
- package/dest/cmds/validator_keys/utils.d.ts +1 -1
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -1
- package/dest/cmds/validator_keys/utils.js +1 -1
- package/dest/config/chain_l2_config.d.ts +12 -38
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +33 -493
- package/dest/config/generated/networks.d.ts +205 -0
- package/dest/config/generated/networks.d.ts.map +1 -0
- package/dest/config/generated/networks.js +206 -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/network_config.d.ts +6 -3
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +50 -28
- package/dest/utils/aztec.d.ts +7 -13
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +19 -40
- package/dest/utils/commands.d.ts +7 -6
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +6 -5
- package/dest/utils/encoding.js +1 -1
- package/dest/utils/inspect.d.ts +3 -2
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +4 -1
- package/package.json +41 -33
- package/src/cmds/aztec_node/get_block.ts +2 -1
- package/src/cmds/aztec_node/{get_current_base_fee.ts → get_current_min_fee.ts} +2 -2
- package/src/cmds/aztec_node/get_logs.ts +3 -2
- package/src/cmds/aztec_node/index.ts +3 -3
- package/src/cmds/contracts/inspect_contract.ts +1 -1
- package/src/cmds/infrastructure/index.ts +0 -1
- package/src/cmds/infrastructure/sequencers.ts +7 -5
- package/src/cmds/infrastructure/setup_l2_contract.ts +1 -1
- package/src/cmds/l1/assume_proven_through.ts +4 -4
- package/src/cmds/l1/bridge_erc20.ts +2 -1
- package/src/cmds/l1/{deploy_l1_contracts.ts → deploy_l1_contracts_cmd.ts} +39 -22
- package/src/cmds/l1/deploy_new_rollup.ts +4 -9
- package/src/cmds/l1/get_l1_addresses.ts +4 -2
- 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 +12 -21
- package/src/cmds/l1/prover_stats.ts +6 -2
- package/src/cmds/l1/trigger_seed_snapshot.ts +2 -1
- package/src/cmds/l1/update_l1_validators.ts +46 -25
- package/src/cmds/misc/generate_secret_and_hash.ts +1 -1
- package/src/cmds/misc/index.ts +1 -1
- package/src/cmds/validator_keys/generate_bls_keypair.ts +1 -1
- package/src/cmds/validator_keys/new.ts +3 -2
- package/src/cmds/validator_keys/shared.ts +2 -1
- package/src/cmds/validator_keys/staker.ts +5 -4
- package/src/cmds/validator_keys/utils.ts +2 -1
- package/src/config/chain_l2_config.ts +33 -644
- package/src/config/generated/networks.ts +210 -0
- package/src/config/get_l1_config.ts +4 -1
- package/src/config/network_config.ts +53 -29
- package/src/utils/aztec.ts +24 -83
- package/src/utils/commands.ts +6 -5
- package/src/utils/encoding.ts +1 -1
- package/src/utils/inspect.ts +6 -2
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts +0 -3
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts.map +0 -1
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +0 -4
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
-
import {
|
|
2
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
3
|
+
import type { Operator } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
3
4
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
-
import type { LogFn
|
|
5
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
5
6
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
6
7
|
|
|
7
8
|
import { deployNewRollupContracts } from '../../utils/aztec.js';
|
|
@@ -14,15 +15,12 @@ export async function deployNewRollup(
|
|
|
14
15
|
privateKey: string | undefined,
|
|
15
16
|
mnemonic: string,
|
|
16
17
|
mnemonicIndex: number,
|
|
17
|
-
salt: number | undefined,
|
|
18
18
|
testAccounts: boolean,
|
|
19
19
|
sponsoredFPC: boolean,
|
|
20
20
|
json: boolean,
|
|
21
21
|
initialValidators: Operator[],
|
|
22
22
|
realVerifier: boolean,
|
|
23
|
-
createVerificationJson: string | false,
|
|
24
23
|
log: LogFn,
|
|
25
|
-
debugLogger: Logger,
|
|
26
24
|
) {
|
|
27
25
|
const config = getL1ContractsConfigEnvVars();
|
|
28
26
|
|
|
@@ -34,18 +32,15 @@ export async function deployNewRollup(
|
|
|
34
32
|
const { rollup, slashFactoryAddress } = await deployNewRollupContracts(
|
|
35
33
|
registryAddress,
|
|
36
34
|
rpcUrls,
|
|
37
|
-
chainId,
|
|
38
35
|
privateKey,
|
|
36
|
+
chainId,
|
|
39
37
|
mnemonic,
|
|
40
38
|
mnemonicIndex,
|
|
41
|
-
salt,
|
|
42
39
|
initialValidators,
|
|
43
40
|
genesisArchiveRoot,
|
|
44
41
|
fundingNeeded,
|
|
45
42
|
config,
|
|
46
43
|
realVerifier,
|
|
47
|
-
createVerificationJson,
|
|
48
|
-
debugLogger,
|
|
49
44
|
);
|
|
50
45
|
|
|
51
46
|
if (json) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import {
|
|
2
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
3
|
+
import { RegistryContract } from '@aztec/ethereum/contracts';
|
|
4
|
+
import type { ViemPublicClient } from '@aztec/ethereum/types';
|
|
3
5
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
6
|
|
|
5
7
|
import { createPublicClient, fallback, http } from 'viem';
|
|
@@ -15,7 +17,7 @@ export async function getL1Addresses(
|
|
|
15
17
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
16
18
|
const publicClient: ViemPublicClient = createPublicClient({
|
|
17
19
|
chain: chain.chainInfo,
|
|
18
|
-
transport: fallback(rpcUrls.map(url => http(url))),
|
|
20
|
+
transport: fallback(rpcUrls.map(url => http(url, { batch: false }))),
|
|
19
21
|
pollingInterval: 100,
|
|
20
22
|
});
|
|
21
23
|
const addresses = await RegistryContract.collectAddresses(publicClient, registryAddress.toString(), rollupVersion);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createEthereumChain } from '@aztec/ethereum';
|
|
1
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
@@ -18,7 +18,7 @@ export async function getL1Balance(
|
|
|
18
18
|
const chain = createEthereumChain(l1RpcUrls, chainId);
|
|
19
19
|
const publicClient = createPublicClient({
|
|
20
20
|
chain: chain.chainInfo,
|
|
21
|
-
transport: fallback(l1RpcUrls.map(url => http(url))),
|
|
21
|
+
transport: fallback(l1RpcUrls.map(url => http(url, { batch: false }))),
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
let balance = 0n;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
ProposalState,
|
|
5
|
-
RegistryContract,
|
|
6
|
-
createEthereumChain,
|
|
7
|
-
createExtendedL1Client,
|
|
8
|
-
} from '@aztec/ethereum';
|
|
1
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
2
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
3
|
+
import { FeeJuiceContract, GovernanceContract, ProposalState, RegistryContract } from '@aztec/ethereum/contracts';
|
|
9
4
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
10
5
|
|
|
11
6
|
export async function depositGovernanceTokens({
|
package/src/cmds/l1/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
3
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
4
|
|
|
4
5
|
import { type Command, Option } from 'commander';
|
|
5
6
|
|
|
6
|
-
import { getL1RollupAddressFromEnv } from '../../config/get_l1_config.js';
|
|
7
7
|
import {
|
|
8
8
|
ETHEREUM_HOSTS,
|
|
9
9
|
MNEMONIC,
|
|
@@ -15,8 +15,6 @@ import {
|
|
|
15
15
|
parseEthereumAddress,
|
|
16
16
|
} from '../../utils/commands.js';
|
|
17
17
|
|
|
18
|
-
export { addL1Validator } from './update_l1_validators.js';
|
|
19
|
-
|
|
20
18
|
const l1RpcUrlsOption = new Option(
|
|
21
19
|
'--l1-rpc-urls <string>',
|
|
22
20
|
'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)',
|
|
@@ -42,31 +40,25 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
42
40
|
)
|
|
43
41
|
.option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', arg => parseInt(arg), 0)
|
|
44
42
|
.addOption(l1ChainIdOption)
|
|
45
|
-
.option('--salt <number>', 'The optional salt to use in deployment', arg => parseInt(arg))
|
|
46
43
|
.option('--json', 'Output the contract addresses in JSON format')
|
|
47
44
|
.option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts')
|
|
48
45
|
.option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
|
|
49
|
-
.option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false)
|
|
50
46
|
.option('--real-verifier', 'Deploy the real verifier', false)
|
|
51
47
|
.option('--existing-token <address>', 'Use an existing ERC20 for both fee and staking', parseEthereumAddress)
|
|
52
|
-
.option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false)
|
|
53
48
|
.action(async options => {
|
|
54
|
-
const {
|
|
49
|
+
const { deployL1ContractsCmd } = await import('./deploy_l1_contracts_cmd.js');
|
|
55
50
|
|
|
56
51
|
const initialValidators =
|
|
57
52
|
options.validators?.split(',').map((validator: string) => EthAddress.fromString(validator)) || [];
|
|
58
|
-
await
|
|
53
|
+
await deployL1ContractsCmd(
|
|
59
54
|
options.l1RpcUrls,
|
|
60
55
|
options.l1ChainId,
|
|
61
56
|
options.privateKey,
|
|
62
57
|
options.mnemonic,
|
|
63
58
|
options.mnemonicIndex,
|
|
64
|
-
options.salt,
|
|
65
59
|
options.testAccounts,
|
|
66
60
|
options.sponsoredFpc,
|
|
67
|
-
options.acceleratedTestDeployments,
|
|
68
61
|
options.json,
|
|
69
|
-
options.createVerificationJson,
|
|
70
62
|
initialValidators,
|
|
71
63
|
options.realVerifier,
|
|
72
64
|
options.existingToken,
|
|
@@ -89,12 +81,10 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
89
81
|
)
|
|
90
82
|
.option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', arg => parseInt(arg), 0)
|
|
91
83
|
.addOption(l1ChainIdOption)
|
|
92
|
-
.option('--salt <number>', 'The optional salt to use in deployment', arg => parseInt(arg))
|
|
93
84
|
.option('--json', 'Output the contract addresses in JSON format')
|
|
94
85
|
.option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts')
|
|
95
86
|
.option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
|
|
96
87
|
.option('--real-verifier', 'Deploy the real verifier', false)
|
|
97
|
-
.option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false)
|
|
98
88
|
.action(async options => {
|
|
99
89
|
const { deployNewRollup } = await import('./deploy_new_rollup.js');
|
|
100
90
|
|
|
@@ -107,15 +97,12 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
107
97
|
options.privateKey,
|
|
108
98
|
options.mnemonic,
|
|
109
99
|
options.mnemonicIndex,
|
|
110
|
-
options.salt,
|
|
111
100
|
options.testAccounts,
|
|
112
101
|
options.sponsoredFpc,
|
|
113
102
|
options.json,
|
|
114
103
|
initialValidators,
|
|
115
104
|
options.realVerifier,
|
|
116
|
-
options.createVerificationJson,
|
|
117
105
|
log,
|
|
118
|
-
debugLogger,
|
|
119
106
|
);
|
|
120
107
|
});
|
|
121
108
|
|
|
@@ -313,7 +300,11 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
313
300
|
.action(async options => {
|
|
314
301
|
const { addL1ValidatorViaRollup } = await import('./update_l1_validators.js');
|
|
315
302
|
|
|
316
|
-
|
|
303
|
+
let rollupAddress = options.rollup;
|
|
304
|
+
if (!rollupAddress) {
|
|
305
|
+
const { getL1RollupAddressFromEnv } = await import('../../config/get_l1_config.js');
|
|
306
|
+
rollupAddress = await getL1RollupAddressFromEnv(options.l1RpcUrls, options.l1ChainId);
|
|
307
|
+
}
|
|
317
308
|
|
|
318
309
|
await addL1ValidatorViaRollup({
|
|
319
310
|
rpcUrls: options.l1RpcUrls,
|
|
@@ -507,14 +498,14 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
507
498
|
program
|
|
508
499
|
.command('set-proven-through', { hidden: true })
|
|
509
500
|
.description(
|
|
510
|
-
'Instructs the L1 rollup contract to assume all blocks until the given
|
|
501
|
+
'Instructs the L1 rollup contract to assume all blocks until the given checkpoint are automatically proven.',
|
|
511
502
|
)
|
|
512
|
-
.argument('[
|
|
503
|
+
.argument('[checkpoint]', 'The target checkpoint, defaults to the latest pending checkpoint.', parseBigint)
|
|
513
504
|
.addOption(l1RpcUrlsOption)
|
|
514
505
|
.addOption(nodeOption)
|
|
515
|
-
.action(async (
|
|
506
|
+
.action(async (checkpoint, options) => {
|
|
516
507
|
const { assumeProvenThrough } = await import('./assume_proven_through.js');
|
|
517
|
-
await assumeProvenThrough(
|
|
508
|
+
await assumeProvenThrough(CheckpointNumber.fromBigInt(checkpoint), options.l1RpcUrls, options.nodeUrl, log);
|
|
518
509
|
});
|
|
519
510
|
|
|
520
511
|
program
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { retrieveL2ProofVerifiedEvents } from '@aztec/archiver';
|
|
2
|
-
import {
|
|
2
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
3
|
+
import type { ViemPublicClient } from '@aztec/ethereum/types';
|
|
3
4
|
import { compactArray, mapValues, unique } from '@aztec/foundation/collection';
|
|
4
5
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
6
|
import { type LogFn, type Logger, createLogger } from '@aztec/foundation/log';
|
|
@@ -46,7 +47,10 @@ export async function proverStats(opts: {
|
|
|
46
47
|
.then(a => a.rollupAddress);
|
|
47
48
|
|
|
48
49
|
const chain = createEthereumChain(l1RpcUrls, chainId).chainInfo;
|
|
49
|
-
const publicClient = createPublicClient({
|
|
50
|
+
const publicClient = createPublicClient({
|
|
51
|
+
chain,
|
|
52
|
+
transport: fallback(l1RpcUrls.map(url => http(url, { batch: false }))),
|
|
53
|
+
});
|
|
50
54
|
const lastBlockNum = endBlock ?? (await publicClient.getBlockNumber());
|
|
51
55
|
debugLog.verbose(`Querying events on rollup at ${rollup.toString()} from ${startBlock} up to ${lastBlockNum}`);
|
|
52
56
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { createEthereumChain
|
|
1
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
2
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
2
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
4
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
4
5
|
|
|
@@ -1,25 +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 { 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
|
-
|
|
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: '
|
|
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
|
-
|
|
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:
|
|
138
|
+
abi: RollupAbi,
|
|
119
139
|
});
|
|
120
|
-
dualLog(`
|
|
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/
|
|
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
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { prettyPrintJSON } from '@aztec/cli/utils';
|
|
2
|
-
import {
|
|
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 {
|
|
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 {
|
|
3
|
-
import {
|
|
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 {
|
|
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
|
|