@aztec/cli 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2 → 0.77.0-testnet-ignition.21
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 +1 -1
- package/dest/cmds/contracts/index.d.ts +4 -0
- package/dest/cmds/contracts/index.d.ts.map +1 -0
- package/dest/cmds/contracts/inspect_contract.d.ts +3 -0
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -0
- package/dest/cmds/contracts/inspect_contract.js +3 -3
- package/dest/cmds/contracts/parse_parameter_struct.d.ts +3 -0
- package/dest/cmds/contracts/parse_parameter_struct.d.ts.map +1 -0
- package/dest/cmds/devnet/bootstrap_network.d.ts +3 -0
- package/dest/cmds/devnet/bootstrap_network.d.ts.map +1 -0
- package/dest/cmds/devnet/bootstrap_network.js +13 -10
- package/dest/cmds/devnet/faucet.d.ts +4 -0
- package/dest/cmds/devnet/faucet.d.ts.map +1 -0
- package/dest/cmds/devnet/index.d.ts +4 -0
- package/dest/cmds/devnet/index.d.ts.map +1 -0
- package/dest/cmds/devnet/index.js +5 -3
- package/dest/cmds/infrastructure/index.d.ts +4 -0
- package/dest/cmds/infrastructure/index.d.ts.map +1 -0
- package/dest/cmds/infrastructure/index.js +8 -6
- package/dest/cmds/infrastructure/sequencers.d.ts +13 -0
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -0
- package/dest/cmds/infrastructure/sequencers.js +5 -5
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +3 -0
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -0
- package/dest/cmds/infrastructure/setup_l2_contract.js +43 -0
- package/dest/cmds/l1/advance_epoch.d.ts +3 -0
- package/dest/cmds/l1/advance_epoch.d.ts.map +1 -0
- package/dest/cmds/l1/advance_epoch.js +3 -3
- package/dest/cmds/l1/assume_proven_through.d.ts +3 -0
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -0
- package/dest/cmds/l1/assume_proven_through.js +8 -8
- package/dest/cmds/l1/bridge_erc20.d.ts +4 -0
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -0
- package/dest/cmds/l1/bridge_erc20.js +3 -3
- package/dest/cmds/l1/create_l1_account.d.ts +3 -0
- package/dest/cmds/l1/create_l1_account.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +4 -0
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_l1_contracts.js +7 -3
- package/dest/cmds/l1/deploy_l1_verifier.d.ts +5 -0
- package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_l1_verifier.js +4 -4
- package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -0
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_new_rollup.js +19 -0
- package/dest/cmds/l1/get_l1_addresses.d.ts +4 -0
- package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -0
- package/dest/cmds/l1/get_l1_addresses.js +18 -0
- package/dest/cmds/l1/get_l1_balance.d.ts +4 -0
- package/dest/cmds/l1/get_l1_balance.d.ts.map +1 -0
- package/dest/cmds/l1/get_l1_balance.js +4 -4
- package/dest/cmds/l1/governance_utils.d.ts +50 -0
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -0
- package/dest/cmds/l1/governance_utils.js +85 -0
- package/dest/cmds/l1/index.d.ts +4 -0
- package/dest/cmds/l1/index.d.ts.map +1 -0
- package/dest/cmds/l1/index.js +108 -27
- package/dest/cmds/l1/prover_stats.d.ts +14 -0
- package/dest/cmds/l1/prover_stats.d.ts.map +1 -0
- package/dest/cmds/l1/prover_stats.js +6 -6
- package/dest/cmds/l1/update_l1_validators.d.ts +30 -0
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -0
- package/dest/cmds/l1/update_l1_validators.js +22 -22
- package/dest/cmds/misc/compute_selector.d.ts +3 -0
- package/dest/cmds/misc/compute_selector.d.ts.map +1 -0
- package/dest/cmds/misc/compute_selector.js +1 -1
- package/dest/cmds/misc/example_contracts.d.ts +3 -0
- package/dest/cmds/misc/example_contracts.d.ts.map +1 -0
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +3 -0
- package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -0
- package/dest/cmds/misc/generate_bootnode_enr.js +5 -0
- package/dest/cmds/misc/generate_p2p_private_key.d.ts +3 -0
- package/dest/cmds/misc/generate_p2p_private_key.d.ts.map +1 -0
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +3 -0
- package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -0
- package/dest/cmds/misc/generate_secret_key.d.ts +5 -0
- package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -0
- package/dest/cmds/misc/index.d.ts +4 -0
- package/dest/cmds/misc/index.d.ts.map +1 -0
- package/dest/cmds/misc/index.js +9 -1
- package/dest/cmds/misc/setup_contracts.d.ts +7 -0
- package/dest/cmds/misc/setup_contracts.d.ts.map +1 -0
- package/dest/cmds/misc/setup_contracts.js +5 -3
- package/dest/cmds/misc/update/common.d.ts +17 -0
- package/dest/cmds/misc/update/common.d.ts.map +1 -0
- package/dest/cmds/misc/update/github.d.ts +4 -0
- package/dest/cmds/misc/update/github.d.ts.map +1 -0
- package/dest/cmds/misc/update/noir.d.ts +10 -0
- package/dest/cmds/misc/update/noir.d.ts.map +1 -0
- package/dest/cmds/misc/update/npm.d.ts +34 -0
- package/dest/cmds/misc/update/npm.d.ts.map +1 -0
- package/dest/cmds/misc/update/utils.d.ts +14 -0
- package/dest/cmds/misc/update/utils.d.ts.map +1 -0
- package/dest/cmds/misc/update.d.ts +3 -0
- package/dest/cmds/misc/update.d.ts.map +1 -0
- package/dest/cmds/pxe/add_contract.d.ts +5 -0
- package/dest/cmds/pxe/add_contract.d.ts.map +1 -0
- package/dest/cmds/pxe/add_contract.js +6 -4
- package/dest/cmds/pxe/block_number.d.ts +3 -0
- package/dest/cmds/pxe/block_number.d.ts.map +1 -0
- package/dest/cmds/pxe/get_account.d.ts +4 -0
- package/dest/cmds/pxe/get_account.d.ts.map +1 -0
- package/dest/cmds/pxe/get_accounts.d.ts +3 -0
- package/dest/cmds/pxe/get_accounts.d.ts.map +1 -0
- package/dest/cmds/pxe/get_block.d.ts +3 -0
- package/dest/cmds/pxe/get_block.d.ts.map +1 -0
- package/dest/cmds/pxe/get_contract_data.d.ts +4 -0
- package/dest/cmds/pxe/get_contract_data.d.ts.map +1 -0
- package/dest/cmds/pxe/get_contract_data.js +1 -1
- package/dest/cmds/pxe/get_current_base_fee.d.ts +3 -0
- package/dest/cmds/pxe/get_current_base_fee.d.ts.map +1 -0
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +4 -0
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/pxe/get_logs.d.ts +4 -0
- package/dest/cmds/pxe/get_logs.d.ts.map +1 -0
- package/dest/cmds/pxe/get_node_info.d.ts +3 -0
- package/dest/cmds/pxe/get_node_info.d.ts.map +1 -0
- package/dest/cmds/pxe/get_node_info.js +2 -2
- package/dest/cmds/pxe/get_pxe_info.d.ts +3 -0
- package/dest/cmds/pxe/get_pxe_info.d.ts.map +1 -0
- package/dest/cmds/pxe/index.d.ts +4 -0
- package/dest/cmds/pxe/index.d.ts.map +1 -0
- package/dest/cmds/pxe/index.js +1 -1
- package/dest/utils/aztec.d.ts +68 -0
- package/dest/utils/aztec.d.ts.map +1 -0
- package/dest/utils/aztec.js +34 -23
- package/dest/utils/commands.d.ts +143 -0
- package/dest/utils/commands.d.ts.map +1 -0
- package/dest/utils/commands.js +2 -2
- package/dest/utils/encoding.d.ts +15 -0
- package/dest/utils/encoding.d.ts.map +1 -0
- package/dest/utils/encoding.js +6 -13
- package/dest/utils/github.d.ts +4 -0
- package/dest/utils/github.d.ts.map +1 -0
- package/dest/utils/index.d.ts +5 -0
- package/dest/utils/index.d.ts.map +1 -0
- package/dest/utils/inspect.d.ts +17 -0
- package/dest/utils/inspect.d.ts.map +1 -0
- package/dest/utils/inspect.js +4 -4
- package/package.json +21 -20
- package/src/cmds/contracts/index.ts +2 -2
- package/src/cmds/contracts/inspect_contract.ts +5 -5
- package/src/cmds/contracts/parse_parameter_struct.ts +2 -2
- package/src/cmds/devnet/bootstrap_network.ts +24 -12
- package/src/cmds/devnet/faucet.ts +2 -2
- package/src/cmds/devnet/index.ts +16 -8
- package/src/cmds/infrastructure/index.ts +12 -11
- package/src/cmds/infrastructure/sequencers.ts +10 -7
- package/src/cmds/infrastructure/setup_l2_contract.ts +47 -0
- package/src/cmds/l1/advance_epoch.ts +4 -4
- package/src/cmds/l1/assume_proven_through.ts +8 -14
- package/src/cmds/l1/bridge_erc20.ts +5 -6
- package/src/cmds/l1/create_l1_account.ts +1 -1
- package/src/cmds/l1/deploy_l1_contracts.ts +13 -5
- package/src/cmds/l1/deploy_l1_verifier.ts +7 -7
- package/src/cmds/l1/deploy_new_rollup.ts +58 -0
- package/src/cmds/l1/get_l1_addresses.ts +30 -0
- package/src/cmds/l1/get_l1_balance.ts +9 -6
- package/src/cmds/l1/governance_utils.ts +187 -0
- package/src/cmds/l1/index.ts +238 -97
- package/src/cmds/l1/prover_stats.ts +21 -11
- package/src/cmds/l1/update_l1_validators.ts +25 -25
- package/src/cmds/misc/compute_selector.ts +2 -2
- package/src/cmds/misc/example_contracts.ts +1 -1
- package/src/cmds/misc/generate_bootnode_enr.ts +12 -0
- package/src/cmds/misc/generate_p2p_private_key.ts +1 -1
- package/src/cmds/misc/generate_secret_and_hash.ts +1 -1
- package/src/cmds/misc/index.ts +25 -3
- package/src/cmds/misc/setup_contracts.ts +6 -4
- package/src/cmds/misc/update/noir.ts +2 -2
- package/src/cmds/misc/update/npm.ts +2 -2
- package/src/cmds/misc/update/utils.ts +1 -1
- package/src/cmds/misc/update.ts +2 -2
- package/src/cmds/pxe/add_contract.ts +7 -5
- package/src/cmds/pxe/block_number.ts +1 -1
- package/src/cmds/pxe/get_account.ts +2 -2
- package/src/cmds/pxe/get_accounts.ts +1 -1
- package/src/cmds/pxe/get_block.ts +1 -1
- package/src/cmds/pxe/get_contract_data.ts +5 -3
- package/src/cmds/pxe/get_current_base_fee.ts +1 -1
- package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +1 -1
- package/src/cmds/pxe/get_logs.ts +2 -2
- package/src/cmds/pxe/get_node_info.ts +3 -3
- package/src/cmds/pxe/get_pxe_info.ts +1 -1
- package/src/cmds/pxe/index.ts +3 -3
- package/src/utils/aztec.ts +74 -44
- package/src/utils/commands.ts +4 -4
- package/src/utils/encoding.ts +7 -13
- package/src/utils/inspect.ts +8 -7
- package/dest/cmds/infrastructure/setup_protocol_contract.js +0 -31
- package/src/cmds/infrastructure/setup_protocol_contract.ts +0 -36
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
2
|
import { createEthereumChain, getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
3
|
-
import {
|
|
3
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
4
4
|
import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
5
5
|
|
|
6
|
-
import { createPublicClient, createWalletClient, getContract, http } from 'viem';
|
|
6
|
+
import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
|
|
7
7
|
import { mnemonicToAccount } from 'viem/accounts';
|
|
8
8
|
|
|
9
9
|
export async function sequencers(opts: {
|
|
@@ -11,24 +11,27 @@ export async function sequencers(opts: {
|
|
|
11
11
|
who?: string;
|
|
12
12
|
mnemonic?: string;
|
|
13
13
|
rpcUrl: string;
|
|
14
|
-
|
|
14
|
+
l1RpcUrls: string[];
|
|
15
15
|
chainId: number;
|
|
16
16
|
blockNumber?: number;
|
|
17
17
|
log: LogFn;
|
|
18
18
|
debugLogger: Logger;
|
|
19
19
|
}) {
|
|
20
|
-
const { command, who: maybeWho, mnemonic, rpcUrl,
|
|
20
|
+
const { command, who: maybeWho, mnemonic, rpcUrl, l1RpcUrls, chainId, log, debugLogger } = opts;
|
|
21
21
|
const client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
22
22
|
const { l1ContractAddresses } = await client.getNodeInfo();
|
|
23
23
|
|
|
24
|
-
const chain = createEthereumChain(
|
|
25
|
-
const publicClient = createPublicClient({
|
|
24
|
+
const chain = createEthereumChain(l1RpcUrls, chainId);
|
|
25
|
+
const publicClient = createPublicClient({
|
|
26
|
+
chain: chain.chainInfo,
|
|
27
|
+
transport: fallback(l1RpcUrls.map(url => http(url))),
|
|
28
|
+
});
|
|
26
29
|
|
|
27
30
|
const walletClient = mnemonic
|
|
28
31
|
? createWalletClient({
|
|
29
32
|
account: mnemonicToAccount(mnemonic),
|
|
30
33
|
chain: chain.chainInfo,
|
|
31
|
-
transport: http(
|
|
34
|
+
transport: fallback(l1RpcUrls.map(url => http(url))),
|
|
32
35
|
})
|
|
33
36
|
: undefined;
|
|
34
37
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type InitialAccountData, deployFundedSchnorrAccounts, getInitialTestAccounts } from '@aztec/accounts/testing';
|
|
2
|
+
import { type AztecAddress, SignerlessWallet, type WaitOpts, createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
3
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
5
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
6
|
+
|
|
7
|
+
import { setupCanonicalL2FeeJuice } from '../misc/setup_contracts.js';
|
|
8
|
+
|
|
9
|
+
export async function setupL2Contracts(
|
|
10
|
+
rpcUrl: string,
|
|
11
|
+
testAccounts: boolean,
|
|
12
|
+
json: boolean,
|
|
13
|
+
skipProofWait: boolean,
|
|
14
|
+
log: LogFn,
|
|
15
|
+
) {
|
|
16
|
+
const waitOpts: WaitOpts = {
|
|
17
|
+
timeout: 180,
|
|
18
|
+
interval: 1,
|
|
19
|
+
proven: !skipProofWait,
|
|
20
|
+
provenTimeout: 600,
|
|
21
|
+
};
|
|
22
|
+
log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
|
|
23
|
+
log('setupL2Contracts: Creating PXE client...');
|
|
24
|
+
const pxe = createPXEClient(rpcUrl, {}, makeFetch([1, 1, 1, 1, 1], false));
|
|
25
|
+
const wallet = new SignerlessWallet(pxe);
|
|
26
|
+
|
|
27
|
+
log('setupL2Contracts: Getting fee juice portal address...');
|
|
28
|
+
// Deploy Fee Juice
|
|
29
|
+
const feeJuicePortalAddress = (await wallet.getNodeInfo()).l1ContractAddresses.feeJuicePortalAddress;
|
|
30
|
+
log('setupL2Contracts: Setting up fee juice portal...');
|
|
31
|
+
await setupCanonicalL2FeeJuice(wallet, feeJuicePortalAddress, waitOpts, log);
|
|
32
|
+
|
|
33
|
+
let deployedAccounts: InitialAccountData[] = [];
|
|
34
|
+
if (testAccounts) {
|
|
35
|
+
log('setupL2Contracts: Deploying test accounts...');
|
|
36
|
+
deployedAccounts = await getInitialTestAccounts();
|
|
37
|
+
await deployFundedSchnorrAccounts(pxe, deployedAccounts, waitOpts);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (json) {
|
|
41
|
+
const toPrint: Record<string, AztecAddress> = { ...ProtocolContractAddress };
|
|
42
|
+
deployedAccounts.forEach((a, i) => {
|
|
43
|
+
toPrint[`testAccount${i}`] = a.address;
|
|
44
|
+
});
|
|
45
|
+
log(JSON.stringify(toPrint, null, 2));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CheatCodes, createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
3
|
|
|
4
|
-
export async function advanceEpoch(
|
|
5
|
-
const pxe = createPXEClient(rpcUrl, makeFetch([], true));
|
|
4
|
+
export async function advanceEpoch(l1RpcUrls: string[], rpcUrl: string, log: LogFn) {
|
|
5
|
+
const pxe = createPXEClient(rpcUrl, {}, makeFetch([], true));
|
|
6
6
|
const rollupAddress = await pxe.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
|
|
7
7
|
|
|
8
|
-
const cheat = CheatCodes.createRollup(
|
|
8
|
+
const cheat = CheatCodes.createRollup(l1RpcUrls, { rollupAddress });
|
|
9
9
|
|
|
10
10
|
await cheat.advanceToNextEpoch();
|
|
11
11
|
log(`Warped time to advance to next epoch`);
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import { createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
2
|
-
import {
|
|
3
|
-
import { type LogFn } from '@aztec/foundation/log';
|
|
4
|
-
|
|
5
|
-
import { setAssumeProvenThrough } from '../../utils/aztec.js';
|
|
1
|
+
import { EthCheatCodes, RollupCheatCodes, createPXEClient, makeFetch } from '@aztec/aztec.js';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
6
3
|
|
|
7
4
|
export async function assumeProvenThrough(
|
|
8
5
|
blockNumberOrLatest: number | undefined,
|
|
9
|
-
|
|
6
|
+
l1RpcUrls: string[],
|
|
10
7
|
rpcUrl: string,
|
|
11
|
-
chainId: number,
|
|
12
|
-
privateKey: string | undefined,
|
|
13
|
-
mnemonic: string,
|
|
14
8
|
log: LogFn,
|
|
15
9
|
) {
|
|
16
|
-
const
|
|
17
|
-
const { walletClient } = createL1Clients(chain.rpcUrl, privateKey ?? mnemonic, chain.chainInfo);
|
|
18
|
-
|
|
19
|
-
const pxe = createPXEClient(rpcUrl, makeFetch([], true));
|
|
10
|
+
const pxe = createPXEClient(rpcUrl, {}, makeFetch([], true));
|
|
20
11
|
const rollupAddress = await pxe.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
|
|
21
12
|
const blockNumber = blockNumberOrLatest ?? (await pxe.getBlockNumber());
|
|
22
13
|
|
|
23
|
-
|
|
14
|
+
const ethCheatCode = new EthCheatCodes(l1RpcUrls);
|
|
15
|
+
const rollupCheatCodes = new RollupCheatCodes(ethCheatCode, { rollupAddress });
|
|
16
|
+
|
|
17
|
+
await rollupCheatCodes.markAsProven(blockNumber);
|
|
24
18
|
log(`Assumed proven through block ${blockNumber}`);
|
|
25
19
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { L1ToL2TokenPortalManager } from '@aztec/aztec.js';
|
|
2
|
-
import { type AztecAddress, type EthAddress, type Fr } from '@aztec/circuits.js';
|
|
1
|
+
import { type AztecAddress, type EthAddress, type Fr, L1ToL2TokenPortalManager } from '@aztec/aztec.js';
|
|
3
2
|
import { createEthereumChain, createL1Clients } from '@aztec/ethereum';
|
|
4
|
-
import {
|
|
3
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
5
4
|
|
|
6
5
|
import { prettyPrintJSON } from '../../utils/commands.js';
|
|
7
6
|
|
|
8
7
|
export async function bridgeERC20(
|
|
9
8
|
amount: bigint,
|
|
10
9
|
recipient: AztecAddress,
|
|
11
|
-
|
|
10
|
+
l1RpcUrls: string[],
|
|
12
11
|
chainId: number,
|
|
13
12
|
privateKey: string | undefined,
|
|
14
13
|
mnemonic: string,
|
|
@@ -21,8 +20,8 @@ export async function bridgeERC20(
|
|
|
21
20
|
debugLogger: Logger,
|
|
22
21
|
) {
|
|
23
22
|
// Prepare L1 client
|
|
24
|
-
const chain = createEthereumChain(
|
|
25
|
-
const { publicClient, walletClient } = createL1Clients(chain.
|
|
23
|
+
const chain = createEthereumChain(l1RpcUrls, chainId);
|
|
24
|
+
const { publicClient, walletClient } = createL1Clients(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
|
|
26
25
|
|
|
27
26
|
// Setup portal manager
|
|
28
27
|
const manager = new L1ToL2TokenPortalManager(portalAddress, tokenAddress, publicClient, walletClient, debugLogger);
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { getInitialTestAccounts } from '@aztec/accounts/testing';
|
|
1
2
|
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
5
|
+
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
4
6
|
|
|
5
7
|
import { deployAztecContracts } from '../../utils/aztec.js';
|
|
6
8
|
|
|
7
9
|
export async function deployL1Contracts(
|
|
8
|
-
|
|
10
|
+
rpcUrls: string[],
|
|
9
11
|
chainId: number,
|
|
10
12
|
privateKey: string | undefined,
|
|
11
13
|
mnemonic: string,
|
|
12
14
|
mnemonicIndex: number,
|
|
13
15
|
salt: number | undefined,
|
|
16
|
+
testAccounts: boolean,
|
|
14
17
|
json: boolean,
|
|
15
18
|
initialValidators: EthAddress[],
|
|
16
19
|
log: LogFn,
|
|
@@ -18,14 +21,19 @@ export async function deployL1Contracts(
|
|
|
18
21
|
) {
|
|
19
22
|
const config = getL1ContractsConfigEnvVars();
|
|
20
23
|
|
|
24
|
+
const initialFundedAccounts = testAccounts ? await getInitialTestAccounts() : [];
|
|
25
|
+
const { genesisBlockHash, genesisArchiveRoot } = await getGenesisValues(initialFundedAccounts.map(a => a.address));
|
|
26
|
+
|
|
21
27
|
const { l1ContractAddresses } = await deployAztecContracts(
|
|
22
|
-
|
|
28
|
+
rpcUrls,
|
|
23
29
|
chainId,
|
|
24
30
|
privateKey,
|
|
25
31
|
mnemonic,
|
|
26
32
|
mnemonicIndex,
|
|
27
33
|
salt,
|
|
28
34
|
initialValidators,
|
|
35
|
+
genesisArchiveRoot,
|
|
36
|
+
genesisBlockHash,
|
|
29
37
|
config,
|
|
30
38
|
debugLogger,
|
|
31
39
|
);
|
|
@@ -50,6 +58,6 @@ export async function deployL1Contracts(
|
|
|
50
58
|
log(`RewardDistributor Address: ${l1ContractAddresses.rewardDistributorAddress.toString()}`);
|
|
51
59
|
log(`GovernanceProposer Address: ${l1ContractAddresses.governanceProposerAddress.toString()}`);
|
|
52
60
|
log(`Governance Address: ${l1ContractAddresses.governanceAddress.toString()}`);
|
|
53
|
-
log(`SlashFactory Address: ${l1ContractAddresses.slashFactoryAddress
|
|
61
|
+
log(`SlashFactory Address: ${l1ContractAddresses.slashFactoryAddress?.toString()}`);
|
|
54
62
|
}
|
|
55
63
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createCompatibleClient } from '@aztec/aztec.js';
|
|
2
2
|
import { createEthereumChain, createL1Clients, deployL1Contract } from '@aztec/ethereum';
|
|
3
|
-
import {
|
|
3
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
4
4
|
import { HonkVerifierAbi, HonkVerifierBytecode } from '@aztec/l1-artifacts';
|
|
5
5
|
|
|
6
6
|
import { InvalidOptionArgumentError } from 'commander';
|
|
@@ -8,7 +8,7 @@ import { type Hex, getContract } from 'viem';
|
|
|
8
8
|
|
|
9
9
|
export async function deployUltraHonkVerifier(
|
|
10
10
|
rollupAddress: Hex | undefined,
|
|
11
|
-
|
|
11
|
+
ethRpcUrls: string[],
|
|
12
12
|
l1ChainId: string,
|
|
13
13
|
privateKey: string | undefined,
|
|
14
14
|
mnemonic: string,
|
|
@@ -23,9 +23,9 @@ export async function deployUltraHonkVerifier(
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const { publicClient, walletClient } = createL1Clients(
|
|
26
|
-
|
|
26
|
+
ethRpcUrls,
|
|
27
27
|
privateKey ?? mnemonic,
|
|
28
|
-
createEthereumChain(
|
|
28
|
+
createEthereumChain(ethRpcUrls, l1ChainId).chainInfo,
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
if (!rollupAddress && pxeRpcUrl) {
|
|
@@ -61,7 +61,7 @@ export async function deployUltraHonkVerifier(
|
|
|
61
61
|
|
|
62
62
|
export async function deployMockVerifier(
|
|
63
63
|
rollupAddress: Hex | undefined,
|
|
64
|
-
|
|
64
|
+
ethRpcUrls: string[],
|
|
65
65
|
l1ChainId: string,
|
|
66
66
|
privateKey: string | undefined,
|
|
67
67
|
mnemonic: string,
|
|
@@ -70,9 +70,9 @@ export async function deployMockVerifier(
|
|
|
70
70
|
debugLogger: Logger,
|
|
71
71
|
) {
|
|
72
72
|
const { publicClient, walletClient } = createL1Clients(
|
|
73
|
-
|
|
73
|
+
ethRpcUrls,
|
|
74
74
|
privateKey ?? mnemonic,
|
|
75
|
-
createEthereumChain(
|
|
75
|
+
createEthereumChain(ethRpcUrls, l1ChainId).chainInfo,
|
|
76
76
|
);
|
|
77
77
|
const { MockVerifierAbi, MockVerifierBytecode, RollupAbi } = await import('@aztec/l1-artifacts');
|
|
78
78
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { getInitialTestAccounts } from '@aztec/accounts/testing';
|
|
2
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum';
|
|
3
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
5
|
+
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
6
|
+
|
|
7
|
+
import { deployNewRollupContracts } from '../../utils/aztec.js';
|
|
8
|
+
|
|
9
|
+
export async function deployNewRollup(
|
|
10
|
+
registryAddress: EthAddress,
|
|
11
|
+
rpcUrls: string[],
|
|
12
|
+
chainId: number,
|
|
13
|
+
privateKey: string | undefined,
|
|
14
|
+
mnemonic: string,
|
|
15
|
+
mnemonicIndex: number,
|
|
16
|
+
salt: number | undefined,
|
|
17
|
+
testAccounts: boolean,
|
|
18
|
+
json: boolean,
|
|
19
|
+
initialValidators: EthAddress[],
|
|
20
|
+
log: LogFn,
|
|
21
|
+
debugLogger: Logger,
|
|
22
|
+
) {
|
|
23
|
+
const config = getL1ContractsConfigEnvVars();
|
|
24
|
+
|
|
25
|
+
const initialFundedAccounts = testAccounts ? await getInitialTestAccounts() : [];
|
|
26
|
+
const { genesisBlockHash, genesisArchiveRoot } = await getGenesisValues(initialFundedAccounts.map(a => a.address));
|
|
27
|
+
|
|
28
|
+
const { payloadAddress, rollup } = await deployNewRollupContracts(
|
|
29
|
+
registryAddress,
|
|
30
|
+
rpcUrls,
|
|
31
|
+
chainId,
|
|
32
|
+
privateKey,
|
|
33
|
+
mnemonic,
|
|
34
|
+
mnemonicIndex,
|
|
35
|
+
salt,
|
|
36
|
+
initialValidators,
|
|
37
|
+
genesisArchiveRoot,
|
|
38
|
+
genesisBlockHash,
|
|
39
|
+
config,
|
|
40
|
+
debugLogger,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
if (json) {
|
|
44
|
+
log(
|
|
45
|
+
JSON.stringify(
|
|
46
|
+
{
|
|
47
|
+
payloadAddress: payloadAddress.toString(),
|
|
48
|
+
rollupAddress: rollup.address,
|
|
49
|
+
},
|
|
50
|
+
null,
|
|
51
|
+
2,
|
|
52
|
+
),
|
|
53
|
+
);
|
|
54
|
+
} else {
|
|
55
|
+
log(`Payload Address: ${payloadAddress.toString()}`);
|
|
56
|
+
log(`Rollup Address: ${rollup.address}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/aztec.js';
|
|
2
|
+
import { RegistryContract, type ViemPublicClient, createEthereumChain } from '@aztec/ethereum';
|
|
3
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
|
+
|
|
5
|
+
import { createPublicClient, fallback, http } from 'viem';
|
|
6
|
+
|
|
7
|
+
export async function getL1Addresses(
|
|
8
|
+
registryAddress: EthAddress,
|
|
9
|
+
rollupVersion: number | bigint | 'canonical',
|
|
10
|
+
rpcUrls: string[],
|
|
11
|
+
chainId: number,
|
|
12
|
+
json: boolean,
|
|
13
|
+
log: LogFn,
|
|
14
|
+
) {
|
|
15
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
16
|
+
const publicClient: ViemPublicClient = createPublicClient({
|
|
17
|
+
chain: chain.chainInfo,
|
|
18
|
+
transport: fallback(rpcUrls.map(url => http(url))),
|
|
19
|
+
pollingInterval: 100,
|
|
20
|
+
});
|
|
21
|
+
const addresses = await RegistryContract.collectAddresses(publicClient, registryAddress.toString(), rollupVersion);
|
|
22
|
+
|
|
23
|
+
if (json) {
|
|
24
|
+
log(JSON.stringify(addresses, null, 2));
|
|
25
|
+
} else {
|
|
26
|
+
for (const [key, value] of Object.entries(addresses)) {
|
|
27
|
+
log(`${key}: ${value.toString()}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { type EthAddress } from '@aztec/circuits.js';
|
|
2
1
|
import { createEthereumChain } from '@aztec/ethereum';
|
|
3
|
-
import {
|
|
2
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
import { TestERC20Abi } from '@aztec/l1-artifacts';
|
|
5
5
|
|
|
6
|
-
import { createPublicClient, getContract, http } from 'viem';
|
|
6
|
+
import { createPublicClient, fallback, getContract, http } from 'viem';
|
|
7
7
|
|
|
8
8
|
import { prettyPrintJSON } from '../../utils/commands.js';
|
|
9
9
|
|
|
10
10
|
export async function getL1Balance(
|
|
11
11
|
who: EthAddress,
|
|
12
12
|
token: EthAddress | undefined,
|
|
13
|
-
|
|
13
|
+
l1RpcUrls: string[],
|
|
14
14
|
chainId: number,
|
|
15
15
|
json: boolean,
|
|
16
16
|
log: LogFn,
|
|
17
17
|
) {
|
|
18
|
-
const chain = createEthereumChain(
|
|
19
|
-
const publicClient = createPublicClient({
|
|
18
|
+
const chain = createEthereumChain(l1RpcUrls, chainId);
|
|
19
|
+
const publicClient = createPublicClient({
|
|
20
|
+
chain: chain.chainInfo,
|
|
21
|
+
transport: fallback(l1RpcUrls.map(url => http(url))),
|
|
22
|
+
});
|
|
20
23
|
|
|
21
24
|
let balance = 0n;
|
|
22
25
|
if (token) {
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FeeJuiceContract,
|
|
3
|
+
GovernanceContract,
|
|
4
|
+
ProposalState,
|
|
5
|
+
RegistryContract,
|
|
6
|
+
createEthereumChain,
|
|
7
|
+
createL1Clients,
|
|
8
|
+
} from '@aztec/ethereum';
|
|
9
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
10
|
+
|
|
11
|
+
export async function depositGovernanceTokens({
|
|
12
|
+
registryAddress,
|
|
13
|
+
rpcUrls,
|
|
14
|
+
chainId,
|
|
15
|
+
privateKey,
|
|
16
|
+
mnemonic,
|
|
17
|
+
mnemonicIndex,
|
|
18
|
+
recipient,
|
|
19
|
+
amount,
|
|
20
|
+
debugLogger,
|
|
21
|
+
mint,
|
|
22
|
+
}: {
|
|
23
|
+
registryAddress: `0x${string}`;
|
|
24
|
+
rpcUrls: string[];
|
|
25
|
+
chainId: number;
|
|
26
|
+
privateKey: string | undefined;
|
|
27
|
+
mnemonic: string;
|
|
28
|
+
mnemonicIndex: number;
|
|
29
|
+
recipient: `0x${string}`;
|
|
30
|
+
amount: bigint;
|
|
31
|
+
debugLogger: Logger;
|
|
32
|
+
mint: boolean;
|
|
33
|
+
}) {
|
|
34
|
+
debugLogger.info(`Depositing ${amount} governance tokens to ${recipient}`);
|
|
35
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
36
|
+
const { publicClient, walletClient } = createL1Clients(
|
|
37
|
+
rpcUrls,
|
|
38
|
+
privateKey ?? mnemonic,
|
|
39
|
+
chain.chainInfo,
|
|
40
|
+
mnemonicIndex,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const addresses = await RegistryContract.collectAddresses(publicClient, registryAddress, 'canonical');
|
|
44
|
+
const governanceAddress = addresses.governanceAddress.toString();
|
|
45
|
+
const tokenAddress = addresses.feeJuiceAddress.toString();
|
|
46
|
+
|
|
47
|
+
const feeJuice = new FeeJuiceContract(tokenAddress, publicClient, walletClient);
|
|
48
|
+
const governance = new GovernanceContract(governanceAddress, publicClient, walletClient);
|
|
49
|
+
if (mint) {
|
|
50
|
+
await feeJuice.mint(recipient, amount);
|
|
51
|
+
debugLogger.info(`Minted ${amount} tokens to ${recipient}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
await feeJuice.approve(governanceAddress, amount);
|
|
55
|
+
debugLogger.info(`Approved ${amount} tokens for governance`);
|
|
56
|
+
|
|
57
|
+
await governance.deposit(recipient, amount);
|
|
58
|
+
debugLogger.info(`Deposited ${amount} tokens to ${recipient}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function proposeWithLock({
|
|
62
|
+
payloadAddress,
|
|
63
|
+
registryAddress,
|
|
64
|
+
rpcUrls,
|
|
65
|
+
chainId,
|
|
66
|
+
privateKey,
|
|
67
|
+
mnemonic,
|
|
68
|
+
mnemonicIndex,
|
|
69
|
+
json,
|
|
70
|
+
debugLogger,
|
|
71
|
+
log,
|
|
72
|
+
}: {
|
|
73
|
+
payloadAddress: `0x${string}`;
|
|
74
|
+
registryAddress: `0x${string}`;
|
|
75
|
+
rpcUrls: string[];
|
|
76
|
+
chainId: number;
|
|
77
|
+
privateKey: string | undefined;
|
|
78
|
+
mnemonic: string;
|
|
79
|
+
mnemonicIndex: number;
|
|
80
|
+
debugLogger: Logger;
|
|
81
|
+
log: LogFn;
|
|
82
|
+
json: boolean;
|
|
83
|
+
}) {
|
|
84
|
+
debugLogger.info(`Proposing with lock from ${payloadAddress} to ${registryAddress}`);
|
|
85
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
86
|
+
const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
|
|
87
|
+
|
|
88
|
+
const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
|
|
89
|
+
const governanceAddress = addresses.governanceAddress.toString();
|
|
90
|
+
|
|
91
|
+
const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
|
|
92
|
+
|
|
93
|
+
const proposalId = await governance.proposeWithLock({
|
|
94
|
+
payloadAddress,
|
|
95
|
+
withdrawAddress: clients.walletClient.account.address,
|
|
96
|
+
});
|
|
97
|
+
if (json) {
|
|
98
|
+
log(JSON.stringify({ proposalId }, null, 2));
|
|
99
|
+
} else {
|
|
100
|
+
log(`Proposed with lock`);
|
|
101
|
+
log(`Proposal ID: ${proposalId}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export async function voteOnGovernanceProposal({
|
|
106
|
+
proposalId,
|
|
107
|
+
voteAmount,
|
|
108
|
+
inFavor,
|
|
109
|
+
waitTilActive,
|
|
110
|
+
registryAddress,
|
|
111
|
+
rpcUrls,
|
|
112
|
+
chainId,
|
|
113
|
+
privateKey,
|
|
114
|
+
mnemonic,
|
|
115
|
+
mnemonicIndex,
|
|
116
|
+
debugLogger,
|
|
117
|
+
}: {
|
|
118
|
+
proposalId: bigint;
|
|
119
|
+
voteAmount: bigint | undefined;
|
|
120
|
+
inFavor: boolean;
|
|
121
|
+
waitTilActive: boolean;
|
|
122
|
+
registryAddress: `0x${string}`;
|
|
123
|
+
rpcUrls: string[];
|
|
124
|
+
chainId: number;
|
|
125
|
+
privateKey: string | undefined;
|
|
126
|
+
mnemonic: string;
|
|
127
|
+
mnemonicIndex: number;
|
|
128
|
+
debugLogger: Logger;
|
|
129
|
+
}) {
|
|
130
|
+
debugLogger.info(
|
|
131
|
+
`Voting on proposal ${proposalId} with ${voteAmount ? voteAmount : 'all'} tokens in favor: ${inFavor}`,
|
|
132
|
+
);
|
|
133
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
134
|
+
const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
|
|
135
|
+
|
|
136
|
+
const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
|
|
137
|
+
const governanceAddress = addresses.governanceAddress.toString();
|
|
138
|
+
|
|
139
|
+
const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
|
|
140
|
+
const state = await governance.getProposalState(proposalId);
|
|
141
|
+
if (state !== ProposalState.Active && !waitTilActive) {
|
|
142
|
+
debugLogger.warn(`Proposal is not active, but waitTilActive is false. Not voting.`);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
await governance.awaitProposalActive({ proposalId, logger: debugLogger });
|
|
147
|
+
await governance.vote({ proposalId, voteAmount, inFavor, retries: 10, logger: debugLogger });
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export async function executeGovernanceProposal({
|
|
151
|
+
proposalId,
|
|
152
|
+
waitTilExecutable,
|
|
153
|
+
registryAddress,
|
|
154
|
+
rpcUrls,
|
|
155
|
+
chainId,
|
|
156
|
+
privateKey,
|
|
157
|
+
mnemonic,
|
|
158
|
+
mnemonicIndex,
|
|
159
|
+
debugLogger,
|
|
160
|
+
}: {
|
|
161
|
+
proposalId: bigint;
|
|
162
|
+
waitTilExecutable: boolean;
|
|
163
|
+
registryAddress: `0x${string}`;
|
|
164
|
+
rpcUrls: string[];
|
|
165
|
+
chainId: number;
|
|
166
|
+
privateKey: string | undefined;
|
|
167
|
+
mnemonic: string;
|
|
168
|
+
mnemonicIndex: number;
|
|
169
|
+
debugLogger: Logger;
|
|
170
|
+
}) {
|
|
171
|
+
debugLogger.info(`Executing proposal ${proposalId}`);
|
|
172
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
173
|
+
const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
|
|
174
|
+
|
|
175
|
+
const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
|
|
176
|
+
const governanceAddress = addresses.governanceAddress.toString();
|
|
177
|
+
|
|
178
|
+
const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
|
|
179
|
+
const state = await governance.getProposalState(proposalId);
|
|
180
|
+
if (state !== ProposalState.Executable && !waitTilExecutable) {
|
|
181
|
+
debugLogger.warn(`Proposal is not executable, but waitTilExecutable is false. Not executing.`);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
await governance.awaitProposalExecutable({ proposalId, logger: debugLogger });
|
|
186
|
+
await governance.executeProposal({ proposalId, retries: 10, logger: debugLogger });
|
|
187
|
+
}
|