@aztec/cli 3.0.0-canary.a9708bd → 3.0.0-devnet.20251212
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_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 +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 +3 -8
- 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 +4 -10
- 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 +7 -9
- package/dest/cmds/infrastructure/sequencers.d.ts +3 -5
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +7 -4
- 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 +10 -25
- 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 +6 -5
- 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 +8 -6
- package/dest/cmds/l1/bridge_erc20.d.ts +2 -2
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +3 -2
- 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 +6 -6
- package/dest/cmds/l1/deploy_new_rollup.d.ts +3 -3
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +5 -5
- 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 +2 -1
- package/dest/cmds/l1/get_l1_balance.d.ts +1 -1
- package/dest/cmds/l1/get_l1_balance.js +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 +3 -1
- 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 +18 -34
- 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 +29 -29
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts +2 -2
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -1
- package/dest/cmds/l1/trigger_seed_snapshot.js +2 -1
- package/dest/cmds/l1/update_l1_validators.d.ts +10 -5
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +74 -9
- 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 +1 -1
- package/dest/cmds/misc/generate_p2p_private_key.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.js +2 -2
- 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 +1 -1
- package/dest/cmds/misc/index.d.ts +1 -1
- package/dest/cmds/misc/update/common.d.ts +1 -1
- package/dest/cmds/misc/update/github.d.ts +1 -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/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 +132 -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 +208 -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 +41 -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 +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 +109 -0
- package/dest/utils/aztec.d.ts +8 -12
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +14 -35
- package/dest/utils/commands.d.ts +18 -10
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +35 -9
- package/dest/utils/encoding.d.ts +1 -1
- package/dest/utils/encoding.js +1 -1
- package/dest/utils/github.d.ts +1 -1
- package/dest/utils/index.d.ts +1 -1
- package/dest/utils/inspect.d.ts +5 -11
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +13 -95
- package/dest/utils/setup_contracts.d.ts +2 -4
- package/dest/utils/setup_contracts.d.ts.map +1 -1
- package/dest/utils/setup_contracts.js +2 -22
- package/package.json +40 -28
- 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_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 +11 -9
- package/src/cmds/{pxe → aztec_node}/get_node_info.ts +5 -16
- package/src/cmds/aztec_node/index.ts +87 -0
- package/src/cmds/contracts/inspect_contract.ts +4 -11
- package/src/cmds/infrastructure/index.ts +7 -18
- package/src/cmds/infrastructure/sequencers.ts +9 -8
- package/src/cmds/infrastructure/setup_l2_contract.ts +13 -30
- package/src/cmds/l1/advance_epoch.ts +6 -5
- package/src/cmds/l1/assume_proven_through.ts +10 -6
- package/src/cmds/l1/bridge_erc20.ts +5 -2
- package/src/cmds/l1/deploy_l1_contracts.ts +7 -4
- package/src/cmds/l1/deploy_new_rollup.ts +6 -3
- package/src/cmds/l1/get_l1_addresses.ts +4 -2
- package/src/cmds/l1/get_l1_balance.ts +1 -1
- package/src/cmds/l1/governance_utils.ts +3 -8
- package/src/cmds/l1/index.ts +25 -53
- package/src/cmds/l1/prover_stats.ts +38 -30
- package/src/cmds/l1/trigger_seed_snapshot.ts +2 -1
- package/src/cmds/l1/update_l1_validators.ts +88 -18
- package/src/cmds/misc/generate_secret_and_hash.ts +2 -2
- package/src/cmds/misc/generate_secret_key.ts +1 -1
- package/src/cmds/misc/update/npm.ts +1 -1
- 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 +80 -0
- package/src/config/cached_fetch.ts +67 -0
- package/src/config/chain_l2_config.ts +669 -0
- package/src/config/enrich_env.ts +15 -0
- package/src/config/get_l1_config.ts +31 -0
- package/src/config/index.ts +4 -0
- package/src/config/network_config.ts +140 -0
- package/src/utils/aztec.ts +17 -49
- package/src/utils/commands.ts +49 -13
- package/src/utils/encoding.ts +1 -1
- package/src/utils/inspect.ts +19 -111
- package/src/utils/setup_contracts.ts +4 -43
- 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 -216
- 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/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 -321
- package/src/cmds/devnet/faucet.ts +0 -33
- package/src/cmds/devnet/index.ts +0 -60
- 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,6 +1,9 @@
|
|
|
1
|
-
import { Fr
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
2
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
3
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
4
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
5
|
+
import { GSEContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
6
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
7
|
import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
5
8
|
|
|
6
9
|
import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
|
|
@@ -11,15 +14,13 @@ export async function sequencers(opts: {
|
|
|
11
14
|
who?: string;
|
|
12
15
|
mnemonic?: string;
|
|
13
16
|
bn254SecretKey?: bigint;
|
|
14
|
-
|
|
17
|
+
nodeUrl: string;
|
|
15
18
|
l1RpcUrls: string[];
|
|
16
19
|
chainId: number;
|
|
17
|
-
blockNumber?: number;
|
|
18
20
|
log: LogFn;
|
|
19
|
-
debugLogger: Logger;
|
|
20
21
|
}) {
|
|
21
|
-
const { command, who: maybeWho, mnemonic, bn254SecretKey,
|
|
22
|
-
const client =
|
|
22
|
+
const { command, who: maybeWho, mnemonic, bn254SecretKey, nodeUrl, l1RpcUrls, chainId, log } = opts;
|
|
23
|
+
const client = createAztecNodeClient(nodeUrl);
|
|
23
24
|
const { l1ContractAddresses } = await client.getNodeInfo();
|
|
24
25
|
|
|
25
26
|
const chain = createEthereumChain(l1RpcUrls, chainId);
|
|
@@ -1,50 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import type { WaitOpts } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
5
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
3
6
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
7
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
8
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
9
|
+
import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export async function setupL2Contracts(
|
|
10
|
-
rpcUrl: string,
|
|
11
|
-
testAccounts: boolean,
|
|
12
|
-
sponsoredFPC: boolean,
|
|
13
|
-
json: boolean,
|
|
14
|
-
skipProofWait: boolean,
|
|
15
|
-
log: LogFn,
|
|
16
|
-
) {
|
|
11
|
+
export async function setupL2Contracts(nodeUrl: string, testAccounts: boolean, json: boolean, log: LogFn) {
|
|
17
12
|
const waitOpts: WaitOpts = {
|
|
18
13
|
timeout: 180,
|
|
19
14
|
interval: 1,
|
|
20
15
|
};
|
|
21
|
-
const waitForProvenOptions: WaitForProvenOpts | undefined = !skipProofWait
|
|
22
|
-
? {
|
|
23
|
-
provenTimeout: 600,
|
|
24
|
-
}
|
|
25
|
-
: undefined;
|
|
26
16
|
log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
|
|
27
|
-
if (waitForProvenOptions) {
|
|
28
|
-
log('setupL2Contracts: Wait for proven options' + jsonStringify(waitForProvenOptions));
|
|
29
|
-
}
|
|
30
17
|
log('setupL2Contracts: Creating PXE client...');
|
|
31
|
-
const
|
|
18
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
19
|
+
const wallet = await TestWallet.create(node);
|
|
32
20
|
|
|
33
|
-
let
|
|
21
|
+
let deployedAccountManagers: AccountManager[] = [];
|
|
34
22
|
if (testAccounts) {
|
|
35
23
|
log('setupL2Contracts: Deploying test accounts...');
|
|
36
|
-
|
|
37
|
-
await deployFundedSchnorrAccounts(
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (sponsoredFPC) {
|
|
41
|
-
log('setupL2Contracts: Setting up sponsored FPC...');
|
|
42
|
-
await setupSponsoredFPC(pxe, log, waitOpts, waitForProvenOptions);
|
|
24
|
+
const initialAccountsData = await getInitialTestAccountsData();
|
|
25
|
+
deployedAccountManagers = await deployFundedSchnorrAccounts(wallet, node, initialAccountsData, waitOpts);
|
|
43
26
|
}
|
|
44
27
|
|
|
45
28
|
if (json) {
|
|
46
29
|
const toPrint: Record<string, AztecAddress> = { ...ProtocolContractAddress };
|
|
47
|
-
|
|
30
|
+
deployedAccountManagers.forEach((a, i) => {
|
|
48
31
|
toPrint[`testAccount${i}`] = a.address;
|
|
49
32
|
});
|
|
50
33
|
log(JSON.stringify(toPrint, null, 2));
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
2
|
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
4
5
|
|
|
5
|
-
export async function advanceEpoch(l1RpcUrls: string[],
|
|
6
|
-
const
|
|
7
|
-
const rollupAddress = await
|
|
6
|
+
export async function advanceEpoch(l1RpcUrls: string[], nodeUrl: string, log: LogFn) {
|
|
7
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
8
|
+
const rollupAddress = await aztecNode.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
|
|
8
9
|
|
|
9
|
-
const cheat = RollupCheatCodes.create(l1RpcUrls, { rollupAddress });
|
|
10
|
+
const cheat = RollupCheatCodes.create(l1RpcUrls, { rollupAddress }, new DateProvider());
|
|
10
11
|
|
|
11
12
|
await cheat.advanceToNextEpoch();
|
|
12
13
|
log(`Warped time to advance to next epoch`);
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
2
|
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
4
6
|
|
|
5
7
|
export async function assumeProvenThrough(
|
|
6
8
|
blockNumberOrLatest: number | undefined,
|
|
7
9
|
l1RpcUrls: string[],
|
|
8
|
-
|
|
10
|
+
nodeUrl: string,
|
|
9
11
|
log: LogFn,
|
|
10
12
|
) {
|
|
11
|
-
const
|
|
12
|
-
const rollupAddress = await
|
|
13
|
-
const blockNumber = blockNumberOrLatest
|
|
13
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
14
|
+
const rollupAddress = await aztecNode.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
|
|
15
|
+
const blockNumber: BlockNumber = blockNumberOrLatest
|
|
16
|
+
? BlockNumber(blockNumberOrLatest)
|
|
17
|
+
: await aztecNode.getBlockNumber();
|
|
14
18
|
|
|
15
|
-
const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, { rollupAddress });
|
|
19
|
+
const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, { rollupAddress }, new DateProvider());
|
|
16
20
|
|
|
17
21
|
await rollupCheatCodes.markAsProven(blockNumber);
|
|
18
22
|
log(`Assumed proven through block ${blockNumber}`);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { L1ToL2TokenPortalManager } from '@aztec/aztec.js/ethereum';
|
|
3
|
+
import type { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
5
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
3
6
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
4
7
|
|
|
5
8
|
import { prettyPrintJSON } from '../../utils/commands.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
+
import type { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
4
5
|
import { SecretValue } from '@aztec/foundation/config';
|
|
5
6
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
6
7
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
@@ -22,12 +23,13 @@ export async function deployL1Contracts(
|
|
|
22
23
|
createVerificationJson: string | false,
|
|
23
24
|
initialValidators: EthAddress[],
|
|
24
25
|
realVerifier: boolean,
|
|
26
|
+
existingToken: EthAddress | undefined,
|
|
25
27
|
log: LogFn,
|
|
26
28
|
debugLogger: Logger,
|
|
27
29
|
) {
|
|
28
30
|
const config = getL1ContractsConfigEnvVars();
|
|
29
31
|
|
|
30
|
-
const initialAccounts = testAccounts ? await
|
|
32
|
+
const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
|
|
31
33
|
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
32
34
|
const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
|
|
33
35
|
const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
@@ -50,6 +52,7 @@ export async function deployL1Contracts(
|
|
|
50
52
|
fundingNeeded,
|
|
51
53
|
acceleratedTestDeployments,
|
|
52
54
|
config,
|
|
55
|
+
existingToken,
|
|
53
56
|
realVerifier,
|
|
54
57
|
createVerificationJson,
|
|
55
58
|
debugLogger,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
3
|
+
import type { Operator } from '@aztec/ethereum/deploy-l1-contracts';
|
|
3
4
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
5
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
5
6
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
@@ -20,12 +21,13 @@ export async function deployNewRollup(
|
|
|
20
21
|
json: boolean,
|
|
21
22
|
initialValidators: Operator[],
|
|
22
23
|
realVerifier: boolean,
|
|
24
|
+
createVerificationJson: string | false,
|
|
23
25
|
log: LogFn,
|
|
24
26
|
debugLogger: Logger,
|
|
25
27
|
) {
|
|
26
28
|
const config = getL1ContractsConfigEnvVars();
|
|
27
29
|
|
|
28
|
-
const initialAccounts = testAccounts ? await
|
|
30
|
+
const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
|
|
29
31
|
const sponsoredFPCAddress = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
30
32
|
const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddress);
|
|
31
33
|
const { genesisArchiveRoot, fundingNeeded } = await getGenesisValues(initialFundedAccounts);
|
|
@@ -43,6 +45,7 @@ export async function deployNewRollup(
|
|
|
43
45
|
fundingNeeded,
|
|
44
46
|
config,
|
|
45
47
|
realVerifier,
|
|
48
|
+
createVerificationJson,
|
|
46
49
|
debugLogger,
|
|
47
50
|
);
|
|
48
51
|
|
|
@@ -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';
|
|
@@ -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';
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
ProposalState,
|
|
5
|
-
RegistryContract,
|
|
6
|
-
createEthereumChain,
|
|
7
|
-
createExtendedL1Client,
|
|
8
|
-
} from '@aztec/ethereum';
|
|
1
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
2
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
3
|
+
import { FeeJuiceContract, GovernanceContract, ProposalState, RegistryContract } from '@aztec/ethereum/contracts';
|
|
9
4
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
10
5
|
|
|
11
6
|
export async function depositGovernanceTokens({
|
package/src/cmds/l1/index.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
import { withoutHexPrefix } from '@aztec/foundation/string';
|
|
4
3
|
|
|
5
4
|
import { type Command, Option } from 'commander';
|
|
6
5
|
|
|
6
|
+
import { getL1RollupAddressFromEnv } from '../../config/get_l1_config.js';
|
|
7
7
|
import {
|
|
8
8
|
ETHEREUM_HOSTS,
|
|
9
9
|
MNEMONIC,
|
|
10
10
|
PRIVATE_KEY,
|
|
11
11
|
l1ChainIdOption,
|
|
12
|
+
nodeOption,
|
|
12
13
|
parseAztecAddress,
|
|
13
14
|
parseBigint,
|
|
14
15
|
parseEthereumAddress,
|
|
15
|
-
pxeOption,
|
|
16
16
|
} from '../../utils/commands.js';
|
|
17
17
|
|
|
18
18
|
export { addL1Validator } from './update_l1_validators.js';
|
|
@@ -26,6 +26,8 @@ const l1RpcUrlsOption = new Option(
|
|
|
26
26
|
.makeOptionMandatory(true)
|
|
27
27
|
.argParser((arg: string) => arg.split(',').map(url => url.trim()));
|
|
28
28
|
|
|
29
|
+
const networkOption = new Option('--network <string>', 'Network to execute against').env('NETWORK');
|
|
30
|
+
|
|
29
31
|
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
30
32
|
program
|
|
31
33
|
.command('deploy-l1-contracts')
|
|
@@ -46,6 +48,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
46
48
|
.option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
|
|
47
49
|
.option('--accelerated-test-deployments', 'Fire and forget deployment transactions, use in testing only', false)
|
|
48
50
|
.option('--real-verifier', 'Deploy the real verifier', false)
|
|
51
|
+
.option('--existing-token <address>', 'Use an existing ERC20 for both fee and staking', parseEthereumAddress)
|
|
49
52
|
.option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false)
|
|
50
53
|
.action(async options => {
|
|
51
54
|
const { deployL1Contracts } = await import('./deploy_l1_contracts.js');
|
|
@@ -66,6 +69,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
66
69
|
options.createVerificationJson,
|
|
67
70
|
initialValidators,
|
|
68
71
|
options.realVerifier,
|
|
72
|
+
options.existingToken,
|
|
69
73
|
log,
|
|
70
74
|
debugLogger,
|
|
71
75
|
);
|
|
@@ -90,6 +94,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
90
94
|
.option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts')
|
|
91
95
|
.option('--sponsored-fpc', 'Populate genesis state with a testing sponsored FPC contract')
|
|
92
96
|
.option('--real-verifier', 'Deploy the real verifier', false)
|
|
97
|
+
.option('--create-verification-json [path]', 'Create JSON file for etherscan contract verification', false)
|
|
93
98
|
.action(async options => {
|
|
94
99
|
const { deployNewRollup } = await import('./deploy_new_rollup.js');
|
|
95
100
|
|
|
@@ -108,6 +113,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
108
113
|
options.json,
|
|
109
114
|
initialValidators,
|
|
110
115
|
options.realVerifier,
|
|
116
|
+
options.createVerificationJson,
|
|
111
117
|
log,
|
|
112
118
|
debugLogger,
|
|
113
119
|
);
|
|
@@ -285,8 +291,9 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
285
291
|
|
|
286
292
|
program
|
|
287
293
|
.command('add-l1-validator')
|
|
288
|
-
.description('Adds a validator to the L1 rollup contract.')
|
|
294
|
+
.description('Adds a validator to the L1 rollup contract via a direct deposit.')
|
|
289
295
|
.addOption(l1RpcUrlsOption)
|
|
296
|
+
.addOption(networkOption)
|
|
290
297
|
.option('-pk, --private-key <string>', 'The private key to use sending the transaction', PRIVATE_KEY)
|
|
291
298
|
.option(
|
|
292
299
|
'-m, --mnemonic <string>',
|
|
@@ -295,32 +302,29 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
295
302
|
)
|
|
296
303
|
.addOption(l1ChainIdOption)
|
|
297
304
|
.option('--attester <address>', 'ethereum address of the attester', parseEthereumAddress)
|
|
305
|
+
.option('--withdrawer <address>', 'ethereum address of the withdrawer', parseEthereumAddress)
|
|
298
306
|
.option(
|
|
299
307
|
'--bls-secret-key <string>',
|
|
300
308
|
'The BN254 scalar field element used as a secret key for BLS signatures. Will be associated with the attester address.',
|
|
301
309
|
parseBigint,
|
|
302
310
|
)
|
|
303
|
-
.option('--
|
|
304
|
-
.option('--
|
|
305
|
-
Buffer.from(withoutHexPrefix(arg), 'hex'),
|
|
306
|
-
)
|
|
307
|
-
.option(
|
|
308
|
-
'--merkle-proof <string>',
|
|
309
|
-
'The merkle proof to use for the attestation (comma separated list of 32 byte buffers)',
|
|
310
|
-
arg => arg.split(','),
|
|
311
|
-
)
|
|
311
|
+
.option('--move-with-latest-rollup', 'Whether to move with the latest rollup', true)
|
|
312
|
+
.option('--rollup <string>', 'Rollup contract address', parseEthereumAddress)
|
|
312
313
|
.action(async options => {
|
|
313
|
-
const {
|
|
314
|
-
|
|
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({
|
|
315
319
|
rpcUrls: options.l1RpcUrls,
|
|
316
320
|
chainId: options.l1ChainId,
|
|
317
321
|
privateKey: options.privateKey,
|
|
318
322
|
mnemonic: options.mnemonic,
|
|
319
323
|
attesterAddress: options.attester,
|
|
320
|
-
stakingAssetHandlerAddress: options.stakingAssetHandler,
|
|
321
|
-
merkleProof: options.merkleProof,
|
|
322
|
-
proofParams: options.proof,
|
|
323
324
|
blsSecretKey: options.blsSecretKey,
|
|
325
|
+
withdrawerAddress: options.withdrawer,
|
|
326
|
+
rollupAddress,
|
|
327
|
+
moveWithLatestRollup: options.moveWithLatestRollup,
|
|
324
328
|
log,
|
|
325
329
|
debugLogger,
|
|
326
330
|
});
|
|
@@ -507,52 +511,20 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
507
511
|
)
|
|
508
512
|
.argument('[blockNumber]', 'The target block number, defaults to the latest pending block number.', parseBigint)
|
|
509
513
|
.addOption(l1RpcUrlsOption)
|
|
510
|
-
.addOption(
|
|
514
|
+
.addOption(nodeOption)
|
|
511
515
|
.action(async (blockNumber, options) => {
|
|
512
516
|
const { assumeProvenThrough } = await import('./assume_proven_through.js');
|
|
513
|
-
await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.
|
|
517
|
+
await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.nodeUrl, log);
|
|
514
518
|
});
|
|
515
519
|
|
|
516
520
|
program
|
|
517
521
|
.command('advance-epoch')
|
|
518
522
|
.description('Use L1 cheat codes to warp time until the next epoch.')
|
|
519
523
|
.addOption(l1RpcUrlsOption)
|
|
520
|
-
.addOption(
|
|
524
|
+
.addOption(nodeOption)
|
|
521
525
|
.action(async options => {
|
|
522
526
|
const { advanceEpoch } = await import('./advance_epoch.js');
|
|
523
|
-
await advanceEpoch(options.l1RpcUrls, options.
|
|
524
|
-
});
|
|
525
|
-
|
|
526
|
-
program
|
|
527
|
-
.command('prover-stats', { hidden: true })
|
|
528
|
-
.addOption(l1RpcUrlsOption)
|
|
529
|
-
.addOption(l1ChainIdOption)
|
|
530
|
-
.option('--start-block <number>', 'The L1 block number to start from', parseBigint, 1n)
|
|
531
|
-
.option('--end-block <number>', 'The last L1 block number to query', parseBigint)
|
|
532
|
-
.option('--batch-size <number>', 'The number of blocks to query in each batch', parseBigint, 100n)
|
|
533
|
-
.option('--proving-timeout <number>', 'Cutoff for proving time to consider a block', parseBigint)
|
|
534
|
-
.option('--l1-rollup-address <string>', 'Address of the rollup contract (required if node URL is not set)')
|
|
535
|
-
.option(
|
|
536
|
-
'--node-url <string>',
|
|
537
|
-
'JSON RPC URL of an Aztec node to retrieve the rollup contract address (required if L1 rollup address is not set)',
|
|
538
|
-
)
|
|
539
|
-
.option('--raw-logs', 'Output raw logs instead of aggregated stats')
|
|
540
|
-
.action(async options => {
|
|
541
|
-
const { proverStats } = await import('./prover_stats.js');
|
|
542
|
-
const { l1RpcUrls, chainId, l1RollupAddress, startBlock, endBlock, batchSize, nodeUrl, provingTimeout, rawLogs } =
|
|
543
|
-
options;
|
|
544
|
-
await proverStats({
|
|
545
|
-
l1RpcUrls,
|
|
546
|
-
chainId,
|
|
547
|
-
l1RollupAddress,
|
|
548
|
-
startBlock,
|
|
549
|
-
endBlock,
|
|
550
|
-
batchSize,
|
|
551
|
-
nodeUrl,
|
|
552
|
-
provingTimeout,
|
|
553
|
-
rawLogs,
|
|
554
|
-
log,
|
|
555
|
-
});
|
|
527
|
+
await advanceEpoch(options.l1RpcUrls, options.nodeUrl, log);
|
|
556
528
|
});
|
|
557
529
|
|
|
558
530
|
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';
|
|
@@ -55,33 +56,40 @@ export async function proverStats(opts: {
|
|
|
55
56
|
|
|
56
57
|
// If we only care for raw logs, output them
|
|
57
58
|
if (rawLogs && !provingTimeout) {
|
|
58
|
-
log(`l1_block_number,
|
|
59
|
+
log(`l1_block_number, checkpoint_number, prover_id, tx_hash`);
|
|
59
60
|
for (const event of events) {
|
|
60
|
-
const { l1BlockNumber,
|
|
61
|
-
log(`${l1BlockNumber}, ${
|
|
61
|
+
const { l1BlockNumber, checkpointNumber, proverId, txHash } = event;
|
|
62
|
+
log(`${l1BlockNumber}, ${checkpointNumber}, ${proverId}, ${txHash}`);
|
|
62
63
|
}
|
|
63
64
|
return;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
// If we don't have a proving timeout, we can just count the number of unique
|
|
67
|
+
// If we don't have a proving timeout, we can just count the number of unique checkpoints per prover
|
|
67
68
|
if (!provingTimeout) {
|
|
68
69
|
const stats = groupBy(events, 'proverId');
|
|
69
|
-
log(`prover_id,
|
|
70
|
+
log(`prover_id, total_checkpoints_proven`);
|
|
70
71
|
for (const proverId in stats) {
|
|
71
|
-
const
|
|
72
|
-
log(`${proverId}, ${
|
|
72
|
+
const uniqueCheckpoints = new Set(stats[proverId].map(e => e.checkpointNumber));
|
|
73
|
+
log(`${proverId}, ${uniqueCheckpoints.size}`);
|
|
73
74
|
}
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
// But if we do, fetch the events for each
|
|
78
|
-
const
|
|
78
|
+
// But if we do, fetch the events for each checkpoint submitted, so we can look up their timestamp
|
|
79
|
+
const checkpointEvents = await getCheckpointProposedEvents(
|
|
80
|
+
startBlock,
|
|
81
|
+
lastBlockNum,
|
|
82
|
+
batchSize,
|
|
83
|
+
debugLog,
|
|
84
|
+
publicClient,
|
|
85
|
+
rollup,
|
|
86
|
+
);
|
|
79
87
|
debugLog.verbose(
|
|
80
|
-
`First
|
|
88
|
+
`First checkpoint within range is ${checkpointEvents[0]?.args.checkpointNumber} at L1 block ${checkpointEvents[0]?.blockNumber}`,
|
|
81
89
|
);
|
|
82
90
|
|
|
83
91
|
// Get the timestamps for every block on every log, both for proof and block submissions
|
|
84
|
-
const l1BlockNumbers = unique([...events.map(e => e.l1BlockNumber), ...
|
|
92
|
+
const l1BlockNumbers = unique([...events.map(e => e.l1BlockNumber), ...checkpointEvents.map(e => e.blockNumber)]);
|
|
85
93
|
const l1BlockTimestamps: Record<string, bigint> = {};
|
|
86
94
|
for (const l1Batch of chunk(l1BlockNumbers, Number(batchSize))) {
|
|
87
95
|
const blocks = await Promise.all(
|
|
@@ -93,44 +101,44 @@ export async function proverStats(opts: {
|
|
|
93
101
|
}
|
|
94
102
|
}
|
|
95
103
|
|
|
96
|
-
// Map from
|
|
97
|
-
const
|
|
98
|
-
for (const
|
|
99
|
-
|
|
104
|
+
// Map from checkpoint number to the l1 block in which it was submitted
|
|
105
|
+
const checkpointSubmissions: Record<string, bigint> = {};
|
|
106
|
+
for (const checkpointEvent of checkpointEvents) {
|
|
107
|
+
checkpointSubmissions[checkpointEvent.args.checkpointNumber!.toString()] = checkpointEvent.blockNumber;
|
|
100
108
|
}
|
|
101
109
|
|
|
102
110
|
// If we want raw logs, output them
|
|
103
111
|
if (rawLogs) {
|
|
104
|
-
log(`l1_block_number,
|
|
112
|
+
log(`l1_block_number, checkpoint_number, checkpoint_submission_timestamp, proof_timestamp, prover_id, tx_hash`);
|
|
105
113
|
for (const event of events) {
|
|
106
|
-
const { l1BlockNumber,
|
|
107
|
-
const uploadedBlockNumber =
|
|
114
|
+
const { l1BlockNumber, checkpointNumber, proverId, txHash } = event;
|
|
115
|
+
const uploadedBlockNumber = checkpointSubmissions[checkpointNumber.toString()];
|
|
108
116
|
if (!uploadedBlockNumber) {
|
|
109
117
|
continue;
|
|
110
118
|
}
|
|
111
119
|
const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
|
|
112
120
|
const provenTimestamp = l1BlockTimestamps[l1BlockNumber.toString()];
|
|
113
|
-
log(`${l1BlockNumber}, ${
|
|
121
|
+
log(`${l1BlockNumber}, ${checkpointNumber}, ${uploadedTimestamp}, ${provenTimestamp}, ${proverId}, ${txHash}`);
|
|
114
122
|
}
|
|
115
123
|
return;
|
|
116
124
|
}
|
|
117
125
|
|
|
118
126
|
// Or calculate stats per prover
|
|
119
|
-
const stats = mapValues(groupBy(events, 'proverId'), (
|
|
127
|
+
const stats = mapValues(groupBy(events, 'proverId'), (checkpoints, proverId) =>
|
|
120
128
|
compactArray(
|
|
121
|
-
|
|
129
|
+
checkpoints.map(e => {
|
|
122
130
|
const provenTimestamp = l1BlockTimestamps[e.l1BlockNumber.toString()];
|
|
123
|
-
const uploadedBlockNumber =
|
|
131
|
+
const uploadedBlockNumber = checkpointSubmissions[e.checkpointNumber.toString()];
|
|
124
132
|
if (!uploadedBlockNumber) {
|
|
125
133
|
debugLog.verbose(
|
|
126
|
-
`Skipping ${proverId}'s proof for
|
|
134
|
+
`Skipping ${proverId}'s proof for checkpoint ${e.checkpointNumber} as it was before the start block`,
|
|
127
135
|
);
|
|
128
136
|
return undefined;
|
|
129
137
|
}
|
|
130
138
|
const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
|
|
131
139
|
const provingTime = provenTimestamp - uploadedTimestamp;
|
|
132
140
|
debugLog.debug(
|
|
133
|
-
`prover=${e.proverId}
|
|
141
|
+
`prover=${e.proverId} checkpointNumber=${e.checkpointNumber} uploaded=${uploadedTimestamp} proven=${provenTimestamp} time=${provingTime}`,
|
|
134
142
|
);
|
|
135
143
|
return { provenTimestamp, uploadedTimestamp, provingTime, ...e };
|
|
136
144
|
}),
|
|
@@ -141,8 +149,8 @@ export async function proverStats(opts: {
|
|
|
141
149
|
for (const proverId in stats) {
|
|
142
150
|
const blocks = stats[proverId];
|
|
143
151
|
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.
|
|
152
|
+
const uniqueBlocksWithinTimeout = new Set(withinTimeout.map(e => e.checkpointNumber));
|
|
153
|
+
const uniqueBlocks = new Set(blocks.map(e => e.checkpointNumber));
|
|
146
154
|
const avgProvingTime =
|
|
147
155
|
blocks.length === 0 ? 0 : Math.ceil(Number(blocks.reduce((acc, b) => acc + b.provingTime, 0n)) / blocks.length);
|
|
148
156
|
|
|
@@ -171,7 +179,7 @@ async function getL2ProofVerifiedEvents(
|
|
|
171
179
|
return events;
|
|
172
180
|
}
|
|
173
181
|
|
|
174
|
-
async function
|
|
182
|
+
async function getCheckpointProposedEvents(
|
|
175
183
|
startBlock: bigint,
|
|
176
184
|
lastBlockNum: bigint,
|
|
177
185
|
batchSize: bigint,
|
|
@@ -188,14 +196,14 @@ async function getL2BlockEvents(
|
|
|
188
196
|
address: getAddress(rollup.toString()),
|
|
189
197
|
event: getAbiItem({
|
|
190
198
|
abi: RollupAbi,
|
|
191
|
-
name: '
|
|
199
|
+
name: 'CheckpointProposed',
|
|
192
200
|
}),
|
|
193
201
|
fromBlock: blockNum,
|
|
194
202
|
toBlock: end,
|
|
195
203
|
});
|
|
196
204
|
|
|
197
205
|
events.push(...newEvents);
|
|
198
|
-
debugLog.verbose(`Got ${newEvents.length} events querying
|
|
206
|
+
debugLog.verbose(`Got ${newEvents.length} events querying checkpoints submitted from block ${blockNum} to ${end}`);
|
|
199
207
|
blockNum += batchSize;
|
|
200
208
|
}
|
|
201
209
|
return events;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { createEthereumChain
|
|
1
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
2
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
2
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
4
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
4
5
|
|