@aztec/cli 3.0.0-nightly.20250908 → 3.0.0-nightly.20250911
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/devnet/bootstrap_network.d.ts.map +1 -1
- package/dest/cmds/devnet/bootstrap_network.js +11 -10
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +2 -2
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +10 -14
- package/dest/cmds/l1/deploy_l1_contracts.js +2 -2
- package/dest/cmds/l1/deploy_new_rollup.js +2 -2
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +9 -7
- package/dest/cmds/l1/update_l1_validators.d.ts +5 -0
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +52 -0
- package/dest/config/chain_l2_config.d.ts +32 -0
- package/dest/config/chain_l2_config.d.ts.map +1 -0
- package/dest/config/chain_l2_config.js +291 -0
- package/dest/config/get_l1_config.d.ts +8 -0
- package/dest/config/get_l1_config.d.ts.map +1 -0
- package/dest/config/get_l1_config.js +22 -0
- package/dest/config/index.d.ts +3 -0
- package/dest/config/index.d.ts.map +1 -0
- package/dest/config/index.js +2 -0
- package/dest/utils/setup_contracts.d.ts +3 -3
- package/dest/utils/setup_contracts.d.ts.map +1 -1
- package/dest/utils/setup_contracts.js +9 -19
- package/package.json +26 -23
- package/src/cmds/devnet/bootstrap_network.ts +15 -10
- package/src/cmds/infrastructure/index.ts +1 -9
- package/src/cmds/infrastructure/setup_l2_contract.ts +10 -17
- package/src/cmds/l1/deploy_l1_contracts.ts +2 -2
- package/src/cmds/l1/deploy_new_rollup.ts +2 -2
- package/src/cmds/l1/index.ts +16 -16
- package/src/cmds/l1/update_l1_validators.ts +74 -0
- package/src/config/chain_l2_config.ts +382 -0
- package/src/config/get_l1_config.ts +28 -0
- package/src/config/index.ts +2 -0
- package/src/utils/setup_contracts.ts +6 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap_network.d.ts","sourceRoot":"","sources":["../../../src/cmds/devnet/bootstrap_network.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap_network.d.ts","sourceRoot":"","sources":["../../../src/cmds/devnet/bootstrap_network.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAsB3D,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EAAE,EAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,KAAK,MAAM,EAAE,GAAG,SAAS,EACvC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,KAAK,EACV,QAAQ,EAAE,MAAM,iBAsFjB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import { BatchCall, Fr, L1FeeJuicePortalManager, createCompatibleClient, retryUntil, waitForProven } from '@aztec/aztec.js';
|
|
3
3
|
import { createEthereumChain, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
|
|
4
|
+
import { TestWallet } from '@aztec/test-wallet';
|
|
4
5
|
import { getContract } from 'viem';
|
|
5
6
|
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
6
7
|
const waitOpts = {
|
|
@@ -13,12 +14,12 @@ const provenWaitOpts = {
|
|
|
13
14
|
};
|
|
14
15
|
export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey, l1Mnemonic, addressIndex, json, log, debugLog) {
|
|
15
16
|
const pxe = await createCompatibleClient(pxeUrl, debugLog);
|
|
17
|
+
const wallet = new TestWallet(pxe);
|
|
16
18
|
// We assume here that the initial test accounts were prefunded with deploy-l1-contracts, and deployed with setup-l2-contracts
|
|
17
19
|
// so all we need to do is register them to our pxe.
|
|
18
|
-
const [
|
|
19
|
-
await
|
|
20
|
-
const
|
|
21
|
-
const defaultAccountAddress = wallet.getAddress();
|
|
20
|
+
const [accountData] = await getInitialTestAccountsData();
|
|
21
|
+
const accountManager = await wallet.createSchnorrAccount(accountData.secret, accountData.salt, accountData.signingKey);
|
|
22
|
+
const defaultAccountAddress = accountManager.getAddress();
|
|
22
23
|
const l1Client = createExtendedL1Client(l1Urls, l1PrivateKey ? privateKeyToAccount(l1PrivateKey) : // Note that this account needs to be funded on L1 !
|
|
23
24
|
mnemonicToAccount(l1Mnemonic, {
|
|
24
25
|
addressIndex
|
|
@@ -26,7 +27,7 @@ export async function bootstrapNetwork(pxeUrl, l1Urls, l1ChainId, l1PrivateKey,
|
|
|
26
27
|
const { erc20Address, portalAddress } = await deployERC20(l1Client);
|
|
27
28
|
const { token, bridge } = await deployToken(wallet, defaultAccountAddress, portalAddress);
|
|
28
29
|
await initPortal(pxe, l1Client, erc20Address, portalAddress, bridge.address);
|
|
29
|
-
const fpcAdmin =
|
|
30
|
+
const fpcAdmin = defaultAccountAddress;
|
|
30
31
|
const fpc = await deployFPC(wallet, defaultAccountAddress, token.address, fpcAdmin);
|
|
31
32
|
const counter = await deployCounter(wallet, defaultAccountAddress);
|
|
32
33
|
await fundFPC(pxe, counter.address, wallet, defaultAccountAddress, l1Client, fpc.address, debugLog);
|
|
@@ -190,19 +191,19 @@ async function fundFPC(pxe, counterAddress, wallet, defaultAccountAddress, l1Cli
|
|
|
190
191
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
191
192
|
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
192
193
|
const { CounterContract } = await import('@aztec/noir-test-contracts.js/Counter');
|
|
193
|
-
const { protocolContractAddresses: { feeJuice } } = await
|
|
194
|
+
const { protocolContractAddresses: { feeJuice } } = await pxe.getNodeInfo();
|
|
194
195
|
const feeJuiceContract = await FeeJuiceContract.at(feeJuice, wallet);
|
|
195
|
-
const feeJuicePortal = await L1FeeJuicePortalManager.new(
|
|
196
|
+
const feeJuicePortal = await L1FeeJuicePortalManager.new(pxe, l1Client, debugLog);
|
|
196
197
|
const { claimAmount, claimSecret, messageLeafIndex, messageHash } = await feeJuicePortal.bridgeTokensPublic(fpcAddress, undefined, true);
|
|
197
198
|
await retryUntil(async ()=>await pxe.isL1ToL2MessageSynced(Fr.fromHexString(messageHash)), 'message sync', 600, 1);
|
|
198
199
|
const counter = await CounterContract.at(counterAddress, wallet);
|
|
199
200
|
debugLog.info('Incrementing Counter');
|
|
200
201
|
// TODO (alexg) remove this once sequencer builds blocks continuously
|
|
201
202
|
// advance the chain
|
|
202
|
-
await counter.methods.increment(
|
|
203
|
+
await counter.methods.increment(defaultAccountAddress).send({
|
|
203
204
|
from: defaultAccountAddress
|
|
204
205
|
}).wait(waitOpts);
|
|
205
|
-
await counter.methods.increment(
|
|
206
|
+
await counter.methods.increment(defaultAccountAddress).send({
|
|
206
207
|
from: defaultAccountAddress
|
|
207
208
|
}).wait(waitOpts);
|
|
208
209
|
debugLog.info('Claiming FPC');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAgD/E"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ETHEREUM_HOSTS, l1ChainIdOption, parseOptionalInteger, pxeOption } from '../../utils/commands.js';
|
|
2
2
|
export function injectCommands(program, log, debugLogger) {
|
|
3
|
-
program.command('setup-protocol-contracts').description('Bootstrap the blockchain by initializing all the protocol contracts').addOption(pxeOption).option('--testAccounts', 'Deploy funded test accounts.').option('--sponsoredFPC', 'Deploy a sponsored FPC.').option('--json', 'Output the contract addresses in JSON format').
|
|
3
|
+
program.command('setup-protocol-contracts').description('Bootstrap the blockchain by initializing all the protocol contracts').addOption(pxeOption).option('--testAccounts', 'Deploy funded test accounts.').option('--sponsoredFPC', 'Deploy a sponsored FPC.').option('--json', 'Output the contract addresses in JSON format').action(async (options)=>{
|
|
4
4
|
const { setupL2Contracts } = await import('./setup_l2_contract.js');
|
|
5
|
-
await setupL2Contracts(options.rpcUrl, options.testAccounts, options.sponsoredFPC, options.json,
|
|
5
|
+
await setupL2Contracts(options.rpcUrl, options.testAccounts, options.sponsoredFPC, options.json, log);
|
|
6
6
|
});
|
|
7
7
|
program.command('sequencers').argument('<command>', 'Command to run: list, add, remove, who-next').argument('[who]', 'Who to add/remove').description('Manages or queries registered sequencers on the L1 rollup contract.').requiredOption('--l1-rpc-urls <string>', 'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)', (arg)=>arg.split(','), [
|
|
8
8
|
ETHEREUM_HOSTS
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
-
export declare function setupL2Contracts(rpcUrl: string, testAccounts: boolean, sponsoredFPC: boolean, json: boolean,
|
|
2
|
+
export declare function setupL2Contracts(rpcUrl: string, testAccounts: boolean, sponsoredFPC: boolean, json: boolean, log: LogFn): Promise<void>;
|
|
3
3
|
//# sourceMappingURL=setup_l2_contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_l2_contract.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/setup_l2_contract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"setup_l2_contract.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/setup_l2_contract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAMnD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,KAAK,iBA8BX"}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import { createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
3
3
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
4
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
5
|
+
import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet';
|
|
5
6
|
import { setupSponsoredFPC } from '../../utils/setup_contracts.js';
|
|
6
|
-
export async function setupL2Contracts(rpcUrl, testAccounts, sponsoredFPC, json,
|
|
7
|
+
export async function setupL2Contracts(rpcUrl, testAccounts, sponsoredFPC, json, log) {
|
|
7
8
|
const waitOpts = {
|
|
8
9
|
timeout: 180,
|
|
9
10
|
interval: 1
|
|
10
11
|
};
|
|
11
|
-
const waitForProvenOptions = !skipProofWait ? {
|
|
12
|
-
provenTimeout: 600
|
|
13
|
-
} : undefined;
|
|
14
12
|
log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
|
|
15
|
-
if (waitForProvenOptions) {
|
|
16
|
-
log('setupL2Contracts: Wait for proven options' + jsonStringify(waitForProvenOptions));
|
|
17
|
-
}
|
|
18
13
|
log('setupL2Contracts: Creating PXE client...');
|
|
19
14
|
const pxe = createPXEClient(rpcUrl, {}, makeFetch([
|
|
20
15
|
1,
|
|
@@ -23,22 +18,23 @@ export async function setupL2Contracts(rpcUrl, testAccounts, sponsoredFPC, json,
|
|
|
23
18
|
1,
|
|
24
19
|
1
|
|
25
20
|
], false));
|
|
26
|
-
|
|
21
|
+
const wallet = new TestWallet(pxe);
|
|
22
|
+
let deployedAccountManagers = [];
|
|
27
23
|
if (testAccounts) {
|
|
28
24
|
log('setupL2Contracts: Deploying test accounts...');
|
|
29
|
-
|
|
30
|
-
await deployFundedSchnorrAccounts(
|
|
25
|
+
const initialAccountsData = await getInitialTestAccountsData();
|
|
26
|
+
deployedAccountManagers = await deployFundedSchnorrAccounts(wallet, initialAccountsData, waitOpts);
|
|
31
27
|
}
|
|
32
28
|
if (sponsoredFPC) {
|
|
33
29
|
log('setupL2Contracts: Setting up sponsored FPC...');
|
|
34
|
-
await setupSponsoredFPC(pxe, log
|
|
30
|
+
await setupSponsoredFPC(pxe, log);
|
|
35
31
|
}
|
|
36
32
|
if (json) {
|
|
37
33
|
const toPrint = {
|
|
38
34
|
...ProtocolContractAddress
|
|
39
35
|
};
|
|
40
|
-
|
|
41
|
-
toPrint[`testAccount${i}`] = a.
|
|
36
|
+
deployedAccountManagers.forEach((a, i)=>{
|
|
37
|
+
toPrint[`testAccount${i}`] = a.getAddress();
|
|
42
38
|
});
|
|
43
39
|
log(JSON.stringify(toPrint, null, 2));
|
|
44
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import { Fr } from '@aztec/aztec.js';
|
|
3
3
|
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
4
4
|
import { SecretValue } from '@aztec/foundation/config';
|
|
@@ -7,7 +7,7 @@ import { deployAztecContracts } from '../../utils/aztec.js';
|
|
|
7
7
|
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
|
|
8
8
|
export async function deployL1Contracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, testAccounts, sponsoredFPC, acceleratedTestDeployments, json, createVerificationJson, initialValidators, realVerifier, log, debugLogger) {
|
|
9
9
|
const config = getL1ContractsConfigEnvVars();
|
|
10
|
-
const initialAccounts = testAccounts ? await
|
|
10
|
+
const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
|
|
11
11
|
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
12
12
|
const initialFundedAccounts = initialAccounts.map((a)=>a.address).concat(sponsoredFPCAddress);
|
|
13
13
|
const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
3
3
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
4
4
|
import { deployNewRollupContracts } from '../../utils/aztec.js';
|
|
5
5
|
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
|
|
6
6
|
export async function deployNewRollup(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, testAccounts, sponsoredFPC, json, initialValidators, realVerifier, log, debugLogger) {
|
|
7
7
|
const config = getL1ContractsConfigEnvVars();
|
|
8
|
-
const initialAccounts = testAccounts ? await
|
|
8
|
+
const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
|
|
9
9
|
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
10
10
|
const initialFundedAccounts = initialAccounts.map((a)=>a.address).concat(sponsoredFPCAddress);
|
|
11
11
|
const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAcjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAa3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAghB/E"}
|
package/dest/cmds/l1/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import { withoutHexPrefix } from '@aztec/foundation/string';
|
|
3
2
|
import { Option } from 'commander';
|
|
3
|
+
import { getL1RollupAddressFromEnv } from '../../config/get_l1_config.js';
|
|
4
4
|
import { ETHEREUM_HOSTS, MNEMONIC, PRIVATE_KEY, l1ChainIdOption, parseAztecAddress, parseBigint, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
|
|
5
5
|
export { addL1Validator } from './update_l1_validators.js';
|
|
6
6
|
const l1RpcUrlsOption = new Option('--l1-rpc-urls <string>', 'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)').env('ETHEREUM_HOSTS').default([
|
|
7
7
|
ETHEREUM_HOSTS
|
|
8
8
|
]).makeOptionMandatory(true).argParser((arg)=>arg.split(',').map((url)=>url.trim()));
|
|
9
|
+
const networkOption = new Option('--network <string>', 'Network to execute against').env('NETWORK');
|
|
9
10
|
export function injectCommands(program, log, debugLogger) {
|
|
10
11
|
program.command('deploy-l1-contracts').description('Deploys all necessary Ethereum contracts for Aztec.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--validators <string>', 'Comma separated list of validators').option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', (arg)=>parseInt(arg), 0).addOption(l1ChainIdOption).option('--salt <number>', 'The optional salt to use in deployment', (arg)=>parseInt(arg)).option('--json', 'Output the contract addresses in JSON format').option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts').option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract').option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false).option('--real-verifier', 'Deploy the real verifier', false).option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false).action(async (options)=>{
|
|
11
12
|
const { deployL1Contracts } = await import('./deploy_l1_contracts.js');
|
|
@@ -95,18 +96,19 @@ export function injectCommands(program, log, debugLogger) {
|
|
|
95
96
|
const account = generateL1Account();
|
|
96
97
|
log(JSON.stringify(account, null, 2));
|
|
97
98
|
});
|
|
98
|
-
program.command('add-l1-validator').description('Adds a validator to the L1 rollup contract.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use sending the transaction', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use sending the transaction', 'test test test test test test test test test test test junk').addOption(l1ChainIdOption).option('--attester <address>', 'ethereum address of the attester', parseEthereumAddress).option('--bls-secret-key <string>', 'The BN254 scalar field element used as a secret key for BLS signatures. Will be associated with the attester address.', parseBigint).option('--
|
|
99
|
-
const {
|
|
100
|
-
await
|
|
99
|
+
program.command('add-l1-validator').description('Adds a validator to the L1 rollup contract via a direct deposit.').addOption(l1RpcUrlsOption).addOption(networkOption).option('-pk, --private-key <string>', 'The private key to use sending the transaction', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use sending the transaction', 'test test test test test test test test test test test junk').addOption(l1ChainIdOption).option('--attester <address>', 'ethereum address of the attester', parseEthereumAddress).option('--withdrawer <address>', 'ethereum address of the withdrawer', parseEthereumAddress).option('--bls-secret-key <string>', 'The BN254 scalar field element used as a secret key for BLS signatures. Will be associated with the attester address.', parseBigint).option('--move-with-latest-rollup', 'Whether to move with the latest rollup', true).option('--rollup <string>', 'Rollup contract address', parseEthereumAddress).action(async (options)=>{
|
|
100
|
+
const { addL1ValidatorViaRollup } = await import('./update_l1_validators.js');
|
|
101
|
+
const rollupAddress = options.rollup ?? await getL1RollupAddressFromEnv(options.l1RpcUrls, options.l1ChainId);
|
|
102
|
+
await addL1ValidatorViaRollup({
|
|
101
103
|
rpcUrls: options.l1RpcUrls,
|
|
102
104
|
chainId: options.l1ChainId,
|
|
103
105
|
privateKey: options.privateKey,
|
|
104
106
|
mnemonic: options.mnemonic,
|
|
105
107
|
attesterAddress: options.attester,
|
|
106
|
-
stakingAssetHandlerAddress: options.stakingAssetHandler,
|
|
107
|
-
merkleProof: options.merkleProof,
|
|
108
|
-
proofParams: options.proof,
|
|
109
108
|
blsSecretKey: options.blsSecretKey,
|
|
109
|
+
withdrawerAddress: options.withdrawer,
|
|
110
|
+
rollupAddress,
|
|
111
|
+
moveWithLatestRollup: options.moveWithLatestRollup,
|
|
110
112
|
log,
|
|
111
113
|
debugLogger
|
|
112
114
|
});
|
|
@@ -29,6 +29,11 @@ export declare function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic,
|
|
|
29
29
|
proofParams: Buffer;
|
|
30
30
|
merkleProof: string[];
|
|
31
31
|
}): Promise<void>;
|
|
32
|
+
export declare function addL1ValidatorViaRollup({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, withdrawerAddress, blsSecretKey, moveWithLatestRollup, rollupAddress, log, debugLogger, }: RollupCommandArgs & LoggerArgs & {
|
|
33
|
+
blsSecretKey: bigint;
|
|
34
|
+
attesterAddress: EthAddress;
|
|
35
|
+
moveWithLatestRollup: boolean;
|
|
36
|
+
}): Promise<void>;
|
|
32
37
|
export declare function removeL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, log, debugLogger, }: RollupCommandArgs & LoggerArgs & {
|
|
33
38
|
validatorAddress: EthAddress;
|
|
34
39
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update_l1_validators.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/update_l1_validators.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAS3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,UAAU,CAAC;IAC1B,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B,EAAE,UAAU,CAAC;CACxC;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,KAAK,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB;;;EAQhC;AAED,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,eAAe,EACf,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,YAAY,EACZ,GAAG,EACH,WAAW,GACZ,EAAE,8BAA8B,GAC/B,UAAU,GAAG;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,UAAU,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,iBA4DF;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,gBAAgB,EAAE,UAAU,CAAA;CAAE,iBAiBnE;AAED,wBAAsB,WAAW,CAAC,EAChC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,iBAgBhC;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,aAAa,EACb,SAAS,EACT,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,iBAyBxD;AAED,wBAAsB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,iBAAiB,GAAG,UAAU,iBAwBzG"}
|
|
1
|
+
{"version":3,"file":"update_l1_validators.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/update_l1_validators.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAS3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,UAAU,CAAC;IAC1B,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B,EAAE,UAAU,CAAC;CACxC;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,KAAK,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB;;;EAQhC;AAED,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,eAAe,EACf,0BAA0B,EAC1B,WAAW,EACX,WAAW,EACX,YAAY,EACZ,GAAG,EACH,WAAW,GACZ,EAAE,8BAA8B,GAC/B,UAAU,GAAG;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,UAAU,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,iBA4DF;AAED,wBAAsB,uBAAuB,CAAC,EAC5C,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAClB,UAAU,GAAG;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,UAAU,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;CAC/B,iBAuDF;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,gBAAgB,EAAE,UAAU,CAAA;CAAE,iBAiBnE;AAED,wBAAsB,WAAW,CAAC,EAChC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,iBAgBhC;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,aAAa,EACb,SAAS,EACT,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,iBAyBxD;AAED,wBAAsB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,iBAAiB,GAAG,UAAU,iBAwBzG"}
|
|
@@ -71,6 +71,58 @@ export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, a
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
+
export async function addL1ValidatorViaRollup({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, withdrawerAddress, blsSecretKey, moveWithLatestRollup, rollupAddress, log, debugLogger }) {
|
|
75
|
+
const dualLog = makeDualLog(log, debugLogger);
|
|
76
|
+
const account = getAccount(privateKey, mnemonic);
|
|
77
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
78
|
+
const l1Client = createExtendedL1Client(rpcUrls, account, chain.chainInfo);
|
|
79
|
+
dualLog(`Adding validator ${attesterAddress} to rollup ${rollupAddress.toString()} via direct deposit`);
|
|
80
|
+
if (!withdrawerAddress) {
|
|
81
|
+
throw new Error(`Withdrawer address required`);
|
|
82
|
+
}
|
|
83
|
+
const rollup = getContract({
|
|
84
|
+
address: rollupAddress.toString(),
|
|
85
|
+
abi: RollupAbi,
|
|
86
|
+
client: l1Client
|
|
87
|
+
});
|
|
88
|
+
const gseAddress = await rollup.read.getGSE();
|
|
89
|
+
const gse = new GSEContract(l1Client, gseAddress);
|
|
90
|
+
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
91
|
+
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, debugLogger);
|
|
92
|
+
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
93
|
+
to: rollupAddress.toString(),
|
|
94
|
+
data: encodeFunctionData({
|
|
95
|
+
abi: RollupAbi,
|
|
96
|
+
functionName: 'deposit',
|
|
97
|
+
args: [
|
|
98
|
+
attesterAddress.toString(),
|
|
99
|
+
withdrawerAddress.toString(),
|
|
100
|
+
registrationTuple.publicKeyInG1,
|
|
101
|
+
registrationTuple.publicKeyInG2,
|
|
102
|
+
registrationTuple.proofOfPossession,
|
|
103
|
+
moveWithLatestRollup
|
|
104
|
+
]
|
|
105
|
+
}),
|
|
106
|
+
abi: StakingAssetHandlerAbi
|
|
107
|
+
});
|
|
108
|
+
dualLog(`Transaction hash: ${receipt.transactionHash}`);
|
|
109
|
+
await l1Client.waitForTransactionReceipt({
|
|
110
|
+
hash: receipt.transactionHash
|
|
111
|
+
});
|
|
112
|
+
if (isAnvilTestChain(chainId)) {
|
|
113
|
+
dualLog(`Funding validator on L1`);
|
|
114
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
|
|
115
|
+
await cheatCodes.setBalance(attesterAddress, 10n ** 20n);
|
|
116
|
+
} else {
|
|
117
|
+
const balance = await l1Client.getBalance({
|
|
118
|
+
address: attesterAddress.toString()
|
|
119
|
+
});
|
|
120
|
+
dualLog(`Validator balance: ${formatEther(balance)} ETH`);
|
|
121
|
+
if (balance === 0n) {
|
|
122
|
+
dualLog(`WARNING: Proposer has no balance. Remember to fund it!`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
74
126
|
export async function removeL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, log, debugLogger }) {
|
|
75
127
|
const dualLog = makeDualLog(log, debugLogger);
|
|
76
128
|
const account = getAccount(privateKey, mnemonic);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type L1ContractsConfig } from '@aztec/ethereum';
|
|
2
|
+
import type { NetworkNames } from '@aztec/foundation/config';
|
|
3
|
+
import type { SharedNodeConfig } from '@aztec/node-lib/config';
|
|
4
|
+
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
5
|
+
export type L2ChainConfig = L1ContractsConfig & Omit<SlasherConfig, 'slashValidatorsNever' | 'slashValidatorsAlways'> & {
|
|
6
|
+
l1ChainId: number;
|
|
7
|
+
testAccounts: boolean;
|
|
8
|
+
sponsoredFPC: boolean;
|
|
9
|
+
p2pEnabled: boolean;
|
|
10
|
+
p2pBootstrapNodes: string[];
|
|
11
|
+
registryAddress: string;
|
|
12
|
+
slashFactoryAddress: string;
|
|
13
|
+
feeAssetHandlerAddress: string;
|
|
14
|
+
seqMinTxsPerBlock: number;
|
|
15
|
+
seqMaxTxsPerBlock: number;
|
|
16
|
+
realProofs: boolean;
|
|
17
|
+
snapshotsUrl: string;
|
|
18
|
+
autoUpdate: SharedNodeConfig['autoUpdate'];
|
|
19
|
+
autoUpdateUrl?: string;
|
|
20
|
+
maxTxPoolSize: number;
|
|
21
|
+
publicIncludeMetrics?: string[];
|
|
22
|
+
publicMetricsCollectorUrl?: string;
|
|
23
|
+
publicMetricsCollectFrom?: string[];
|
|
24
|
+
sentinelEnabled: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare const stagingIgnitionL2ChainConfig: L2ChainConfig;
|
|
27
|
+
export declare const stagingPublicL2ChainConfig: L2ChainConfig;
|
|
28
|
+
export declare const testnetL2ChainConfig: L2ChainConfig;
|
|
29
|
+
export declare function getBootnodes(networkName: NetworkNames, cacheDir?: string): Promise<any>;
|
|
30
|
+
export declare function getL2ChainConfig(networkName: NetworkNames, cacheDir?: string): Promise<L2ChainConfig | undefined>;
|
|
31
|
+
export declare function enrichEnvironmentWithChainConfig(networkName: NetworkNames): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=chain_l2_config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain_l2_config.d.ts","sourceRoot":"","sources":["../../src/config/chain_l2_config.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAOrE,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAC3C,IAAI,CAAC,aAAa,EAAE,sBAAsB,GAAG,uBAAuB,CAAC,GAAG;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAGpC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAoCJ,eAAO,MAAM,4BAA4B,EAAE,aAqC1C,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,aAiDxC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,aAiDlC,CAAC;AAIF,wBAAsB,YAAY,CAAC,WAAW,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,MAAM,gBAgC9E;AAED,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,YAAY,EACzB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAkBpC;AAuBD,wBAAsB,gCAAgC,CAAC,WAAW,EAAE,YAAY,iBA0F/E"}
|