@aztec/cli 0.0.0-test.1 → 0.0.1-commit.5476d83
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 +9 -0
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts +3 -0
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_current_base_fee.js +7 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +5 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.js +12 -0
- package/dest/cmds/aztec_node/get_logs.d.ts +6 -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 +12 -14
- 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 -9
- package/dest/cmds/infrastructure/sequencers.d.ts +5 -5
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +29 -16
- 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 +2 -2
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +9 -8
- 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 +5 -5
- package/dest/cmds/l1/create_l1_account.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +3 -3
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +23 -6
- package/dest/cmds/l1/deploy_new_rollup.d.ts +3 -2
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +17 -8
- 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_balance.d.ts +1 -1
- package/dest/cmds/l1/governance_utils.d.ts +5 -5
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.js +17 -17
- package/dest/cmds/l1/index.d.ts +2 -1
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +33 -43
- 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 +28 -28
- 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 +19 -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 +159 -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 +3 -3
- 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 +7 -3
- 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 +131 -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 +273 -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 +207 -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 +40 -0
- package/dest/config/chain_l2_config.d.ts.map +1 -0
- package/dest/config/chain_l2_config.js +505 -0
- package/dest/config/enrich_env.d.ts +4 -0
- package/dest/config/enrich_env.d.ts.map +1 -0
- package/dest/config/enrich_env.js +12 -0
- package/dest/config/get_l1_config.d.ts +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 +5 -0
- package/dest/config/index.d.ts.map +1 -0
- package/dest/config/index.js +4 -0
- package/dest/config/network_config.d.ts +22 -0
- package/dest/config/network_config.d.ts.map +1 -0
- package/dest/config/network_config.js +109 -0
- package/dest/utils/aztec.d.ts +13 -18
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +54 -49
- package/dest/utils/commands.d.ts +19 -11
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +40 -14
- package/dest/utils/encoding.d.ts +1 -1
- package/dest/utils/encoding.js +1 -1
- 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 +4 -11
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +19 -109
- 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 +52 -36
- 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 +10 -0
- package/src/cmds/aztec_node/get_current_base_fee.ts +9 -0
- package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +27 -0
- package/src/cmds/{pxe → aztec_node}/get_logs.ts +8 -7
- 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 +19 -16
- package/src/cmds/infrastructure/index.ts +8 -10
- package/src/cmds/infrastructure/sequencers.ts +36 -19
- 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 +8 -7
- package/src/cmds/l1/bridge_erc20.ts +7 -4
- package/src/cmds/l1/deploy_l1_contracts.ts +32 -7
- package/src/cmds/l1/deploy_new_rollup.ts +23 -9
- package/src/cmds/l1/get_l1_addresses.ts +1 -1
- package/src/cmds/l1/governance_utils.ts +18 -17
- package/src/cmds/l1/index.ts +74 -101
- package/src/cmds/l1/prover_stats.ts +36 -29
- package/src/cmds/l1/trigger_seed_snapshot.ts +31 -0
- package/src/cmds/l1/update_l1_validators.ts +194 -94
- package/src/cmds/misc/generate_bootnode_enr.ts +3 -2
- package/src/cmds/misc/generate_secret_and_hash.ts +3 -3
- 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 +13 -4
- 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 +206 -0
- package/src/cmds/validator_keys/shared.ts +325 -0
- package/src/cmds/validator_keys/staker.ts +300 -0
- package/src/cmds/validator_keys/utils.ts +80 -0
- package/src/config/cached_fetch.ts +67 -0
- package/src/config/chain_l2_config.ts +668 -0
- package/src/config/enrich_env.ts +15 -0
- package/src/config/get_l1_config.ts +28 -0
- package/src/config/index.ts +4 -0
- package/src/config/network_config.ts +140 -0
- package/src/utils/aztec.ts +78 -65
- package/src/utils/commands.ts +54 -18
- package/src/utils/encoding.ts +1 -1
- package/src/utils/github.ts +0 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/inspect.ts +23 -123
- 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_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_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
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
ProposalState,
|
|
5
5
|
RegistryContract,
|
|
6
6
|
createEthereumChain,
|
|
7
|
-
|
|
7
|
+
createExtendedL1Client,
|
|
8
8
|
} from '@aztec/ethereum';
|
|
9
9
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
10
10
|
|
|
@@ -33,19 +33,20 @@ export async function depositGovernanceTokens({
|
|
|
33
33
|
}) {
|
|
34
34
|
debugLogger.info(`Depositing ${amount} governance tokens to ${recipient}`);
|
|
35
35
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
36
|
-
const
|
|
36
|
+
const extendedClient = createExtendedL1Client(
|
|
37
37
|
rpcUrls,
|
|
38
38
|
privateKey ?? mnemonic,
|
|
39
39
|
chain.chainInfo,
|
|
40
|
+
undefined,
|
|
40
41
|
mnemonicIndex,
|
|
41
42
|
);
|
|
42
43
|
|
|
43
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
44
|
+
const addresses = await RegistryContract.collectAddresses(extendedClient, registryAddress, 'canonical');
|
|
44
45
|
const governanceAddress = addresses.governanceAddress.toString();
|
|
45
|
-
const tokenAddress = addresses.
|
|
46
|
+
const tokenAddress = addresses.stakingAssetAddress.toString();
|
|
46
47
|
|
|
47
|
-
const feeJuice = new FeeJuiceContract(tokenAddress,
|
|
48
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
48
|
+
const feeJuice = new FeeJuiceContract(tokenAddress, extendedClient);
|
|
49
|
+
const governance = new GovernanceContract(governanceAddress, extendedClient);
|
|
49
50
|
if (mint) {
|
|
50
51
|
await feeJuice.mint(recipient, amount);
|
|
51
52
|
debugLogger.info(`Minted ${amount} tokens to ${recipient}`);
|
|
@@ -83,19 +84,19 @@ export async function proposeWithLock({
|
|
|
83
84
|
}) {
|
|
84
85
|
debugLogger.info(`Proposing with lock from ${payloadAddress} to ${registryAddress}`);
|
|
85
86
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
86
|
-
const
|
|
87
|
+
const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
|
|
87
88
|
|
|
88
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
89
|
+
const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
|
|
89
90
|
const governanceAddress = addresses.governanceAddress.toString();
|
|
90
91
|
|
|
91
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
92
|
+
const governance = new GovernanceContract(governanceAddress, client);
|
|
92
93
|
|
|
93
94
|
const proposalId = await governance.proposeWithLock({
|
|
94
95
|
payloadAddress,
|
|
95
|
-
withdrawAddress:
|
|
96
|
+
withdrawAddress: client.account.address,
|
|
96
97
|
});
|
|
97
98
|
if (json) {
|
|
98
|
-
log(JSON.stringify({ proposalId }, null, 2));
|
|
99
|
+
log(JSON.stringify({ proposalId: Number(proposalId) }, null, 2));
|
|
99
100
|
} else {
|
|
100
101
|
log(`Proposed with lock`);
|
|
101
102
|
log(`Proposal ID: ${proposalId}`);
|
|
@@ -131,12 +132,12 @@ export async function voteOnGovernanceProposal({
|
|
|
131
132
|
`Voting on proposal ${proposalId} with ${voteAmount ? voteAmount : 'all'} tokens in favor: ${inFavor}`,
|
|
132
133
|
);
|
|
133
134
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
134
|
-
const
|
|
135
|
+
const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
|
|
135
136
|
|
|
136
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
137
|
+
const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
|
|
137
138
|
const governanceAddress = addresses.governanceAddress.toString();
|
|
138
139
|
|
|
139
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
140
|
+
const governance = new GovernanceContract(governanceAddress, client);
|
|
140
141
|
const state = await governance.getProposalState(proposalId);
|
|
141
142
|
if (state !== ProposalState.Active && !waitTilActive) {
|
|
142
143
|
debugLogger.warn(`Proposal is not active, but waitTilActive is false. Not voting.`);
|
|
@@ -170,12 +171,12 @@ export async function executeGovernanceProposal({
|
|
|
170
171
|
}) {
|
|
171
172
|
debugLogger.info(`Executing proposal ${proposalId}`);
|
|
172
173
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
173
|
-
const
|
|
174
|
+
const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, undefined, mnemonicIndex);
|
|
174
175
|
|
|
175
|
-
const addresses = await RegistryContract.collectAddresses(
|
|
176
|
+
const addresses = await RegistryContract.collectAddresses(client, registryAddress, 'canonical');
|
|
176
177
|
const governanceAddress = addresses.governanceAddress.toString();
|
|
177
178
|
|
|
178
|
-
const governance = new GovernanceContract(governanceAddress,
|
|
179
|
+
const governance = new GovernanceContract(governanceAddress, client);
|
|
179
180
|
const state = await governance.getProposalState(proposalId);
|
|
180
181
|
if (state !== ProposalState.Executable && !waitTilExecutable) {
|
|
181
182
|
debugLogger.warn(`Proposal is not executable, but waitTilExecutable is false. Not executing.`);
|
package/src/cmds/l1/index.ts
CHANGED
|
@@ -3,17 +3,20 @@ import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
|
3
3
|
|
|
4
4
|
import { type Command, Option } from 'commander';
|
|
5
5
|
|
|
6
|
+
import { getL1RollupAddressFromEnv } from '../../config/get_l1_config.js';
|
|
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
|
|
|
18
|
+
export { addL1Validator } from './update_l1_validators.js';
|
|
19
|
+
|
|
17
20
|
const l1RpcUrlsOption = new Option(
|
|
18
21
|
'--l1-rpc-urls <string>',
|
|
19
22
|
'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)',
|
|
@@ -23,9 +26,9 @@ const l1RpcUrlsOption = new Option(
|
|
|
23
26
|
.makeOptionMandatory(true)
|
|
24
27
|
.argParser((arg: string) => arg.split(',').map(url => url.trim()));
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
const { BB_BINARY_PATH, BB_WORKING_DIRECTORY } = process.env;
|
|
29
|
+
const networkOption = new Option('--network <string>', 'Network to execute against').env('NETWORK');
|
|
28
30
|
|
|
31
|
+
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
29
32
|
program
|
|
30
33
|
.command('deploy-l1-contracts')
|
|
31
34
|
.description('Deploys all necessary Ethereum contracts for Aztec.')
|
|
@@ -42,7 +45,11 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
42
45
|
.option('--salt <number>', 'The optional salt to use in deployment', arg => parseInt(arg))
|
|
43
46
|
.option('--json', 'Output the contract addresses in JSON format')
|
|
44
47
|
.option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts')
|
|
48
|
+
.option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
|
|
45
49
|
.option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false)
|
|
50
|
+
.option('--real-verifier', 'Deploy the real verifier', false)
|
|
51
|
+
.option('--existing-token <address>', 'Use an existing ERC20 for both fee and staking', parseEthereumAddress)
|
|
52
|
+
.option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false)
|
|
46
53
|
.action(async options => {
|
|
47
54
|
const { deployL1Contracts } = await import('./deploy_l1_contracts.js');
|
|
48
55
|
|
|
@@ -56,9 +63,13 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
56
63
|
options.mnemonicIndex,
|
|
57
64
|
options.salt,
|
|
58
65
|
options.testAccounts,
|
|
66
|
+
options.sponsoredFpc,
|
|
59
67
|
options.acceleratedTestDeployments,
|
|
60
68
|
options.json,
|
|
69
|
+
options.createVerificationJson,
|
|
61
70
|
initialValidators,
|
|
71
|
+
options.realVerifier,
|
|
72
|
+
options.existingToken,
|
|
62
73
|
log,
|
|
63
74
|
debugLogger,
|
|
64
75
|
);
|
|
@@ -66,7 +77,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
66
77
|
|
|
67
78
|
program
|
|
68
79
|
.command('deploy-new-rollup')
|
|
69
|
-
.description('Deploys a new rollup contract and
|
|
80
|
+
.description('Deploys a new rollup contract and adds it to the registry (if you are the owner).')
|
|
70
81
|
.requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress)
|
|
71
82
|
.addOption(l1RpcUrlsOption)
|
|
72
83
|
.option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY)
|
|
@@ -74,13 +85,16 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
74
85
|
.option(
|
|
75
86
|
'-m, --mnemonic <string>',
|
|
76
87
|
'The mnemonic to use in deployment',
|
|
77
|
-
'test test test test test test test test test test test junk',
|
|
88
|
+
MNEMONIC ?? 'test test test test test test test test test test test junk',
|
|
78
89
|
)
|
|
79
90
|
.option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', arg => parseInt(arg), 0)
|
|
80
91
|
.addOption(l1ChainIdOption)
|
|
81
92
|
.option('--salt <number>', 'The optional salt to use in deployment', arg => parseInt(arg))
|
|
82
93
|
.option('--json', 'Output the contract addresses in JSON format')
|
|
83
94
|
.option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts')
|
|
95
|
+
.option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
|
|
96
|
+
.option('--real-verifier', 'Deploy the real verifier', false)
|
|
97
|
+
.option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false)
|
|
84
98
|
.action(async options => {
|
|
85
99
|
const { deployNewRollup } = await import('./deploy_new_rollup.js');
|
|
86
100
|
|
|
@@ -95,8 +109,11 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
95
109
|
options.mnemonicIndex,
|
|
96
110
|
options.salt,
|
|
97
111
|
options.testAccounts,
|
|
112
|
+
options.sponsoredFpc,
|
|
98
113
|
options.json,
|
|
99
114
|
initialValidators,
|
|
115
|
+
options.realVerifier,
|
|
116
|
+
options.createVerificationJson,
|
|
100
117
|
log,
|
|
101
118
|
debugLogger,
|
|
102
119
|
);
|
|
@@ -274,28 +291,40 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
274
291
|
|
|
275
292
|
program
|
|
276
293
|
.command('add-l1-validator')
|
|
277
|
-
.description('Adds a validator to the L1 rollup contract.')
|
|
294
|
+
.description('Adds a validator to the L1 rollup contract via a direct deposit.')
|
|
278
295
|
.addOption(l1RpcUrlsOption)
|
|
279
|
-
.
|
|
296
|
+
.addOption(networkOption)
|
|
297
|
+
.option('-pk, --private-key <string>', 'The private key to use sending the transaction', PRIVATE_KEY)
|
|
280
298
|
.option(
|
|
281
299
|
'-m, --mnemonic <string>',
|
|
282
|
-
'The mnemonic to use
|
|
300
|
+
'The mnemonic to use sending the transaction',
|
|
283
301
|
'test test test test test test test test test test test junk',
|
|
284
302
|
)
|
|
285
303
|
.addOption(l1ChainIdOption)
|
|
286
|
-
.option('--
|
|
287
|
-
.option('--rollup <address>', 'ethereum address of the rollup contract', parseEthereumAddress)
|
|
304
|
+
.option('--attester <address>', 'ethereum address of the attester', parseEthereumAddress)
|
|
288
305
|
.option('--withdrawer <address>', 'ethereum address of the withdrawer', parseEthereumAddress)
|
|
306
|
+
.option(
|
|
307
|
+
'--bls-secret-key <string>',
|
|
308
|
+
'The BN254 scalar field element used as a secret key for BLS signatures. Will be associated with the attester address.',
|
|
309
|
+
parseBigint,
|
|
310
|
+
)
|
|
311
|
+
.option('--move-with-latest-rollup', 'Whether to move with the latest rollup', true)
|
|
312
|
+
.option('--rollup <string>', 'Rollup contract address', parseEthereumAddress)
|
|
289
313
|
.action(async options => {
|
|
290
|
-
const {
|
|
291
|
-
|
|
314
|
+
const { addL1ValidatorViaRollup } = await import('./update_l1_validators.js');
|
|
315
|
+
|
|
316
|
+
const rollupAddress = options.rollup ?? (await getL1RollupAddressFromEnv(options.l1RpcUrls, options.l1ChainId));
|
|
317
|
+
|
|
318
|
+
await addL1ValidatorViaRollup({
|
|
292
319
|
rpcUrls: options.l1RpcUrls,
|
|
293
320
|
chainId: options.l1ChainId,
|
|
294
321
|
privateKey: options.privateKey,
|
|
295
322
|
mnemonic: options.mnemonic,
|
|
296
|
-
|
|
297
|
-
|
|
323
|
+
attesterAddress: options.attester,
|
|
324
|
+
blsSecretKey: options.blsSecretKey,
|
|
298
325
|
withdrawerAddress: options.withdrawer,
|
|
326
|
+
rollupAddress,
|
|
327
|
+
moveWithLatestRollup: options.moveWithLatestRollup,
|
|
299
328
|
log,
|
|
300
329
|
debugLogger,
|
|
301
330
|
});
|
|
@@ -347,6 +376,30 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
347
376
|
});
|
|
348
377
|
});
|
|
349
378
|
|
|
379
|
+
program
|
|
380
|
+
.command('trigger-seed-snapshot')
|
|
381
|
+
.description('Triggers a seed snapshot for the next epoch.')
|
|
382
|
+
.option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY)
|
|
383
|
+
.option(
|
|
384
|
+
'-m, --mnemonic <string>',
|
|
385
|
+
'The mnemonic to use in deployment',
|
|
386
|
+
'test test test test test test test test test test test junk',
|
|
387
|
+
)
|
|
388
|
+
.option('--rollup <address>', 'ethereum address of the rollup contract', parseEthereumAddress)
|
|
389
|
+
.addOption(l1RpcUrlsOption)
|
|
390
|
+
.addOption(l1ChainIdOption)
|
|
391
|
+
.action(async options => {
|
|
392
|
+
const { triggerSeedSnapshot } = await import('./trigger_seed_snapshot.js');
|
|
393
|
+
await triggerSeedSnapshot({
|
|
394
|
+
rollupAddress: options.rollup,
|
|
395
|
+
rpcUrls: options.l1RpcUrls,
|
|
396
|
+
chainId: options.l1ChainId,
|
|
397
|
+
privateKey: options.privateKey,
|
|
398
|
+
mnemonic: options.mnemonic,
|
|
399
|
+
log,
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
|
|
350
403
|
program
|
|
351
404
|
.command('debug-rollup')
|
|
352
405
|
.description('Debugs the rollup contract.')
|
|
@@ -391,56 +444,6 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
391
444
|
});
|
|
392
445
|
});
|
|
393
446
|
|
|
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
447
|
program
|
|
445
448
|
.command('bridge-erc20')
|
|
446
449
|
.description('Bridges ERC20 tokens to L2.')
|
|
@@ -457,6 +460,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
457
460
|
.addOption(l1ChainIdOption)
|
|
458
461
|
.requiredOption('-t, --token <string>', 'The address of the token to bridge', parseEthereumAddress)
|
|
459
462
|
.requiredOption('-p, --portal <string>', 'The address of the portal contract', parseEthereumAddress)
|
|
463
|
+
.option('-f, --faucet <string>', 'The address of the faucet contract (only used if minting)', parseEthereumAddress)
|
|
460
464
|
.option('--l1-private-key <string>', 'The private key to use for deployment', PRIVATE_KEY)
|
|
461
465
|
.option('--json', 'Output the claim in JSON format')
|
|
462
466
|
.action(async (amount, recipient, options) => {
|
|
@@ -469,6 +473,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
469
473
|
options.l1PrivateKey,
|
|
470
474
|
options.mnemonic,
|
|
471
475
|
options.token,
|
|
476
|
+
options.faucet,
|
|
472
477
|
options.portal,
|
|
473
478
|
options.private,
|
|
474
479
|
options.mint,
|
|
@@ -506,52 +511,20 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
506
511
|
)
|
|
507
512
|
.argument('[blockNumber]', 'The target block number, defaults to the latest pending block number.', parseBigint)
|
|
508
513
|
.addOption(l1RpcUrlsOption)
|
|
509
|
-
.addOption(
|
|
514
|
+
.addOption(nodeOption)
|
|
510
515
|
.action(async (blockNumber, options) => {
|
|
511
516
|
const { assumeProvenThrough } = await import('./assume_proven_through.js');
|
|
512
|
-
await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.
|
|
517
|
+
await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.nodeUrl, log);
|
|
513
518
|
});
|
|
514
519
|
|
|
515
520
|
program
|
|
516
521
|
.command('advance-epoch')
|
|
517
522
|
.description('Use L1 cheat codes to warp time until the next epoch.')
|
|
518
523
|
.addOption(l1RpcUrlsOption)
|
|
519
|
-
.addOption(
|
|
524
|
+
.addOption(nodeOption)
|
|
520
525
|
.action(async options => {
|
|
521
526
|
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
|
-
});
|
|
527
|
+
await advanceEpoch(options.l1RpcUrls, options.nodeUrl, log);
|
|
555
528
|
});
|
|
556
529
|
|
|
557
530
|
return program;
|
|
@@ -55,33 +55,40 @@ export async function proverStats(opts: {
|
|
|
55
55
|
|
|
56
56
|
// If we only care for raw logs, output them
|
|
57
57
|
if (rawLogs && !provingTimeout) {
|
|
58
|
-
log(`l1_block_number,
|
|
58
|
+
log(`l1_block_number, checkpoint_number, prover_id, tx_hash`);
|
|
59
59
|
for (const event of events) {
|
|
60
|
-
const { l1BlockNumber,
|
|
61
|
-
log(`${l1BlockNumber}, ${
|
|
60
|
+
const { l1BlockNumber, checkpointNumber, proverId, txHash } = event;
|
|
61
|
+
log(`${l1BlockNumber}, ${checkpointNumber}, ${proverId}, ${txHash}`);
|
|
62
62
|
}
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
// If we don't have a proving timeout, we can just count the number of unique
|
|
66
|
+
// If we don't have a proving timeout, we can just count the number of unique checkpoints per prover
|
|
67
67
|
if (!provingTimeout) {
|
|
68
68
|
const stats = groupBy(events, 'proverId');
|
|
69
|
-
log(`prover_id,
|
|
69
|
+
log(`prover_id, total_checkpoints_proven`);
|
|
70
70
|
for (const proverId in stats) {
|
|
71
|
-
const
|
|
72
|
-
log(`${proverId}, ${
|
|
71
|
+
const uniqueCheckpoints = new Set(stats[proverId].map(e => e.checkpointNumber));
|
|
72
|
+
log(`${proverId}, ${uniqueCheckpoints.size}`);
|
|
73
73
|
}
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
// But if we do, fetch the events for each
|
|
78
|
-
const
|
|
77
|
+
// But if we do, fetch the events for each checkpoint submitted, so we can look up their timestamp
|
|
78
|
+
const checkpointEvents = await getCheckpointProposedEvents(
|
|
79
|
+
startBlock,
|
|
80
|
+
lastBlockNum,
|
|
81
|
+
batchSize,
|
|
82
|
+
debugLog,
|
|
83
|
+
publicClient,
|
|
84
|
+
rollup,
|
|
85
|
+
);
|
|
79
86
|
debugLog.verbose(
|
|
80
|
-
`First
|
|
87
|
+
`First checkpoint within range is ${checkpointEvents[0]?.args.checkpointNumber} at L1 block ${checkpointEvents[0]?.blockNumber}`,
|
|
81
88
|
);
|
|
82
89
|
|
|
83
90
|
// Get the timestamps for every block on every log, both for proof and block submissions
|
|
84
|
-
const l1BlockNumbers = unique([...events.map(e => e.l1BlockNumber), ...
|
|
91
|
+
const l1BlockNumbers = unique([...events.map(e => e.l1BlockNumber), ...checkpointEvents.map(e => e.blockNumber)]);
|
|
85
92
|
const l1BlockTimestamps: Record<string, bigint> = {};
|
|
86
93
|
for (const l1Batch of chunk(l1BlockNumbers, Number(batchSize))) {
|
|
87
94
|
const blocks = await Promise.all(
|
|
@@ -93,44 +100,44 @@ export async function proverStats(opts: {
|
|
|
93
100
|
}
|
|
94
101
|
}
|
|
95
102
|
|
|
96
|
-
// Map from
|
|
97
|
-
const
|
|
98
|
-
for (const
|
|
99
|
-
|
|
103
|
+
// Map from checkpoint number to the l1 block in which it was submitted
|
|
104
|
+
const checkpointSubmissions: Record<string, bigint> = {};
|
|
105
|
+
for (const checkpointEvent of checkpointEvents) {
|
|
106
|
+
checkpointSubmissions[checkpointEvent.args.checkpointNumber!.toString()] = checkpointEvent.blockNumber;
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
// If we want raw logs, output them
|
|
103
110
|
if (rawLogs) {
|
|
104
|
-
log(`l1_block_number,
|
|
111
|
+
log(`l1_block_number, checkpoint_number, checkpoint_submission_timestamp, proof_timestamp, prover_id, tx_hash`);
|
|
105
112
|
for (const event of events) {
|
|
106
|
-
const { l1BlockNumber,
|
|
107
|
-
const uploadedBlockNumber =
|
|
113
|
+
const { l1BlockNumber, checkpointNumber, proverId, txHash } = event;
|
|
114
|
+
const uploadedBlockNumber = checkpointSubmissions[checkpointNumber.toString()];
|
|
108
115
|
if (!uploadedBlockNumber) {
|
|
109
116
|
continue;
|
|
110
117
|
}
|
|
111
118
|
const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
|
|
112
119
|
const provenTimestamp = l1BlockTimestamps[l1BlockNumber.toString()];
|
|
113
|
-
log(`${l1BlockNumber}, ${
|
|
120
|
+
log(`${l1BlockNumber}, ${checkpointNumber}, ${uploadedTimestamp}, ${provenTimestamp}, ${proverId}, ${txHash}`);
|
|
114
121
|
}
|
|
115
122
|
return;
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
// Or calculate stats per prover
|
|
119
|
-
const stats = mapValues(groupBy(events, 'proverId'), (
|
|
126
|
+
const stats = mapValues(groupBy(events, 'proverId'), (checkpoints, proverId) =>
|
|
120
127
|
compactArray(
|
|
121
|
-
|
|
128
|
+
checkpoints.map(e => {
|
|
122
129
|
const provenTimestamp = l1BlockTimestamps[e.l1BlockNumber.toString()];
|
|
123
|
-
const uploadedBlockNumber =
|
|
130
|
+
const uploadedBlockNumber = checkpointSubmissions[e.checkpointNumber.toString()];
|
|
124
131
|
if (!uploadedBlockNumber) {
|
|
125
132
|
debugLog.verbose(
|
|
126
|
-
`Skipping ${proverId}'s proof for
|
|
133
|
+
`Skipping ${proverId}'s proof for checkpoint ${e.checkpointNumber} as it was before the start block`,
|
|
127
134
|
);
|
|
128
135
|
return undefined;
|
|
129
136
|
}
|
|
130
137
|
const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
|
|
131
138
|
const provingTime = provenTimestamp - uploadedTimestamp;
|
|
132
139
|
debugLog.debug(
|
|
133
|
-
`prover=${e.proverId}
|
|
140
|
+
`prover=${e.proverId} checkpointNumber=${e.checkpointNumber} uploaded=${uploadedTimestamp} proven=${provenTimestamp} time=${provingTime}`,
|
|
134
141
|
);
|
|
135
142
|
return { provenTimestamp, uploadedTimestamp, provingTime, ...e };
|
|
136
143
|
}),
|
|
@@ -141,8 +148,8 @@ export async function proverStats(opts: {
|
|
|
141
148
|
for (const proverId in stats) {
|
|
142
149
|
const blocks = stats[proverId];
|
|
143
150
|
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.
|
|
151
|
+
const uniqueBlocksWithinTimeout = new Set(withinTimeout.map(e => e.checkpointNumber));
|
|
152
|
+
const uniqueBlocks = new Set(blocks.map(e => e.checkpointNumber));
|
|
146
153
|
const avgProvingTime =
|
|
147
154
|
blocks.length === 0 ? 0 : Math.ceil(Number(blocks.reduce((acc, b) => acc + b.provingTime, 0n)) / blocks.length);
|
|
148
155
|
|
|
@@ -171,7 +178,7 @@ async function getL2ProofVerifiedEvents(
|
|
|
171
178
|
return events;
|
|
172
179
|
}
|
|
173
180
|
|
|
174
|
-
async function
|
|
181
|
+
async function getCheckpointProposedEvents(
|
|
175
182
|
startBlock: bigint,
|
|
176
183
|
lastBlockNum: bigint,
|
|
177
184
|
batchSize: bigint,
|
|
@@ -188,14 +195,14 @@ async function getL2BlockEvents(
|
|
|
188
195
|
address: getAddress(rollup.toString()),
|
|
189
196
|
event: getAbiItem({
|
|
190
197
|
abi: RollupAbi,
|
|
191
|
-
name: '
|
|
198
|
+
name: 'CheckpointProposed',
|
|
192
199
|
}),
|
|
193
200
|
fromBlock: blockNum,
|
|
194
201
|
toBlock: end,
|
|
195
202
|
});
|
|
196
203
|
|
|
197
204
|
events.push(...newEvents);
|
|
198
|
-
debugLog.verbose(`Got ${newEvents.length} events querying
|
|
205
|
+
debugLog.verbose(`Got ${newEvents.length} events querying checkpoints submitted from block ${blockNum} to ${end}`);
|
|
199
206
|
blockNum += batchSize;
|
|
200
207
|
}
|
|
201
208
|
return events;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
+
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
4
|
+
|
|
5
|
+
import { getContract } from 'viem';
|
|
6
|
+
|
|
7
|
+
import type { RollupCommandArgs } from './update_l1_validators.js';
|
|
8
|
+
|
|
9
|
+
export async function triggerSeedSnapshot({
|
|
10
|
+
rpcUrls,
|
|
11
|
+
chainId,
|
|
12
|
+
privateKey,
|
|
13
|
+
mnemonic,
|
|
14
|
+
rollupAddress,
|
|
15
|
+
log,
|
|
16
|
+
}: RollupCommandArgs & { log: LogFn }) {
|
|
17
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
18
|
+
const client = createExtendedL1Client(rpcUrls, privateKey ?? mnemonic!, chain.chainInfo);
|
|
19
|
+
|
|
20
|
+
const rollup = getContract({
|
|
21
|
+
address: rollupAddress.toString(),
|
|
22
|
+
abi: RollupAbi,
|
|
23
|
+
client,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
log('Triggering seed snapshot for next epoch');
|
|
27
|
+
const txHash = await rollup.write.checkpointRandao();
|
|
28
|
+
log(`Sent! | Seed snapshot setup for next epoch | tx hash: ${txHash}`);
|
|
29
|
+
const receipt = await client.waitForTransactionReceipt({ hash: txHash });
|
|
30
|
+
log(`Done! | Seed snapshot setup for next epoch | tx hash: ${txHash} | status: ${receipt.status}`);
|
|
31
|
+
}
|