@aztec/cli 0.0.0-test.0 → 0.0.1-commit.0208eb9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -428
- package/dest/cmds/aztec_node/block_number.d.ts +3 -0
- package/dest/cmds/aztec_node/block_number.d.ts.map +1 -0
- package/dest/cmds/aztec_node/block_number.js +10 -0
- package/dest/cmds/aztec_node/get_block.d.ts +3 -0
- package/dest/cmds/aztec_node/get_block.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_block.js +10 -0
- package/dest/cmds/aztec_node/get_current_min_fee.d.ts +3 -0
- package/dest/cmds/aztec_node/get_current_min_fee.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_current_min_fee.js +7 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +5 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.js +12 -0
- package/dest/cmds/aztec_node/get_logs.d.ts +7 -0
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_logs.js +4 -4
- package/dest/cmds/aztec_node/get_node_info.d.ts +3 -0
- package/dest/cmds/aztec_node/get_node_info.d.ts.map +1 -0
- package/dest/cmds/{pxe → aztec_node}/get_node_info.js +14 -15
- package/dest/cmds/aztec_node/index.d.ts +4 -0
- package/dest/cmds/aztec_node/index.d.ts.map +1 -0
- package/dest/cmds/aztec_node/index.js +28 -0
- package/dest/cmds/contracts/index.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
- package/dest/cmds/contracts/inspect_contract.js +13 -15
- package/dest/cmds/contracts/parse_parameter_struct.d.ts +1 -1
- package/dest/cmds/infrastructure/index.d.ts +3 -3
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +8 -10
- package/dest/cmds/infrastructure/sequencers.d.ts +5 -6
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +38 -18
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +2 -2
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +11 -24
- package/dest/cmds/l1/advance_epoch.d.ts +2 -2
- package/dest/cmds/l1/advance_epoch.d.ts.map +1 -1
- package/dest/cmds/l1/advance_epoch.js +8 -6
- package/dest/cmds/l1/assume_proven_through.d.ts +3 -2
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +10 -10
- package/dest/cmds/l1/bridge_erc20.d.ts +3 -3
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +6 -5
- package/dest/cmds/l1/compute_genesis_values.d.ts +4 -0
- package/dest/cmds/l1/compute_genesis_values.d.ts.map +1 -0
- package/dest/cmds/l1/compute_genesis_values.js +17 -0
- package/dest/cmds/l1/create_l1_account.d.ts +1 -1
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts +4 -0
- package/dest/cmds/l1/deploy_l1_contracts_cmd.d.ts.map +1 -0
- package/dest/cmds/l1/deploy_l1_contracts_cmd.js +81 -0
- package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -3
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +18 -9
- package/dest/cmds/l1/get_l1_addresses.d.ts +2 -2
- package/dest/cmds/l1/get_l1_addresses.d.ts.map +1 -1
- package/dest/cmds/l1/get_l1_addresses.js +5 -2
- package/dest/cmds/l1/get_l1_balance.d.ts +1 -1
- package/dest/cmds/l1/get_l1_balance.js +4 -2
- package/dest/cmds/l1/governance_utils.d.ts +5 -5
- package/dest/cmds/l1/governance_utils.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.js +19 -17
- package/dest/cmds/l1/index.d.ts +1 -1
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +41 -44
- package/dest/cmds/l1/prover_stats.d.ts +1 -1
- package/dest/cmds/l1/prover_stats.d.ts.map +1 -1
- package/dest/cmds/l1/prover_stats.js +32 -30
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts +6 -0
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -0
- package/dest/cmds/l1/trigger_seed_snapshot.js +20 -0
- package/dest/cmds/l1/update_l1_validators.d.ts +21 -6
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +198 -103
- package/dest/cmds/misc/compute_selector.d.ts +1 -1
- package/dest/cmds/misc/example_contracts.d.ts +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +2 -2
- package/dest/cmds/misc/generate_bootnode_enr.d.ts.map +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.js +2 -2
- package/dest/cmds/misc/generate_p2p_private_key.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +2 -2
- package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.js +4 -4
- package/dest/cmds/misc/generate_secret_key.d.ts +2 -2
- package/dest/cmds/misc/generate_secret_key.d.ts.map +1 -1
- package/dest/cmds/misc/generate_secret_key.js +1 -1
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +3 -0
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts.map +1 -0
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.js +4 -0
- package/dest/cmds/misc/index.d.ts +1 -1
- package/dest/cmds/misc/index.d.ts.map +1 -1
- package/dest/cmds/misc/index.js +8 -4
- package/dest/cmds/misc/update/common.d.ts +1 -1
- package/dest/cmds/misc/update/github.d.ts +1 -2
- package/dest/cmds/misc/update/github.d.ts.map +1 -1
- package/dest/cmds/misc/update/github.js +0 -1
- package/dest/cmds/misc/update/noir.d.ts +1 -1
- package/dest/cmds/misc/update/npm.d.ts +1 -1
- package/dest/cmds/misc/update/npm.js +1 -1
- package/dest/cmds/misc/update/utils.d.ts +1 -1
- package/dest/cmds/misc/update.d.ts +1 -1
- package/dest/cmds/misc/update.d.ts.map +1 -1
- package/dest/cmds/misc/update.js +2 -3
- package/dest/cmds/validator_keys/add.d.ts +5 -0
- package/dest/cmds/validator_keys/add.d.ts.map +1 -0
- package/dest/cmds/validator_keys/add.js +83 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +12 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -0
- package/dest/cmds/validator_keys/generate_bls_keypair.js +27 -0
- package/dest/cmds/validator_keys/index.d.ts +4 -0
- package/dest/cmds/validator_keys/index.d.ts.map +1 -0
- package/dest/cmds/validator_keys/index.js +32 -0
- package/dest/cmds/validator_keys/new.d.ts +29 -0
- package/dest/cmds/validator_keys/new.d.ts.map +1 -0
- package/dest/cmds/validator_keys/new.js +134 -0
- package/dest/cmds/validator_keys/shared.d.ts +68 -0
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -0
- package/dest/cmds/validator_keys/shared.js +274 -0
- package/dest/cmds/validator_keys/staker.d.ts +38 -0
- package/dest/cmds/validator_keys/staker.d.ts.map +1 -0
- package/dest/cmds/validator_keys/staker.js +210 -0
- package/dest/cmds/validator_keys/utils.d.ts +25 -0
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -0
- package/dest/cmds/validator_keys/utils.js +52 -0
- package/dest/config/cached_fetch.d.ts +18 -0
- package/dest/config/cached_fetch.d.ts.map +1 -0
- package/dest/config/cached_fetch.js +54 -0
- package/dest/config/chain_l2_config.d.ts +14 -0
- package/dest/config/chain_l2_config.d.ts.map +1 -0
- package/dest/config/chain_l2_config.js +45 -0
- package/dest/config/enrich_env.d.ts +4 -0
- package/dest/config/enrich_env.d.ts.map +1 -0
- package/dest/config/enrich_env.js +12 -0
- package/dest/config/generated/networks.d.ts +205 -0
- package/dest/config/generated/networks.d.ts.map +1 -0
- package/dest/config/generated/networks.js +206 -0
- package/dest/config/get_l1_config.d.ts +9 -0
- package/dest/config/get_l1_config.d.ts.map +1 -0
- package/dest/config/get_l1_config.js +24 -0
- package/dest/config/index.d.ts +5 -0
- package/dest/config/index.d.ts.map +1 -0
- package/dest/config/index.js +4 -0
- package/dest/config/network_config.d.ts +22 -0
- package/dest/config/network_config.d.ts.map +1 -0
- package/dest/config/network_config.js +115 -0
- package/dest/utils/aztec.d.ts +15 -26
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +56 -72
- package/dest/utils/commands.d.ts +22 -13
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +43 -16
- package/dest/utils/encoding.d.ts +1 -1
- package/dest/utils/encoding.js +2 -2
- package/dest/utils/github.d.ts +1 -2
- package/dest/utils/github.d.ts.map +1 -1
- package/dest/utils/github.js +0 -1
- package/dest/utils/index.d.ts +2 -1
- package/dest/utils/index.d.ts.map +1 -1
- package/dest/utils/index.js +1 -0
- package/dest/utils/inspect.d.ts +5 -11
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +23 -110
- package/dest/utils/setup_contracts.d.ts +3 -0
- package/dest/utils/setup_contracts.d.ts.map +1 -0
- package/dest/utils/setup_contracts.js +16 -0
- package/package.json +61 -37
- package/public_include_metric_prefixes.json +1 -0
- package/src/cmds/aztec_node/block_number.ts +9 -0
- package/src/cmds/aztec_node/get_block.ts +11 -0
- package/src/cmds/aztec_node/get_current_min_fee.ts +9 -0
- package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +27 -0
- package/src/cmds/{pxe → aztec_node}/get_logs.ts +11 -9
- package/src/cmds/{pxe → aztec_node}/get_node_info.ts +15 -23
- package/src/cmds/aztec_node/index.ts +87 -0
- package/src/cmds/contracts/inspect_contract.ts +20 -17
- package/src/cmds/infrastructure/index.ts +8 -11
- package/src/cmds/infrastructure/sequencers.ts +41 -22
- package/src/cmds/infrastructure/setup_l2_contract.ts +13 -25
- package/src/cmds/l1/advance_epoch.ts +7 -5
- package/src/cmds/l1/assume_proven_through.ts +11 -10
- package/src/cmds/l1/bridge_erc20.ts +8 -4
- package/src/cmds/l1/compute_genesis_values.ts +29 -0
- package/src/cmds/l1/deploy_l1_contracts_cmd.ts +107 -0
- package/src/cmds/l1/deploy_new_rollup.ts +24 -15
- package/src/cmds/l1/get_l1_addresses.ts +5 -3
- package/src/cmds/l1/get_l1_balance.ts +2 -2
- package/src/cmds/l1/governance_utils.ts +20 -24
- package/src/cmds/l1/index.ts +87 -113
- package/src/cmds/l1/prover_stats.ts +42 -31
- package/src/cmds/l1/trigger_seed_snapshot.ts +32 -0
- package/src/cmds/l1/update_l1_validators.ts +218 -97
- package/src/cmds/misc/generate_bootnode_enr.ts +3 -2
- package/src/cmds/misc/generate_secret_and_hash.ts +4 -4
- package/src/cmds/misc/generate_secret_key.ts +1 -1
- package/src/cmds/misc/get_canonical_sponsored_fpc_address.ts +7 -0
- package/src/cmds/misc/index.ts +14 -5
- package/src/cmds/misc/update/github.ts +0 -1
- package/src/cmds/misc/update/npm.ts +1 -1
- package/src/cmds/misc/update.ts +1 -7
- package/src/cmds/validator_keys/add.ts +123 -0
- package/src/cmds/validator_keys/generate_bls_keypair.ts +34 -0
- package/src/cmds/validator_keys/index.ts +142 -0
- package/src/cmds/validator_keys/new.ts +207 -0
- package/src/cmds/validator_keys/shared.ts +326 -0
- package/src/cmds/validator_keys/staker.ts +301 -0
- package/src/cmds/validator_keys/utils.ts +81 -0
- package/src/config/cached_fetch.ts +67 -0
- package/src/config/chain_l2_config.ts +57 -0
- package/src/config/enrich_env.ts +15 -0
- package/src/config/generated/networks.ts +210 -0
- package/src/config/get_l1_config.ts +31 -0
- package/src/config/index.ts +4 -0
- package/src/config/network_config.ts +147 -0
- package/src/utils/aztec.ts +74 -120
- package/src/utils/commands.ts +57 -20
- package/src/utils/encoding.ts +2 -2
- package/src/utils/github.ts +0 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/inspect.ts +28 -124
- package/src/utils/setup_contracts.ts +19 -0
- package/dest/cmds/devnet/bootstrap_network.d.ts +0 -3
- package/dest/cmds/devnet/bootstrap_network.d.ts.map +0 -1
- package/dest/cmds/devnet/bootstrap_network.js +0 -196
- package/dest/cmds/devnet/faucet.d.ts +0 -4
- package/dest/cmds/devnet/faucet.d.ts.map +0 -1
- package/dest/cmds/devnet/faucet.js +0 -26
- package/dest/cmds/devnet/index.d.ts +0 -4
- package/dest/cmds/devnet/index.d.ts.map +0 -1
- package/dest/cmds/devnet/index.js +0 -14
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +0 -4
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +0 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +0 -29
- package/dest/cmds/l1/deploy_l1_verifier.d.ts +0 -5
- package/dest/cmds/l1/deploy_l1_verifier.d.ts.map +0 -1
- package/dest/cmds/l1/deploy_l1_verifier.js +0 -54
- package/dest/cmds/misc/setup_contracts.d.ts +0 -7
- package/dest/cmds/misc/setup_contracts.d.ts.map +0 -1
- package/dest/cmds/misc/setup_contracts.js +0 -27
- package/dest/cmds/pxe/add_contract.d.ts +0 -5
- package/dest/cmds/pxe/add_contract.d.ts.map +0 -1
- package/dest/cmds/pxe/add_contract.js +0 -29
- package/dest/cmds/pxe/block_number.d.ts +0 -3
- package/dest/cmds/pxe/block_number.d.ts.map +0 -1
- package/dest/cmds/pxe/block_number.js +0 -10
- package/dest/cmds/pxe/get_account.d.ts +0 -4
- package/dest/cmds/pxe/get_account.d.ts.map +0 -1
- package/dest/cmds/pxe/get_account.js +0 -10
- package/dest/cmds/pxe/get_accounts.d.ts +0 -3
- package/dest/cmds/pxe/get_accounts.d.ts.map +0 -1
- package/dest/cmds/pxe/get_accounts.js +0 -25
- package/dest/cmds/pxe/get_block.d.ts +0 -3
- package/dest/cmds/pxe/get_block.d.ts.map +0 -1
- package/dest/cmds/pxe/get_block.js +0 -9
- package/dest/cmds/pxe/get_contract_data.d.ts +0 -4
- package/dest/cmds/pxe/get_contract_data.d.ts.map +0 -1
- package/dest/cmds/pxe/get_contract_data.js +0 -31
- package/dest/cmds/pxe/get_current_base_fee.d.ts +0 -3
- package/dest/cmds/pxe/get_current_base_fee.d.ts.map +0 -1
- package/dest/cmds/pxe/get_current_base_fee.js +0 -7
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts +0 -4
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.d.ts.map +0 -1
- package/dest/cmds/pxe/get_l1_to_l2_message_witness.js +0 -11
- package/dest/cmds/pxe/get_logs.d.ts +0 -4
- package/dest/cmds/pxe/get_logs.d.ts.map +0 -1
- package/dest/cmds/pxe/get_node_info.d.ts +0 -3
- package/dest/cmds/pxe/get_node_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.d.ts +0 -3
- package/dest/cmds/pxe/get_pxe_info.d.ts.map +0 -1
- package/dest/cmds/pxe/get_pxe_info.js +0 -11
- package/dest/cmds/pxe/index.d.ts +0 -4
- package/dest/cmds/pxe/index.d.ts.map +0 -1
- package/dest/cmds/pxe/index.js +0 -55
- package/src/cmds/devnet/bootstrap_network.ts +0 -318
- package/src/cmds/devnet/faucet.ts +0 -33
- package/src/cmds/devnet/index.ts +0 -60
- package/src/cmds/l1/deploy_l1_contracts.ts +0 -65
- package/src/cmds/l1/deploy_l1_verifier.ts +0 -105
- package/src/cmds/misc/setup_contracts.ts +0 -40
- package/src/cmds/pxe/add_contract.ts +0 -41
- package/src/cmds/pxe/block_number.ts +0 -9
- package/src/cmds/pxe/get_account.ts +0 -16
- package/src/cmds/pxe/get_accounts.ts +0 -35
- package/src/cmds/pxe/get_block.ts +0 -10
- package/src/cmds/pxe/get_contract_data.ts +0 -51
- package/src/cmds/pxe/get_current_base_fee.ts +0 -9
- package/src/cmds/pxe/get_l1_to_l2_message_witness.ts +0 -25
- package/src/cmds/pxe/get_pxe_info.ts +0 -13
- package/src/cmds/pxe/index.ts +0 -170
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
4
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
5
|
+
import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
|
|
6
|
+
|
|
7
|
+
export async function getL1ToL2MessageWitness(
|
|
8
|
+
nodeUrl: string,
|
|
9
|
+
contractAddress: AztecAddress,
|
|
10
|
+
messageHash: Fr,
|
|
11
|
+
secret: Fr,
|
|
12
|
+
log: LogFn,
|
|
13
|
+
) {
|
|
14
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
15
|
+
const messageWitness = await getNonNullifiedL1ToL2MessageWitness(node, contractAddress, messageHash, secret);
|
|
16
|
+
|
|
17
|
+
log(
|
|
18
|
+
messageWitness === undefined
|
|
19
|
+
? `
|
|
20
|
+
L1 to L2 Message not found.
|
|
21
|
+
`
|
|
22
|
+
: `
|
|
23
|
+
L1 to L2 message index: ${messageWitness[0]}
|
|
24
|
+
L1 to L2 message sibling path: ${messageWitness[1]}
|
|
25
|
+
`,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import type { AztecAddress
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import type { LogFilter, LogId } from '@aztec/aztec.js/log';
|
|
3
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
4
|
+
import type { TxHash } from '@aztec/aztec.js/tx';
|
|
5
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
6
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
7
|
import { sleep } from '@aztec/foundation/sleep';
|
|
5
8
|
|
|
6
9
|
export async function getLogs(
|
|
7
10
|
txHash: TxHash,
|
|
8
|
-
fromBlock:
|
|
9
|
-
toBlock:
|
|
11
|
+
fromBlock: BlockNumber,
|
|
12
|
+
toBlock: BlockNumber,
|
|
10
13
|
afterLog: LogId,
|
|
11
14
|
contractAddress: AztecAddress,
|
|
12
|
-
|
|
15
|
+
nodeUrl: string,
|
|
13
16
|
follow: boolean,
|
|
14
|
-
debugLogger: Logger,
|
|
15
17
|
log: LogFn,
|
|
16
18
|
) {
|
|
17
|
-
const
|
|
19
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
18
20
|
|
|
19
21
|
if (follow) {
|
|
20
22
|
if (txHash) {
|
|
@@ -28,7 +30,7 @@ export async function getLogs(
|
|
|
28
30
|
const filter: LogFilter = { txHash, fromBlock, toBlock, afterLog, contractAddress };
|
|
29
31
|
|
|
30
32
|
const fetchLogs = async () => {
|
|
31
|
-
const response = await
|
|
33
|
+
const response = await node.getPublicLogs(filter);
|
|
32
34
|
const logs = response.logs;
|
|
33
35
|
|
|
34
36
|
if (!logs.length) {
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { LogFn
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
+
|
|
4
|
+
export async function getNodeInfo(nodeUrl: string, json: boolean, log: LogFn, logJson: (output: any) => void) {
|
|
5
|
+
const client = createAztecNodeClient(nodeUrl);
|
|
3
6
|
|
|
4
|
-
export async function getNodeInfo(
|
|
5
|
-
rpcUrl: string,
|
|
6
|
-
pxeRequest: boolean,
|
|
7
|
-
debugLogger: Logger,
|
|
8
|
-
json: boolean,
|
|
9
|
-
log: LogFn,
|
|
10
|
-
logJson: (output: any) => void,
|
|
11
|
-
) {
|
|
12
|
-
let client: AztecNode | PXE;
|
|
13
|
-
if (pxeRequest) {
|
|
14
|
-
client = await createCompatibleClient(rpcUrl, debugLogger);
|
|
15
|
-
} else {
|
|
16
|
-
client = createAztecNodeClient(rpcUrl);
|
|
17
|
-
}
|
|
18
7
|
const info = await client.getNodeInfo();
|
|
19
8
|
if (json) {
|
|
20
9
|
logJson({
|
|
21
10
|
nodeVersion: info.nodeVersion,
|
|
22
11
|
l1ChainId: info.l1ChainId,
|
|
23
|
-
|
|
12
|
+
rollupVersion: info.rollupVersion,
|
|
24
13
|
enr: info.enr,
|
|
25
14
|
l1ContractAddresses: {
|
|
26
15
|
rollup: info.l1ContractAddresses.rollupAddress.toString(),
|
|
@@ -35,18 +24,20 @@ export async function getNodeInfo(
|
|
|
35
24
|
governanceProposer: info.l1ContractAddresses.governanceProposerAddress.toString(),
|
|
36
25
|
governance: info.l1ContractAddresses.governanceAddress.toString(),
|
|
37
26
|
slashFactory: info.l1ContractAddresses.slashFactoryAddress?.toString(),
|
|
27
|
+
feeAssetHandler: info.l1ContractAddresses.feeAssetHandlerAddress?.toString(),
|
|
28
|
+
stakingAssetHandler: info.l1ContractAddresses.stakingAssetHandlerAddress?.toString(),
|
|
38
29
|
},
|
|
39
30
|
protocolContractAddresses: {
|
|
40
|
-
|
|
31
|
+
classRegistry: info.protocolContractAddresses.classRegistry.toString(),
|
|
41
32
|
feeJuice: info.protocolContractAddresses.feeJuice.toString(),
|
|
42
|
-
|
|
33
|
+
instanceRegistry: info.protocolContractAddresses.instanceRegistry.toString(),
|
|
43
34
|
multiCallEntrypoint: info.protocolContractAddresses.multiCallEntrypoint.toString(),
|
|
44
35
|
},
|
|
45
36
|
});
|
|
46
37
|
} else {
|
|
47
38
|
log(`Node Version: ${info.nodeVersion}`);
|
|
48
39
|
log(`Chain Id: ${info.l1ChainId}`);
|
|
49
|
-
log(`
|
|
40
|
+
log(`Rollup Version: ${info.rollupVersion}`);
|
|
50
41
|
log(`Node ENR: ${info.enr}`);
|
|
51
42
|
log(`L1 Contract Addresses:`);
|
|
52
43
|
log(` Rollup Address: ${info.l1ContractAddresses.rollupAddress.toString()}`);
|
|
@@ -61,11 +52,12 @@ export async function getNodeInfo(
|
|
|
61
52
|
log(` GovernanceProposer Address: ${info.l1ContractAddresses.governanceProposerAddress.toString()}`);
|
|
62
53
|
log(` Governance Address: ${info.l1ContractAddresses.governanceAddress.toString()}`);
|
|
63
54
|
log(` SlashFactory Address: ${info.l1ContractAddresses.slashFactoryAddress?.toString()}`);
|
|
64
|
-
|
|
55
|
+
log(` FeeAssetHandler Address: ${info.l1ContractAddresses.feeAssetHandlerAddress?.toString()}`);
|
|
56
|
+
log(` StakingAssetHandler Address: ${info.l1ContractAddresses.stakingAssetHandlerAddress?.toString()}`);
|
|
65
57
|
log(`L2 Contract Addresses:`);
|
|
66
|
-
log(` Class
|
|
58
|
+
log(` Class Registry: ${info.protocolContractAddresses.classRegistry.toString()}`);
|
|
67
59
|
log(` Fee Juice: ${info.protocolContractAddresses.feeJuice.toString()}`);
|
|
68
|
-
log(` Instance Deployer: ${info.protocolContractAddresses.
|
|
60
|
+
log(` Instance Deployer: ${info.protocolContractAddresses.instanceRegistry.toString()}`);
|
|
69
61
|
log(` MultiCall: ${info.protocolContractAddresses.multiCallEntrypoint.toString()}`);
|
|
70
62
|
}
|
|
71
63
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
2
|
+
|
|
3
|
+
import type { Command } from 'commander';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
logJson,
|
|
7
|
+
nodeOption,
|
|
8
|
+
parseAztecAddress,
|
|
9
|
+
parseField,
|
|
10
|
+
parseOptionalAztecAddress,
|
|
11
|
+
parseOptionalInteger,
|
|
12
|
+
parseOptionalLogId,
|
|
13
|
+
parseOptionalTxHash,
|
|
14
|
+
} from '../../utils/commands.js';
|
|
15
|
+
|
|
16
|
+
export function injectCommands(program: Command, log: LogFn, debugLogger: Logger) {
|
|
17
|
+
program
|
|
18
|
+
.command('get-block')
|
|
19
|
+
.description('Gets info for a given block or latest.')
|
|
20
|
+
.argument('[blockNumber]', 'Block height', parseOptionalInteger)
|
|
21
|
+
.addOption(nodeOption)
|
|
22
|
+
.action(async (blockNumber, options) => {
|
|
23
|
+
const { getBlock } = await import('./get_block.js');
|
|
24
|
+
await getBlock(options.nodeUrl, blockNumber, log);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
program
|
|
28
|
+
.command('get-current-min-fee')
|
|
29
|
+
.description('Gets the current base fee.')
|
|
30
|
+
.addOption(nodeOption)
|
|
31
|
+
.action(async options => {
|
|
32
|
+
const { getCurrentMinFee } = await import('./get_current_min_fee.js');
|
|
33
|
+
await getCurrentMinFee(options.rpcUrl, debugLogger, log);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
program
|
|
37
|
+
.command('get-l1-to-l2-message-witness')
|
|
38
|
+
.description('Gets a L1 to L2 message witness.')
|
|
39
|
+
.requiredOption('-ca, --contract-address <address>', 'Aztec address of the contract.', parseAztecAddress)
|
|
40
|
+
.requiredOption('--message-hash <messageHash>', 'The L1 to L2 message hash.', parseField)
|
|
41
|
+
.requiredOption('--secret <secret>', 'The secret used to claim the L1 to L2 message', parseField)
|
|
42
|
+
.addOption(nodeOption)
|
|
43
|
+
.action(async ({ contractAddress, messageHash, secret, nodeUrl }) => {
|
|
44
|
+
const { getL1ToL2MessageWitness } = await import('./get_l1_to_l2_message_witness.js');
|
|
45
|
+
await getL1ToL2MessageWitness(nodeUrl, contractAddress, messageHash, secret, log);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
program
|
|
49
|
+
.command('get-logs')
|
|
50
|
+
.description('Gets all the public logs from an intersection of all the filter params.')
|
|
51
|
+
.option('-tx, --tx-hash <txHash>', 'A transaction hash to get the receipt for.', parseOptionalTxHash)
|
|
52
|
+
.option(
|
|
53
|
+
'-fb, --from-block <blockNum>',
|
|
54
|
+
'Initial block number for getting logs (defaults to 1).',
|
|
55
|
+
parseOptionalInteger,
|
|
56
|
+
)
|
|
57
|
+
.option('-tb, --to-block <blockNum>', 'Up to which block to fetch logs (defaults to latest).', parseOptionalInteger)
|
|
58
|
+
.option('-al --after-log <logId>', 'ID of a log after which to fetch the logs.', parseOptionalLogId)
|
|
59
|
+
.option('-ca, --contract-address <address>', 'Contract address to filter logs by.', parseOptionalAztecAddress)
|
|
60
|
+
.addOption(nodeOption)
|
|
61
|
+
.option('--follow', 'If set, will keep polling for new logs until interrupted.')
|
|
62
|
+
.action(async ({ txHash, fromBlock, toBlock, afterLog, contractAddress, aztecNodeRpcUrl: nodeUrl, follow }) => {
|
|
63
|
+
const { getLogs } = await import('./get_logs.js');
|
|
64
|
+
await getLogs(txHash, fromBlock, toBlock, afterLog, contractAddress, nodeUrl, follow, log);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
program
|
|
68
|
+
.command('block-number')
|
|
69
|
+
.description('Gets the current Aztec L2 block number.')
|
|
70
|
+
.addOption(nodeOption)
|
|
71
|
+
.action(async (options: any) => {
|
|
72
|
+
const { blockNumber } = await import('./block_number.js');
|
|
73
|
+
await blockNumber(options.nodeUrl, log);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
program
|
|
77
|
+
.command('get-node-info')
|
|
78
|
+
.description('Gets the information of an Aztec node from a PXE or directly from an Aztec node.')
|
|
79
|
+
.option('--json', 'Emit output as json')
|
|
80
|
+
.addOption(nodeOption)
|
|
81
|
+
.action(async options => {
|
|
82
|
+
const { getNodeInfo } = await import('./get_node_info.js');
|
|
83
|
+
await getNodeInfo(options.nodeUrl, options.json, log, logJson(log));
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return program;
|
|
87
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { sha256 } from '@aztec/foundation/crypto';
|
|
1
|
+
import { sha256 } from '@aztec/foundation/crypto/sha256';
|
|
2
2
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
3
|
import {
|
|
4
4
|
type FunctionArtifact,
|
|
5
5
|
FunctionSelector,
|
|
6
6
|
decodeFunctionSignature,
|
|
7
7
|
decodeFunctionSignatureWithParameterNames,
|
|
8
|
+
retainBytecode,
|
|
8
9
|
} from '@aztec/stdlib/abi';
|
|
9
10
|
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
10
11
|
|
|
@@ -12,7 +13,9 @@ import { getContractArtifact } from '../../utils/aztec.js';
|
|
|
12
13
|
|
|
13
14
|
export async function inspectContract(contractArtifactFile: string, debugLogger: Logger, log: LogFn) {
|
|
14
15
|
const contractArtifact = await getContractArtifact(contractArtifactFile, log);
|
|
15
|
-
const contractFns = contractArtifact.functions
|
|
16
|
+
const contractFns = contractArtifact.functions.concat(
|
|
17
|
+
contractArtifact.nonDispatchPublicFunctions.map(f => f as FunctionArtifact),
|
|
18
|
+
);
|
|
16
19
|
if (contractFns.length === 0) {
|
|
17
20
|
log(`No functions found for contract ${contractArtifact.name}`);
|
|
18
21
|
}
|
|
@@ -26,16 +29,9 @@ export async function inspectContract(contractArtifactFile: string, debugLogger:
|
|
|
26
29
|
log(`\tpublic bytecode commitment: ${contractClass.publicBytecodeCommitment.toString()}`);
|
|
27
30
|
log(`\tpublic bytecode length: ${contractClass.packedBytecode.length} bytes (${bytecodeLengthInFields} fields)`);
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
await Promise.all(externalFunctions.map(f => logFunction(f, log)));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const internalFunctions = contractFns.filter(f => f.isInternal);
|
|
36
|
-
if (internalFunctions.length > 0) {
|
|
37
|
-
log(`\nInternal functions:`);
|
|
38
|
-
await Promise.all(internalFunctions.map(f => logFunction(f, log)));
|
|
32
|
+
if (contractFns.length > 0) {
|
|
33
|
+
log(`\nExternal contract functions:`);
|
|
34
|
+
await Promise.all(contractFns.map(f => logFunction(f, log)));
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
37
|
|
|
@@ -43,9 +39,16 @@ async function logFunction(fn: FunctionArtifact, log: LogFn) {
|
|
|
43
39
|
const signatureWithParameterNames = decodeFunctionSignatureWithParameterNames(fn.name, fn.parameters);
|
|
44
40
|
const signature = decodeFunctionSignature(fn.name, fn.parameters);
|
|
45
41
|
const selector = await FunctionSelector.fromSignature(signature);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
|
|
43
|
+
if (retainBytecode(fn)) {
|
|
44
|
+
const bytecodeSize = fn.bytecode.length;
|
|
45
|
+
const bytecodeHash = sha256(fn.bytecode).toString('hex');
|
|
46
|
+
log(
|
|
47
|
+
`${fn.functionType} ${signatureWithParameterNames} \n\tfunction signature: ${signature}\n\tselector: ${selector}\n\tbytecode: ${bytecodeSize} bytes (sha256 ${bytecodeHash})`,
|
|
48
|
+
);
|
|
49
|
+
} else {
|
|
50
|
+
log(
|
|
51
|
+
`${fn.functionType} ${signatureWithParameterNames} \n\tfunction signature: ${signature}\n\tselector: ${selector}`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
51
54
|
}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import type { LogFn
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
|
|
3
3
|
import type { Command } from 'commander';
|
|
4
4
|
|
|
5
|
-
import { ETHEREUM_HOSTS, l1ChainIdOption,
|
|
5
|
+
import { ETHEREUM_HOSTS, l1ChainIdOption, nodeOption, parseOptionalInteger } from '../../utils/commands.js';
|
|
6
6
|
|
|
7
|
-
export function injectCommands(program: Command, log: LogFn
|
|
7
|
+
export function injectCommands(program: Command, log: LogFn) {
|
|
8
8
|
program
|
|
9
9
|
.command('setup-protocol-contracts')
|
|
10
10
|
.description('Bootstrap the blockchain by initializing all the protocol contracts')
|
|
11
|
-
.addOption(
|
|
11
|
+
.addOption(nodeOption)
|
|
12
12
|
.option('--testAccounts', 'Deploy funded test accounts.')
|
|
13
13
|
.option('--json', 'Output the contract addresses in JSON format')
|
|
14
|
-
.option('--skipProofWait', "Don't wait for proofs to land.")
|
|
15
14
|
.action(async options => {
|
|
16
15
|
const { setupL2Contracts } = await import('./setup_l2_contract.js');
|
|
17
|
-
await setupL2Contracts(options.
|
|
16
|
+
await setupL2Contracts(options.nodeUrl, options.testAccounts, options.json, log);
|
|
18
17
|
});
|
|
19
18
|
|
|
20
19
|
program
|
|
@@ -34,7 +33,7 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
34
33
|
'test test test test test test test test test test test junk',
|
|
35
34
|
)
|
|
36
35
|
.option('--block-number <number>', 'Block number to query next sequencer for', parseOptionalInteger)
|
|
37
|
-
.addOption(
|
|
36
|
+
.addOption(nodeOption)
|
|
38
37
|
.addOption(l1ChainIdOption)
|
|
39
38
|
.action(async (command, who, options) => {
|
|
40
39
|
const { sequencers } = await import('./sequencers.js');
|
|
@@ -42,12 +41,10 @@ export function injectCommands(program: Command, log: LogFn, debugLogger: Logger
|
|
|
42
41
|
command: command,
|
|
43
42
|
who,
|
|
44
43
|
mnemonic: options.mnemonic,
|
|
45
|
-
|
|
46
|
-
l1RpcUrls: options.l1RpcUrls
|
|
44
|
+
nodeUrl: options.nodeUrl,
|
|
45
|
+
l1RpcUrls: options.l1RpcUrls,
|
|
47
46
|
chainId: options.l1ChainId,
|
|
48
|
-
blockNumber: options.blockNumber,
|
|
49
47
|
log,
|
|
50
|
-
debugLogger,
|
|
51
48
|
});
|
|
52
49
|
});
|
|
53
50
|
|
|
@@ -1,45 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
2
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
3
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
4
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
5
|
+
import { GSEContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
6
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
7
|
import { RollupAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
5
8
|
|
|
6
9
|
import { createPublicClient, createWalletClient, fallback, getContract, http } from 'viem';
|
|
7
10
|
import { mnemonicToAccount } from 'viem/accounts';
|
|
8
11
|
|
|
9
12
|
export async function sequencers(opts: {
|
|
10
|
-
command: 'list' | 'add' | 'remove' | 'who-next';
|
|
13
|
+
command: 'list' | 'add' | 'remove' | 'who-next' | 'flush';
|
|
11
14
|
who?: string;
|
|
12
15
|
mnemonic?: string;
|
|
13
|
-
|
|
16
|
+
bn254SecretKey?: bigint;
|
|
17
|
+
nodeUrl: string;
|
|
14
18
|
l1RpcUrls: string[];
|
|
15
19
|
chainId: number;
|
|
16
|
-
blockNumber?: number;
|
|
17
20
|
log: LogFn;
|
|
18
|
-
debugLogger: Logger;
|
|
19
21
|
}) {
|
|
20
|
-
const { command, who: maybeWho, mnemonic,
|
|
21
|
-
const client =
|
|
22
|
+
const { command, who: maybeWho, mnemonic, bn254SecretKey, nodeUrl, l1RpcUrls, chainId, log } = opts;
|
|
23
|
+
const client = createAztecNodeClient(nodeUrl);
|
|
22
24
|
const { l1ContractAddresses } = await client.getNodeInfo();
|
|
23
25
|
|
|
24
26
|
const chain = createEthereumChain(l1RpcUrls, chainId);
|
|
25
27
|
const publicClient = createPublicClient({
|
|
26
28
|
chain: chain.chainInfo,
|
|
27
|
-
transport: fallback(l1RpcUrls.map(url => http(url))),
|
|
29
|
+
transport: fallback(l1RpcUrls.map(url => http(url, { batch: false }))),
|
|
28
30
|
});
|
|
29
31
|
|
|
30
32
|
const walletClient = mnemonic
|
|
31
33
|
? createWalletClient({
|
|
32
34
|
account: mnemonicToAccount(mnemonic),
|
|
33
35
|
chain: chain.chainInfo,
|
|
34
|
-
transport: fallback(l1RpcUrls.map(url => http(url))),
|
|
36
|
+
transport: fallback(l1RpcUrls.map(url => http(url, { batch: false }))),
|
|
35
37
|
})
|
|
36
38
|
: undefined;
|
|
37
39
|
|
|
38
|
-
const rollup =
|
|
39
|
-
address: l1ContractAddresses.rollupAddress.toString(),
|
|
40
|
-
abi: RollupAbi,
|
|
41
|
-
client: publicClient,
|
|
42
|
-
});
|
|
40
|
+
const rollup = new RollupContract(publicClient, l1ContractAddresses.rollupAddress);
|
|
43
41
|
|
|
44
42
|
const writeableRollup = walletClient
|
|
45
43
|
? getContract({
|
|
@@ -52,7 +50,7 @@ export async function sequencers(opts: {
|
|
|
52
50
|
const who = (maybeWho as `0x{string}`) ?? walletClient?.account.address.toString();
|
|
53
51
|
|
|
54
52
|
if (command === 'list') {
|
|
55
|
-
const sequencers = await rollup.
|
|
53
|
+
const sequencers = await rollup.getAttesters();
|
|
56
54
|
if (sequencers.length === 0) {
|
|
57
55
|
log(`No sequencers registered on rollup`);
|
|
58
56
|
} else {
|
|
@@ -68,24 +66,45 @@ export async function sequencers(opts: {
|
|
|
68
66
|
|
|
69
67
|
log(`Adding ${who} as sequencer`);
|
|
70
68
|
|
|
69
|
+
const stakingAssetAddress = await rollup.getStakingAsset();
|
|
71
70
|
const stakingAsset = getContract({
|
|
72
|
-
address:
|
|
71
|
+
address: stakingAssetAddress.toString(),
|
|
73
72
|
abi: TestERC20Abi,
|
|
74
73
|
client: walletClient,
|
|
75
74
|
});
|
|
76
75
|
|
|
77
76
|
const config = getL1ContractsConfigEnvVars();
|
|
78
77
|
|
|
78
|
+
const bn254SecretKeyFieldElement = bn254SecretKey ? new Fr(bn254SecretKey) : Fr.random();
|
|
79
|
+
const gseAddress = await rollup.getGSE();
|
|
80
|
+
const gseContract = new GSEContract(publicClient, gseAddress);
|
|
81
|
+
const registrationTuple = await gseContract.makeRegistrationTuple(bn254SecretKeyFieldElement.toBigInt());
|
|
82
|
+
|
|
79
83
|
await Promise.all(
|
|
80
84
|
[
|
|
81
|
-
await stakingAsset.write.mint([walletClient.account.address, config.
|
|
82
|
-
await stakingAsset.write.approve([rollup.address, config.
|
|
85
|
+
await stakingAsset.write.mint([walletClient.account.address, config.activationThreshold], {} as any),
|
|
86
|
+
await stakingAsset.write.approve([rollup.address, config.activationThreshold], {} as any),
|
|
83
87
|
].map(txHash => publicClient.waitForTransactionReceipt({ hash: txHash })),
|
|
84
88
|
);
|
|
85
89
|
|
|
86
|
-
const hash = await writeableRollup.write.deposit([
|
|
90
|
+
const hash = await writeableRollup.write.deposit([
|
|
91
|
+
who,
|
|
92
|
+
who,
|
|
93
|
+
registrationTuple.publicKeyInG1,
|
|
94
|
+
registrationTuple.publicKeyInG2,
|
|
95
|
+
registrationTuple.proofOfPossession,
|
|
96
|
+
true,
|
|
97
|
+
]);
|
|
87
98
|
await publicClient.waitForTransactionReceipt({ hash });
|
|
88
99
|
log(`Added in tx ${hash}`);
|
|
100
|
+
} else if (command === 'flush') {
|
|
101
|
+
if (!writeableRollup) {
|
|
102
|
+
throw new Error(`Missing sequencer address`);
|
|
103
|
+
}
|
|
104
|
+
log(`Flushing staking entry queue`);
|
|
105
|
+
const hash = await writeableRollup.write.flushEntryQueue();
|
|
106
|
+
await publicClient.waitForTransactionReceipt({ hash });
|
|
107
|
+
log(`Flushed staking entry queue in tx ${hash}`);
|
|
89
108
|
} else if (command === 'remove') {
|
|
90
109
|
if (!who || !writeableRollup) {
|
|
91
110
|
throw new Error(`Missing sequencer address`);
|
|
@@ -95,7 +114,7 @@ export async function sequencers(opts: {
|
|
|
95
114
|
await publicClient.waitForTransactionReceipt({ hash });
|
|
96
115
|
log(`Removed in tx ${hash}`);
|
|
97
116
|
} else if (command === 'who-next') {
|
|
98
|
-
const next = await rollup.
|
|
117
|
+
const next = await rollup.getCurrentProposer();
|
|
99
118
|
log(`Sequencer expected to build is ${next}`);
|
|
100
119
|
} else {
|
|
101
120
|
throw new Error(`Unknown command ${command}`);
|
|
@@ -1,45 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import type { WaitOpts } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
5
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
3
6
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
7
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
8
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
9
|
+
import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export async function setupL2Contracts(
|
|
10
|
-
rpcUrl: string,
|
|
11
|
-
testAccounts: boolean,
|
|
12
|
-
json: boolean,
|
|
13
|
-
skipProofWait: boolean,
|
|
14
|
-
log: LogFn,
|
|
15
|
-
) {
|
|
11
|
+
export async function setupL2Contracts(nodeUrl: string, testAccounts: boolean, json: boolean, log: LogFn) {
|
|
16
12
|
const waitOpts: WaitOpts = {
|
|
17
13
|
timeout: 180,
|
|
18
14
|
interval: 1,
|
|
19
|
-
proven: !skipProofWait,
|
|
20
|
-
provenTimeout: 600,
|
|
21
15
|
};
|
|
22
16
|
log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
|
|
23
17
|
log('setupL2Contracts: Creating PXE client...');
|
|
24
|
-
const
|
|
25
|
-
const wallet =
|
|
26
|
-
|
|
27
|
-
log('setupL2Contracts: Getting fee juice portal address...');
|
|
28
|
-
// Deploy Fee Juice
|
|
29
|
-
const feeJuicePortalAddress = (await wallet.getNodeInfo()).l1ContractAddresses.feeJuicePortalAddress;
|
|
30
|
-
log('setupL2Contracts: Setting up fee juice portal...');
|
|
31
|
-
await setupCanonicalL2FeeJuice(wallet, feeJuicePortalAddress, waitOpts, log);
|
|
18
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
19
|
+
const wallet = await TestWallet.create(node);
|
|
32
20
|
|
|
33
|
-
let
|
|
21
|
+
let deployedAccountManagers: AccountManager[] = [];
|
|
34
22
|
if (testAccounts) {
|
|
35
23
|
log('setupL2Contracts: Deploying test accounts...');
|
|
36
|
-
|
|
37
|
-
await deployFundedSchnorrAccounts(
|
|
24
|
+
const initialAccountsData = await getInitialTestAccountsData();
|
|
25
|
+
deployedAccountManagers = await deployFundedSchnorrAccounts(wallet, initialAccountsData, waitOpts);
|
|
38
26
|
}
|
|
39
27
|
|
|
40
28
|
if (json) {
|
|
41
29
|
const toPrint: Record<string, AztecAddress> = { ...ProtocolContractAddress };
|
|
42
|
-
|
|
30
|
+
deployedAccountManagers.forEach((a, i) => {
|
|
43
31
|
toPrint[`testAccount${i}`] = a.address;
|
|
44
32
|
});
|
|
45
33
|
log(JSON.stringify(toPrint, null, 2));
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
|
+
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
3
5
|
|
|
4
|
-
export async function advanceEpoch(l1RpcUrls: string[],
|
|
5
|
-
const
|
|
6
|
-
const rollupAddress = await
|
|
6
|
+
export async function advanceEpoch(l1RpcUrls: string[], nodeUrl: string, log: LogFn) {
|
|
7
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
8
|
+
const rollupAddress = await aztecNode.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
|
|
7
9
|
|
|
8
|
-
const cheat =
|
|
10
|
+
const cheat = RollupCheatCodes.create(l1RpcUrls, { rollupAddress }, new DateProvider());
|
|
9
11
|
|
|
10
12
|
await cheat.advanceToNextEpoch();
|
|
11
13
|
log(`Warped time to advance to next epoch`);
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
|
+
import { RollupCheatCodes } from '@aztec/ethereum/test';
|
|
3
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
|
+
import { DateProvider } from '@aztec/foundation/timer';
|
|
3
6
|
|
|
4
7
|
export async function assumeProvenThrough(
|
|
5
|
-
|
|
8
|
+
checkpointOrLatest: CheckpointNumber | undefined,
|
|
6
9
|
l1RpcUrls: string[],
|
|
7
|
-
|
|
10
|
+
nodeUrl: string,
|
|
8
11
|
log: LogFn,
|
|
9
12
|
) {
|
|
10
|
-
const
|
|
11
|
-
const rollupAddress = await
|
|
12
|
-
const blockNumber = blockNumberOrLatest ?? (await pxe.getBlockNumber());
|
|
13
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
14
|
+
const rollupAddress = await aztecNode.getNodeInfo().then(i => i.l1ContractAddresses.rollupAddress);
|
|
13
15
|
|
|
14
|
-
const
|
|
15
|
-
const rollupCheatCodes = new RollupCheatCodes(ethCheatCode, { rollupAddress });
|
|
16
|
+
const rollupCheatCodes = RollupCheatCodes.create(l1RpcUrls, { rollupAddress }, new DateProvider());
|
|
16
17
|
|
|
17
|
-
await rollupCheatCodes.markAsProven(
|
|
18
|
-
log(`Assumed proven through
|
|
18
|
+
await rollupCheatCodes.markAsProven(checkpointOrLatest);
|
|
19
|
+
log(`Assumed proven through checkpoint ${checkpointOrLatest ?? 'latest'}`);
|
|
19
20
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { L1ToL2TokenPortalManager } from '@aztec/aztec.js/ethereum';
|
|
3
|
+
import type { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
5
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
3
6
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
4
7
|
|
|
5
8
|
import { prettyPrintJSON } from '../../utils/commands.js';
|
|
@@ -12,6 +15,7 @@ export async function bridgeERC20(
|
|
|
12
15
|
privateKey: string | undefined,
|
|
13
16
|
mnemonic: string,
|
|
14
17
|
tokenAddress: EthAddress,
|
|
18
|
+
handlerAddress: EthAddress | undefined,
|
|
15
19
|
portalAddress: EthAddress,
|
|
16
20
|
privateTransfer: boolean,
|
|
17
21
|
mint: boolean,
|
|
@@ -21,10 +25,10 @@ export async function bridgeERC20(
|
|
|
21
25
|
) {
|
|
22
26
|
// Prepare L1 client
|
|
23
27
|
const chain = createEthereumChain(l1RpcUrls, chainId);
|
|
24
|
-
const
|
|
28
|
+
const l1Client = createExtendedL1Client(chain.rpcUrls, privateKey ?? mnemonic, chain.chainInfo);
|
|
25
29
|
|
|
26
30
|
// Setup portal manager
|
|
27
|
-
const manager = new L1ToL2TokenPortalManager(portalAddress, tokenAddress,
|
|
31
|
+
const manager = new L1ToL2TokenPortalManager(portalAddress, tokenAddress, handlerAddress, l1Client, debugLogger);
|
|
28
32
|
let claimSecret: Fr;
|
|
29
33
|
let messageHash: `0x${string}`;
|
|
30
34
|
if (privateTransfer) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
4
|
+
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
5
|
+
|
|
6
|
+
import { getSponsoredFPCAddress } from '../../utils/setup_contracts.js';
|
|
7
|
+
|
|
8
|
+
/** Computes and prints genesis values needed for L1 contract deployment. */
|
|
9
|
+
export async function computeGenesisValuesCmd(testAccounts: boolean, sponsoredFPC: boolean, log: LogFn) {
|
|
10
|
+
const initialAccounts = testAccounts ? await getInitialTestAccountsData() : [];
|
|
11
|
+
const sponsoredFPCAddresses = sponsoredFPC ? await getSponsoredFPCAddress() : [];
|
|
12
|
+
const initialFundedAccounts = initialAccounts.map(a => a.address).concat(sponsoredFPCAddresses);
|
|
13
|
+
const { genesisArchiveRoot } = await getGenesisValues(initialFundedAccounts);
|
|
14
|
+
|
|
15
|
+
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
16
|
+
const vkTreeRoot = getVKTreeRoot();
|
|
17
|
+
|
|
18
|
+
log(
|
|
19
|
+
JSON.stringify(
|
|
20
|
+
{
|
|
21
|
+
vkTreeRoot: vkTreeRoot.toString(),
|
|
22
|
+
protocolContractsHash: protocolContractsHash.toString(),
|
|
23
|
+
genesisArchiveRoot: genesisArchiveRoot.toString(),
|
|
24
|
+
},
|
|
25
|
+
null,
|
|
26
|
+
2,
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
}
|