@aztec/cli 0.17.0 → 0.77.0-testnet-ignition.17
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 +10 -16
- package/dest/cmds/contracts/index.d.ts +4 -0
- package/dest/cmds/contracts/index.d.ts.map +1 -0
- package/dest/cmds/contracts/index.js +12 -0
- package/dest/cmds/contracts/inspect_contract.d.ts +3 -0
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -0
- package/dest/cmds/contracts/inspect_contract.js +37 -0
- package/dest/cmds/{parse_parameter_struct.d.ts → contracts/parse_parameter_struct.d.ts} +1 -4
- package/dest/cmds/contracts/parse_parameter_struct.d.ts.map +1 -0
- package/dest/cmds/contracts/parse_parameter_struct.js +13 -0
- package/dest/cmds/devnet/bootstrap_network.d.ts +3 -0
- package/dest/cmds/devnet/bootstrap_network.d.ts.map +1 -0
- package/dest/cmds/devnet/bootstrap_network.js +196 -0
- package/dest/cmds/devnet/faucet.d.ts +4 -0
- package/dest/cmds/devnet/faucet.d.ts.map +1 -0
- package/dest/cmds/devnet/faucet.js +26 -0
- package/dest/cmds/devnet/index.d.ts +4 -0
- package/dest/cmds/devnet/index.d.ts.map +1 -0
- package/dest/cmds/devnet/index.js +14 -0
- package/dest/cmds/infrastructure/index.d.ts +4 -0
- package/dest/cmds/infrastructure/index.d.ts.map +1 -0
- package/dest/cmds/infrastructure/index.js +24 -0
- package/dest/cmds/infrastructure/sequencers.d.ts +13 -0
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -0
- package/dest/cmds/infrastructure/sequencers.js +93 -0
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +3 -0
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -0
- package/dest/cmds/infrastructure/setup_l2_contract.js +43 -0
- package/dest/cmds/l1/advance_epoch.d.ts +3 -0
- package/dest/cmds/l1/advance_epoch.d.ts.map +1 -0
- package/dest/cmds/l1/advance_epoch.js +10 -0
- package/dest/cmds/l1/assume_proven_through.d.ts +3 -0
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -0
- package/dest/cmds/l1/assume_proven_through.js +12 -0
- package/dest/cmds/l1/bridge_erc20.d.ts +4 -0
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -0
- package/dest/cmds/l1/bridge_erc20.js +31 -0
- package/dest/cmds/l1/create_l1_account.d.ts +3 -0
- package/dest/cmds/l1/create_l1_account.d.ts.map +1 -0
- package/dest/cmds/l1/create_l1_account.js +15 -0
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +4 -0
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_l1_contracts.js +29 -0
- package/dest/cmds/l1/deploy_l1_verifier.d.ts +5 -0
- package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_l1_verifier.js +54 -0
- package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -0
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_new_rollup.js +19 -0
- package/dest/cmds/l1/get_l1_addresses.d.ts +4 -0
- package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -0
- package/dest/cmds/l1/get_l1_addresses.js +18 -0
- package/dest/cmds/l1/get_l1_balance.d.ts +4 -0
- package/dest/cmds/l1/get_l1_balance.d.ts.map +1 -0
- package/dest/cmds/l1/get_l1_balance.js +33 -0
- package/dest/cmds/l1/governance_utils.d.ts +50 -0
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -0
- package/dest/cmds/l1/governance_utils.js +85 -0
- package/dest/cmds/l1/index.d.ts +4 -0
- package/dest/cmds/l1/index.d.ts.map +1 -0
- package/dest/cmds/l1/index.js +208 -0
- package/dest/cmds/l1/prover_stats.d.ts +14 -0
- package/dest/cmds/l1/prover_stats.d.ts.map +1 -0
- package/dest/cmds/l1/prover_stats.js +145 -0
- package/dest/cmds/l1/update_l1_validators.d.ts +30 -0
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -0
- package/dest/cmds/l1/update_l1_validators.js +186 -0
- package/dest/cmds/misc/compute_selector.d.ts +3 -0
- package/dest/cmds/misc/compute_selector.d.ts.map +1 -0
- package/dest/cmds/misc/compute_selector.js +5 -0
- package/dest/cmds/misc/example_contracts.d.ts +3 -0
- package/dest/cmds/misc/example_contracts.d.ts.map +1 -0
- package/dest/cmds/misc/example_contracts.js +6 -0
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +3 -0
- package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -0
- package/dest/cmds/misc/generate_bootnode_enr.js +5 -0
- package/dest/cmds/misc/generate_p2p_private_key.d.ts +3 -0
- package/dest/cmds/misc/generate_p2p_private_key.d.ts.map +1 -0
- package/dest/cmds/misc/generate_p2p_private_key.js +7 -0
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +3 -0
- package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -0
- package/dest/cmds/misc/generate_secret_and_hash.js +11 -0
- package/dest/cmds/misc/generate_secret_key.d.ts +5 -0
- package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -0
- package/dest/cmds/misc/generate_secret_key.js +6 -0
- package/dest/cmds/misc/index.d.ts +4 -0
- package/dest/cmds/misc/index.d.ts.map +1 -0
- package/dest/cmds/misc/index.js +44 -0
- package/dest/cmds/misc/setup_contracts.d.ts +7 -0
- package/dest/cmds/misc/setup_contracts.d.ts.map +1 -0
- package/dest/cmds/misc/setup_contracts.js +27 -0
- package/dest/cmds/misc/update/common.d.ts.map +1 -0
- package/dest/cmds/misc/update/common.js +3 -0
- package/dest/cmds/misc/update/github.d.ts.map +1 -0
- package/dest/cmds/misc/update/github.js +3 -0
- package/dest/{update → cmds/misc/update}/noir.d.ts +2 -2
- package/dest/cmds/misc/update/noir.d.ts.map +1 -0
- package/dest/cmds/misc/update/noir.js +45 -0
- package/dest/{update → cmds/misc/update}/npm.d.ts +3 -3
- package/dest/cmds/misc/update/npm.d.ts.map +1 -0
- package/dest/cmds/misc/update/npm.js +127 -0
- package/dest/cmds/misc/update/utils.d.ts +14 -0
- package/dest/cmds/misc/update/utils.d.ts.map +1 -0
- package/dest/cmds/misc/update/utils.js +38 -0
- package/dest/cmds/misc/update.d.ts +3 -0
- package/dest/cmds/misc/update.d.ts.map +1 -0
- package/dest/cmds/misc/update.js +52 -0
- package/dest/cmds/pxe/add_contract.d.ts +5 -0
- package/dest/cmds/pxe/add_contract.d.ts.map +1 -0
- package/dest/cmds/pxe/add_contract.js +29 -0
- package/dest/cmds/pxe/block_number.d.ts +3 -0
- package/dest/cmds/pxe/block_number.d.ts.map +1 -0
- package/dest/cmds/pxe/block_number.js +10 -0
- package/dest/cmds/pxe/get_account.d.ts +4 -0
- package/dest/cmds/pxe/get_account.d.ts.map +1 -0
- package/dest/cmds/pxe/get_account.js +10 -0
- package/dest/cmds/pxe/get_accounts.d.ts +3 -0
- package/dest/cmds/pxe/get_accounts.d.ts.map +1 -0
- package/dest/cmds/pxe/get_accounts.js +25 -0
- package/dest/cmds/pxe/get_block.d.ts +3 -0
- package/dest/cmds/pxe/get_block.d.ts.map +1 -0
- package/dest/cmds/pxe/get_block.js +9 -0
- package/dest/cmds/pxe/get_contract_data.d.ts +4 -0
- package/dest/cmds/pxe/get_contract_data.d.ts.map +1 -0
- package/dest/cmds/pxe/get_contract_data.js +31 -0
- package/dest/cmds/pxe/get_current_base_fee.d.ts +3 -0
- package/dest/cmds/pxe/get_current_base_fee.d.ts.map +1 -0
- package/dest/cmds/pxe/get_current_base_fee.js +7 -0
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +4 -0
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +11 -0
- package/dest/cmds/pxe/get_logs.d.ts +4 -0
- package/dest/cmds/pxe/get_logs.d.ts.map +1 -0
- package/dest/cmds/pxe/get_logs.js +51 -0
- package/dest/cmds/pxe/get_node_info.d.ts +3 -0
- package/dest/cmds/pxe/get_node_info.d.ts.map +1 -0
- package/dest/cmds/pxe/get_node_info.js +61 -0
- package/dest/cmds/pxe/get_pxe_info.d.ts +3 -0
- package/dest/cmds/pxe/get_pxe_info.d.ts.map +1 -0
- package/dest/cmds/pxe/get_pxe_info.js +11 -0
- package/dest/cmds/pxe/index.d.ts +4 -0
- package/dest/cmds/pxe/index.d.ts.map +1 -0
- package/dest/cmds/pxe/index.js +55 -0
- package/dest/utils/aztec.d.ts +68 -0
- package/dest/utils/aztec.d.ts.map +1 -0
- package/dest/utils/aztec.js +173 -0
- package/dest/{parse_args.d.ts → utils/commands.d.ts} +50 -12
- package/dest/utils/commands.d.ts.map +1 -0
- package/dest/utils/commands.js +303 -0
- package/dest/{encoding.d.ts → utils/encoding.d.ts} +1 -1
- package/dest/utils/encoding.d.ts.map +1 -0
- package/dest/utils/encoding.js +103 -0
- package/dest/utils/github.d.ts +4 -0
- package/dest/utils/github.d.ts.map +1 -0
- package/dest/utils/github.js +3 -0
- package/dest/utils/index.d.ts +5 -0
- package/dest/utils/index.d.ts.map +1 -0
- package/dest/utils/index.js +4 -0
- package/dest/utils/inspect.d.ts +17 -0
- package/dest/utils/inspect.d.ts.map +1 -0
- package/dest/utils/inspect.js +177 -0
- package/package.json +68 -22
- package/src/cmds/contracts/index.ts +34 -0
- package/src/cmds/contracts/inspect_contract.ts +51 -0
- package/src/cmds/contracts/parse_parameter_struct.ts +27 -0
- package/src/cmds/devnet/bootstrap_network.ts +318 -0
- package/src/cmds/devnet/faucet.ts +33 -0
- package/src/cmds/devnet/index.ts +60 -0
- package/src/cmds/infrastructure/index.ts +55 -0
- package/src/cmds/infrastructure/sequencers.ts +103 -0
- package/src/cmds/infrastructure/setup_l2_contract.ts +47 -0
- package/src/cmds/l1/advance_epoch.ts +12 -0
- package/src/cmds/l1/assume_proven_through.ts +19 -0
- package/src/cmds/l1/bridge_erc20.ts +52 -0
- package/src/cmds/l1/create_l1_account.ts +17 -0
- package/src/cmds/l1/deploy_l1_contracts.ts +63 -0
- package/src/cmds/l1/deploy_l1_verifier.ts +105 -0
- package/src/cmds/l1/deploy_new_rollup.ts +58 -0
- package/src/cmds/l1/get_l1_addresses.ts +30 -0
- package/src/cmds/l1/get_l1_balance.ts +44 -0
- package/src/cmds/l1/governance_utils.ts +187 -0
- package/src/cmds/l1/index.ts +556 -0
- package/src/cmds/l1/prover_stats.ts +202 -0
- package/src/cmds/l1/update_l1_validators.ts +238 -0
- package/src/cmds/misc/compute_selector.ts +7 -0
- package/src/cmds/misc/example_contracts.ts +12 -0
- package/src/cmds/misc/generate_bootnode_enr.ts +12 -0
- package/src/cmds/misc/generate_p2p_private_key.ts +10 -0
- package/src/cmds/misc/generate_secret_and_hash.ts +15 -0
- package/src/cmds/misc/generate_secret_key.ts +5 -0
- package/src/cmds/misc/index.ts +92 -0
- package/src/cmds/misc/setup_contracts.ts +40 -0
- package/src/cmds/misc/update/common.ts +16 -0
- package/src/cmds/misc/update/github.ts +3 -0
- package/src/cmds/misc/update/noir.ts +57 -0
- package/src/cmds/misc/update/npm.ts +154 -0
- package/src/cmds/misc/update/utils.ts +50 -0
- package/src/cmds/misc/update.ts +78 -0
- package/src/cmds/pxe/add_contract.ts +41 -0
- package/src/cmds/pxe/block_number.ts +9 -0
- package/src/cmds/pxe/get_account.ts +16 -0
- package/src/cmds/pxe/get_accounts.ts +35 -0
- package/src/cmds/pxe/get_block.ts +10 -0
- package/src/cmds/pxe/get_contract_data.ts +51 -0
- package/src/cmds/pxe/get_current_base_fee.ts +9 -0
- package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +25 -0
- package/src/cmds/pxe/get_logs.ts +66 -0
- package/src/cmds/pxe/get_node_info.ts +71 -0
- package/src/cmds/pxe/get_pxe_info.ts +13 -0
- package/src/cmds/pxe/index.ts +170 -0
- package/src/utils/aztec.ts +248 -0
- package/src/utils/commands.ts +384 -0
- package/src/utils/encoding.ts +117 -0
- package/src/utils/github.ts +3 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/inspect.ts +208 -0
- package/dest/bin/index.d.ts +0 -3
- package/dest/bin/index.d.ts.map +0 -1
- package/dest/bin/index.js +0 -19
- package/dest/client.d.ts +0 -17
- package/dest/client.d.ts.map +0 -1
- package/dest/client.js +0 -60
- package/dest/cmds/add_contract.d.ts +0 -7
- package/dest/cmds/add_contract.d.ts.map +0 -1
- package/dest/cmds/add_contract.js +0 -15
- package/dest/cmds/add_note.d.ts +0 -8
- package/dest/cmds/add_note.d.ts.map +0 -1
- package/dest/cmds/add_note.js +0 -13
- package/dest/cmds/block_number.d.ts +0 -6
- package/dest/cmds/block_number.d.ts.map +0 -1
- package/dest/cmds/block_number.js +0 -10
- package/dest/cmds/call.d.ts +0 -7
- package/dest/cmds/call.d.ts.map +0 -1
- package/dest/cmds/call.js +0 -18
- package/dest/cmds/check_deploy.d.ts +0 -7
- package/dest/cmds/check_deploy.d.ts.map +0 -1
- package/dest/cmds/check_deploy.js +0 -16
- package/dest/cmds/compute_selector.d.ts +0 -6
- package/dest/cmds/compute_selector.d.ts.map +0 -1
- package/dest/cmds/compute_selector.js +0 -9
- package/dest/cmds/create_account.d.ts +0 -7
- package/dest/cmds/create_account.d.ts.map +0 -1
- package/dest/cmds/create_account.js +0 -31
- package/dest/cmds/deploy.d.ts +0 -7
- package/dest/cmds/deploy.d.ts.map +0 -1
- package/dest/cmds/deploy.js +0 -58
- package/dest/cmds/deploy_l1_contracts.d.ts +0 -6
- package/dest/cmds/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/cmds/deploy_l1_contracts.js +0 -15
- package/dest/cmds/example_contracts.d.ts +0 -6
- package/dest/cmds/example_contracts.d.ts.map +0 -1
- package/dest/cmds/example_contracts.js +0 -10
- package/dest/cmds/generate_p2p_private_key.d.ts +0 -6
- package/dest/cmds/generate_p2p_private_key.d.ts.map +0 -1
- package/dest/cmds/generate_p2p_private_key.js +0 -11
- package/dest/cmds/generate_private_key.d.ts +0 -6
- package/dest/cmds/generate_private_key.d.ts.map +0 -1
- package/dest/cmds/generate_private_key.js +0 -22
- package/dest/cmds/get_account.d.ts +0 -7
- package/dest/cmds/get_account.d.ts.map +0 -1
- package/dest/cmds/get_account.js +0 -15
- package/dest/cmds/get_accounts.d.ts +0 -6
- package/dest/cmds/get_accounts.d.ts.map +0 -1
- package/dest/cmds/get_accounts.js +0 -18
- package/dest/cmds/get_contract_data.d.ts +0 -7
- package/dest/cmds/get_contract_data.d.ts.map +0 -1
- package/dest/cmds/get_contract_data.js +0 -28
- package/dest/cmds/get_logs.d.ts +0 -7
- package/dest/cmds/get_logs.d.ts.map +0 -1
- package/dest/cmds/get_logs.js +0 -54
- package/dest/cmds/get_node_info.d.ts +0 -6
- package/dest/cmds/get_node_info.d.ts.map +0 -1
- package/dest/cmds/get_node_info.js +0 -15
- package/dest/cmds/get_recipient.d.ts +0 -7
- package/dest/cmds/get_recipient.d.ts.map +0 -1
- package/dest/cmds/get_recipient.js +0 -15
- package/dest/cmds/get_recipients.d.ts +0 -6
- package/dest/cmds/get_recipients.d.ts.map +0 -1
- package/dest/cmds/get_recipients.js +0 -18
- package/dest/cmds/get_tx_receipt.d.ts +0 -7
- package/dest/cmds/get_tx_receipt.d.ts.map +0 -1
- package/dest/cmds/get_tx_receipt.js +0 -16
- package/dest/cmds/inspect_contract.d.ts +0 -6
- package/dest/cmds/inspect_contract.d.ts.map +0 -1
- package/dest/cmds/inspect_contract.js +0 -19
- package/dest/cmds/parse_parameter_struct.d.ts.map +0 -1
- package/dest/cmds/parse_parameter_struct.js +0 -20
- package/dest/cmds/register_account.d.ts +0 -7
- package/dest/cmds/register_account.d.ts.map +0 -1
- package/dest/cmds/register_account.js +0 -13
- package/dest/cmds/register_recipient.d.ts +0 -7
- package/dest/cmds/register_recipient.d.ts.map +0 -1
- package/dest/cmds/register_recipient.js +0 -11
- package/dest/cmds/send.d.ts +0 -7
- package/dest/cmds/send.d.ts.map +0 -1
- package/dest/cmds/send.js +0 -27
- package/dest/cmds/unbox.d.ts +0 -7
- package/dest/cmds/unbox.d.ts.map +0 -1
- package/dest/cmds/unbox.js +0 -133
- package/dest/encoding.d.ts.map +0 -1
- package/dest/encoding.js +0 -114
- package/dest/github.d.ts.map +0 -1
- package/dest/github.js +0 -4
- package/dest/index.d.ts +0 -10
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -321
- package/dest/parse_args.d.ts.map +0 -1
- package/dest/parse_args.js +0 -233
- package/dest/test/mocks.d.ts +0 -3
- package/dest/test/mocks.d.ts.map +0 -1
- package/dest/test/mocks.js +0 -65
- package/dest/update/common.d.ts.map +0 -1
- package/dest/update/common.js +0 -2
- package/dest/update/noir.d.ts.map +0 -1
- package/dest/update/noir.js +0 -63
- package/dest/update/npm.d.ts.map +0 -1
- package/dest/update/npm.js +0 -125
- package/dest/update/update.d.ts +0 -3
- package/dest/update/update.d.ts.map +0 -1
- package/dest/update/update.js +0 -58
- package/dest/utils.d.ts +0 -70
- package/dest/utils.d.ts.map +0 -1
- package/dest/utils.js +0 -168
- /package/dest/{update → cmds/misc/update}/common.d.ts +0 -0
- /package/dest/{github.d.ts → cmds/misc/update/github.d.ts} +0 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { Option } from 'commander';
|
|
3
|
+
import { ETHEREUM_HOSTS, PRIVATE_KEY, l1ChainIdOption, makePxeOption, parseAztecAddress, parseBigint, parseEthereumAddress, pxeOption } from '../../utils/commands.js';
|
|
4
|
+
const l1RpcUrlsOption = new Option('--l1-rpc-urls <string>', 'List of Ethereum host URLs. Chain identifiers localhost and testnet can be used (comma separated)').env('ETHEREUM_HOSTS').default([
|
|
5
|
+
ETHEREUM_HOSTS
|
|
6
|
+
]).makeOptionMandatory(true).argParser((arg)=>arg.split(',').map((url)=>url.trim()));
|
|
7
|
+
export function injectCommands(program, log, debugLogger) {
|
|
8
|
+
const { BB_BINARY_PATH, BB_WORKING_DIRECTORY } = process.env;
|
|
9
|
+
program.command('deploy-l1-contracts').description('Deploys all necessary Ethereum contracts for Aztec.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--validators <string>', 'Comma separated list of validators').option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', (arg)=>parseInt(arg), 0).addOption(l1ChainIdOption).option('--salt <number>', 'The optional salt to use in deployment', (arg)=>parseInt(arg)).option('--json', 'Output the contract addresses in JSON format').option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts').action(async (options)=>{
|
|
10
|
+
const { deployL1Contracts } = await import('./deploy_l1_contracts.js');
|
|
11
|
+
const initialValidators = options.validators?.split(',').map((validator)=>EthAddress.fromString(validator)) || [];
|
|
12
|
+
await deployL1Contracts(options.l1RpcUrls, options.l1ChainId, options.privateKey, options.mnemonic, options.mnemonicIndex, options.salt, options.testAccounts, options.json, initialValidators, log, debugLogger);
|
|
13
|
+
});
|
|
14
|
+
program.command('deploy-new-rollup').description('Deploys a new rollup contract and a payload to upgrade the registry with it.').requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress).addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--validators <string>', 'Comma separated list of validators').option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use in deployment', (arg)=>parseInt(arg), 0).addOption(l1ChainIdOption).option('--salt <number>', 'The optional salt to use in deployment', (arg)=>parseInt(arg)).option('--json', 'Output the contract addresses in JSON format').option('--test-accounts', 'Populate genesis state with initial fee juice for test accounts').action(async (options)=>{
|
|
15
|
+
const { deployNewRollup } = await import('./deploy_new_rollup.js');
|
|
16
|
+
const initialValidators = options.validators?.split(',').map((validator)=>EthAddress.fromString(validator)) || [];
|
|
17
|
+
await deployNewRollup(options.registryAddress, options.l1RpcUrls, options.l1ChainId, options.privateKey, options.mnemonic, options.mnemonicIndex, options.salt, options.testAccounts, options.json, initialValidators, log, debugLogger);
|
|
18
|
+
});
|
|
19
|
+
program.command('deposit-governance-tokens').description('Deposits governance tokens to the governance contract.').requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress).requiredOption('--recipient <string>', 'The recipient of the tokens', parseEthereumAddress).requiredOption('-a, --amount <string>', 'The amount of tokens to deposit', parseBigint).option('--mint', 'Mint the tokens on L1', false).addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).option('-p, --private-key <string>', 'The private key to use to deposit', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use to deposit', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use to deposit', (arg)=>parseInt(arg), 0).action(async (options)=>{
|
|
20
|
+
const { depositGovernanceTokens } = await import('./governance_utils.js');
|
|
21
|
+
await depositGovernanceTokens({
|
|
22
|
+
registryAddress: options.registryAddress.toString(),
|
|
23
|
+
recipient: options.recipient.toString(),
|
|
24
|
+
amount: options.amount,
|
|
25
|
+
mint: options.mint,
|
|
26
|
+
rpcUrls: options.l1RpcUrls,
|
|
27
|
+
chainId: options.l1ChainId,
|
|
28
|
+
privateKey: options.privateKey,
|
|
29
|
+
mnemonic: options.mnemonic,
|
|
30
|
+
mnemonicIndex: options.mnemonicIndex,
|
|
31
|
+
debugLogger
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
program.command('propose-with-lock').description('Makes a proposal to governance with a lock').requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress).requiredOption('-p, --payload-address <string>', 'The address of the payload contract', parseEthereumAddress).addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).option('-pk, --private-key <string>', 'The private key to use to propose', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use to propose', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use to propose', (arg)=>parseInt(arg), 0).option('--json', 'Output the proposal ID in JSON format').action(async (options)=>{
|
|
35
|
+
const { proposeWithLock } = await import('./governance_utils.js');
|
|
36
|
+
await proposeWithLock({
|
|
37
|
+
payloadAddress: options.payloadAddress.toString(),
|
|
38
|
+
registryAddress: options.registryAddress.toString(),
|
|
39
|
+
rpcUrls: options.l1RpcUrls,
|
|
40
|
+
chainId: options.l1ChainId,
|
|
41
|
+
privateKey: options.privateKey,
|
|
42
|
+
mnemonic: options.mnemonic,
|
|
43
|
+
mnemonicIndex: options.mnemonicIndex,
|
|
44
|
+
debugLogger: debugLogger,
|
|
45
|
+
json: options.json,
|
|
46
|
+
log
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
program.command('vote-on-governance-proposal').description('Votes on a governance proposal.').requiredOption('-p, --proposal-id <string>', 'The ID of the proposal', parseBigint).option('-a, --vote-amount <string>', 'The amount of tokens to vote', parseBigint).requiredOption('--in-favor <boolean>', 'Whether to vote in favor of the proposal. Use "yea" for true, any other value for false.', (arg)=>arg === 'yea' || arg === 'true' || arg === '1' || arg === 'yes').requiredOption('--wait <boolean>', 'Whether to wait until the proposal is active', (arg)=>arg === 'true').requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress).addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).option('-pk, --private-key <string>', 'The private key to use to vote', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use to vote', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use to vote', (arg)=>parseInt(arg), 0).action(async (options)=>{
|
|
50
|
+
const { voteOnGovernanceProposal } = await import('./governance_utils.js');
|
|
51
|
+
await voteOnGovernanceProposal({
|
|
52
|
+
proposalId: options.proposalId,
|
|
53
|
+
voteAmount: options.voteAmount,
|
|
54
|
+
inFavor: options.inFavor,
|
|
55
|
+
waitTilActive: options.wait,
|
|
56
|
+
registryAddress: options.registryAddress.toString(),
|
|
57
|
+
rpcUrls: options.l1RpcUrls,
|
|
58
|
+
chainId: options.l1ChainId,
|
|
59
|
+
privateKey: options.privateKey,
|
|
60
|
+
mnemonic: options.mnemonic,
|
|
61
|
+
mnemonicIndex: options.mnemonicIndex,
|
|
62
|
+
debugLogger
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
program.command('execute-governance-proposal').description('Executes a governance proposal.').requiredOption('-p, --proposal-id <string>', 'The ID of the proposal', parseBigint).requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress).requiredOption('--wait <boolean>', 'Whether to wait until the proposal is executable', (arg)=>arg === 'true').addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).option('-pk, --private-key <string>', 'The private key to use to vote', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use to vote', 'test test test test test test test test test test test junk').option('-i, --mnemonic-index <number>', 'The index of the mnemonic to use to vote', (arg)=>parseInt(arg), 0).action(async (options)=>{
|
|
66
|
+
const { executeGovernanceProposal } = await import('./governance_utils.js');
|
|
67
|
+
await executeGovernanceProposal({
|
|
68
|
+
proposalId: options.proposalId,
|
|
69
|
+
registryAddress: options.registryAddress.toString(),
|
|
70
|
+
waitTilExecutable: options.wait,
|
|
71
|
+
rpcUrls: options.l1RpcUrls,
|
|
72
|
+
chainId: options.l1ChainId,
|
|
73
|
+
privateKey: options.privateKey,
|
|
74
|
+
mnemonic: options.mnemonic,
|
|
75
|
+
mnemonicIndex: options.mnemonicIndex,
|
|
76
|
+
debugLogger
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
program.command('get-l1-addresses').description('Gets the addresses of the L1 contracts.').requiredOption('-r, --registry-address <string>', 'The address of the registry contract', parseEthereumAddress).addOption(l1RpcUrlsOption).requiredOption('-v, --rollup-version <number>', 'The version of the rollup', (arg)=>{
|
|
80
|
+
if (arg === 'canonical' || arg === 'latest' || arg === '') {
|
|
81
|
+
return 'canonical';
|
|
82
|
+
}
|
|
83
|
+
const version = parseInt(arg);
|
|
84
|
+
if (isNaN(version)) {
|
|
85
|
+
throw new Error('Invalid rollup version');
|
|
86
|
+
}
|
|
87
|
+
return version;
|
|
88
|
+
}).addOption(l1ChainIdOption).option('--json', 'Output the addresses in JSON format').action(async (options)=>{
|
|
89
|
+
const { getL1Addresses } = await import('./get_l1_addresses.js');
|
|
90
|
+
await getL1Addresses(options.registryAddress, options.rollupVersion, options.l1RpcUrls, options.l1ChainId, options.json, log);
|
|
91
|
+
});
|
|
92
|
+
program.command('generate-l1-account').description('Generates a new private key for an account on L1.').option('--json', 'Output the private key in JSON format').action(async ()=>{
|
|
93
|
+
const { generateL1Account } = await import('./update_l1_validators.js');
|
|
94
|
+
const account = generateL1Account();
|
|
95
|
+
log(JSON.stringify(account, null, 2));
|
|
96
|
+
});
|
|
97
|
+
program.command('add-l1-validator').description('Adds a validator to the L1 rollup contract.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').addOption(l1ChainIdOption).option('--validator <address>', 'ethereum address of the validator', parseEthereumAddress).option('--rollup <address>', 'ethereum address of the rollup contract', parseEthereumAddress).option('--withdrawer <address>', 'ethereum address of the withdrawer', parseEthereumAddress).action(async (options)=>{
|
|
98
|
+
const { addL1Validator } = await import('./update_l1_validators.js');
|
|
99
|
+
await addL1Validator({
|
|
100
|
+
rpcUrls: options.l1RpcUrls,
|
|
101
|
+
chainId: options.l1ChainId,
|
|
102
|
+
privateKey: options.privateKey,
|
|
103
|
+
mnemonic: options.mnemonic,
|
|
104
|
+
validatorAddress: options.validator,
|
|
105
|
+
rollupAddress: options.rollup,
|
|
106
|
+
withdrawerAddress: options.withdrawer,
|
|
107
|
+
log,
|
|
108
|
+
debugLogger
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
program.command('remove-l1-validator').description('Removes a validator to the L1 rollup contract.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').addOption(l1ChainIdOption).option('--validator <address>', 'ethereum address of the validator', parseEthereumAddress).option('--rollup <address>', 'ethereum address of the rollup contract', parseEthereumAddress).action(async (options)=>{
|
|
112
|
+
const { removeL1Validator } = await import('./update_l1_validators.js');
|
|
113
|
+
await removeL1Validator({
|
|
114
|
+
rpcUrls: options.l1RpcUrls,
|
|
115
|
+
chainId: options.l1ChainId,
|
|
116
|
+
privateKey: options.privateKey,
|
|
117
|
+
mnemonic: options.mnemonic,
|
|
118
|
+
validatorAddress: options.validator,
|
|
119
|
+
rollupAddress: options.rollup,
|
|
120
|
+
log,
|
|
121
|
+
debugLogger
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
program.command('fast-forward-epochs').description('Fast forwards the epoch of the L1 rollup contract.').addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).option('--rollup <address>', 'ethereum address of the rollup contract', parseEthereumAddress).option('--count <number>', 'The number of epochs to fast forward', (arg)=>BigInt(parseInt(arg)), 1n).action(async (options)=>{
|
|
125
|
+
const { fastForwardEpochs } = await import('./update_l1_validators.js');
|
|
126
|
+
await fastForwardEpochs({
|
|
127
|
+
rpcUrls: options.l1RpcUrls,
|
|
128
|
+
chainId: options.l1ChainId,
|
|
129
|
+
rollupAddress: options.rollup,
|
|
130
|
+
numEpochs: options.count,
|
|
131
|
+
log,
|
|
132
|
+
debugLogger
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
program.command('debug-rollup').description('Debugs the rollup contract.').addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).option('--rollup <address>', 'ethereum address of the rollup contract', parseEthereumAddress).action(async (options)=>{
|
|
136
|
+
const { debugRollup } = await import('./update_l1_validators.js');
|
|
137
|
+
await debugRollup({
|
|
138
|
+
rpcUrls: options.l1RpcUrls,
|
|
139
|
+
chainId: options.l1ChainId,
|
|
140
|
+
privateKey: options.privateKey,
|
|
141
|
+
mnemonic: options.mnemonic,
|
|
142
|
+
rollupAddress: options.rollup,
|
|
143
|
+
log,
|
|
144
|
+
debugLogger
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
program.command('prune-rollup').description('Prunes the pending chain on the rollup contract.').addOption(l1RpcUrlsOption).option('-pk, --private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').addOption(l1ChainIdOption).option('--rollup <address>', 'ethereum address of the rollup contract', parseEthereumAddress).action(async (options)=>{
|
|
148
|
+
const { pruneRollup } = await import('./update_l1_validators.js');
|
|
149
|
+
await pruneRollup({
|
|
150
|
+
rpcUrls: options.rpcUrls,
|
|
151
|
+
chainId: options.l1ChainId,
|
|
152
|
+
privateKey: options.privateKey,
|
|
153
|
+
mnemonic: options.mnemonic,
|
|
154
|
+
rollupAddress: options.rollup,
|
|
155
|
+
log,
|
|
156
|
+
debugLogger
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
program.command('deploy-l1-verifier').description('Deploys the rollup verifier contract').addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).addOption(makePxeOption(false).conflicts('rollup-address')).addOption(new Option('--rollup-address <string>', 'The address of the rollup contract').env('ROLLUP_CONTRACT_ADDRESS').argParser(parseEthereumAddress).conflicts('rpc-url')).option('--l1-private-key <string>', 'The L1 private key to use for deployment', PRIVATE_KEY).option('-m, --mnemonic <string>', 'The mnemonic to use in deployment', 'test test test test test test test test test test test junk').requiredOption('--verifier <verifier>', 'Either mock or real', 'real').option('--bb <path>', 'Path to bb binary', BB_BINARY_PATH).option('--bb-working-dir <path>', 'Path to bb working directory', BB_WORKING_DIRECTORY).action(async (options)=>{
|
|
160
|
+
const { deployMockVerifier, deployUltraHonkVerifier } = await import('./deploy_l1_verifier.js');
|
|
161
|
+
if (options.verifier === 'mock') {
|
|
162
|
+
await deployMockVerifier(options.rollupAddress?.toString(), options.l1RpcUrls, options.l1ChainId, options.l1PrivateKey, options.mnemonic, options.rpcUrl, log, debugLogger);
|
|
163
|
+
} else {
|
|
164
|
+
await deployUltraHonkVerifier(options.rollupAddress?.toString(), options.l1RpcUrls, options.l1ChainId, options.l1PrivateKey, options.mnemonic, options.rpcUrl, options.bb, options.bbWorkingDir, log, debugLogger);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
program.command('bridge-erc20').description('Bridges ERC20 tokens to L2.').argument('<amount>', 'The amount of Fee Juice to mint and bridge.', parseBigint).argument('<recipient>', 'Aztec address of the recipient.', parseAztecAddress).addOption(l1RpcUrlsOption).option('-m, --mnemonic <string>', 'The mnemonic to use for deriving the Ethereum address that will mint and bridge', 'test test test test test test test test test test test junk').option('--mint', 'Mint the tokens on L1', false).option('--private', 'If the bridge should use the private flow', false).addOption(l1ChainIdOption).requiredOption('-t, --token <string>', 'The address of the token to bridge', parseEthereumAddress).requiredOption('-p, --portal <string>', 'The address of the portal contract', parseEthereumAddress).option('--l1-private-key <string>', 'The private key to use for deployment', PRIVATE_KEY).option('--json', 'Output the claim in JSON format').action(async (amount, recipient, options)=>{
|
|
168
|
+
const { bridgeERC20 } = await import('./bridge_erc20.js');
|
|
169
|
+
await bridgeERC20(amount, recipient, options.l1RpcUrls, options.l1ChainId, options.l1PrivateKey, options.mnemonic, options.token, options.portal, options.private, options.mint, options.json, log, debugLogger);
|
|
170
|
+
});
|
|
171
|
+
program.command('create-l1-account').option('--json', 'Output the account in JSON format').action(async (options)=>{
|
|
172
|
+
const { createL1Account } = await import('./create_l1_account.js');
|
|
173
|
+
createL1Account(options.json, log);
|
|
174
|
+
});
|
|
175
|
+
program.command('get-l1-balance').description('Gets the balance of an ERC token in L1 for the given Ethereum address.').argument('<who>', 'Ethereum address to check.', parseEthereumAddress).addOption(l1RpcUrlsOption).option('-t, --token <string>', 'The address of the token to check the balance of', parseEthereumAddress).addOption(l1ChainIdOption).option('--json', 'Output the balance in JSON format').action(async (who, options)=>{
|
|
176
|
+
const { getL1Balance } = await import('./get_l1_balance.js');
|
|
177
|
+
await getL1Balance(who, options.token, options.l1RpcUrls, options.l1ChainId, options.json, log);
|
|
178
|
+
});
|
|
179
|
+
program.command('set-proven-through', {
|
|
180
|
+
hidden: true
|
|
181
|
+
}).description('Instructs the L1 rollup contract to assume all blocks until the given number are automatically proven.').argument('[blockNumber]', 'The target block number, defaults to the latest pending block number.', parseBigint).addOption(l1RpcUrlsOption).addOption(pxeOption).action(async (blockNumber, options)=>{
|
|
182
|
+
const { assumeProvenThrough } = await import('./assume_proven_through.js');
|
|
183
|
+
await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.rpcUrl, log);
|
|
184
|
+
});
|
|
185
|
+
program.command('advance-epoch').description('Use L1 cheat codes to warp time until the next epoch.').addOption(l1RpcUrlsOption).addOption(pxeOption).action(async (options)=>{
|
|
186
|
+
const { advanceEpoch } = await import('./advance_epoch.js');
|
|
187
|
+
await advanceEpoch(options.l1RpcUrls, options.rpcUrl, log);
|
|
188
|
+
});
|
|
189
|
+
program.command('prover-stats', {
|
|
190
|
+
hidden: true
|
|
191
|
+
}).addOption(l1RpcUrlsOption).addOption(l1ChainIdOption).option('--start-block <number>', 'The L1 block number to start from', parseBigint, 1n).option('--end-block <number>', 'The last L1 block number to query', parseBigint).option('--batch-size <number>', 'The number of blocks to query in each batch', parseBigint, 100n).option('--proving-timeout <number>', 'Cutoff for proving time to consider a block', parseBigint).option('--l1-rollup-address <string>', 'Address of the rollup contract (required if node URL is not set)').option('--node-url <string>', 'JSON RPC URL of an Aztec node to retrieve the rollup contract address (required if L1 rollup address is not set)').option('--raw-logs', 'Output raw logs instead of aggregated stats').action(async (options)=>{
|
|
192
|
+
const { proverStats } = await import('./prover_stats.js');
|
|
193
|
+
const { l1RpcUrls, chainId, l1RollupAddress, startBlock, endBlock, batchSize, nodeUrl, provingTimeout, rawLogs } = options;
|
|
194
|
+
await proverStats({
|
|
195
|
+
l1RpcUrls,
|
|
196
|
+
chainId,
|
|
197
|
+
l1RollupAddress,
|
|
198
|
+
startBlock,
|
|
199
|
+
endBlock,
|
|
200
|
+
batchSize,
|
|
201
|
+
nodeUrl,
|
|
202
|
+
provingTimeout,
|
|
203
|
+
rawLogs,
|
|
204
|
+
log
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
return program;
|
|
208
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type LogFn } from '@aztec/foundation/log';
|
|
2
|
+
export declare function proverStats(opts: {
|
|
3
|
+
l1RpcUrls: string[];
|
|
4
|
+
chainId: number;
|
|
5
|
+
l1RollupAddress: string | undefined;
|
|
6
|
+
nodeUrl: string | undefined;
|
|
7
|
+
log: LogFn;
|
|
8
|
+
startBlock: bigint;
|
|
9
|
+
endBlock: bigint | undefined;
|
|
10
|
+
batchSize: bigint;
|
|
11
|
+
provingTimeout: bigint | undefined;
|
|
12
|
+
rawLogs: boolean;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=prover_stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prover_stats.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/prover_stats.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAA6B,MAAM,uBAAuB,CAAC;AAQ9E,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,GAAG,EAAE,KAAK,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,OAAO,EAAE,OAAO,CAAC;CAClB,iBAgIA"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { retrieveL2ProofVerifiedEvents } from '@aztec/archiver';
|
|
2
|
+
import { createEthereumChain } from '@aztec/ethereum';
|
|
3
|
+
import { compactArray, mapValues, unique } from '@aztec/foundation/collection';
|
|
4
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
+
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
7
|
+
import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
8
|
+
import chunk from 'lodash.chunk';
|
|
9
|
+
import groupBy from 'lodash.groupby';
|
|
10
|
+
import { createPublicClient, fallback, getAbiItem, getAddress, http } from 'viem';
|
|
11
|
+
export async function proverStats(opts) {
|
|
12
|
+
const debugLog = createLogger('cli:prover_stats');
|
|
13
|
+
const { startBlock, chainId, l1RpcUrls, l1RollupAddress, batchSize, nodeUrl, provingTimeout, endBlock, rawLogs, log } = opts;
|
|
14
|
+
if (!l1RollupAddress && !nodeUrl) {
|
|
15
|
+
throw new Error('Either L1 rollup address or node URL must be set');
|
|
16
|
+
}
|
|
17
|
+
const rollup = l1RollupAddress ? EthAddress.fromString(l1RollupAddress) : await createAztecNodeClient(nodeUrl).getL1ContractAddresses().then((a)=>a.rollupAddress);
|
|
18
|
+
const chain = createEthereumChain(l1RpcUrls, chainId).chainInfo;
|
|
19
|
+
const publicClient = createPublicClient({
|
|
20
|
+
chain,
|
|
21
|
+
transport: fallback(l1RpcUrls.map((url)=>http(url)))
|
|
22
|
+
});
|
|
23
|
+
const lastBlockNum = endBlock ?? await publicClient.getBlockNumber();
|
|
24
|
+
debugLog.verbose(`Querying events on rollup at ${rollup.toString()} from ${startBlock} up to ${lastBlockNum}`);
|
|
25
|
+
// Get all events for L2 proof submissions
|
|
26
|
+
const events = await getL2ProofVerifiedEvents(startBlock, lastBlockNum, batchSize, debugLog, publicClient, rollup);
|
|
27
|
+
// If we only care for raw logs, output them
|
|
28
|
+
if (rawLogs && !provingTimeout) {
|
|
29
|
+
log(`l1_block_number, l2_block_number, prover_id, tx_hash`);
|
|
30
|
+
for (const event of events){
|
|
31
|
+
const { l1BlockNumber, l2BlockNumber, proverId, txHash } = event;
|
|
32
|
+
log(`${l1BlockNumber}, ${l2BlockNumber}, ${proverId}, ${txHash}`);
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
// If we don't have a proving timeout, we can just count the number of unique blocks per prover
|
|
37
|
+
if (!provingTimeout) {
|
|
38
|
+
const stats = groupBy(events, 'proverId');
|
|
39
|
+
log(`prover_id, total_blocks_proven`);
|
|
40
|
+
for(const proverId in stats){
|
|
41
|
+
const uniqueBlocks = new Set(stats[proverId].map((e)=>e.l2BlockNumber));
|
|
42
|
+
log(`${proverId}, ${uniqueBlocks.size}`);
|
|
43
|
+
}
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// But if we do, fetch the events for each block submitted, so we can look up their timestamp
|
|
47
|
+
const blockEvents = await getL2BlockEvents(startBlock, lastBlockNum, batchSize, debugLog, publicClient, rollup);
|
|
48
|
+
debugLog.verbose(`First L2 block within range is ${blockEvents[0]?.args.blockNumber} at L1 block ${blockEvents[0]?.blockNumber}`);
|
|
49
|
+
// Get the timestamps for every block on every log, both for proof and block submissions
|
|
50
|
+
const l1BlockNumbers = unique([
|
|
51
|
+
...events.map((e)=>e.l1BlockNumber),
|
|
52
|
+
...blockEvents.map((e)=>e.blockNumber)
|
|
53
|
+
]);
|
|
54
|
+
const l1BlockTimestamps = {};
|
|
55
|
+
for (const l1Batch of chunk(l1BlockNumbers, Number(batchSize))){
|
|
56
|
+
const blocks = await Promise.all(l1Batch.map((blockNumber)=>publicClient.getBlock({
|
|
57
|
+
includeTransactions: false,
|
|
58
|
+
blockNumber
|
|
59
|
+
})));
|
|
60
|
+
debugLog.verbose(`Queried ${blocks.length} L1 blocks between ${l1Batch[0]} and ${l1Batch[l1Batch.length - 1]}`);
|
|
61
|
+
for (const block of blocks){
|
|
62
|
+
l1BlockTimestamps[block.number.toString()] = block.timestamp;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Map from l2 block number to the l1 block in which it was submitted
|
|
66
|
+
const l2BlockSubmissions = {};
|
|
67
|
+
for (const blockEvent of blockEvents){
|
|
68
|
+
l2BlockSubmissions[blockEvent.args.blockNumber.toString()] = blockEvent.blockNumber;
|
|
69
|
+
}
|
|
70
|
+
// If we want raw logs, output them
|
|
71
|
+
if (rawLogs) {
|
|
72
|
+
log(`l1_block_number, l2_block_number, l2_block_submission_timestamp, proof_timestamp, prover_id, tx_hash`);
|
|
73
|
+
for (const event of events){
|
|
74
|
+
const { l1BlockNumber, l2BlockNumber, proverId, txHash } = event;
|
|
75
|
+
const uploadedBlockNumber = l2BlockSubmissions[l2BlockNumber.toString()];
|
|
76
|
+
if (!uploadedBlockNumber) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
|
|
80
|
+
const provenTimestamp = l1BlockTimestamps[l1BlockNumber.toString()];
|
|
81
|
+
log(`${l1BlockNumber}, ${l2BlockNumber}, ${uploadedTimestamp}, ${provenTimestamp}, ${proverId}, ${txHash}`);
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
// Or calculate stats per prover
|
|
86
|
+
const stats = mapValues(groupBy(events, 'proverId'), (blocks, proverId)=>compactArray(blocks.map((e)=>{
|
|
87
|
+
const provenTimestamp = l1BlockTimestamps[e.l1BlockNumber.toString()];
|
|
88
|
+
const uploadedBlockNumber = l2BlockSubmissions[e.l2BlockNumber.toString()];
|
|
89
|
+
if (!uploadedBlockNumber) {
|
|
90
|
+
debugLog.verbose(`Skipping ${proverId}'s proof for L2 block ${e.l2BlockNumber} as it was before the start block`);
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
const uploadedTimestamp = l1BlockTimestamps[uploadedBlockNumber.toString()];
|
|
94
|
+
const provingTime = provenTimestamp - uploadedTimestamp;
|
|
95
|
+
debugLog.debug(`prover=${e.proverId} blockNumber=${e.l2BlockNumber} uploaded=${uploadedTimestamp} proven=${provenTimestamp} time=${provingTime}`);
|
|
96
|
+
return {
|
|
97
|
+
provenTimestamp,
|
|
98
|
+
uploadedTimestamp,
|
|
99
|
+
provingTime,
|
|
100
|
+
...e
|
|
101
|
+
};
|
|
102
|
+
})));
|
|
103
|
+
log(`prover_id, blocks_proven_within_timeout, total_blocks_proven, avg_proving_time`);
|
|
104
|
+
for(const proverId in stats){
|
|
105
|
+
const blocks = stats[proverId];
|
|
106
|
+
const withinTimeout = blocks.filter((b)=>b.provingTime <= provingTimeout);
|
|
107
|
+
const uniqueBlocksWithinTimeout = new Set(withinTimeout.map((e)=>e.l2BlockNumber));
|
|
108
|
+
const uniqueBlocks = new Set(blocks.map((e)=>e.l2BlockNumber));
|
|
109
|
+
const avgProvingTime = blocks.length === 0 ? 0 : Math.ceil(Number(blocks.reduce((acc, b)=>acc + b.provingTime, 0n)) / blocks.length);
|
|
110
|
+
log(`${proverId}, ${uniqueBlocksWithinTimeout.size}, ${uniqueBlocks.size}, ${avgProvingTime}`);
|
|
111
|
+
}
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
async function getL2ProofVerifiedEvents(startBlock, lastBlockNum, batchSize, debugLog, publicClient, rollup) {
|
|
115
|
+
let blockNum = startBlock;
|
|
116
|
+
const events = [];
|
|
117
|
+
while(blockNum <= lastBlockNum){
|
|
118
|
+
const end = blockNum + batchSize > lastBlockNum + 1n ? lastBlockNum + 1n : blockNum + batchSize;
|
|
119
|
+
const newEvents = await retrieveL2ProofVerifiedEvents(publicClient, rollup, blockNum, end);
|
|
120
|
+
events.push(...newEvents);
|
|
121
|
+
debugLog.verbose(`Got ${newEvents.length} events querying l2 proof verified from block ${blockNum} to ${end}`);
|
|
122
|
+
blockNum += batchSize;
|
|
123
|
+
}
|
|
124
|
+
return events;
|
|
125
|
+
}
|
|
126
|
+
async function getL2BlockEvents(startBlock, lastBlockNum, batchSize, debugLog, publicClient, rollup) {
|
|
127
|
+
let blockNum = startBlock;
|
|
128
|
+
const events = [];
|
|
129
|
+
while(blockNum <= lastBlockNum){
|
|
130
|
+
const end = blockNum + batchSize > lastBlockNum + 1n ? lastBlockNum + 1n : blockNum + batchSize;
|
|
131
|
+
const newEvents = await publicClient.getLogs({
|
|
132
|
+
address: getAddress(rollup.toString()),
|
|
133
|
+
event: getAbiItem({
|
|
134
|
+
abi: RollupAbi,
|
|
135
|
+
name: 'L2BlockProposed'
|
|
136
|
+
}),
|
|
137
|
+
fromBlock: blockNum,
|
|
138
|
+
toBlock: end
|
|
139
|
+
});
|
|
140
|
+
events.push(...newEvents);
|
|
141
|
+
debugLog.verbose(`Got ${newEvents.length} events querying l2 block submitted from block ${blockNum} to ${end}`);
|
|
142
|
+
blockNum += batchSize;
|
|
143
|
+
}
|
|
144
|
+
return events;
|
|
145
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
+
export interface RollupCommandArgs {
|
|
4
|
+
rpcUrls: string[];
|
|
5
|
+
chainId: number;
|
|
6
|
+
privateKey?: string;
|
|
7
|
+
mnemonic?: string;
|
|
8
|
+
rollupAddress: EthAddress;
|
|
9
|
+
withdrawerAddress?: EthAddress;
|
|
10
|
+
}
|
|
11
|
+
export interface LoggerArgs {
|
|
12
|
+
log: LogFn;
|
|
13
|
+
debugLogger: Logger;
|
|
14
|
+
}
|
|
15
|
+
export declare function generateL1Account(): {
|
|
16
|
+
privateKey: `0x${string}`;
|
|
17
|
+
address: `0x${string}`;
|
|
18
|
+
};
|
|
19
|
+
export declare function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, withdrawerAddress, log, debugLogger, }: RollupCommandArgs & LoggerArgs & {
|
|
20
|
+
validatorAddress: EthAddress;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
export declare function removeL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, log, debugLogger, }: RollupCommandArgs & LoggerArgs & {
|
|
23
|
+
validatorAddress: EthAddress;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
export declare function pruneRollup({ rpcUrls, chainId, privateKey, mnemonic, rollupAddress, log, debugLogger, }: RollupCommandArgs & LoggerArgs): Promise<void>;
|
|
26
|
+
export declare function fastForwardEpochs({ rpcUrls, chainId, rollupAddress, numEpochs, log, debugLogger, }: RollupCommandArgs & LoggerArgs & {
|
|
27
|
+
numEpochs: bigint;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
export declare function debugRollup({ rpcUrls, chainId, rollupAddress, log }: RollupCommandArgs & LoggerArgs): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=update_l1_validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update_l1_validators.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/update_l1_validators.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,UAAU,CAAC;IAC1B,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,KAAK,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,iBAAiB;;;EAQhC;AAED,wBAAsB,cAAc,CAAC,EACnC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,gBAAgB,EAAE,UAAU,CAAA;CAAE,iBA+CnE;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,gBAAgB,EAAE,UAAU,CAAA;CAAE,iBAcnE;AAED,wBAAsB,WAAW,CAAC,EAChC,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,iBAchC;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,aAAa,EACb,SAAS,EACT,GAAG,EACH,WAAW,GACZ,EAAE,iBAAiB,GAAG,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,iBAyBxD;AAED,wBAAsB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,iBAAiB,GAAG,UAAU,iBA4BzG"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { EthCheatCodes, createEthereumChain, getExpectedAddress, getL1ContractsConfigEnvVars, isAnvilTestChain } from '@aztec/ethereum';
|
|
2
|
+
import { ForwarderAbi, ForwarderBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
3
|
+
import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
|
|
4
|
+
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
5
|
+
export function generateL1Account() {
|
|
6
|
+
const privateKey = generatePrivateKey();
|
|
7
|
+
const account = privateKeyToAccount(privateKey);
|
|
8
|
+
account.address;
|
|
9
|
+
return {
|
|
10
|
+
privateKey,
|
|
11
|
+
address: account.address
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, withdrawerAddress, log, debugLogger }) {
|
|
15
|
+
const config = getL1ContractsConfigEnvVars();
|
|
16
|
+
const dualLog = makeDualLog(log, debugLogger);
|
|
17
|
+
const publicClient = getPublicClient(rpcUrls, chainId);
|
|
18
|
+
const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
|
|
19
|
+
const rollup = getContract({
|
|
20
|
+
address: rollupAddress.toString(),
|
|
21
|
+
abi: RollupAbi,
|
|
22
|
+
client: walletClient
|
|
23
|
+
});
|
|
24
|
+
const stakingAsset = getContract({
|
|
25
|
+
address: await rollup.read.getStakingAsset(),
|
|
26
|
+
abi: TestERC20Abi,
|
|
27
|
+
client: walletClient
|
|
28
|
+
});
|
|
29
|
+
await Promise.all([
|
|
30
|
+
await stakingAsset.write.mint([
|
|
31
|
+
walletClient.account.address,
|
|
32
|
+
config.minimumStake
|
|
33
|
+
], {}),
|
|
34
|
+
await stakingAsset.write.approve([
|
|
35
|
+
rollupAddress.toString(),
|
|
36
|
+
config.minimumStake
|
|
37
|
+
], {})
|
|
38
|
+
].map((txHash)=>publicClient.waitForTransactionReceipt({
|
|
39
|
+
hash: txHash
|
|
40
|
+
})));
|
|
41
|
+
dualLog(`Adding validator ${validatorAddress.toString()} to rollup ${rollupAddress.toString()}`);
|
|
42
|
+
const txHash = await rollup.write.deposit([
|
|
43
|
+
validatorAddress.toString(),
|
|
44
|
+
// TODO(#11451): custom forwarders
|
|
45
|
+
getExpectedAddress(ForwarderAbi, ForwarderBytecode, [
|
|
46
|
+
validatorAddress.toString()
|
|
47
|
+
], validatorAddress.toString()).address,
|
|
48
|
+
withdrawerAddress?.toString() ?? validatorAddress.toString(),
|
|
49
|
+
config.minimumStake
|
|
50
|
+
]);
|
|
51
|
+
dualLog(`Transaction hash: ${txHash}`);
|
|
52
|
+
await publicClient.waitForTransactionReceipt({
|
|
53
|
+
hash: txHash
|
|
54
|
+
});
|
|
55
|
+
if (isAnvilTestChain(chainId)) {
|
|
56
|
+
dualLog(`Funding validator on L1`);
|
|
57
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
|
|
58
|
+
await cheatCodes.setBalance(validatorAddress, 10n ** 20n);
|
|
59
|
+
} else {
|
|
60
|
+
const balance = await publicClient.getBalance({
|
|
61
|
+
address: validatorAddress.toString()
|
|
62
|
+
});
|
|
63
|
+
const balanceInEth = Number(balance) / 10 ** 18;
|
|
64
|
+
dualLog(`Validator balance: ${balanceInEth.toFixed(6)} ETH`);
|
|
65
|
+
if (balanceInEth === 0) {
|
|
66
|
+
dualLog(`WARNING: Validator has no balance. Remember to fund it!`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export async function removeL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, log, debugLogger }) {
|
|
71
|
+
const dualLog = makeDualLog(log, debugLogger);
|
|
72
|
+
const publicClient = getPublicClient(rpcUrls, chainId);
|
|
73
|
+
const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
|
|
74
|
+
const rollup = getContract({
|
|
75
|
+
address: rollupAddress.toString(),
|
|
76
|
+
abi: RollupAbi,
|
|
77
|
+
client: walletClient
|
|
78
|
+
});
|
|
79
|
+
dualLog(`Removing validator ${validatorAddress.toString()} from rollup ${rollupAddress.toString()}`);
|
|
80
|
+
const txHash = await rollup.write.initiateWithdraw([
|
|
81
|
+
validatorAddress.toString(),
|
|
82
|
+
validatorAddress.toString()
|
|
83
|
+
]);
|
|
84
|
+
dualLog(`Transaction hash: ${txHash}`);
|
|
85
|
+
await publicClient.waitForTransactionReceipt({
|
|
86
|
+
hash: txHash
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export async function pruneRollup({ rpcUrls, chainId, privateKey, mnemonic, rollupAddress, log, debugLogger }) {
|
|
90
|
+
const dualLog = makeDualLog(log, debugLogger);
|
|
91
|
+
const publicClient = getPublicClient(rpcUrls, chainId);
|
|
92
|
+
const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
|
|
93
|
+
const rollup = getContract({
|
|
94
|
+
address: rollupAddress.toString(),
|
|
95
|
+
abi: RollupAbi,
|
|
96
|
+
client: walletClient
|
|
97
|
+
});
|
|
98
|
+
dualLog(`Trying prune`);
|
|
99
|
+
const txHash = await rollup.write.prune();
|
|
100
|
+
dualLog(`Transaction hash: ${txHash}`);
|
|
101
|
+
await publicClient.waitForTransactionReceipt({
|
|
102
|
+
hash: txHash
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export async function fastForwardEpochs({ rpcUrls, chainId, rollupAddress, numEpochs, log, debugLogger }) {
|
|
106
|
+
const dualLog = makeDualLog(log, debugLogger);
|
|
107
|
+
const publicClient = getPublicClient(rpcUrls, chainId);
|
|
108
|
+
const rollup = getContract({
|
|
109
|
+
address: rollupAddress.toString(),
|
|
110
|
+
abi: RollupAbi,
|
|
111
|
+
client: publicClient
|
|
112
|
+
});
|
|
113
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
|
|
114
|
+
const currentSlot = await rollup.read.getCurrentSlot();
|
|
115
|
+
const l2SlotsInEpoch = await rollup.read.getEpochDuration();
|
|
116
|
+
const timestamp = await rollup.read.getTimestampForSlot([
|
|
117
|
+
currentSlot + l2SlotsInEpoch * numEpochs
|
|
118
|
+
]);
|
|
119
|
+
dualLog(`Fast forwarding ${numEpochs} epochs to ${timestamp}`);
|
|
120
|
+
try {
|
|
121
|
+
await cheatCodes.warp(Number(timestamp));
|
|
122
|
+
dualLog(`Fast forwarded ${numEpochs} epochs to ${timestamp}`);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
if (error instanceof Error && error.message.includes("is lower than or equal to previous block's timestamp")) {
|
|
125
|
+
dualLog(`Someone else fast forwarded the chain to a point after/equal to the target time`);
|
|
126
|
+
} else {
|
|
127
|
+
// Re-throw other errors
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }) {
|
|
133
|
+
const config = getL1ContractsConfigEnvVars();
|
|
134
|
+
const publicClient = getPublicClient(rpcUrls, chainId);
|
|
135
|
+
const rollup = getContract({
|
|
136
|
+
address: rollupAddress.toString(),
|
|
137
|
+
abi: RollupAbi,
|
|
138
|
+
client: publicClient
|
|
139
|
+
});
|
|
140
|
+
const pendingNum = await rollup.read.getPendingBlockNumber();
|
|
141
|
+
log(`Pending block num: ${pendingNum}`);
|
|
142
|
+
const provenNum = await rollup.read.getProvenBlockNumber();
|
|
143
|
+
log(`Proven block num: ${provenNum}`);
|
|
144
|
+
const validators = await rollup.read.getAttesters();
|
|
145
|
+
log(`Validators: ${validators.map((v)=>v.toString()).join(', ')}`);
|
|
146
|
+
const committee = await rollup.read.getCurrentEpochCommittee();
|
|
147
|
+
log(`Committee: ${committee.map((v)=>v.toString()).join(', ')}`);
|
|
148
|
+
const archive = await rollup.read.archive();
|
|
149
|
+
log(`Archive: ${archive}`);
|
|
150
|
+
const epochNum = await rollup.read.getCurrentEpoch();
|
|
151
|
+
log(`Current epoch: ${epochNum}`);
|
|
152
|
+
const slot = await rollup.read.getCurrentSlot();
|
|
153
|
+
log(`Current slot: ${slot}`);
|
|
154
|
+
const proposerDuringPrevL1Block = await rollup.read.getCurrentProposer();
|
|
155
|
+
log(`Proposer during previous L1 block: ${proposerDuringPrevL1Block}`);
|
|
156
|
+
const nextBlockTS = BigInt((await publicClient.getBlock()).timestamp + BigInt(config.ethereumSlotDuration));
|
|
157
|
+
const proposer = await rollup.read.getProposerAt([
|
|
158
|
+
nextBlockTS
|
|
159
|
+
]);
|
|
160
|
+
log(`Proposer NOW: ${proposer.toString()}`);
|
|
161
|
+
}
|
|
162
|
+
function makeDualLog(log, debugLogger) {
|
|
163
|
+
return (msg)=>{
|
|
164
|
+
log(msg);
|
|
165
|
+
debugLogger.info(msg);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function getPublicClient(rpcUrls, chainId) {
|
|
169
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
170
|
+
return createPublicClient({
|
|
171
|
+
chain: chain.chainInfo,
|
|
172
|
+
transport: fallback(rpcUrls.map((url)=>http(url)))
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function getWalletClient(rpcUrls, chainId, privateKey, mnemonic) {
|
|
176
|
+
if (!privateKey && !mnemonic) {
|
|
177
|
+
throw new Error('Either privateKey or mnemonic must be provided to create a wallet client');
|
|
178
|
+
}
|
|
179
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
180
|
+
const account = !privateKey ? mnemonicToAccount(mnemonic) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}`);
|
|
181
|
+
return createWalletClient({
|
|
182
|
+
account,
|
|
183
|
+
chain: chain.chainInfo,
|
|
184
|
+
transport: fallback(rpcUrls.map((url)=>http(url)))
|
|
185
|
+
});
|
|
186
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute_selector.d.ts","sourceRoot":"","sources":["../../../src/cmds/misc/compute_selector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,wBAAsB,eAAe,CAAC,iBAAiB,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAG1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example_contracts.d.ts","sourceRoot":"","sources":["../../../src/cmds/misc/example_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,KAAK,iBAOhD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { getExampleContractNames } from '../../utils/aztec.js';
|
|
2
|
+
export async function exampleContracts(log) {
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
+
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
5
|
+
return (await getExampleContractNames()).filter((name)=>name !== 'AvmTest').sort().forEach((name)=>log(name));
|
|
6
|
+
}
|