@aztec/cli 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2 → 0.77.0-testnet-ignition.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dest/cmds/contracts/index.d.ts +4 -0
- package/dest/cmds/contracts/index.d.ts.map +1 -0
- package/dest/cmds/contracts/inspect_contract.d.ts +3 -0
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -0
- package/dest/cmds/contracts/inspect_contract.js +3 -3
- package/dest/cmds/contracts/parse_parameter_struct.d.ts +3 -0
- package/dest/cmds/contracts/parse_parameter_struct.d.ts.map +1 -0
- package/dest/cmds/devnet/bootstrap_network.d.ts +3 -0
- package/dest/cmds/devnet/bootstrap_network.d.ts.map +1 -0
- package/dest/cmds/devnet/bootstrap_network.js +13 -10
- package/dest/cmds/devnet/faucet.d.ts +4 -0
- package/dest/cmds/devnet/faucet.d.ts.map +1 -0
- package/dest/cmds/devnet/index.d.ts +4 -0
- package/dest/cmds/devnet/index.d.ts.map +1 -0
- package/dest/cmds/devnet/index.js +5 -3
- package/dest/cmds/infrastructure/index.d.ts +4 -0
- package/dest/cmds/infrastructure/index.d.ts.map +1 -0
- package/dest/cmds/infrastructure/index.js +8 -6
- package/dest/cmds/infrastructure/sequencers.d.ts +13 -0
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -0
- package/dest/cmds/infrastructure/sequencers.js +5 -5
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +3 -0
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -0
- package/dest/cmds/infrastructure/setup_l2_contract.js +43 -0
- package/dest/cmds/l1/advance_epoch.d.ts +3 -0
- package/dest/cmds/l1/advance_epoch.d.ts.map +1 -0
- package/dest/cmds/l1/advance_epoch.js +3 -3
- package/dest/cmds/l1/assume_proven_through.d.ts +3 -0
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -0
- package/dest/cmds/l1/assume_proven_through.js +8 -8
- package/dest/cmds/l1/bridge_erc20.d.ts +4 -0
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -0
- package/dest/cmds/l1/bridge_erc20.js +3 -3
- package/dest/cmds/l1/create_l1_account.d.ts +3 -0
- package/dest/cmds/l1/create_l1_account.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +4 -0
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_l1_contracts.js +7 -3
- package/dest/cmds/l1/deploy_l1_verifier.d.ts +5 -0
- package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_l1_verifier.js +4 -4
- package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -0
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_new_rollup.js +19 -0
- package/dest/cmds/l1/get_l1_addresses.d.ts +4 -0
- package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -0
- package/dest/cmds/l1/get_l1_addresses.js +18 -0
- package/dest/cmds/l1/get_l1_balance.d.ts +4 -0
- package/dest/cmds/l1/get_l1_balance.d.ts.map +1 -0
- package/dest/cmds/l1/get_l1_balance.js +4 -4
- package/dest/cmds/l1/governance_utils.d.ts +50 -0
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -0
- package/dest/cmds/l1/governance_utils.js +85 -0
- package/dest/cmds/l1/index.d.ts +4 -0
- package/dest/cmds/l1/index.d.ts.map +1 -0
- package/dest/cmds/l1/index.js +108 -27
- package/dest/cmds/l1/prover_stats.d.ts +14 -0
- package/dest/cmds/l1/prover_stats.d.ts.map +1 -0
- package/dest/cmds/l1/prover_stats.js +6 -6
- package/dest/cmds/l1/update_l1_validators.d.ts +30 -0
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -0
- package/dest/cmds/l1/update_l1_validators.js +22 -22
- package/dest/cmds/misc/compute_selector.d.ts +3 -0
- package/dest/cmds/misc/compute_selector.d.ts.map +1 -0
- package/dest/cmds/misc/compute_selector.js +1 -1
- package/dest/cmds/misc/example_contracts.d.ts +3 -0
- package/dest/cmds/misc/example_contracts.d.ts.map +1 -0
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +3 -0
- package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -0
- package/dest/cmds/misc/generate_bootnode_enr.js +5 -0
- package/dest/cmds/misc/generate_p2p_private_key.d.ts +3 -0
- package/dest/cmds/misc/generate_p2p_private_key.d.ts.map +1 -0
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +3 -0
- package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -0
- package/dest/cmds/misc/generate_secret_key.d.ts +5 -0
- package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -0
- package/dest/cmds/misc/index.d.ts +4 -0
- package/dest/cmds/misc/index.d.ts.map +1 -0
- package/dest/cmds/misc/index.js +9 -1
- package/dest/cmds/misc/setup_contracts.d.ts +7 -0
- package/dest/cmds/misc/setup_contracts.d.ts.map +1 -0
- package/dest/cmds/misc/setup_contracts.js +5 -3
- package/dest/cmds/misc/update/common.d.ts +17 -0
- package/dest/cmds/misc/update/common.d.ts.map +1 -0
- package/dest/cmds/misc/update/github.d.ts +4 -0
- package/dest/cmds/misc/update/github.d.ts.map +1 -0
- package/dest/cmds/misc/update/noir.d.ts +10 -0
- package/dest/cmds/misc/update/noir.d.ts.map +1 -0
- package/dest/cmds/misc/update/npm.d.ts +34 -0
- package/dest/cmds/misc/update/npm.d.ts.map +1 -0
- package/dest/cmds/misc/update/utils.d.ts +14 -0
- package/dest/cmds/misc/update/utils.d.ts.map +1 -0
- package/dest/cmds/misc/update.d.ts +3 -0
- package/dest/cmds/misc/update.d.ts.map +1 -0
- package/dest/cmds/pxe/add_contract.d.ts +5 -0
- package/dest/cmds/pxe/add_contract.d.ts.map +1 -0
- package/dest/cmds/pxe/add_contract.js +6 -4
- package/dest/cmds/pxe/block_number.d.ts +3 -0
- package/dest/cmds/pxe/block_number.d.ts.map +1 -0
- package/dest/cmds/pxe/get_account.d.ts +4 -0
- package/dest/cmds/pxe/get_account.d.ts.map +1 -0
- package/dest/cmds/pxe/get_accounts.d.ts +3 -0
- package/dest/cmds/pxe/get_accounts.d.ts.map +1 -0
- package/dest/cmds/pxe/get_block.d.ts +3 -0
- package/dest/cmds/pxe/get_block.d.ts.map +1 -0
- package/dest/cmds/pxe/get_contract_data.d.ts +4 -0
- package/dest/cmds/pxe/get_contract_data.d.ts.map +1 -0
- package/dest/cmds/pxe/get_contract_data.js +1 -1
- package/dest/cmds/pxe/get_current_base_fee.d.ts +3 -0
- package/dest/cmds/pxe/get_current_base_fee.d.ts.map +1 -0
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +4 -0
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/pxe/get_logs.d.ts +4 -0
- package/dest/cmds/pxe/get_logs.d.ts.map +1 -0
- package/dest/cmds/pxe/get_node_info.d.ts +3 -0
- package/dest/cmds/pxe/get_node_info.d.ts.map +1 -0
- package/dest/cmds/pxe/get_node_info.js +2 -2
- package/dest/cmds/pxe/get_pxe_info.d.ts +3 -0
- package/dest/cmds/pxe/get_pxe_info.d.ts.map +1 -0
- package/dest/cmds/pxe/index.d.ts +4 -0
- package/dest/cmds/pxe/index.d.ts.map +1 -0
- package/dest/cmds/pxe/index.js +1 -1
- package/dest/utils/aztec.d.ts +68 -0
- package/dest/utils/aztec.d.ts.map +1 -0
- package/dest/utils/aztec.js +34 -23
- package/dest/utils/commands.d.ts +143 -0
- package/dest/utils/commands.d.ts.map +1 -0
- package/dest/utils/commands.js +2 -2
- package/dest/utils/encoding.d.ts +15 -0
- package/dest/utils/encoding.d.ts.map +1 -0
- package/dest/utils/encoding.js +6 -13
- package/dest/utils/github.d.ts +4 -0
- package/dest/utils/github.d.ts.map +1 -0
- package/dest/utils/index.d.ts +5 -0
- package/dest/utils/index.d.ts.map +1 -0
- package/dest/utils/inspect.d.ts +17 -0
- package/dest/utils/inspect.d.ts.map +1 -0
- package/dest/utils/inspect.js +4 -4
- package/package.json +21 -20
- package/src/cmds/contracts/index.ts +2 -2
- package/src/cmds/contracts/inspect_contract.ts +5 -5
- package/src/cmds/contracts/parse_parameter_struct.ts +2 -2
- package/src/cmds/devnet/bootstrap_network.ts +24 -12
- package/src/cmds/devnet/faucet.ts +2 -2
- package/src/cmds/devnet/index.ts +16 -8
- package/src/cmds/infrastructure/index.ts +12 -11
- package/src/cmds/infrastructure/sequencers.ts +10 -7
- package/src/cmds/infrastructure/setup_l2_contract.ts +47 -0
- package/src/cmds/l1/advance_epoch.ts +4 -4
- package/src/cmds/l1/assume_proven_through.ts +8 -14
- package/src/cmds/l1/bridge_erc20.ts +5 -6
- package/src/cmds/l1/create_l1_account.ts +1 -1
- package/src/cmds/l1/deploy_l1_contracts.ts +13 -5
- package/src/cmds/l1/deploy_l1_verifier.ts +7 -7
- package/src/cmds/l1/deploy_new_rollup.ts +58 -0
- package/src/cmds/l1/get_l1_addresses.ts +30 -0
- package/src/cmds/l1/get_l1_balance.ts +9 -6
- package/src/cmds/l1/governance_utils.ts +187 -0
- package/src/cmds/l1/index.ts +238 -97
- package/src/cmds/l1/prover_stats.ts +21 -11
- package/src/cmds/l1/update_l1_validators.ts +25 -25
- package/src/cmds/misc/compute_selector.ts +2 -2
- package/src/cmds/misc/example_contracts.ts +1 -1
- package/src/cmds/misc/generate_bootnode_enr.ts +12 -0
- package/src/cmds/misc/generate_p2p_private_key.ts +1 -1
- package/src/cmds/misc/generate_secret_and_hash.ts +1 -1
- package/src/cmds/misc/index.ts +25 -3
- package/src/cmds/misc/setup_contracts.ts +6 -4
- package/src/cmds/misc/update/noir.ts +2 -2
- package/src/cmds/misc/update/npm.ts +2 -2
- package/src/cmds/misc/update/utils.ts +1 -1
- package/src/cmds/misc/update.ts +2 -2
- package/src/cmds/pxe/add_contract.ts +7 -5
- package/src/cmds/pxe/block_number.ts +1 -1
- package/src/cmds/pxe/get_account.ts +2 -2
- package/src/cmds/pxe/get_accounts.ts +1 -1
- package/src/cmds/pxe/get_block.ts +1 -1
- package/src/cmds/pxe/get_contract_data.ts +5 -3
- package/src/cmds/pxe/get_current_base_fee.ts +1 -1
- package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +1 -1
- package/src/cmds/pxe/get_logs.ts +2 -2
- package/src/cmds/pxe/get_node_info.ts +3 -3
- package/src/cmds/pxe/get_pxe_info.ts +1 -1
- package/src/cmds/pxe/index.ts +3 -3
- package/src/utils/aztec.ts +74 -44
- package/src/utils/commands.ts +4 -4
- package/src/utils/encoding.ts +7 -13
- package/src/utils/inspect.ts +8 -7
- package/dest/cmds/infrastructure/setup_protocol_contract.js +0 -31
- package/src/cmds/infrastructure/setup_protocol_contract.ts +0 -36
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governance_utils.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/governance_utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAsB,uBAAuB,CAAC,EAC5C,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,SAAS,EACT,MAAM,EACN,WAAW,EACX,IAAI,GACL,EAAE;IACD,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,KAAK,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,iBA0BA;AAED,wBAAsB,eAAe,CAAC,EACpC,cAAc,EACd,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,WAAW,EACX,GAAG,GACJ,EAAE;IACD,cAAc,EAAE,KAAK,MAAM,EAAE,CAAC;IAC9B,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,KAAK,CAAC;IACX,IAAI,EAAE,OAAO,CAAC;CACf,iBAoBA;AAED,wBAAsB,wBAAwB,CAAC,EAC7C,UAAU,EACV,UAAU,EACV,OAAO,EACP,aAAa,EACb,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,WAAW,GACZ,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,iBAmBA;AAED,wBAAsB,yBAAyB,CAAC,EAC9C,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,WAAW,GACZ,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,iBAiBA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { FeeJuiceContract, GovernanceContract, ProposalState, RegistryContract, createEthereumChain, createL1Clients } from '@aztec/ethereum';
|
|
2
|
+
export async function depositGovernanceTokens({ registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, recipient, amount, debugLogger, mint }) {
|
|
3
|
+
debugLogger.info(`Depositing ${amount} governance tokens to ${recipient}`);
|
|
4
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
5
|
+
const { publicClient, walletClient } = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
|
|
6
|
+
const addresses = await RegistryContract.collectAddresses(publicClient, registryAddress, 'canonical');
|
|
7
|
+
const governanceAddress = addresses.governanceAddress.toString();
|
|
8
|
+
const tokenAddress = addresses.feeJuiceAddress.toString();
|
|
9
|
+
const feeJuice = new FeeJuiceContract(tokenAddress, publicClient, walletClient);
|
|
10
|
+
const governance = new GovernanceContract(governanceAddress, publicClient, walletClient);
|
|
11
|
+
if (mint) {
|
|
12
|
+
await feeJuice.mint(recipient, amount);
|
|
13
|
+
debugLogger.info(`Minted ${amount} tokens to ${recipient}`);
|
|
14
|
+
}
|
|
15
|
+
await feeJuice.approve(governanceAddress, amount);
|
|
16
|
+
debugLogger.info(`Approved ${amount} tokens for governance`);
|
|
17
|
+
await governance.deposit(recipient, amount);
|
|
18
|
+
debugLogger.info(`Deposited ${amount} tokens to ${recipient}`);
|
|
19
|
+
}
|
|
20
|
+
export async function proposeWithLock({ payloadAddress, registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, json, debugLogger, log }) {
|
|
21
|
+
debugLogger.info(`Proposing with lock from ${payloadAddress} to ${registryAddress}`);
|
|
22
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
23
|
+
const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
|
|
24
|
+
const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
|
|
25
|
+
const governanceAddress = addresses.governanceAddress.toString();
|
|
26
|
+
const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
|
|
27
|
+
const proposalId = await governance.proposeWithLock({
|
|
28
|
+
payloadAddress,
|
|
29
|
+
withdrawAddress: clients.walletClient.account.address
|
|
30
|
+
});
|
|
31
|
+
if (json) {
|
|
32
|
+
log(JSON.stringify({
|
|
33
|
+
proposalId
|
|
34
|
+
}, null, 2));
|
|
35
|
+
} else {
|
|
36
|
+
log(`Proposed with lock`);
|
|
37
|
+
log(`Proposal ID: ${proposalId}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export async function voteOnGovernanceProposal({ proposalId, voteAmount, inFavor, waitTilActive, registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, debugLogger }) {
|
|
41
|
+
debugLogger.info(`Voting on proposal ${proposalId} with ${voteAmount ? voteAmount : 'all'} tokens in favor: ${inFavor}`);
|
|
42
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
43
|
+
const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
|
|
44
|
+
const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
|
|
45
|
+
const governanceAddress = addresses.governanceAddress.toString();
|
|
46
|
+
const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
|
|
47
|
+
const state = await governance.getProposalState(proposalId);
|
|
48
|
+
if (state !== ProposalState.Active && !waitTilActive) {
|
|
49
|
+
debugLogger.warn(`Proposal is not active, but waitTilActive is false. Not voting.`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
await governance.awaitProposalActive({
|
|
53
|
+
proposalId,
|
|
54
|
+
logger: debugLogger
|
|
55
|
+
});
|
|
56
|
+
await governance.vote({
|
|
57
|
+
proposalId,
|
|
58
|
+
voteAmount,
|
|
59
|
+
inFavor,
|
|
60
|
+
retries: 10,
|
|
61
|
+
logger: debugLogger
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export async function executeGovernanceProposal({ proposalId, waitTilExecutable, registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, debugLogger }) {
|
|
65
|
+
debugLogger.info(`Executing proposal ${proposalId}`);
|
|
66
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
67
|
+
const clients = createL1Clients(rpcUrls, privateKey ?? mnemonic, chain.chainInfo, mnemonicIndex);
|
|
68
|
+
const addresses = await RegistryContract.collectAddresses(clients.publicClient, registryAddress, 'canonical');
|
|
69
|
+
const governanceAddress = addresses.governanceAddress.toString();
|
|
70
|
+
const governance = new GovernanceContract(governanceAddress, clients.publicClient, clients.walletClient);
|
|
71
|
+
const state = await governance.getProposalState(proposalId);
|
|
72
|
+
if (state !== ProposalState.Executable && !waitTilExecutable) {
|
|
73
|
+
debugLogger.warn(`Proposal is not executable, but waitTilExecutable is false. Not executing.`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
await governance.awaitProposalExecutable({
|
|
77
|
+
proposalId,
|
|
78
|
+
logger: debugLogger
|
|
79
|
+
});
|
|
80
|
+
await governance.executeProposal({
|
|
81
|
+
proposalId,
|
|
82
|
+
retries: 10,
|
|
83
|
+
logger: debugLogger
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAsBjD,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,WAkhB/E"}
|
package/dest/cmds/l1/index.js
CHANGED
|
@@ -1,22 +1,103 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import { Option } from 'commander';
|
|
3
|
-
import {
|
|
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()));
|
|
4
7
|
export function injectCommands(program, log, debugLogger) {
|
|
5
8
|
const { BB_BINARY_PATH, BB_WORKING_DIRECTORY } = process.env;
|
|
6
|
-
program.command('deploy-l1-contracts').description('Deploys all necessary Ethereum contracts for Aztec.').
|
|
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)=>{
|
|
7
10
|
const { deployL1Contracts } = await import('./deploy_l1_contracts.js');
|
|
8
11
|
const initialValidators = options.validators?.split(',').map((validator)=>EthAddress.fromString(validator)) || [];
|
|
9
|
-
await deployL1Contracts(options.
|
|
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);
|
|
10
91
|
});
|
|
11
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 ()=>{
|
|
12
93
|
const { generateL1Account } = await import('./update_l1_validators.js');
|
|
13
94
|
const account = generateL1Account();
|
|
14
95
|
log(JSON.stringify(account, null, 2));
|
|
15
96
|
});
|
|
16
|
-
program.command('add-l1-validator').description('Adds a validator to the L1 rollup contract.').
|
|
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)=>{
|
|
17
98
|
const { addL1Validator } = await import('./update_l1_validators.js');
|
|
18
99
|
await addL1Validator({
|
|
19
|
-
|
|
100
|
+
rpcUrls: options.l1RpcUrls,
|
|
20
101
|
chainId: options.l1ChainId,
|
|
21
102
|
privateKey: options.privateKey,
|
|
22
103
|
mnemonic: options.mnemonic,
|
|
@@ -27,10 +108,10 @@ export function injectCommands(program, log, debugLogger) {
|
|
|
27
108
|
debugLogger
|
|
28
109
|
});
|
|
29
110
|
});
|
|
30
|
-
program.command('remove-l1-validator').description('Removes a validator to the L1 rollup contract.').
|
|
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)=>{
|
|
31
112
|
const { removeL1Validator } = await import('./update_l1_validators.js');
|
|
32
113
|
await removeL1Validator({
|
|
33
|
-
|
|
114
|
+
rpcUrls: options.l1RpcUrls,
|
|
34
115
|
chainId: options.l1ChainId,
|
|
35
116
|
privateKey: options.privateKey,
|
|
36
117
|
mnemonic: options.mnemonic,
|
|
@@ -40,10 +121,10 @@ export function injectCommands(program, log, debugLogger) {
|
|
|
40
121
|
debugLogger
|
|
41
122
|
});
|
|
42
123
|
});
|
|
43
|
-
program.command('fast-forward-epochs').description('Fast forwards the epoch of the L1 rollup contract.').
|
|
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)=>{
|
|
44
125
|
const { fastForwardEpochs } = await import('./update_l1_validators.js');
|
|
45
126
|
await fastForwardEpochs({
|
|
46
|
-
|
|
127
|
+
rpcUrls: options.l1RpcUrls,
|
|
47
128
|
chainId: options.l1ChainId,
|
|
48
129
|
rollupAddress: options.rollup,
|
|
49
130
|
numEpochs: options.count,
|
|
@@ -51,10 +132,10 @@ export function injectCommands(program, log, debugLogger) {
|
|
|
51
132
|
debugLogger
|
|
52
133
|
});
|
|
53
134
|
});
|
|
54
|
-
program.command('debug-rollup').description('Debugs the rollup contract.').
|
|
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)=>{
|
|
55
136
|
const { debugRollup } = await import('./update_l1_validators.js');
|
|
56
137
|
await debugRollup({
|
|
57
|
-
|
|
138
|
+
rpcUrls: options.l1RpcUrls,
|
|
58
139
|
chainId: options.l1ChainId,
|
|
59
140
|
privateKey: options.privateKey,
|
|
60
141
|
mnemonic: options.mnemonic,
|
|
@@ -63,10 +144,10 @@ export function injectCommands(program, log, debugLogger) {
|
|
|
63
144
|
debugLogger
|
|
64
145
|
});
|
|
65
146
|
});
|
|
66
|
-
program.command('prune-rollup').description('Prunes the pending chain on the rollup contract.').
|
|
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)=>{
|
|
67
148
|
const { pruneRollup } = await import('./update_l1_validators.js');
|
|
68
149
|
await pruneRollup({
|
|
69
|
-
|
|
150
|
+
rpcUrls: options.rpcUrls,
|
|
70
151
|
chainId: options.l1ChainId,
|
|
71
152
|
privateKey: options.privateKey,
|
|
72
153
|
mnemonic: options.mnemonic,
|
|
@@ -75,43 +156,43 @@ export function injectCommands(program, log, debugLogger) {
|
|
|
75
156
|
debugLogger
|
|
76
157
|
});
|
|
77
158
|
});
|
|
78
|
-
program.command('deploy-l1-verifier').description('Deploys the rollup verifier contract').
|
|
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)=>{
|
|
79
160
|
const { deployMockVerifier, deployUltraHonkVerifier } = await import('./deploy_l1_verifier.js');
|
|
80
161
|
if (options.verifier === 'mock') {
|
|
81
|
-
await deployMockVerifier(options.rollupAddress?.toString(), options.
|
|
162
|
+
await deployMockVerifier(options.rollupAddress?.toString(), options.l1RpcUrls, options.l1ChainId, options.l1PrivateKey, options.mnemonic, options.rpcUrl, log, debugLogger);
|
|
82
163
|
} else {
|
|
83
|
-
await deployUltraHonkVerifier(options.rollupAddress?.toString(), options.
|
|
164
|
+
await deployUltraHonkVerifier(options.rollupAddress?.toString(), options.l1RpcUrls, options.l1ChainId, options.l1PrivateKey, options.mnemonic, options.rpcUrl, options.bb, options.bbWorkingDir, log, debugLogger);
|
|
84
165
|
}
|
|
85
166
|
});
|
|
86
|
-
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).
|
|
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)=>{
|
|
87
168
|
const { bridgeERC20 } = await import('./bridge_erc20.js');
|
|
88
|
-
await bridgeERC20(amount, recipient, options.
|
|
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);
|
|
89
170
|
});
|
|
90
171
|
program.command('create-l1-account').option('--json', 'Output the account in JSON format').action(async (options)=>{
|
|
91
172
|
const { createL1Account } = await import('./create_l1_account.js');
|
|
92
173
|
createL1Account(options.json, log);
|
|
93
174
|
});
|
|
94
|
-
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).
|
|
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)=>{
|
|
95
176
|
const { getL1Balance } = await import('./get_l1_balance.js');
|
|
96
|
-
await getL1Balance(who, options.token, options.
|
|
177
|
+
await getL1Balance(who, options.token, options.l1RpcUrls, options.l1ChainId, options.json, log);
|
|
97
178
|
});
|
|
98
179
|
program.command('set-proven-through', {
|
|
99
180
|
hidden: true
|
|
100
|
-
}).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).
|
|
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)=>{
|
|
101
182
|
const { assumeProvenThrough } = await import('./assume_proven_through.js');
|
|
102
|
-
await assumeProvenThrough(blockNumber, options.
|
|
183
|
+
await assumeProvenThrough(blockNumber, options.l1RpcUrls, options.rpcUrl, log);
|
|
103
184
|
});
|
|
104
|
-
program.command('advance-epoch').description('Use L1 cheat codes to warp time until the next epoch.').
|
|
185
|
+
program.command('advance-epoch').description('Use L1 cheat codes to warp time until the next epoch.').addOption(l1RpcUrlsOption).addOption(pxeOption).action(async (options)=>{
|
|
105
186
|
const { advanceEpoch } = await import('./advance_epoch.js');
|
|
106
|
-
await advanceEpoch(options.
|
|
187
|
+
await advanceEpoch(options.l1RpcUrls, options.rpcUrl, log);
|
|
107
188
|
});
|
|
108
189
|
program.command('prover-stats', {
|
|
109
190
|
hidden: true
|
|
110
|
-
}).
|
|
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)=>{
|
|
111
192
|
const { proverStats } = await import('./prover_stats.js');
|
|
112
|
-
const {
|
|
193
|
+
const { l1RpcUrls, chainId, l1RollupAddress, startBlock, endBlock, batchSize, nodeUrl, provingTimeout, rawLogs } = options;
|
|
113
194
|
await proverStats({
|
|
114
|
-
|
|
195
|
+
l1RpcUrls,
|
|
115
196
|
chainId,
|
|
116
197
|
l1RollupAddress,
|
|
117
198
|
startBlock,
|
|
@@ -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"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { retrieveL2ProofVerifiedEvents } from '@aztec/archiver';
|
|
2
|
-
import { createAztecNodeClient } from '@aztec/circuit-types';
|
|
3
|
-
import { EthAddress } from '@aztec/circuits.js';
|
|
4
2
|
import { createEthereumChain } from '@aztec/ethereum';
|
|
5
3
|
import { compactArray, mapValues, unique } from '@aztec/foundation/collection';
|
|
4
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
7
6
|
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
7
|
+
import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
8
8
|
import chunk from 'lodash.chunk';
|
|
9
9
|
import groupBy from 'lodash.groupby';
|
|
10
|
-
import { createPublicClient, getAbiItem, getAddress, http } from 'viem';
|
|
10
|
+
import { createPublicClient, fallback, getAbiItem, getAddress, http } from 'viem';
|
|
11
11
|
export async function proverStats(opts) {
|
|
12
12
|
const debugLog = createLogger('cli:prover_stats');
|
|
13
|
-
const { startBlock, chainId,
|
|
13
|
+
const { startBlock, chainId, l1RpcUrls, l1RollupAddress, batchSize, nodeUrl, provingTimeout, endBlock, rawLogs, log } = opts;
|
|
14
14
|
if (!l1RollupAddress && !nodeUrl) {
|
|
15
15
|
throw new Error('Either L1 rollup address or node URL must be set');
|
|
16
16
|
}
|
|
17
17
|
const rollup = l1RollupAddress ? EthAddress.fromString(l1RollupAddress) : await createAztecNodeClient(nodeUrl).getL1ContractAddresses().then((a)=>a.rollupAddress);
|
|
18
|
-
const chain = createEthereumChain(
|
|
18
|
+
const chain = createEthereumChain(l1RpcUrls, chainId).chainInfo;
|
|
19
19
|
const publicClient = createPublicClient({
|
|
20
20
|
chain,
|
|
21
|
-
transport: http(
|
|
21
|
+
transport: fallback(l1RpcUrls.map((url)=>http(url)))
|
|
22
22
|
});
|
|
23
23
|
const lastBlockNum = endBlock ?? await publicClient.getBlockNumber();
|
|
24
24
|
debugLog.verbose(`Querying events on rollup at ${rollup.toString()} from ${startBlock} up to ${lastBlockNum}`);
|
|
@@ -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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EthCheatCodes, createEthereumChain, getExpectedAddress, getL1ContractsConfigEnvVars, isAnvilTestChain } from '@aztec/ethereum';
|
|
2
2
|
import { ForwarderAbi, ForwarderBytecode, RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
3
|
-
import { createPublicClient, createWalletClient, getContract, http } from 'viem';
|
|
3
|
+
import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
|
|
4
4
|
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
5
5
|
export function generateL1Account() {
|
|
6
6
|
const privateKey = generatePrivateKey();
|
|
@@ -11,11 +11,11 @@ export function generateL1Account() {
|
|
|
11
11
|
address: account.address
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
export async function addL1Validator({
|
|
14
|
+
export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, withdrawerAddress, log, debugLogger }) {
|
|
15
15
|
const config = getL1ContractsConfigEnvVars();
|
|
16
16
|
const dualLog = makeDualLog(log, debugLogger);
|
|
17
|
-
const publicClient = getPublicClient(
|
|
18
|
-
const walletClient = getWalletClient(
|
|
17
|
+
const publicClient = getPublicClient(rpcUrls, chainId);
|
|
18
|
+
const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
|
|
19
19
|
const rollup = getContract({
|
|
20
20
|
address: rollupAddress.toString(),
|
|
21
21
|
abi: RollupAbi,
|
|
@@ -54,7 +54,7 @@ export async function addL1Validator({ rpcUrl, chainId, privateKey, mnemonic, va
|
|
|
54
54
|
});
|
|
55
55
|
if (isAnvilTestChain(chainId)) {
|
|
56
56
|
dualLog(`Funding validator on L1`);
|
|
57
|
-
const cheatCodes = new EthCheatCodes(
|
|
57
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
|
|
58
58
|
await cheatCodes.setBalance(validatorAddress, 10n ** 20n);
|
|
59
59
|
} else {
|
|
60
60
|
const balance = await publicClient.getBalance({
|
|
@@ -67,10 +67,10 @@ export async function addL1Validator({ rpcUrl, chainId, privateKey, mnemonic, va
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
export async function removeL1Validator({
|
|
70
|
+
export async function removeL1Validator({ rpcUrls, chainId, privateKey, mnemonic, validatorAddress, rollupAddress, log, debugLogger }) {
|
|
71
71
|
const dualLog = makeDualLog(log, debugLogger);
|
|
72
|
-
const publicClient = getPublicClient(
|
|
73
|
-
const walletClient = getWalletClient(
|
|
72
|
+
const publicClient = getPublicClient(rpcUrls, chainId);
|
|
73
|
+
const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
|
|
74
74
|
const rollup = getContract({
|
|
75
75
|
address: rollupAddress.toString(),
|
|
76
76
|
abi: RollupAbi,
|
|
@@ -86,10 +86,10 @@ export async function removeL1Validator({ rpcUrl, chainId, privateKey, mnemonic,
|
|
|
86
86
|
hash: txHash
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
export async function pruneRollup({
|
|
89
|
+
export async function pruneRollup({ rpcUrls, chainId, privateKey, mnemonic, rollupAddress, log, debugLogger }) {
|
|
90
90
|
const dualLog = makeDualLog(log, debugLogger);
|
|
91
|
-
const publicClient = getPublicClient(
|
|
92
|
-
const walletClient = getWalletClient(
|
|
91
|
+
const publicClient = getPublicClient(rpcUrls, chainId);
|
|
92
|
+
const walletClient = getWalletClient(rpcUrls, chainId, privateKey, mnemonic);
|
|
93
93
|
const rollup = getContract({
|
|
94
94
|
address: rollupAddress.toString(),
|
|
95
95
|
abi: RollupAbi,
|
|
@@ -102,15 +102,15 @@ export async function pruneRollup({ rpcUrl, chainId, privateKey, mnemonic, rollu
|
|
|
102
102
|
hash: txHash
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
export async function fastForwardEpochs({
|
|
105
|
+
export async function fastForwardEpochs({ rpcUrls, chainId, rollupAddress, numEpochs, log, debugLogger }) {
|
|
106
106
|
const dualLog = makeDualLog(log, debugLogger);
|
|
107
|
-
const publicClient = getPublicClient(
|
|
107
|
+
const publicClient = getPublicClient(rpcUrls, chainId);
|
|
108
108
|
const rollup = getContract({
|
|
109
109
|
address: rollupAddress.toString(),
|
|
110
110
|
abi: RollupAbi,
|
|
111
111
|
client: publicClient
|
|
112
112
|
});
|
|
113
|
-
const cheatCodes = new EthCheatCodes(
|
|
113
|
+
const cheatCodes = new EthCheatCodes(rpcUrls, debugLogger);
|
|
114
114
|
const currentSlot = await rollup.read.getCurrentSlot();
|
|
115
115
|
const l2SlotsInEpoch = await rollup.read.getEpochDuration();
|
|
116
116
|
const timestamp = await rollup.read.getTimestampForSlot([
|
|
@@ -129,9 +129,9 @@ export async function fastForwardEpochs({ rpcUrl, chainId, rollupAddress, numEpo
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
export async function debugRollup({
|
|
132
|
+
export async function debugRollup({ rpcUrls, chainId, rollupAddress, log }) {
|
|
133
133
|
const config = getL1ContractsConfigEnvVars();
|
|
134
|
-
const publicClient = getPublicClient(
|
|
134
|
+
const publicClient = getPublicClient(rpcUrls, chainId);
|
|
135
135
|
const rollup = getContract({
|
|
136
136
|
address: rollupAddress.toString(),
|
|
137
137
|
abi: RollupAbi,
|
|
@@ -165,22 +165,22 @@ function makeDualLog(log, debugLogger) {
|
|
|
165
165
|
debugLogger.info(msg);
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
-
function getPublicClient(
|
|
169
|
-
const chain = createEthereumChain(
|
|
168
|
+
function getPublicClient(rpcUrls, chainId) {
|
|
169
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
170
170
|
return createPublicClient({
|
|
171
171
|
chain: chain.chainInfo,
|
|
172
|
-
transport: http(
|
|
172
|
+
transport: fallback(rpcUrls.map((url)=>http(url)))
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
-
function getWalletClient(
|
|
175
|
+
function getWalletClient(rpcUrls, chainId, privateKey, mnemonic) {
|
|
176
176
|
if (!privateKey && !mnemonic) {
|
|
177
177
|
throw new Error('Either privateKey or mnemonic must be provided to create a wallet client');
|
|
178
178
|
}
|
|
179
|
-
const chain = createEthereumChain(
|
|
179
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
180
180
|
const account = !privateKey ? mnemonicToAccount(mnemonic) : privateKeyToAccount(`${privateKey.startsWith('0x') ? '' : '0x'}${privateKey}`);
|
|
181
181
|
return createWalletClient({
|
|
182
182
|
account,
|
|
183
183
|
chain: chain.chainInfo,
|
|
184
|
-
transport: http(
|
|
184
|
+
transport: fallback(rpcUrls.map((url)=>http(url)))
|
|
185
185
|
});
|
|
186
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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionSelector } from '@aztec/
|
|
1
|
+
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
2
2
|
export async function computeSelector(functionSignature, log) {
|
|
3
3
|
const selector = await FunctionSelector.fromSignature(functionSignature);
|
|
4
4
|
log(`${selector}`);
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"generate_bootnode_enr.d.ts","sourceRoot":"","sources":["../../../src/cmds/misc/generate_bootnode_enr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,MAAM,EAClB,kBAAkB,EAAE,MAAM,EAC1B,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,KAAK,iBAIX"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createBootnodeENRandPeerId } from '@aztec/p2p/enr';
|
|
2
|
+
export async function generateEncodedBootnodeENR(privateKey, udpAnnounceAddress, l1ChainId, log) {
|
|
3
|
+
const { enr } = await createBootnodeENRandPeerId(privateKey, udpAnnounceAddress, l1ChainId);
|
|
4
|
+
log(`ENR: ${enr.encodeTxt()}`);
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate_p2p_private_key.d.ts","sourceRoot":"","sources":["../../../src/cmds/misc/generate_p2p_private_key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,KAAK,iBAKrD"}
|