@aztec/cli 0.0.0-test.0 → 0.0.1-commit.023c3e5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -428
- package/dest/cmds/aztec_node/block_number.d.ts +3 -0
- package/dest/cmds/aztec_node/block_number.d.ts.map +1 -0
- package/dest/cmds/aztec_node/block_number.js +10 -0
- package/dest/cmds/aztec_node/get_block.d.ts +3 -0
- package/dest/cmds/aztec_node/get_block.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_block.js +10 -0
- package/dest/cmds/aztec_node/get_current_min_fee.d.ts +3 -0
- package/dest/cmds/aztec_node/get_current_min_fee.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_current_min_fee.js +7 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +5 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.js +12 -0
- package/dest/cmds/aztec_node/get_logs.d.ts +7 -0
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_logs.js +4 -4
- package/dest/cmds/aztec_node/get_node_info.d.ts +3 -0
- package/dest/cmds/aztec_node/get_node_info.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_node_info.js +14 -15
- package/dest/cmds/aztec_node/index.d.ts +4 -0
- package/dest/cmds/aztec_node/index.d.ts.map +1 -0
- package/dest/cmds/aztec_node/index.js +28 -0
- package/dest/cmds/contracts/index.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
- package/dest/cmds/contracts/inspect_contract.js +13 -15
- package/dest/cmds/contracts/parse_parameter_struct.d.ts +1 -1
- package/dest/cmds/infrastructure/index.d.ts +3 -3
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +8 -10
- package/dest/cmds/infrastructure/sequencers.d.ts +5 -6
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +38 -18
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +2 -2
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +11 -24
- package/dest/cmds/l1/advance_epoch.d.ts +2 -2
- package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
- package/dest/cmds/l1/advance_epoch.js +8 -6
- 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 +10 -10
- package/dest/cmds/l1/bridge_erc20.d.ts +3 -3
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +6 -5
- package/dest/cmds/l1/create_l1_account.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts +4 -0
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_l1_contracts_cmd.js +81 -0
- package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -3
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +18 -9
- package/dest/cmds/l1/get_l1_addresses.d.ts +2 -2
- package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
- package/dest/cmds/l1/get_l1_addresses.js +5 -2
- package/dest/cmds/l1/get_l1_balance.d.ts +1 -1
- package/dest/cmds/l1/get_l1_balance.js +4 -2
- package/dest/cmds/l1/governance_utils.d.ts +5 -5
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.js +19 -17
- package/dest/cmds/l1/index.d.ts +1 -1
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +37 -44
- package/dest/cmds/l1/prover_stats.d.ts +1 -1
- package/dest/cmds/l1/prover_stats.d.ts.map +1 -1
- package/dest/cmds/l1/prover_stats.js +32 -30
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts +6 -0
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -0
- package/dest/cmds/l1/trigger_seed_snapshot.js +20 -0
- package/dest/cmds/l1/update_l1_validators.d.ts +21 -6
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +198 -103
- package/dest/cmds/misc/compute_selector.d.ts +1 -1
- package/dest/cmds/misc/example_contracts.d.ts +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +2 -2
- package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.js +2 -2
- package/dest/cmds/misc/generate_p2p_private_key.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +2 -2
- package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.js +4 -4
- package/dest/cmds/misc/generate_secret_key.d.ts +2 -2
- package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -1
- package/dest/cmds/misc/generate_secret_key.js +1 -1
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +3 -0
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts.map +1 -0
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.js +4 -0
- 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 +8 -4
- package/dest/cmds/misc/update/common.d.ts +1 -1
- package/dest/cmds/misc/update/github.d.ts +1 -2
- package/dest/cmds/misc/update/github.d.ts.map +1 -1
- package/dest/cmds/misc/update/github.js +0 -1
- package/dest/cmds/misc/update/noir.d.ts +1 -1
- package/dest/cmds/misc/update/npm.d.ts +1 -1
- package/dest/cmds/misc/update/npm.js +1 -1
- package/dest/cmds/misc/update/utils.d.ts +1 -1
- package/dest/cmds/misc/update.d.ts +1 -1
- package/dest/cmds/misc/update.d.ts.map +1 -1
- package/dest/cmds/misc/update.js +2 -3
- package/dest/cmds/validator_keys/add.d.ts +5 -0
- package/dest/cmds/validator_keys/add.d.ts.map +1 -0
- package/dest/cmds/validator_keys/add.js +83 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +12 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.js +27 -0
- package/dest/cmds/validator_keys/index.d.ts +4 -0
- package/dest/cmds/validator_keys/index.d.ts.map +1 -0
- package/dest/cmds/validator_keys/index.js +32 -0
- package/dest/cmds/validator_keys/new.d.ts +29 -0
- package/dest/cmds/validator_keys/new.d.ts.map +1 -0
- package/dest/cmds/validator_keys/new.js +134 -0
- package/dest/cmds/validator_keys/shared.d.ts +68 -0
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -0
- package/dest/cmds/validator_keys/shared.js +274 -0
- package/dest/cmds/validator_keys/staker.d.ts +38 -0
- package/dest/cmds/validator_keys/staker.d.ts.map +1 -0
- package/dest/cmds/validator_keys/staker.js +210 -0
- package/dest/cmds/validator_keys/utils.d.ts +25 -0
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -0
- package/dest/cmds/validator_keys/utils.js +52 -0
- package/dest/config/cached_fetch.d.ts +18 -0
- package/dest/config/cached_fetch.d.ts.map +1 -0
- package/dest/config/cached_fetch.js +54 -0
- package/dest/config/chain_l2_config.d.ts +14 -0
- package/dest/config/chain_l2_config.d.ts.map +1 -0
- package/dest/config/chain_l2_config.js +45 -0
- package/dest/config/enrich_env.d.ts +4 -0
- package/dest/config/enrich_env.d.ts.map +1 -0
- package/dest/config/enrich_env.js +12 -0
- package/dest/config/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 +9 -0
- package/dest/config/get_l1_config.d.ts.map +1 -0
- package/dest/config/get_l1_config.js +24 -0
- package/dest/config/index.d.ts +5 -0
- package/dest/config/index.d.ts.map +1 -0
- package/dest/config/index.js +4 -0
- package/dest/config/network_config.d.ts +22 -0
- package/dest/config/network_config.d.ts.map +1 -0
- package/dest/config/network_config.js +115 -0
- package/dest/utils/aztec.d.ts +15 -26
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +56 -72
- package/dest/utils/commands.d.ts +22 -13
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +43 -16
- package/dest/utils/encoding.d.ts +1 -1
- package/dest/utils/encoding.js +2 -2
- package/dest/utils/github.d.ts +1 -2
- package/dest/utils/github.d.ts.map +1 -1
- package/dest/utils/github.js +0 -1
- package/dest/utils/index.d.ts +2 -1
- package/dest/utils/index.d.ts.map +1 -1
- package/dest/utils/index.js +1 -0
- package/dest/utils/inspect.d.ts +5 -11
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +23 -110
- package/dest/utils/setup_contracts.d.ts +3 -0
- package/dest/utils/setup_contracts.d.ts.map +1 -0
- package/dest/utils/setup_contracts.js +16 -0
- package/package.json +61 -37
- package/public_include_metric_prefixes.json +1 -0
- package/src/cmds/aztec_node/block_number.ts +9 -0
- package/src/cmds/aztec_node/get_block.ts +11 -0
- package/src/cmds/aztec_node/get_current_min_fee.ts +9 -0
- package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +27 -0
- package/src/cmds/{pxe → aztec_node}/get_logs.ts +11 -9
- package/src/cmds/{pxe → aztec_node}/get_node_info.ts +15 -23
- package/src/cmds/aztec_node/index.ts +87 -0
- package/src/cmds/contracts/inspect_contract.ts +20 -17
- package/src/cmds/infrastructure/index.ts +8 -11
- package/src/cmds/infrastructure/sequencers.ts +41 -22
- package/src/cmds/infrastructure/setup_l2_contract.ts +13 -25
- package/src/cmds/l1/advance_epoch.ts +7 -5
- package/src/cmds/l1/assume_proven_through.ts +11 -10
- package/src/cmds/l1/bridge_erc20.ts +8 -4
- package/src/cmds/l1/deploy_l1_contracts_cmd.ts +107 -0
- package/src/cmds/l1/deploy_new_rollup.ts +24 -15
- package/src/cmds/l1/get_l1_addresses.ts +5 -3
- package/src/cmds/l1/get_l1_balance.ts +2 -2
- package/src/cmds/l1/governance_utils.ts +20 -24
- package/src/cmds/l1/index.ts +77 -113
- package/src/cmds/l1/prover_stats.ts +42 -31
- package/src/cmds/l1/trigger_seed_snapshot.ts +32 -0
- package/src/cmds/l1/update_l1_validators.ts +218 -97
- package/src/cmds/misc/generate_bootnode_enr.ts +3 -2
- package/src/cmds/misc/generate_secret_and_hash.ts +4 -4
- package/src/cmds/misc/generate_secret_key.ts +1 -1
- package/src/cmds/misc/get_canonical_sponsored_fpc_address.ts +7 -0
- package/src/cmds/misc/index.ts +14 -5
- package/src/cmds/misc/update/github.ts +0 -1
- package/src/cmds/misc/update/npm.ts +1 -1
- package/src/cmds/misc/update.ts +1 -7
- package/src/cmds/validator_keys/add.ts +123 -0
- package/src/cmds/validator_keys/generate_bls_keypair.ts +34 -0
- package/src/cmds/validator_keys/index.ts +142 -0
- package/src/cmds/validator_keys/new.ts +207 -0
- package/src/cmds/validator_keys/shared.ts +326 -0
- package/src/cmds/validator_keys/staker.ts +301 -0
- package/src/cmds/validator_keys/utils.ts +81 -0
- package/src/config/cached_fetch.ts +67 -0
- package/src/config/chain_l2_config.ts +57 -0
- package/src/config/enrich_env.ts +15 -0
- package/src/config/generated/networks.ts +210 -0
- package/src/config/get_l1_config.ts +31 -0
- package/src/config/index.ts +4 -0
- package/src/config/network_config.ts +147 -0
- package/src/utils/aztec.ts +74 -120
- package/src/utils/commands.ts +57 -20
- package/src/utils/encoding.ts +2 -2
- package/src/utils/github.ts +0 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/inspect.ts +28 -124
- package/src/utils/setup_contracts.ts +19 -0
- package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
- package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
- package/dest/cmds/devnet/bootstrap_network.js +0 -196
- package/dest/cmds/devnet/faucet.d.ts +0 -4
- package/dest/cmds/devnet/faucet.d.ts.map +0 -1
- package/dest/cmds/devnet/faucet.js +0 -26
- package/dest/cmds/devnet/index.d.ts +0 -4
- package/dest/cmds/devnet/index.d.ts.map +0 -1
- package/dest/cmds/devnet/index.js +0 -14
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +0 -4
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +0 -29
- package/dest/cmds/l1/deploy_l1_verifier.d.ts +0 -5
- package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +0 -1
- package/dest/cmds/l1/deploy_l1_verifier.js +0 -54
- package/dest/cmds/misc/setup_contracts.d.ts +0 -7
- package/dest/cmds/misc/setup_contracts.d.ts.map +0 -1
- package/dest/cmds/misc/setup_contracts.js +0 -27
- package/dest/cmds/pxe/add_contract.d.ts +0 -5
- package/dest/cmds/pxe/add_contract.d.ts.map +0 -1
- package/dest/cmds/pxe/add_contract.js +0 -29
- package/dest/cmds/pxe/block_number.d.ts +0 -3
- package/dest/cmds/pxe/block_number.d.ts.map +0 -1
- package/dest/cmds/pxe/block_number.js +0 -10
- package/dest/cmds/pxe/get_account.d.ts +0 -4
- package/dest/cmds/pxe/get_account.d.ts.map +0 -1
- package/dest/cmds/pxe/get_account.js +0 -10
- package/dest/cmds/pxe/get_accounts.d.ts +0 -3
- package/dest/cmds/pxe/get_accounts.d.ts.map +0 -1
- package/dest/cmds/pxe/get_accounts.js +0 -25
- package/dest/cmds/pxe/get_block.d.ts +0 -3
- package/dest/cmds/pxe/get_block.d.ts.map +0 -1
- package/dest/cmds/pxe/get_block.js +0 -9
- package/dest/cmds/pxe/get_contract_data.d.ts +0 -4
- package/dest/cmds/pxe/get_contract_data.d.ts.map +0 -1
- package/dest/cmds/pxe/get_contract_data.js +0 -31
- package/dest/cmds/pxe/get_current_base_fee.d.ts +0 -3
- package/dest/cmds/pxe/get_current_base_fee.d.ts.map +0 -1
- package/dest/cmds/pxe/get_current_base_fee.js +0 -7
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +0 -4
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +0 -1
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +0 -11
- package/dest/cmds/pxe/get_logs.d.ts +0 -4
- package/dest/cmds/pxe/get_logs.d.ts.map +0 -1
- package/dest/cmds/pxe/get_node_info.d.ts +0 -3
- package/dest/cmds/pxe/get_node_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.d.ts +0 -3
- package/dest/cmds/pxe/get_pxe_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.js +0 -11
- package/dest/cmds/pxe/index.d.ts +0 -4
- package/dest/cmds/pxe/index.d.ts.map +0 -1
- package/dest/cmds/pxe/index.js +0 -55
- package/src/cmds/devnet/bootstrap_network.ts +0 -318
- package/src/cmds/devnet/faucet.ts +0 -33
- package/src/cmds/devnet/index.ts +0 -60
- package/src/cmds/l1/deploy_l1_contracts.ts +0 -65
- package/src/cmds/l1/deploy_l1_verifier.ts +0 -105
- package/src/cmds/misc/setup_contracts.ts +0 -40
- package/src/cmds/pxe/add_contract.ts +0 -41
- package/src/cmds/pxe/block_number.ts +0 -9
- package/src/cmds/pxe/get_account.ts +0 -16
- package/src/cmds/pxe/get_accounts.ts +0 -35
- package/src/cmds/pxe/get_block.ts +0 -10
- package/src/cmds/pxe/get_contract_data.ts +0 -51
- package/src/cmds/pxe/get_current_base_fee.ts +0 -9
- package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +0 -25
- package/src/cmds/pxe/get_pxe_info.ts +0 -13
- package/src/cmds/pxe/index.ts +0 -170
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { EthAddress } from '@aztec/aztec.js';
|
|
2
|
-
import {
|
|
1
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
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
|
-
createL1Clients,
|
|
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({
|
|
@@ -33,19 +28,20 @@ export async function depositGovernanceTokens({
|
|
|
33
28
|
}) {
|
|
34
29
|
debugLogger.info(`Depositing ${amount} governance tokens to ${recipient}`);
|
|
35
30
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
36
|
-
const
|
|
31
|
+
const extendedClient = createExtendedL1Client(
|
|
37
32
|
rpcUrls,
|
|
38
33
|
privateKey ?? mnemonic,
|
|
39
34
|
chain.chainInfo,
|
|
35
|
+
undefined,
|
|
40
36
|
mnemonicIndex,
|
|
41
37
|
);
|
|
42
38
|
|
|
43
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
39
|
+
const addresses = await RegistryContract.collectAddresses(extendedClient, registryAddress, 'canonical');
|
|
44
40
|
const governanceAddress = addresses.governanceAddress.toString();
|
|
45
|
-
const tokenAddress = addresses.
|
|
41
|
+
const tokenAddress = addresses.stakingAssetAddress.toString();
|
|
46
42
|
|
|
47
|
-
const feeJuice = new FeeJuiceContract(tokenAddress,
|
|
48
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
43
|
+
const feeJuice = new FeeJuiceContract(tokenAddress, extendedClient);
|
|
44
|
+
const governance = new GovernanceContract(governanceAddress, extendedClient);
|
|
49
45
|
if (mint) {
|
|
50
46
|
await feeJuice.mint(recipient, amount);
|
|
51
47
|
debugLogger.info(`Minted ${amount} tokens to ${recipient}`);
|
|
@@ -83,19 +79,19 @@ export async function proposeWithLock({
|
|
|
83
79
|
}) {
|
|
84
80
|
debugLogger.info(`Proposing with lock from ${payloadAddress} to ${registryAddress}`);
|
|
85
81
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
86
|
-
const
|
|
82
|
+
const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
|
|
87
83
|
|
|
88
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
84
|
+
const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
|
|
89
85
|
const governanceAddress = addresses.governanceAddress.toString();
|
|
90
86
|
|
|
91
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
87
|
+
const governance = new GovernanceContract(governanceAddress, client);
|
|
92
88
|
|
|
93
89
|
const proposalId = await governance.proposeWithLock({
|
|
94
90
|
payloadAddress,
|
|
95
|
-
withdrawAddress:
|
|
91
|
+
withdrawAddress: client.account.address,
|
|
96
92
|
});
|
|
97
93
|
if (json) {
|
|
98
|
-
log(JSON.stringify({ proposalId }, null, 2));
|
|
94
|
+
log(JSON.stringify({ proposalId: Number(proposalId) }, null, 2));
|
|
99
95
|
} else {
|
|
100
96
|
log(`Proposed with lock`);
|
|
101
97
|
log(`Proposal ID: ${proposalId}`);
|
|
@@ -131,12 +127,12 @@ export async function voteOnGovernanceProposal({
|
|
|
131
127
|
`Voting on proposal ${proposalId} with ${voteAmount ? voteAmount : 'all'} tokens in favor: ${inFavor}`,
|
|
132
128
|
);
|
|
133
129
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
134
|
-
const
|
|
130
|
+
const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
|
|
135
131
|
|
|
136
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
132
|
+
const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
|
|
137
133
|
const governanceAddress = addresses.governanceAddress.toString();
|
|
138
134
|
|
|
139
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
135
|
+
const governance = new GovernanceContract(governanceAddress, client);
|
|
140
136
|
const state = await governance.getProposalState(proposalId);
|
|
141
137
|
if (state !== ProposalState.Active && !waitTilActive) {
|
|
142
138
|
debugLogger.warn(`Proposal is not active, but waitTilActive is false. Not voting.`);
|
|
@@ -170,12 +166,12 @@ export async function executeGovernanceProposal({
|
|
|
170
166
|
}) {
|
|
171
167
|
debugLogger.info(`Executing proposal ${proposalId}`);
|
|
172
168
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
173
|
-
const
|
|
169
|
+
const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
|
|
174
170
|
|
|
175
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
171
|
+
const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
|
|
176
172
|
const governanceAddress = addresses.governanceAddress.toString();
|
|
177
173
|
|
|
178
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
174
|
+
const governance = new GovernanceContract(governanceAddress, client);
|
|
179
175
|
const state = await governance.getProposalState(proposalId);
|
|
180
176
|
if (state !== ProposalState.Executable && !waitTilExecutable) {
|
|
181
177
|
debugLogger.warn(`Proposal is not executable, but waitTilExecutable is false. Not executing.`);
|
package/src/cmds/l1/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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
|
|
|
@@ -5,13 +6,13 @@ import { type Command, Option } from 'commander';
|
|
|
5
6
|
|
|
6
7
|
import {
|
|
7
8
|
ETHEREUM_HOSTS,
|
|
9
|
+
MNEMONIC,
|
|
8
10
|
PRIVATE_KEY,
|
|
9
11
|
l1ChainIdOption,
|
|
10
|
-
|
|
12
|
+
nodeOption,
|
|
11
13
|
parseAztecAddress,
|
|
12
14
|
parseBigint,
|
|
13
15
|
parseEthereumAddress,
|
|
14
|
-
pxeOption,
|
|
15
16
|
} from '../../utils/commands.js';
|
|
16
17
|
|
|
17
18
|
const l1RpcUrlsOption = new Option(
|
|
@@ -23,9 +24,9 @@ const l1RpcUrlsOption = new Option(
|
|
|
23
24
|
.makeOptionMandatory(true)
|
|
24
25
|
.argParser((arg: string) => arg.split(',').map(url => url.trim()));
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
const { BB_BINARY_PATH, BB_WORKING_DIRECTORY } = process.env;
|
|
27
|
+
const networkOption = new Option('--network <string>', 'Network to execute against').env('NETWORK');
|
|
28
28
|
|
|
29
|
+
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
29
30
|
program
|
|
30
31
|
.command('deploy-l1-contracts')
|
|
31
32
|
.description('Deploys all necessary Ethereum contracts for Aztec.')
|
|
@@ -39,26 +40,28 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
39
40
|
)
|
|
40
41
|
.option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', arg => parseInt(arg), 0)
|
|
41
42
|
.addOption(l1ChainIdOption)
|
|
42
|
-
.option('--salt <number>', 'The optional salt to use in deployment', arg => parseInt(arg))
|
|
43
43
|
.option('--json', 'Output the contract addresses in JSON format')
|
|
44
44
|
.option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts')
|
|
45
|
-
.option('--
|
|
45
|
+
.option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
|
|
46
|
+
.option('--real-verifier', 'Deploy the real verifier', false)
|
|
47
|
+
.option('--existing-token <address>', 'Use an existing ERC20 for both fee and staking', parseEthereumAddress)
|
|
46
48
|
.action(async options => {
|
|
47
|
-
const {
|
|
49
|
+
const { deployL1ContractsCmd } = await import('./deploy_l1_contracts_cmd.js');
|
|
48
50
|
|
|
49
51
|
const initialValidators =
|
|
50
52
|
options.validators?.split(',').map((validator: string) => EthAddress.fromString(validator)) || [];
|
|
51
|
-
await
|
|
53
|
+
await deployL1ContractsCmd(
|
|
52
54
|
options.l1RpcUrls,
|
|
53
55
|
options.l1ChainId,
|
|
54
56
|
options.privateKey,
|
|
55
57
|
options.mnemonic,
|
|
56
58
|
options.mnemonicIndex,
|
|
57
|
-
options.salt,
|
|
58
59
|
options.testAccounts,
|
|
59
|
-
options.
|
|
60
|
+
options.sponsoredFpc,
|
|
60
61
|
options.json,
|
|
61
62
|
initialValidators,
|
|
63
|
+
options.realVerifier,
|
|
64
|
+
options.existingToken,
|
|
62
65
|
log,
|
|
63
66
|
debugLogger,
|
|
64
67
|
);
|
|
@@ -66,7 +69,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
66
69
|
|
|
67
70
|
program
|
|
68
71
|
.command('deploy-new-rollup')
|
|
69
|
-
.description('Deploys a new rollup contract and
|
|
72
|
+
.description('Deploys a new rollup contract and adds it to the registry (if you are the owner).')
|
|
70
73
|
.requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress)
|
|
71
74
|
.addOption(l1RpcUrlsOption)
|
|
72
75
|
.option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY)
|
|
@@ -74,13 +77,14 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
74
77
|
.option(
|
|
75
78
|
'-m, --mnemonic <string>',
|
|
76
79
|
'The mnemonic to use in deployment',
|
|
77
|
-
'test test test test test test test test test test test junk',
|
|
80
|
+
MNEMONIC ?? 'test test test test test test test test test test test junk',
|
|
78
81
|
)
|
|
79
82
|
.option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', arg => parseInt(arg), 0)
|
|
80
83
|
.addOption(l1ChainIdOption)
|
|
81
|
-
.option('--salt <number>', 'The optional salt to use in deployment', arg => parseInt(arg))
|
|
82
84
|
.option('--json', 'Output the contract addresses in JSON format')
|
|
83
85
|
.option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts')
|
|
86
|
+
.option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
|
|
87
|
+
.option('--real-verifier', 'Deploy the real verifier', false)
|
|
84
88
|
.action(async options => {
|
|
85
89
|
const { deployNewRollup } = await import('./deploy_new_rollup.js');
|
|
86
90
|
|
|
@@ -93,12 +97,12 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
93
97
|
options.privateKey,
|
|
94
98
|
options.mnemonic,
|
|
95
99
|
options.mnemonicIndex,
|
|
96
|
-
options.salt,
|
|
97
100
|
options.testAccounts,
|
|
101
|
+
options.sponsoredFpc,
|
|
98
102
|
options.json,
|
|
99
103
|
initialValidators,
|
|
104
|
+
options.realVerifier,
|
|
100
105
|
log,
|
|
101
|
-
debugLogger,
|
|
102
106
|
);
|
|
103
107
|
});
|
|
104
108
|
|
|
@@ -274,28 +278,44 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
274
278
|
|
|
275
279
|
program
|
|
276
280
|
.command('add-l1-validator')
|
|
277
|
-
.description('Adds a validator to the L1 rollup contract.')
|
|
281
|
+
.description('Adds a validator to the L1 rollup contract via a direct deposit.')
|
|
278
282
|
.addOption(l1RpcUrlsOption)
|
|
279
|
-
.
|
|
283
|
+
.addOption(networkOption)
|
|
284
|
+
.option('-pk, --private-key <string>', 'The private key to use sending the transaction', PRIVATE_KEY)
|
|
280
285
|
.option(
|
|
281
286
|
'-m, --mnemonic <string>',
|
|
282
|
-
'The mnemonic to use
|
|
287
|
+
'The mnemonic to use sending the transaction',
|
|
283
288
|
'test test test test test test test test test test test junk',
|
|
284
289
|
)
|
|
285
290
|
.addOption(l1ChainIdOption)
|
|
286
|
-
.option('--
|
|
287
|
-
.option('--rollup <address>', 'ethereum address of the rollup contract', parseEthereumAddress)
|
|
291
|
+
.option('--attester <address>', 'ethereum address of the attester', parseEthereumAddress)
|
|
288
292
|
.option('--withdrawer <address>', 'ethereum address of the withdrawer', parseEthereumAddress)
|
|
293
|
+
.option(
|
|
294
|
+
'--bls-secret-key <string>',
|
|
295
|
+
'The BN254 scalar field element used as a secret key for BLS signatures. Will be associated with the attester address.',
|
|
296
|
+
parseBigint,
|
|
297
|
+
)
|
|
298
|
+
.option('--move-with-latest-rollup', 'Whether to move with the latest rollup', true)
|
|
299
|
+
.option('--rollup <string>', 'Rollup contract address', parseEthereumAddress)
|
|
289
300
|
.action(async options => {
|
|
290
|
-
const {
|
|
291
|
-
|
|
301
|
+
const { addL1ValidatorViaRollup } = await import('./update_l1_validators.js');
|
|
302
|
+
|
|
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
|
+
}
|
|
308
|
+
|
|
309
|
+
await addL1ValidatorViaRollup({
|
|
292
310
|
rpcUrls: options.l1RpcUrls,
|
|
293
311
|
chainId: options.l1ChainId,
|
|
294
312
|
privateKey: options.privateKey,
|
|
295
313
|
mnemonic: options.mnemonic,
|
|
296
|
-
|
|
297
|
-
|
|
314
|
+
attesterAddress: options.attester,
|
|
315
|
+
blsSecretKey: options.blsSecretKey,
|
|
298
316
|
withdrawerAddress: options.withdrawer,
|
|
317
|
+
rollupAddress,
|
|
318
|
+
moveWithLatestRollup: options.moveWithLatestRollup,
|
|
299
319
|
log,
|
|
300
320
|
debugLogger,
|
|
301
321
|
});
|
|
@@ -347,6 +367,30 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
347
367
|
});
|
|
348
368
|
});
|
|
349
369
|
|
|
370
|
+
program
|
|
371
|
+
.command('trigger-seed-snapshot')
|
|
372
|
+
.description('Triggers a seed snapshot for the next epoch.')
|
|
373
|
+
.option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY)
|
|
374
|
+
.option(
|
|
375
|
+
'-m, --mnemonic <string>',
|
|
376
|
+
'The mnemonic to use in deployment',
|
|
377
|
+
'test test test test test test test test test test test junk',
|
|
378
|
+
)
|
|
379
|
+
.option('--rollup <address>', 'ethereum address of the rollup contract', parseEthereumAddress)
|
|
380
|
+
.addOption(l1RpcUrlsOption)
|
|
381
|
+
.addOption(l1ChainIdOption)
|
|
382
|
+
.action(async options => {
|
|
383
|
+
const { triggerSeedSnapshot } = await import('./trigger_seed_snapshot.js');
|
|
384
|
+
await triggerSeedSnapshot({
|
|
385
|
+
rollupAddress: options.rollup,
|
|
386
|
+
rpcUrls: options.l1RpcUrls,
|
|
387
|
+
chainId: options.l1ChainId,
|
|
388
|
+
privateKey: options.privateKey,
|
|
389
|
+
mnemonic: options.mnemonic,
|
|
390
|
+
log,
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
|
|
350
394
|
program
|
|
351
395
|
.command('debug-rollup')
|
|
352
396
|
.description('Debugs the rollup contract.')
|
|
@@ -391,56 +435,6 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
391
435
|
});
|
|
392
436
|
});
|
|
393
437
|
|
|
394
|
-
program
|
|
395
|
-
.command('deploy-l1-verifier')
|
|
396
|
-
.description('Deploys the rollup verifier contract')
|
|
397
|
-
.addOption(l1RpcUrlsOption)
|
|
398
|
-
.addOption(l1ChainIdOption)
|
|
399
|
-
.addOption(makePxeOption(false).conflicts('rollup-address'))
|
|
400
|
-
.addOption(
|
|
401
|
-
new Option('--rollup-address <string>', 'The address of the rollup contract')
|
|
402
|
-
.env('ROLLUP_CONTRACT_ADDRESS')
|
|
403
|
-
.argParser(parseEthereumAddress)
|
|
404
|
-
.conflicts('rpc-url'),
|
|
405
|
-
)
|
|
406
|
-
.option('--l1-private-key <string>', 'The L1 private key to use for deployment', PRIVATE_KEY)
|
|
407
|
-
.option(
|
|
408
|
-
'-m, --mnemonic <string>',
|
|
409
|
-
'The mnemonic to use in deployment',
|
|
410
|
-
'test test test test test test test test test test test junk',
|
|
411
|
-
)
|
|
412
|
-
.requiredOption('--verifier <verifier>', 'Either mock or real', 'real')
|
|
413
|
-
.option('--bb <path>', 'Path to bb binary', BB_BINARY_PATH)
|
|
414
|
-
.option('--bb-working-dir <path>', 'Path to bb working directory', BB_WORKING_DIRECTORY)
|
|
415
|
-
.action(async options => {
|
|
416
|
-
const { deployMockVerifier, deployUltraHonkVerifier } = await import('./deploy_l1_verifier.js');
|
|
417
|
-
if (options.verifier === 'mock') {
|
|
418
|
-
await deployMockVerifier(
|
|
419
|
-
options.rollupAddress?.toString(),
|
|
420
|
-
options.l1RpcUrls,
|
|
421
|
-
options.l1ChainId,
|
|
422
|
-
options.l1PrivateKey,
|
|
423
|
-
options.mnemonic,
|
|
424
|
-
options.rpcUrl,
|
|
425
|
-
log,
|
|
426
|
-
debugLogger,
|
|
427
|
-
);
|
|
428
|
-
} else {
|
|
429
|
-
await deployUltraHonkVerifier(
|
|
430
|
-
options.rollupAddress?.toString(),
|
|
431
|
-
options.l1RpcUrls,
|
|
432
|
-
options.l1ChainId,
|
|
433
|
-
options.l1PrivateKey,
|
|
434
|
-
options.mnemonic,
|
|
435
|
-
options.rpcUrl,
|
|
436
|
-
options.bb,
|
|
437
|
-
options.bbWorkingDir,
|
|
438
|
-
log,
|
|
439
|
-
debugLogger,
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
|
-
|
|
444
438
|
program
|
|
445
439
|
.command('bridge-erc20')
|
|
446
440
|
.description('Bridges ERC20 tokens to L2.')
|
|
@@ -457,6 +451,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
457
451
|
.addOption(l1ChainIdOption)
|
|
458
452
|
.requiredOption('-t, --token <string>', 'The address of the token to bridge', parseEthereumAddress)
|
|
459
453
|
.requiredOption('-p, --portal <string>', 'The address of the portal contract', parseEthereumAddress)
|
|
454
|
+
.option('-f, --faucet <string>', 'The address of the faucet contract (only used if minting)', parseEthereumAddress)
|
|
460
455
|
.option('--l1-private-key <string>', 'The private key to use for deployment', PRIVATE_KEY)
|
|
461
456
|
.option('--json', 'Output the claim in JSON format')
|
|
462
457
|
.action(async (amount, recipient, options) => {
|
|
@@ -469,6 +464,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
469
464
|
options.l1PrivateKey,
|
|
470
465
|
options.mnemonic,
|
|
471
466
|
options.token,
|
|
467
|
+
options.faucet,
|
|
472
468
|
options.portal,
|
|
473
469
|
options.private,
|
|
474
470
|
options.mint,
|
|
@@ -502,56 +498,24 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
502
498
|
program
|
|
503
499
|
.command('set-proven-through', { hidden: true })
|
|
504
500
|
.description(
|
|
505
|
-
'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.',
|
|
506
502
|
)
|
|
507
|
-
.argument('[
|
|
503
|
+
.argument('[checkpoint]', 'The target checkpoint, defaults to the latest pending checkpoint.', parseBigint)
|
|
508
504
|
.addOption(l1RpcUrlsOption)
|
|
509
|
-
.addOption(
|
|
510
|
-
.action(async (
|
|
505
|
+
.addOption(nodeOption)
|
|
506
|
+
.action(async (checkpoint, options) => {
|
|
511
507
|
const { assumeProvenThrough } = await import('./assume_proven_through.js');
|
|
512
|
-
await assumeProvenThrough(
|
|
508
|
+
await assumeProvenThrough(CheckpointNumber.fromBigInt(checkpoint), options.l1RpcUrls, options.nodeUrl, log);
|
|
513
509
|
});
|
|
514
510
|
|
|
515
511
|
program
|
|
516
512
|
.command('advance-epoch')
|
|
517
513
|
.description('Use L1 cheat codes to warp time until the next epoch.')
|
|
518
514
|
.addOption(l1RpcUrlsOption)
|
|
519
|
-
.addOption(
|
|
515
|
+
.addOption(nodeOption)
|
|
520
516
|
.action(async options => {
|
|
521
517
|
const { advanceEpoch } = await import('./advance_epoch.js');
|
|
522
|
-
await advanceEpoch(options.l1RpcUrls, options.
|
|
523
|
-
});
|
|
524
|
-
|
|
525
|
-
program
|
|
526
|
-
.command('prover-stats', { hidden: true })
|
|
527
|
-
.addOption(l1RpcUrlsOption)
|
|
528
|
-
.addOption(l1ChainIdOption)
|
|
529
|
-
.option('--start-block <number>', 'The L1 block number to start from', parseBigint, 1n)
|
|
530
|
-
.option('--end-block <number>', 'The last L1 block number to query', parseBigint)
|
|
531
|
-
.option('--batch-size <number>', 'The number of blocks to query in each batch', parseBigint, 100n)
|
|
532
|
-
.option('--proving-timeout <number>', 'Cutoff for proving time to consider a block', parseBigint)
|
|
533
|
-
.option('--l1-rollup-address <string>', 'Address of the rollup contract (required if node URL is not set)')
|
|
534
|
-
.option(
|
|
535
|
-
'--node-url <string>',
|
|
536
|
-
'JSON RPC URL of an Aztec node to retrieve the rollup contract address (required if L1 rollup address is not set)',
|
|
537
|
-
)
|
|
538
|
-
.option('--raw-logs', 'Output raw logs instead of aggregated stats')
|
|
539
|
-
.action(async options => {
|
|
540
|
-
const { proverStats } = await import('./prover_stats.js');
|
|
541
|
-
const { l1RpcUrls, chainId, l1RollupAddress, startBlock, endBlock, batchSize, nodeUrl, provingTimeout, rawLogs } =
|
|
542
|
-
options;
|
|
543
|
-
await proverStats({
|
|
544
|
-
l1RpcUrls,
|
|
545
|
-
chainId,
|
|
546
|
-
l1RollupAddress,
|
|
547
|
-
startBlock,
|
|
548
|
-
endBlock,
|
|
549
|
-
batchSize,
|
|
550
|
-
nodeUrl,
|
|
551
|
-
provingTimeout,
|
|
552
|
-
rawLogs,
|
|
553
|
-
log,
|
|
554
|
-
});
|
|
518
|
+
await advanceEpoch(options.l1RpcUrls, options.nodeUrl, log);
|
|
555
519
|
});
|
|
556
520
|
|
|
557
521
|
return 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
|
|
|
@@ -55,33 +59,40 @@ export async function proverStats(opts: {
|
|
|
55
59
|
|
|
56
60
|
// If we only care for raw logs, output them
|
|
57
61
|
if (rawLogs && !provingTimeout) {
|
|
58
|
-
log(`l1_block_number,
|
|
62
|
+
log(`l1_block_number, checkpoint_number, prover_id, tx_hash`);
|
|
59
63
|
for (const event of events) {
|
|
60
|
-
const { l1BlockNumber,
|
|
61
|
-
log(`${l1BlockNumber}, ${
|
|
64
|
+
const { l1BlockNumber, checkpointNumber, proverId, txHash } = event;
|
|
65
|
+
log(`${l1BlockNumber}, ${checkpointNumber}, ${proverId}, ${txHash}`);
|
|
62
66
|
}
|
|
63
67
|
return;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
// If we don't have a proving timeout, we can just count the number of unique
|
|
70
|
+
// If we don't have a proving timeout, we can just count the number of unique checkpoints per prover
|
|
67
71
|
if (!provingTimeout) {
|
|
68
72
|
const stats = groupBy(events, 'proverId');
|
|
69
|
-
log(`prover_id,
|
|
73
|
+
log(`prover_id, total_checkpoints_proven`);
|
|
70
74
|
for (const proverId in stats) {
|
|
71
|
-
const
|
|
72
|
-
log(`${proverId}, ${
|
|
75
|
+
const uniqueCheckpoints = new Set(stats[proverId].map(e => e.checkpointNumber));
|
|
76
|
+
log(`${proverId}, ${uniqueCheckpoints.size}`);
|
|
73
77
|
}
|
|
74
78
|
return;
|
|
75
79
|
}
|
|
76
80
|
|
|
77
|
-
// But if we do, fetch the events for each
|
|
78
|
-
const
|
|
81
|
+
// But if we do, fetch the events for each checkpoint submitted, so we can look up their timestamp
|
|
82
|
+
const checkpointEvents = await getCheckpointProposedEvents(
|
|
83
|
+
startBlock,
|
|
84
|
+
lastBlockNum,
|
|
85
|
+
batchSize,
|
|
86
|
+
debugLog,
|
|
87
|
+
publicClient,
|
|
88
|
+
rollup,
|
|
89
|
+
);
|
|
79
90
|
debugLog.verbose(
|
|
80
|
-
`First
|
|
91
|
+
`First checkpoint within range is ${checkpointEvents[0]?.args.checkpointNumber} at L1 block ${checkpointEvents[0]?.blockNumber}`,
|
|
81
92
|
);
|
|
82
93
|
|
|
83
94
|
// Get the timestamps for every block on every log, both for proof and block submissions
|
|
84
|
-
const l1BlockNumbers = unique([...events.map(e => e.l1BlockNumber), ...
|
|
95
|
+
const l1BlockNumbers = unique([...events.map(e => e.l1BlockNumber), ...checkpointEvents.map(e => e.blockNumber)]);
|
|
85
96
|
const l1BlockTimestamps: Record<string, bigint> = {};
|
|
86
97
|
for (const l1Batch of chunk(l1BlockNumbers, Number(batchSize))) {
|
|
87
98
|
const blocks = await Promise.all(
|
|
@@ -93,44 +104,44 @@ export async function proverStats(opts: {
|
|
|
93
104
|
}
|
|
94
105
|
}
|
|
95
106
|
|
|
96
|
-
// Map from
|
|
97
|
-
const
|
|
98
|
-
for (const
|
|
99
|
-
|
|
107
|
+
// Map from checkpoint number to the l1 block in which it was submitted
|
|
108
|
+
const checkpointSubmissions: Record<string, bigint> = {};
|
|
109
|
+
for (const checkpointEvent of checkpointEvents) {
|
|
110
|
+
checkpointSubmissions[checkpointEvent.args.checkpointNumber!.toString()] = checkpointEvent.blockNumber;
|
|
100
111
|
}
|
|
101
112
|
|
|
102
113
|
// If we want raw logs, output them
|
|
103
114
|
if (rawLogs) {
|
|
104
|
-
log(`l1_block_number,
|
|
115
|
+
log(`l1_block_number, checkpoint_number, checkpoint_submission_timestamp, proof_timestamp, prover_id, tx_hash`);
|
|
105
116
|
for (const event of events) {
|
|
106
|
-
const { l1BlockNumber,
|
|
107
|
-
const uploadedBlockNumber =
|
|
117
|
+
const { l1BlockNumber, checkpointNumber, proverId, txHash } = event;
|
|
118
|
+
const uploadedBlockNumber = checkpointSubmissions[checkpointNumber.toString()];
|
|
108
119
|
if (!uploadedBlockNumber) {
|
|
109
120
|
continue;
|
|
110
121
|
}
|
|
111
122
|
const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
|
|
112
123
|
const provenTimestamp = l1BlockTimestamps[l1BlockNumber.toString()];
|
|
113
|
-
log(`${l1BlockNumber}, ${
|
|
124
|
+
log(`${l1BlockNumber}, ${checkpointNumber}, ${uploadedTimestamp}, ${provenTimestamp}, ${proverId}, ${txHash}`);
|
|
114
125
|
}
|
|
115
126
|
return;
|
|
116
127
|
}
|
|
117
128
|
|
|
118
129
|
// Or calculate stats per prover
|
|
119
|
-
const stats = mapValues(groupBy(events, 'proverId'), (
|
|
130
|
+
const stats = mapValues(groupBy(events, 'proverId'), (checkpoints, proverId) =>
|
|
120
131
|
compactArray(
|
|
121
|
-
|
|
132
|
+
checkpoints.map(e => {
|
|
122
133
|
const provenTimestamp = l1BlockTimestamps[e.l1BlockNumber.toString()];
|
|
123
|
-
const uploadedBlockNumber =
|
|
134
|
+
const uploadedBlockNumber = checkpointSubmissions[e.checkpointNumber.toString()];
|
|
124
135
|
if (!uploadedBlockNumber) {
|
|
125
136
|
debugLog.verbose(
|
|
126
|
-
`Skipping ${proverId}'s proof for
|
|
137
|
+
`Skipping ${proverId}'s proof for checkpoint ${e.checkpointNumber} as it was before the start block`,
|
|
127
138
|
);
|
|
128
139
|
return undefined;
|
|
129
140
|
}
|
|
130
141
|
const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
|
|
131
142
|
const provingTime = provenTimestamp - uploadedTimestamp;
|
|
132
143
|
debugLog.debug(
|
|
133
|
-
`prover=${e.proverId}
|
|
144
|
+
`prover=${e.proverId} checkpointNumber=${e.checkpointNumber} uploaded=${uploadedTimestamp} proven=${provenTimestamp} time=${provingTime}`,
|
|
134
145
|
);
|
|
135
146
|
return { provenTimestamp, uploadedTimestamp, provingTime, ...e };
|
|
136
147
|
}),
|
|
@@ -141,8 +152,8 @@ export async function proverStats(opts: {
|
|
|
141
152
|
for (const proverId in stats) {
|
|
142
153
|
const blocks = stats[proverId];
|
|
143
154
|
const withinTimeout = blocks.filter(b => b.provingTime <= provingTimeout);
|
|
144
|
-
const uniqueBlocksWithinTimeout = new Set(withinTimeout.map(e => e.
|
|
145
|
-
const uniqueBlocks = new Set(blocks.map(e => e.
|
|
155
|
+
const uniqueBlocksWithinTimeout = new Set(withinTimeout.map(e => e.checkpointNumber));
|
|
156
|
+
const uniqueBlocks = new Set(blocks.map(e => e.checkpointNumber));
|
|
146
157
|
const avgProvingTime =
|
|
147
158
|
blocks.length === 0 ? 0 : Math.ceil(Number(blocks.reduce((acc, b) => acc + b.provingTime, 0n)) / blocks.length);
|
|
148
159
|
|
|
@@ -171,7 +182,7 @@ async function getL2ProofVerifiedEvents(
|
|
|
171
182
|
return events;
|
|
172
183
|
}
|
|
173
184
|
|
|
174
|
-
async function
|
|
185
|
+
async function getCheckpointProposedEvents(
|
|
175
186
|
startBlock: bigint,
|
|
176
187
|
lastBlockNum: bigint,
|
|
177
188
|
batchSize: bigint,
|
|
@@ -188,14 +199,14 @@ async function getL2BlockEvents(
|
|
|
188
199
|
address: getAddress(rollup.toString()),
|
|
189
200
|
event: getAbiItem({
|
|
190
201
|
abi: RollupAbi,
|
|
191
|
-
name: '
|
|
202
|
+
name: 'CheckpointProposed',
|
|
192
203
|
}),
|
|
193
204
|
fromBlock: blockNum,
|
|
194
205
|
toBlock: end,
|
|
195
206
|
});
|
|
196
207
|
|
|
197
208
|
events.push(...newEvents);
|
|
198
|
-
debugLog.verbose(`Got ${newEvents.length} events querying
|
|
209
|
+
debugLog.verbose(`Got ${newEvents.length} events querying checkpoints submitted from block ${blockNum} to ${end}`);
|
|
199
210
|
blockNum += batchSize;
|
|
200
211
|
}
|
|
201
212
|
return events;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
2
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
3
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
|
+
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
5
|
+
|
|
6
|
+
import { getContract } from 'viem';
|
|
7
|
+
|
|
8
|
+
import type { RollupCommandArgs } from './update_l1_validators.js';
|
|
9
|
+
|
|
10
|
+
export async function triggerSeedSnapshot({
|
|
11
|
+
rpcUrls,
|
|
12
|
+
chainId,
|
|
13
|
+
privateKey,
|
|
14
|
+
mnemonic,
|
|
15
|
+
rollupAddress,
|
|
16
|
+
log,
|
|
17
|
+
}: RollupCommandArgs & { log: LogFn }) {
|
|
18
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
19
|
+
const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic!, chain.chainInfo);
|
|
20
|
+
|
|
21
|
+
const rollup = getContract({
|
|
22
|
+
address: rollupAddress.toString(),
|
|
23
|
+
abi: RollupAbi,
|
|
24
|
+
client,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
log('Triggering seed snapshot for next epoch');
|
|
28
|
+
const txHash = await rollup.write.checkpointRandao();
|
|
29
|
+
log(`Sent! | Seed snapshot setup for next epoch | tx hash: ${txHash}`);
|
|
30
|
+
const receipt = await client.waitForTransactionReceipt({ hash: txHash });
|
|
31
|
+
log(`Done! | Seed snapshot setup for next epoch | tx hash: ${txHash} | status: ${receipt.status}`);
|
|
32
|
+
}
|