@aztec/cli 0.0.1-commit.b655e406 → 0.0.1-commit.c7c42ec
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/aztec_node/block_number.d.ts +1 -1
- package/dest/cmds/aztec_node/get_block.d.ts +1 -1
- package/dest/cmds/aztec_node/get_block.d.ts.map +1 -1
- package/dest/cmds/aztec_node/get_block.js +2 -1
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts +1 -1
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +1 -1
- package/dest/cmds/aztec_node/get_logs.d.ts +3 -2
- package/dest/cmds/aztec_node/get_logs.d.ts.map +1 -1
- package/dest/cmds/aztec_node/get_node_info.d.ts +1 -1
- package/dest/cmds/aztec_node/index.d.ts +1 -1
- package/dest/cmds/contracts/index.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts +1 -1
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
- package/dest/cmds/contracts/inspect_contract.js +4 -10
- package/dest/cmds/contracts/parse_parameter_struct.d.ts +1 -1
- package/dest/cmds/infrastructure/index.d.ts +1 -1
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +0 -1
- package/dest/cmds/infrastructure/sequencers.d.ts +1 -2
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +9 -3
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
- package/dest/cmds/l1/advance_epoch.d.ts +1 -1
- package/dest/cmds/l1/assume_proven_through.d.ts +1 -1
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +2 -1
- package/dest/cmds/l1/bridge_erc20.d.ts +1 -1
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +2 -1
- 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.js → deploy_l1_contracts_cmd.js} +39 -4
- package/dest/cmds/l1/deploy_new_rollup.d.ts +4 -4
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +3 -3
- package/dest/cmds/l1/get_l1_addresses.d.ts +1 -1
- 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 +3 -1
- package/dest/cmds/l1/index.d.ts +1 -2
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +10 -8
- 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 +2 -2
- package/dest/cmds/l1/trigger_seed_snapshot.d.ts.map +1 -1
- package/dest/cmds/l1/trigger_seed_snapshot.js +2 -1
- package/dest/cmds/l1/update_l1_validators.d.ts +6 -6
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +7 -3
- package/dest/cmds/misc/compute_selector.d.ts +1 -1
- package/dest/cmds/misc/example_contracts.d.ts +1 -1
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
- package/dest/cmds/misc/generate_p2p_private_key.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.js +1 -1
- package/dest/cmds/misc/generate_secret_key.d.ts +1 -1
- package/dest/cmds/misc/get_canonical_sponsored_fpc_address.d.ts +1 -1
- package/dest/cmds/misc/index.d.ts +1 -1
- package/dest/cmds/misc/index.d.ts.map +1 -1
- package/dest/cmds/misc/index.js +1 -1
- package/dest/cmds/misc/update/common.d.ts +1 -1
- package/dest/cmds/misc/update/github.d.ts +1 -1
- package/dest/cmds/misc/update/noir.d.ts +1 -1
- package/dest/cmds/misc/update/npm.d.ts +1 -1
- package/dest/cmds/misc/update/npm.js +1 -1
- package/dest/cmds/misc/update/utils.d.ts +1 -1
- package/dest/cmds/misc/update.d.ts +1 -1
- package/dest/cmds/validator_keys/add.d.ts +1 -1
- package/dest/cmds/validator_keys/add.d.ts.map +1 -1
- package/dest/cmds/validator_keys/add.js +20 -7
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts +1 -1
- package/dest/cmds/validator_keys/generate_bls_keypair.d.ts.map +1 -1
- package/dest/cmds/validator_keys/generate_bls_keypair.js +3 -2
- package/dest/cmds/validator_keys/index.d.ts +1 -1
- package/dest/cmds/validator_keys/index.d.ts.map +1 -1
- package/dest/cmds/validator_keys/index.js +16 -4
- package/dest/cmds/validator_keys/new.d.ts +7 -4
- package/dest/cmds/validator_keys/new.d.ts.map +1 -1
- package/dest/cmds/validator_keys/new.js +90 -16
- package/dest/cmds/validator_keys/shared.d.ts +4 -4
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -1
- package/dest/cmds/validator_keys/shared.js +31 -28
- 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 +1 -1
- package/dest/config/chain_l2_config.d.ts +13 -11
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +110 -61
- package/dest/config/enrich_env.d.ts +1 -1
- package/dest/config/get_l1_config.d.ts +3 -2
- package/dest/config/get_l1_config.d.ts.map +1 -1
- package/dest/config/get_l1_config.js +3 -1
- package/dest/config/index.d.ts +1 -1
- package/dest/config/network_config.d.ts +6 -3
- package/dest/config/network_config.d.ts.map +1 -1
- package/dest/config/network_config.js +64 -28
- package/dest/utils/aztec.d.ts +7 -13
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +19 -40
- package/dest/utils/commands.d.ts +8 -7
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +6 -5
- package/dest/utils/encoding.d.ts +1 -1
- package/dest/utils/encoding.js +1 -1
- package/dest/utils/github.d.ts +1 -1
- package/dest/utils/index.d.ts +1 -1
- package/dest/utils/inspect.d.ts +3 -2
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/setup_contracts.d.ts +1 -1
- package/package.json +38 -30
- package/public_include_metric_prefixes.json +1 -0
- package/src/cmds/aztec_node/get_block.ts +2 -1
- package/src/cmds/aztec_node/get_logs.ts +3 -2
- package/src/cmds/contracts/inspect_contract.ts +4 -11
- package/src/cmds/infrastructure/index.ts +0 -1
- package/src/cmds/infrastructure/sequencers.ts +5 -4
- package/src/cmds/l1/assume_proven_through.ts +4 -1
- package/src/cmds/l1/bridge_erc20.ts +2 -1
- package/src/cmds/l1/{deploy_l1_contracts.ts → deploy_l1_contracts_cmd.ts} +39 -22
- package/src/cmds/l1/deploy_new_rollup.ts +4 -9
- package/src/cmds/l1/get_l1_addresses.ts +4 -2
- package/src/cmds/l1/get_l1_balance.ts +2 -2
- package/src/cmds/l1/governance_utils.ts +3 -8
- package/src/cmds/l1/index.ts +7 -17
- package/src/cmds/l1/prover_stats.ts +42 -31
- package/src/cmds/l1/trigger_seed_snapshot.ts +2 -1
- package/src/cmds/l1/update_l1_validators.ts +7 -12
- package/src/cmds/misc/generate_secret_and_hash.ts +1 -1
- package/src/cmds/misc/index.ts +1 -1
- package/src/cmds/misc/update/npm.ts +1 -1
- package/src/cmds/validator_keys/add.ts +20 -10
- package/src/cmds/validator_keys/generate_bls_keypair.ts +3 -2
- package/src/cmds/validator_keys/index.ts +67 -21
- package/src/cmds/validator_keys/new.ts +110 -23
- package/src/cmds/validator_keys/shared.ts +32 -27
- package/src/cmds/validator_keys/staker.ts +301 -0
- package/src/cmds/validator_keys/utils.ts +81 -0
- package/src/config/chain_l2_config.ts +139 -72
- package/src/config/get_l1_config.ts +4 -1
- package/src/config/network_config.ts +74 -29
- package/src/utils/aztec.ts +24 -83
- package/src/utils/commands.ts +6 -5
- package/src/utils/encoding.ts +1 -1
- package/src/utils/inspect.ts +2 -1
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +0 -4
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +0 -1
package/src/utils/aztec.ts
CHANGED
|
@@ -6,23 +6,23 @@ import {
|
|
|
6
6
|
loadContractArtifact,
|
|
7
7
|
} from '@aztec/aztec.js/abi';
|
|
8
8
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type Operator,
|
|
13
|
-
RollupContract,
|
|
14
|
-
} from '@aztec/ethereum';
|
|
9
|
+
import type { L1ContractsConfig } from '@aztec/ethereum/config';
|
|
10
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
11
|
+
import type { Operator } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
15
12
|
import { SecretValue } from '@aztec/foundation/config';
|
|
16
|
-
import { Fr } from '@aztec/foundation/
|
|
17
|
-
import type
|
|
13
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
14
|
+
import { type LogFn, createLogger } from '@aztec/foundation/log';
|
|
18
15
|
import type { NoirPackageConfig } from '@aztec/foundation/noir';
|
|
19
16
|
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
20
17
|
|
|
21
18
|
import TOML from '@iarna/toml';
|
|
22
19
|
import { readFile } from 'fs/promises';
|
|
20
|
+
import type { HDAccount, Hex, PrivateKeyAccount } from 'viem';
|
|
23
21
|
|
|
24
22
|
import { encodeArgs } from './encoding.js';
|
|
25
23
|
|
|
24
|
+
const logger = createLogger('cli:utils:aztec');
|
|
25
|
+
|
|
26
26
|
/**
|
|
27
27
|
* Helper to get an ABI function or throw error if it doesn't exist.
|
|
28
28
|
* @param artifact - Contract's build artifact in JSON format.
|
|
@@ -37,89 +37,32 @@ export function getFunctionAbi(artifact: ContractArtifact, fnName: string): Func
|
|
|
37
37
|
return fn;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
* Function to execute the 'deployRollupContracts' command.
|
|
42
|
-
* @param rpcUrls - The RPC URL of the ethereum node.
|
|
43
|
-
* @param chainId - The chain ID of the L1 host.
|
|
44
|
-
* @param privateKey - The private key to be used in contract deployment.
|
|
45
|
-
* @param mnemonic - The mnemonic to be used in contract deployment.
|
|
46
|
-
*/
|
|
47
|
-
export async function deployAztecContracts(
|
|
48
|
-
rpcUrls: string[],
|
|
49
|
-
chainId: number,
|
|
50
|
-
privateKey: string | undefined,
|
|
51
|
-
mnemonic: string,
|
|
52
|
-
mnemonicIndex: number,
|
|
53
|
-
salt: number | undefined,
|
|
54
|
-
initialValidators: Operator[],
|
|
55
|
-
genesisArchiveRoot: Fr,
|
|
56
|
-
feeJuicePortalInitialBalance: bigint,
|
|
57
|
-
acceleratedTestDeployments: boolean,
|
|
58
|
-
config: L1ContractsConfig,
|
|
59
|
-
existingToken: EthAddress | undefined,
|
|
60
|
-
realVerifier: boolean,
|
|
61
|
-
createVerificationJson: string | false,
|
|
62
|
-
debugLogger: Logger,
|
|
63
|
-
): Promise<DeployL1ContractsReturnType> {
|
|
64
|
-
const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum');
|
|
65
|
-
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
66
|
-
|
|
67
|
-
const account = !privateKey
|
|
68
|
-
? mnemonicToAccount(mnemonic!, { addressIndex: mnemonicIndex })
|
|
69
|
-
: privateKeyToAccount(addLeadingHex(privateKey));
|
|
70
|
-
const chain = createEthereumChain(rpcUrls, chainId);
|
|
71
|
-
|
|
72
|
-
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
73
|
-
|
|
74
|
-
const result = await deployL1Contracts(
|
|
75
|
-
chain.rpcUrls,
|
|
76
|
-
account,
|
|
77
|
-
chain.chainInfo,
|
|
78
|
-
debugLogger,
|
|
79
|
-
{
|
|
80
|
-
vkTreeRoot: getVKTreeRoot(),
|
|
81
|
-
protocolContractsHash,
|
|
82
|
-
genesisArchiveRoot,
|
|
83
|
-
salt,
|
|
84
|
-
initialValidators,
|
|
85
|
-
acceleratedTestDeployments,
|
|
86
|
-
feeJuicePortalInitialBalance,
|
|
87
|
-
realVerifier,
|
|
88
|
-
existingTokenAddress: existingToken,
|
|
89
|
-
...config,
|
|
90
|
-
},
|
|
91
|
-
config,
|
|
92
|
-
createVerificationJson,
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
40
|
export async function deployNewRollupContracts(
|
|
99
41
|
registryAddress: EthAddress,
|
|
100
42
|
rpcUrls: string[],
|
|
101
|
-
chainId: number,
|
|
102
43
|
privateKey: string | undefined,
|
|
44
|
+
chainId: number,
|
|
103
45
|
mnemonic: string,
|
|
104
46
|
mnemonicIndex: number,
|
|
105
|
-
salt: number | undefined,
|
|
106
47
|
initialValidators: Operator[],
|
|
107
48
|
genesisArchiveRoot: Fr,
|
|
108
49
|
feeJuicePortalInitialBalance: bigint,
|
|
109
50
|
config: L1ContractsConfig,
|
|
110
51
|
realVerifier: boolean,
|
|
111
|
-
createVerificationJson: string | false,
|
|
112
|
-
logger: Logger,
|
|
113
52
|
): Promise<{ rollup: RollupContract; slashFactoryAddress: EthAddress }> {
|
|
114
|
-
const {
|
|
53
|
+
const { deployRollupForUpgrade } = await import('@aztec/ethereum/deploy-aztec-l1-contracts');
|
|
115
54
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
116
55
|
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
117
56
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
57
|
+
let account: HDAccount | PrivateKeyAccount;
|
|
58
|
+
if (privateKey) {
|
|
59
|
+
account = privateKeyToAccount(addLeadingHex(privateKey));
|
|
60
|
+
} else {
|
|
61
|
+
account = mnemonicToAccount(mnemonic!, { addressIndex: mnemonicIndex });
|
|
62
|
+
const privateKeyBuf = account.getHdKey().privateKey;
|
|
63
|
+
const privateKeyHex = Buffer.from(privateKeyBuf!).toString('hex');
|
|
64
|
+
privateKey = `0x${privateKeyHex}`;
|
|
65
|
+
}
|
|
123
66
|
|
|
124
67
|
if (!initialValidators || initialValidators.length === 0) {
|
|
125
68
|
// initialize the new rollup with Amin's validator address.
|
|
@@ -138,9 +81,11 @@ export async function deployNewRollupContracts(
|
|
|
138
81
|
}
|
|
139
82
|
|
|
140
83
|
const { rollup, slashFactoryAddress } = await deployRollupForUpgrade(
|
|
141
|
-
|
|
84
|
+
privateKey as Hex,
|
|
85
|
+
rpcUrls[0],
|
|
86
|
+
chainId,
|
|
87
|
+
registryAddress,
|
|
142
88
|
{
|
|
143
|
-
salt,
|
|
144
89
|
vkTreeRoot: getVKTreeRoot(),
|
|
145
90
|
protocolContractsHash,
|
|
146
91
|
genesisArchiveRoot,
|
|
@@ -149,13 +94,9 @@ export async function deployNewRollupContracts(
|
|
|
149
94
|
realVerifier,
|
|
150
95
|
...config,
|
|
151
96
|
},
|
|
152
|
-
registryAddress,
|
|
153
|
-
logger,
|
|
154
|
-
config,
|
|
155
|
-
createVerificationJson,
|
|
156
97
|
);
|
|
157
98
|
|
|
158
|
-
return { rollup, slashFactoryAddress };
|
|
99
|
+
return { rollup, slashFactoryAddress: EthAddress.fromString(slashFactoryAddress!) };
|
|
159
100
|
}
|
|
160
101
|
|
|
161
102
|
/**
|
package/src/utils/commands.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
-
import { LogId } from '@aztec/aztec.js/log';
|
|
5
|
-
import { TxHash } from '@aztec/aztec.js/tx';
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
7
4
|
import type { PXE } from '@aztec/pxe/server';
|
|
5
|
+
import { FunctionSelector } from '@aztec/stdlib/abi/function-selector';
|
|
6
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
7
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
8
|
+
import { LogId } from '@aztec/stdlib/logs/log-id';
|
|
9
|
+
import { TxHash } from '@aztec/stdlib/tx/tx-hash';
|
|
9
10
|
|
|
10
11
|
import { type Command, CommanderError, InvalidArgumentError, Option } from 'commander';
|
|
11
12
|
import { lookup } from 'dns/promises';
|
package/src/utils/encoding.ts
CHANGED
package/src/utils/inspect.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
3
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
3
4
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
4
5
|
|
|
5
6
|
export async function inspectBlock(
|
|
6
7
|
aztecNode: AztecNode,
|
|
7
|
-
blockNumber:
|
|
8
|
+
blockNumber: BlockNumber,
|
|
8
9
|
log: LogFn,
|
|
9
10
|
opts: { showTxs?: boolean } = {},
|
|
10
11
|
) {
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
3
|
-
export declare function deployL1Contracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, testAccounts: boolean, sponsoredFPC: boolean, acceleratedTestDeployments: boolean, json: boolean, createVerificationJson: string | false, initialValidators: EthAddress[], realVerifier: boolean, existingToken: EthAddress | undefined, log: LogFn, debugLogger: Logger): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=deploy_l1_contracts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/deploy_l1_contracts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAI5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAM3D,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,0BAA0B,EAAE,OAAO,EACnC,IAAI,EAAE,OAAO,EACb,sBAAsB,EAAE,MAAM,GAAG,KAAK,EACtC,iBAAiB,EAAE,UAAU,EAAE,EAC/B,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,UAAU,GAAG,SAAS,EACrC,GAAG,EAAE,KAAK,EACV,WAAW,EAAE,MAAM,iBA8DpB"}
|