@aztec/cli 0.0.0-test.0 → 0.0.1-fake-c83136db25
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 -427
- 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 +9 -0
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts +3 -0
- package/dest/cmds/aztec_node/get_current_base_fee.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_current_base_fee.js +7 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts +5 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.d.ts.map +1 -0
- package/dest/cmds/aztec_node/get_l1_to_l2_message_witness.js +12 -0
- package/dest/cmds/aztec_node/get_logs.d.ts +6 -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.map +1 -0
- package/dest/cmds/aztec_node/index.js +28 -0
- package/dest/cmds/contracts/inspect_contract.d.ts.map +1 -1
- package/dest/cmds/contracts/inspect_contract.js +9 -5
- package/dest/cmds/infrastructure/index.d.ts +2 -2
- package/dest/cmds/infrastructure/index.d.ts.map +1 -1
- package/dest/cmds/infrastructure/index.js +8 -9
- package/dest/cmds/infrastructure/sequencers.d.ts +4 -4
- package/dest/cmds/infrastructure/sequencers.d.ts.map +1 -1
- package/dest/cmds/infrastructure/sequencers.js +29 -16
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dest/cmds/l1/assume_proven_through.d.ts.map +1 -1
- package/dest/cmds/l1/assume_proven_through.js +9 -8
- package/dest/cmds/l1/bridge_erc20.d.ts +2 -2
- package/dest/cmds/l1/bridge_erc20.d.ts.map +1 -1
- package/dest/cmds/l1/bridge_erc20.js +5 -5
- package/dest/cmds/l1/deploy_l1_contracts.d.ts +2 -2
- package/dest/cmds/l1/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_l1_contracts.js +23 -6
- package/dest/cmds/l1/deploy_new_rollup.d.ts +2 -1
- package/dest/cmds/l1/deploy_new_rollup.d.ts.map +1 -1
- package/dest/cmds/l1/deploy_new_rollup.js +17 -8
- 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/governance_utils.d.ts.map +1 -1
- package/dest/cmds/l1/governance_utils.js +17 -17
- package/dest/cmds/l1/index.d.ts +1 -0
- package/dest/cmds/l1/index.d.ts.map +1 -1
- package/dest/cmds/l1/index.js +33 -43
- 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 +19 -0
- package/dest/cmds/l1/update_l1_validators.d.ts +17 -2
- package/dest/cmds/l1/update_l1_validators.d.ts.map +1 -1
- package/dest/cmds/l1/update_l1_validators.js +159 -103
- package/dest/cmds/misc/generate_bootnode_enr.d.ts +1 -1
- 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_secret_and_hash.d.ts +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.d.ts.map +1 -1
- package/dest/cmds/misc/generate_secret_and_hash.js +3 -3
- package/dest/cmds/misc/generate_secret_key.d.ts +1 -1
- 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.map +1 -1
- package/dest/cmds/misc/index.js +7 -3
- package/dest/cmds/misc/update/github.d.ts +0 -1
- 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.d.ts.map +1 -1
- package/dest/cmds/misc/update.js +2 -3
- 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 +39 -0
- package/dest/config/chain_l2_config.d.ts.map +1 -0
- package/dest/config/chain_l2_config.js +452 -0
- package/dest/config/enrich_env.d.ts +4 -0
- package/dest/config/enrich_env.d.ts.map +1 -0
- package/dest/config/enrich_env.js +12 -0
- package/dest/config/get_l1_config.d.ts +8 -0
- package/dest/config/get_l1_config.d.ts.map +1 -0
- package/dest/config/get_l1_config.js +22 -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 +19 -0
- package/dest/config/network_config.d.ts.map +1 -0
- package/dest/config/network_config.js +79 -0
- package/dest/utils/aztec.d.ts +12 -17
- package/dest/utils/aztec.d.ts.map +1 -1
- package/dest/utils/aztec.js +54 -49
- package/dest/utils/commands.d.ts +7 -8
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +10 -11
- package/dest/utils/encoding.js +1 -1
- package/dest/utils/github.d.ts +0 -1
- package/dest/utils/github.d.ts.map +1 -1
- package/dest/utils/github.js +0 -1
- package/dest/utils/index.d.ts +1 -0
- package/dest/utils/index.d.ts.map +1 -1
- package/dest/utils/index.js +1 -0
- package/dest/utils/inspect.d.ts +3 -10
- package/dest/utils/inspect.d.ts.map +1 -1
- package/dest/utils/inspect.js +19 -109
- 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 +40 -33
- package/src/cmds/aztec_node/block_number.ts +9 -0
- package/src/cmds/aztec_node/get_block.ts +10 -0
- package/src/cmds/aztec_node/get_current_base_fee.ts +9 -0
- package/src/cmds/aztec_node/get_l1_to_l2_message_witness.ts +27 -0
- package/src/cmds/{pxe → aztec_node}/get_logs.ts +8 -7
- 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 +16 -6
- package/src/cmds/infrastructure/index.ts +8 -10
- package/src/cmds/infrastructure/sequencers.ts +36 -19
- 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 +8 -7
- package/src/cmds/l1/bridge_erc20.ts +7 -4
- package/src/cmds/l1/deploy_l1_contracts.ts +32 -7
- package/src/cmds/l1/deploy_new_rollup.ts +23 -9
- package/src/cmds/l1/get_l1_addresses.ts +1 -1
- package/src/cmds/l1/governance_utils.ts +18 -17
- package/src/cmds/l1/index.ts +74 -101
- package/src/cmds/l1/trigger_seed_snapshot.ts +31 -0
- package/src/cmds/l1/update_l1_validators.ts +194 -94
- package/src/cmds/misc/generate_bootnode_enr.ts +3 -2
- package/src/cmds/misc/generate_secret_and_hash.ts +3 -3
- 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 +13 -4
- package/src/cmds/misc/update/github.ts +0 -1
- package/src/cmds/misc/update.ts +1 -7
- package/src/config/cached_fetch.ts +67 -0
- package/src/config/chain_l2_config.ts +597 -0
- package/src/config/enrich_env.ts +15 -0
- package/src/config/get_l1_config.ts +28 -0
- package/src/config/index.ts +4 -0
- package/src/config/network_config.ts +102 -0
- package/src/utils/aztec.ts +78 -65
- package/src/utils/commands.ts +13 -15
- package/src/utils/encoding.ts +1 -1
- package/src/utils/github.ts +0 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/inspect.ts +23 -123
- 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.map +0 -1
- package/dest/cmds/devnet/index.js +0 -14
- 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_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
- /package/dest/cmds/{devnet → aztec_node}/index.d.ts +0 -0
package/dest/utils/aztec.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
import type
|
|
4
|
-
import
|
|
1
|
+
import { type ContractArtifact, type FunctionAbi } from '@aztec/aztec.js/abi';
|
|
2
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { type DeployL1ContractsReturnType, type L1ContractsConfig, type Operator, RollupContract } from '@aztec/ethereum';
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
6
6
|
import type { NoirPackageConfig } from '@aztec/foundation/noir';
|
|
7
7
|
/**
|
|
@@ -10,7 +10,7 @@ import type { NoirPackageConfig } from '@aztec/foundation/noir';
|
|
|
10
10
|
* @param fnName - Function name to be found.
|
|
11
11
|
* @returns The function's ABI.
|
|
12
12
|
*/
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function getFunctionAbi(artifact: ContractArtifact, fnName: string): FunctionAbi;
|
|
14
14
|
/**
|
|
15
15
|
* Function to execute the 'deployRollupContracts' command.
|
|
16
16
|
* @param rpcUrls - The RPC URL of the ethereum node.
|
|
@@ -18,10 +18,10 @@ export declare function getFunctionArtifact(artifact: ContractArtifact, fnName:
|
|
|
18
18
|
* @param privateKey - The private key to be used in contract deployment.
|
|
19
19
|
* @param mnemonic - The mnemonic to be used in contract deployment.
|
|
20
20
|
*/
|
|
21
|
-
export declare function deployAztecContracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators:
|
|
22
|
-
export declare function deployNewRollupContracts(registryAddress: EthAddress, rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators:
|
|
23
|
-
payloadAddress: EthAddress;
|
|
21
|
+
export declare function deployAztecContracts(rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: Operator[], genesisArchiveRoot: Fr, feeJuicePortalInitialBalance: bigint, acceleratedTestDeployments: boolean, config: L1ContractsConfig, existingToken: EthAddress | undefined, realVerifier: boolean, createVerificationJson: string | false, debugLogger: Logger): Promise<DeployL1ContractsReturnType>;
|
|
22
|
+
export declare function deployNewRollupContracts(registryAddress: EthAddress, rpcUrls: string[], chainId: number, privateKey: string | undefined, mnemonic: string, mnemonicIndex: number, salt: number | undefined, initialValidators: Operator[], genesisArchiveRoot: Fr, feeJuicePortalInitialBalance: bigint, config: L1ContractsConfig, realVerifier: boolean, createVerificationJson: string | false, logger: Logger): Promise<{
|
|
24
23
|
rollup: RollupContract;
|
|
24
|
+
slashFactoryAddress: EthAddress;
|
|
25
25
|
}>;
|
|
26
26
|
/**
|
|
27
27
|
* Gets all contracts available in \@aztec/noir-contracts.js.
|
|
@@ -54,15 +54,10 @@ export declare function prepTx(contractFile: string, functionName: string, _func
|
|
|
54
54
|
*/
|
|
55
55
|
export declare const stripLeadingHex: (hex: string) => string;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @param
|
|
59
|
-
* @returns
|
|
57
|
+
* Adds a leading 0x to a hex string. If a leading 0x is already present the string is returned unchanged.
|
|
58
|
+
* @param hex - A hex string
|
|
59
|
+
* @returns A new string with leading 0x added
|
|
60
60
|
*/
|
|
61
|
+
export declare const addLeadingHex: (hex: string) => `0x${string}`;
|
|
61
62
|
export declare function prettyPrintNargoToml(config: NoirPackageConfig): string;
|
|
62
|
-
/**
|
|
63
|
-
* Checks that Private eXecution Environment (PXE) version matches the expected one by this CLI. Throws if not.
|
|
64
|
-
* @param pxe - PXE client.
|
|
65
|
-
* @param expectedVersionRange - Expected version by CLI.
|
|
66
|
-
*/
|
|
67
|
-
export declare function checkServerVersion(pxe: PXE, expectedVersionRange: string): Promise<void>;
|
|
68
63
|
//# sourceMappingURL=aztec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"aztec.d.ts","sourceRoot":"","sources":["../../src/utils/aztec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAQhE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAMtF;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,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,iBAAiB,EAAE,QAAQ,EAAE,EAC7B,kBAAkB,E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KAAG,KAAK,MAAM,EAKtD,CAAC;AAOF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAUtE"}
|
package/dest/utils/aztec.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { FunctionType, getAllFunctionAbis, loadContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
+
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { SecretValue } from '@aztec/foundation/config';
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
4
6
|
import TOML from '@iarna/toml';
|
|
5
7
|
import { readFile } from 'fs/promises';
|
|
6
|
-
import { gtr, ltr, satisfies, valid } from 'semver';
|
|
7
8
|
import { encodeArgs } from './encoding.js';
|
|
8
9
|
/**
|
|
9
10
|
* Helper to get an ABI function or throw error if it doesn't exist.
|
|
10
11
|
* @param artifact - Contract's build artifact in JSON format.
|
|
11
12
|
* @param fnName - Function name to be found.
|
|
12
13
|
* @returns The function's ABI.
|
|
13
|
-
*/ export function
|
|
14
|
-
const fn = artifact.
|
|
14
|
+
*/ export function getFunctionAbi(artifact, fnName) {
|
|
15
|
+
const fn = getAllFunctionAbis(artifact).find(({ name })=>name === fnName);
|
|
15
16
|
if (!fn) {
|
|
16
17
|
throw Error(`Function ${fnName} not found in contract ABI.`);
|
|
17
18
|
}
|
|
@@ -23,48 +24,66 @@ import { encodeArgs } from './encoding.js';
|
|
|
23
24
|
* @param chainId - The chain ID of the L1 host.
|
|
24
25
|
* @param privateKey - The private key to be used in contract deployment.
|
|
25
26
|
* @param mnemonic - The mnemonic to be used in contract deployment.
|
|
26
|
-
*/ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot,
|
|
27
|
+
*/ export async function deployAztecContracts(rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, acceleratedTestDeployments, config, existingToken, realVerifier, createVerificationJson, debugLogger) {
|
|
27
28
|
const { createEthereumChain, deployL1Contracts } = await import('@aztec/ethereum');
|
|
28
29
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
29
30
|
const account = !privateKey ? mnemonicToAccount(mnemonic, {
|
|
30
31
|
addressIndex: mnemonicIndex
|
|
31
|
-
}) : privateKeyToAccount(
|
|
32
|
+
}) : privateKeyToAccount(addLeadingHex(privateKey));
|
|
32
33
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
33
34
|
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
34
|
-
|
|
35
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
35
|
+
const result = await deployL1Contracts(chain.rpcUrls, account, chain.chainInfo, debugLogger, {
|
|
36
36
|
vkTreeRoot: getVKTreeRoot(),
|
|
37
|
-
|
|
37
|
+
protocolContractsHash,
|
|
38
38
|
genesisArchiveRoot,
|
|
39
|
-
genesisBlockHash,
|
|
40
39
|
salt,
|
|
41
40
|
initialValidators,
|
|
42
41
|
acceleratedTestDeployments,
|
|
42
|
+
feeJuicePortalInitialBalance,
|
|
43
|
+
realVerifier,
|
|
44
|
+
existingTokenAddress: existingToken,
|
|
43
45
|
...config
|
|
44
|
-
}, config);
|
|
46
|
+
}, config, createVerificationJson);
|
|
47
|
+
return result;
|
|
45
48
|
}
|
|
46
|
-
export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot,
|
|
47
|
-
const { createEthereumChain,
|
|
49
|
+
export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId, privateKey, mnemonic, mnemonicIndex, salt, initialValidators, genesisArchiveRoot, feeJuicePortalInitialBalance, config, realVerifier, createVerificationJson, logger) {
|
|
50
|
+
const { createEthereumChain, deployRollupForUpgrade, createExtendedL1Client } = await import('@aztec/ethereum');
|
|
48
51
|
const { mnemonicToAccount, privateKeyToAccount } = await import('viem/accounts');
|
|
49
52
|
const { getVKTreeRoot } = await import('@aztec/noir-protocol-circuits-types/vk-tree');
|
|
50
53
|
const account = !privateKey ? mnemonicToAccount(mnemonic, {
|
|
51
54
|
addressIndex: mnemonicIndex
|
|
52
|
-
}) : privateKeyToAccount(
|
|
55
|
+
}) : privateKeyToAccount(addLeadingHex(privateKey));
|
|
53
56
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
54
|
-
const
|
|
55
|
-
|
|
57
|
+
const client = createExtendedL1Client(rpcUrls, account, chain.chainInfo, undefined, mnemonicIndex);
|
|
58
|
+
if (!initialValidators || initialValidators.length === 0) {
|
|
59
|
+
// initialize the new rollup with Amin's validator address.
|
|
60
|
+
const aminAddressString = '0x3b218d0F26d15B36C715cB06c949210a0d630637';
|
|
61
|
+
const amin = EthAddress.fromString(aminAddressString);
|
|
62
|
+
initialValidators = [
|
|
63
|
+
{
|
|
64
|
+
attester: amin,
|
|
65
|
+
withdrawer: amin,
|
|
66
|
+
// No secrets here. The actual keys are not currently used.
|
|
67
|
+
bn254SecretKey: new SecretValue(Fr.fromHexString(aminAddressString).toBigInt())
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
logger.info('Initializing new rollup with old attesters', {
|
|
71
|
+
initialValidators
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const { rollup, slashFactoryAddress } = await deployRollupForUpgrade(client, {
|
|
56
75
|
salt,
|
|
57
76
|
vkTreeRoot: getVKTreeRoot(),
|
|
58
|
-
|
|
59
|
-
l2FeeJuiceAddress: ProtocolContractAddress.FeeJuice.toField(),
|
|
77
|
+
protocolContractsHash,
|
|
60
78
|
genesisArchiveRoot,
|
|
61
|
-
genesisBlockHash,
|
|
62
79
|
initialValidators,
|
|
80
|
+
feeJuicePortalInitialBalance,
|
|
81
|
+
realVerifier,
|
|
63
82
|
...config
|
|
64
|
-
}, registryAddress, logger, config);
|
|
83
|
+
}, registryAddress, logger, config, createVerificationJson);
|
|
65
84
|
return {
|
|
66
|
-
|
|
67
|
-
|
|
85
|
+
rollup,
|
|
86
|
+
slashFactoryAddress
|
|
68
87
|
};
|
|
69
88
|
}
|
|
70
89
|
/**
|
|
@@ -116,7 +135,7 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
|
|
|
116
135
|
* @returns Formatted contract address, function arguments and caller's aztec address.
|
|
117
136
|
*/ export async function prepTx(contractFile, functionName, _functionArgs, log) {
|
|
118
137
|
const contractArtifact = await getContractArtifact(contractFile, log);
|
|
119
|
-
const functionArtifact =
|
|
138
|
+
const functionArtifact = getFunctionAbi(contractArtifact, functionName);
|
|
120
139
|
const functionArgs = encodeArgs(_functionArgs, functionArtifact.parameters);
|
|
121
140
|
const isPrivate = functionArtifact.functionType === FunctionType.PRIVATE;
|
|
122
141
|
return {
|
|
@@ -136,6 +155,16 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
|
|
|
136
155
|
return hex;
|
|
137
156
|
};
|
|
138
157
|
/**
|
|
158
|
+
* Adds a leading 0x to a hex string. If a leading 0x is already present the string is returned unchanged.
|
|
159
|
+
* @param hex - A hex string
|
|
160
|
+
* @returns A new string with leading 0x added
|
|
161
|
+
*/ export const addLeadingHex = (hex)=>{
|
|
162
|
+
if (hex.length > 2 && hex.startsWith('0x')) {
|
|
163
|
+
return hex;
|
|
164
|
+
}
|
|
165
|
+
return `0x${hex}`;
|
|
166
|
+
};
|
|
167
|
+
/*
|
|
139
168
|
* Pretty prints Nargo.toml contents to a string
|
|
140
169
|
* @param config - Nargo.toml contents
|
|
141
170
|
* @returns The Nargo.toml contents as a string
|
|
@@ -148,27 +177,3 @@ export async function deployNewRollupContracts(registryAddress, rpcUrls, chainId
|
|
|
148
177
|
});
|
|
149
178
|
return partialToml + '\n[dependencies]\n' + dependenciesToml.join('\n') + '\n';
|
|
150
179
|
}
|
|
151
|
-
/** Mismatch between server and client versions. */ class VersionMismatchError extends Error {
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Checks that Private eXecution Environment (PXE) version matches the expected one by this CLI. Throws if not.
|
|
155
|
-
* @param pxe - PXE client.
|
|
156
|
-
* @param expectedVersionRange - Expected version by CLI.
|
|
157
|
-
*/ export async function checkServerVersion(pxe, expectedVersionRange) {
|
|
158
|
-
const serverName = 'Aztec Node';
|
|
159
|
-
const { nodeVersion } = await pxe.getNodeInfo();
|
|
160
|
-
if (!nodeVersion) {
|
|
161
|
-
throw new VersionMismatchError(`Couldn't determine ${serverName} version. You may run into issues.`);
|
|
162
|
-
}
|
|
163
|
-
if (!nodeVersion || !valid(nodeVersion)) {
|
|
164
|
-
throw new VersionMismatchError(`Missing or invalid version identifier for ${serverName} (${nodeVersion ?? 'empty'}).`);
|
|
165
|
-
} else if (!satisfies(nodeVersion, expectedVersionRange)) {
|
|
166
|
-
if (gtr(nodeVersion, expectedVersionRange)) {
|
|
167
|
-
throw new VersionMismatchError(`${serverName} is running version ${nodeVersion} which is newer than the expected by this CLI (${expectedVersionRange}). Consider upgrading your CLI to a newer version.`);
|
|
168
|
-
} else if (ltr(nodeVersion, expectedVersionRange)) {
|
|
169
|
-
throw new VersionMismatchError(`${serverName} is running version ${nodeVersion} which is older than the expected by this CLI (${expectedVersionRange}). Consider upgrading your ${serverName} to a newer version.`);
|
|
170
|
-
} else {
|
|
171
|
-
throw new VersionMismatchError(`${serverName} is running version ${nodeVersion} which does not match the expected by this CLI (${expectedVersionRange}).`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
package/dest/utils/commands.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { FunctionSelector } from '@aztec/aztec.js/abi';
|
|
2
|
-
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import { EthAddress } from '@aztec/aztec.js/eth_address';
|
|
2
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
4
3
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
-
import { LogId } from '@aztec/aztec.js/
|
|
6
|
-
import { TxHash } from '@aztec/aztec.js/
|
|
4
|
+
import { LogId } from '@aztec/aztec.js/log';
|
|
5
|
+
import { TxHash } from '@aztec/aztec.js/tx';
|
|
7
6
|
import type { LogFn } from '@aztec/foundation/log';
|
|
8
|
-
import type { PXE } from '@aztec/
|
|
7
|
+
import type { PXE } from '@aztec/pxe/server';
|
|
9
8
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
10
9
|
import { type Command, Option } from 'commander';
|
|
11
10
|
/**
|
|
@@ -14,10 +13,10 @@ import { type Command, Option } from 'commander';
|
|
|
14
13
|
*/
|
|
15
14
|
export declare const getLocalhost: () => Promise<string>;
|
|
16
15
|
export declare const LOCALHOST: string;
|
|
17
|
-
export declare const ETHEREUM_HOSTS: string, PRIVATE_KEY: string | undefined, API_KEY: string | undefined, CLI_VERSION: string | undefined;
|
|
16
|
+
export declare const ETHEREUM_HOSTS: string, PRIVATE_KEY: string | undefined, MNEMONIC: string | undefined, API_KEY: string | undefined, CLI_VERSION: string | undefined;
|
|
18
17
|
export declare function addOptions(program: Command, options: Option[]): Command;
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
18
|
+
export declare const makeNodeOption: (mandatory: boolean) => Option;
|
|
19
|
+
export declare const nodeOption: Option;
|
|
21
20
|
export declare const l1ChainIdOption: Option;
|
|
22
21
|
export declare const createSecretKeyOption: (description: string, mandatory: boolean, argsParser?: (value: string, previous: Fr) => Fr) => Option;
|
|
23
22
|
export declare const logJson: (log: LogFn) => (obj: object) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/utils/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,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GAAG,EAAE,CAMvD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,EAAE,CAMpD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,EAAE,CAyB5C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAElD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAcjE"}
|
package/dest/utils/commands.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FunctionSelector } from '@aztec/aztec.js/abi';
|
|
2
|
-
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import { EthAddress } from '@aztec/aztec.js/eth_address';
|
|
2
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
4
3
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
-
import { LogId } from '@aztec/aztec.js/
|
|
6
|
-
import { TxHash } from '@aztec/aztec.js/
|
|
4
|
+
import { LogId } from '@aztec/aztec.js/log';
|
|
5
|
+
import { TxHash } from '@aztec/aztec.js/tx';
|
|
7
6
|
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
8
7
|
import { CommanderError, InvalidArgumentError, Option } from 'commander';
|
|
9
8
|
import { lookup } from 'dns/promises';
|
|
@@ -13,13 +12,13 @@ import { rename, writeFile } from 'fs/promises';
|
|
|
13
12
|
* localhost as being host.docker.internal.
|
|
14
13
|
*/ export const getLocalhost = ()=>lookup('host.docker.internal').then(()=>'host.docker.internal').catch(()=>'localhost');
|
|
15
14
|
export const LOCALHOST = await getLocalhost();
|
|
16
|
-
export const { ETHEREUM_HOSTS = `http://${LOCALHOST}:8545`, PRIVATE_KEY, API_KEY, CLI_VERSION } = process.env;
|
|
15
|
+
export const { ETHEREUM_HOSTS = `http://${LOCALHOST}:8545`, PRIVATE_KEY, MNEMONIC, API_KEY, CLI_VERSION } = process.env;
|
|
17
16
|
export function addOptions(program, options) {
|
|
18
17
|
options.forEach((option)=>program.addOption(option));
|
|
19
18
|
return program;
|
|
20
19
|
}
|
|
21
|
-
export const
|
|
22
|
-
export const
|
|
20
|
+
export const makeNodeOption = (mandatory)=>new Option('-n, --node-url <string>', 'URL of the Aztec node').env('AZTEC_NODE_URL').default(`http://${LOCALHOST}:8080`).makeOptionMandatory(mandatory);
|
|
21
|
+
export const nodeOption = makeNodeOption(true);
|
|
23
22
|
export const l1ChainIdOption = new Option('-c, --l1-chain-id <number>', 'Chain ID of the ethereum host').env('L1_CHAIN_ID').default(31337).argParser((value)=>{
|
|
24
23
|
const parsedValue = Number(value);
|
|
25
24
|
if (isNaN(parsedValue)) {
|
|
@@ -221,7 +220,7 @@ export function parseBigint(bigint) {
|
|
|
221
220
|
}
|
|
222
221
|
try {
|
|
223
222
|
return PublicKeys.fromString(publicKey);
|
|
224
|
-
} catch
|
|
223
|
+
} catch {
|
|
225
224
|
throw new InvalidArgumentError(`Invalid public key: ${publicKey}`);
|
|
226
225
|
}
|
|
227
226
|
}
|
|
@@ -233,7 +232,7 @@ export function parseBigint(bigint) {
|
|
|
233
232
|
*/ export function parsePartialAddress(address) {
|
|
234
233
|
try {
|
|
235
234
|
return Fr.fromHexString(address);
|
|
236
|
-
} catch
|
|
235
|
+
} catch {
|
|
237
236
|
throw new InvalidArgumentError(`Invalid partial address: ${address}`);
|
|
238
237
|
}
|
|
239
238
|
}
|
|
@@ -245,7 +244,7 @@ export function parseBigint(bigint) {
|
|
|
245
244
|
*/ export function parseSecretKey(secretKey) {
|
|
246
245
|
try {
|
|
247
246
|
return Fr.fromHexString(secretKey);
|
|
248
|
-
} catch
|
|
247
|
+
} catch {
|
|
249
248
|
throw new InvalidArgumentError(`Invalid encryption secret key: ${secretKey}`);
|
|
250
249
|
}
|
|
251
250
|
}
|
|
@@ -275,7 +274,7 @@ export function parseBigint(bigint) {
|
|
|
275
274
|
return new Fr(BigInt(field.replace(/n$/, '')));
|
|
276
275
|
}
|
|
277
276
|
return new Fr(BigInt(field));
|
|
278
|
-
} catch
|
|
277
|
+
} catch {
|
|
279
278
|
throw new InvalidArgumentError(`Invalid field: ${field}`);
|
|
280
279
|
}
|
|
281
280
|
}
|
package/dest/utils/encoding.js
CHANGED
|
@@ -29,7 +29,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
29
29
|
let res;
|
|
30
30
|
try {
|
|
31
31
|
res = BigInt(arg);
|
|
32
|
-
} catch
|
|
32
|
+
} catch {
|
|
33
33
|
throw new Error(`Invalid value passed for ${name}. Could not parse ${arg} as a${kind === 'integer' ? 'n' : ''} ${kind}.`);
|
|
34
34
|
}
|
|
35
35
|
return res;
|
package/dest/utils/github.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/utils/github.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAC5C,eAAO,MAAM,WAAW,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/utils/github.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAC5C,eAAO,MAAM,WAAW,mBAAmB,CAAC"}
|
package/dest/utils/github.js
CHANGED
package/dest/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
|
package/dest/utils/index.js
CHANGED
package/dest/utils/inspect.d.ts
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import type { ContractArtifact, Fr } from '@aztec/aztec.js';
|
|
2
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
|
-
import type {
|
|
2
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
4
3
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
5
|
-
export declare function inspectBlock(
|
|
4
|
+
export declare function inspectBlock(aztecNode: AztecNode, blockNumber: number, log: LogFn, opts?: {
|
|
6
5
|
showTxs?: boolean;
|
|
7
6
|
}): Promise<void>;
|
|
8
|
-
export declare function inspectTx(
|
|
7
|
+
export declare function inspectTx(aztecNode: AztecNode, txHash: TxHash, log: LogFn, opts?: {
|
|
9
8
|
includeBlockInfo?: boolean;
|
|
10
|
-
artifactMap?: ArtifactMap;
|
|
11
9
|
}): Promise<void>;
|
|
12
|
-
type ArtifactMap = Record<string, ContractArtifactWithClassId>;
|
|
13
|
-
type ContractArtifactWithClassId = ContractArtifact & {
|
|
14
|
-
classId: Fr;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
17
10
|
//# sourceMappingURL=inspect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/utils/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/utils/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,wBAAsB,YAAY,CAChC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,EACV,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,iBA0BjC;AAED,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,KAAK,EACV,IAAI,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,iBAmE1C"}
|
package/dest/utils/inspect.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { NoteStatus } from '@aztec/stdlib/note';
|
|
4
|
-
export async function inspectBlock(pxe, blockNumber, log, opts = {}) {
|
|
5
|
-
const block = await pxe.getBlock(blockNumber);
|
|
1
|
+
export async function inspectBlock(aztecNode, blockNumber, log, opts = {}) {
|
|
2
|
+
const block = await aztecNode.getBlock(blockNumber);
|
|
6
3
|
if (!block) {
|
|
7
4
|
log(`No block found for block number ${blockNumber}`);
|
|
8
5
|
return;
|
|
@@ -11,31 +8,25 @@ export async function inspectBlock(pxe, blockNumber, log, opts = {}) {
|
|
|
11
8
|
log(`Block ${blockNumber} (${blockHash.toString()})`);
|
|
12
9
|
log(` Total fees: ${block.header.totalFees.toBigInt()}`);
|
|
13
10
|
log(` Total mana used: ${block.header.totalManaUsed.toBigInt()}`);
|
|
14
|
-
log(` Fee per gas unit: DA=${block.header.globalVariables.gasFees.feePerDaGas
|
|
11
|
+
log(` Fee per gas unit: DA=${block.header.globalVariables.gasFees.feePerDaGas} L2=${block.header.globalVariables.gasFees.feePerL2Gas}`);
|
|
15
12
|
log(` Coinbase: ${block.header.globalVariables.coinbase}`);
|
|
16
13
|
log(` Fee recipient: ${block.header.globalVariables.feeRecipient}`);
|
|
17
|
-
log(` Timestamp: ${new Date(block.header.globalVariables.timestamp
|
|
14
|
+
log(` Timestamp: ${new Date(Number(block.header.globalVariables.timestamp) * 500)}`);
|
|
18
15
|
if (opts.showTxs) {
|
|
19
16
|
log(``);
|
|
20
|
-
const artifactMap = await getKnownArtifacts(pxe);
|
|
21
17
|
for (const txHash of block.body.txEffects.map((tx)=>tx.txHash)){
|
|
22
|
-
await inspectTx(
|
|
23
|
-
includeBlockInfo: false
|
|
24
|
-
artifactMap
|
|
18
|
+
await inspectTx(aztecNode, txHash, log, {
|
|
19
|
+
includeBlockInfo: false
|
|
25
20
|
});
|
|
26
21
|
}
|
|
27
22
|
} else {
|
|
28
23
|
log(` Transactions: ${block.body.txEffects.length}`);
|
|
29
24
|
}
|
|
30
25
|
}
|
|
31
|
-
export async function inspectTx(
|
|
32
|
-
const [receipt, effectsInBlock
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
pxe.getNotes({
|
|
36
|
-
txHash,
|
|
37
|
-
status: NoteStatus.ACTIVE_OR_NULLIFIED
|
|
38
|
-
})
|
|
26
|
+
export async function inspectTx(aztecNode, txHash, log, opts = {}) {
|
|
27
|
+
const [receipt, effectsInBlock] = await Promise.all([
|
|
28
|
+
aztecNode.getTxReceipt(txHash),
|
|
29
|
+
aztecNode.getTxEffect(txHash)
|
|
39
30
|
]);
|
|
40
31
|
// Base tx data
|
|
41
32
|
log(`Tx ${txHash.toString()}`);
|
|
@@ -47,7 +38,6 @@ export async function inspectTx(pxe, txHash, log, opts = {}) {
|
|
|
47
38
|
return;
|
|
48
39
|
}
|
|
49
40
|
const effects = effectsInBlock.data;
|
|
50
|
-
const artifactMap = opts?.artifactMap ?? await getKnownArtifacts(pxe);
|
|
51
41
|
if (opts.includeBlockInfo) {
|
|
52
42
|
log(` Block: ${receipt.blockNumber} (${receipt.blockHash?.toString()})`);
|
|
53
43
|
}
|
|
@@ -74,39 +64,17 @@ export async function inspectTx(pxe, txHash, log, opts = {}) {
|
|
|
74
64
|
const notes = effects.noteHashes;
|
|
75
65
|
if (notes.length > 0) {
|
|
76
66
|
log(' Created notes:');
|
|
77
|
-
log(` Total: ${notes.length}
|
|
78
|
-
|
|
79
|
-
log(
|
|
80
|
-
for (const note of getNotes){
|
|
81
|
-
inspectNote(note, artifactMap, log);
|
|
82
|
-
}
|
|
67
|
+
log(` Total: ${notes.length}`);
|
|
68
|
+
for (const note of notes){
|
|
69
|
+
log(` Note hash: ${note.toShortString()}`);
|
|
83
70
|
}
|
|
84
71
|
}
|
|
85
|
-
//
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const [note] = await pxe.getNotes({
|
|
92
|
-
siloedNullifier: nullifier
|
|
93
|
-
});
|
|
94
|
-
const deployed = deployNullifiers[nullifier.toString()];
|
|
95
|
-
const initialized = initNullifiers[nullifier.toString()];
|
|
96
|
-
const registered = classNullifiers[nullifier.toString()];
|
|
97
|
-
if (nullifier.toBuffer().equals(txHash.toBuffer())) {
|
|
98
|
-
log(` Transaction hash nullifier ${nullifier.toShortString()}`);
|
|
99
|
-
} else if (note) {
|
|
100
|
-
inspectNote(note, artifactMap, log, `Nullifier ${nullifier.toShortString()} for note`);
|
|
101
|
-
} else if (deployed) {
|
|
102
|
-
log(` Contract ${toFriendlyAddress(deployed, artifactMap)} deployed via nullifier ${nullifier.toShortString()}`);
|
|
103
|
-
} else if (initialized) {
|
|
104
|
-
log(` Contract ${toFriendlyAddress(initialized, artifactMap)} initialized via nullifier ${nullifier.toShortString()}`);
|
|
105
|
-
} else if (registered) {
|
|
106
|
-
log(` Class ${registered} registered via nullifier ${nullifier.toShortString()}`);
|
|
107
|
-
} else {
|
|
108
|
-
log(` Unknown nullifier ${nullifier.toString()}`);
|
|
109
|
-
}
|
|
72
|
+
// Created nullifiers
|
|
73
|
+
const nullifiers = effects.nullifiers;
|
|
74
|
+
if (nullifiers.length > 0) {
|
|
75
|
+
log(' Created nullifiers:');
|
|
76
|
+
for (const nullifier of nullifiers){
|
|
77
|
+
log(` Nullifier: ${nullifier.toShortString()}`);
|
|
110
78
|
}
|
|
111
79
|
}
|
|
112
80
|
// L2 to L1 messages
|
|
@@ -117,61 +85,3 @@ export async function inspectTx(pxe, txHash, log, opts = {}) {
|
|
|
117
85
|
}
|
|
118
86
|
}
|
|
119
87
|
}
|
|
120
|
-
function inspectNote(note, artifactMap, log, text = 'Note') {
|
|
121
|
-
const artifact = artifactMap[note.contractAddress.toString()];
|
|
122
|
-
const contract = artifact?.name ?? note.contractAddress.toString();
|
|
123
|
-
const type = artifact?.notes[note.noteTypeId.toString()]?.typ ?? note.noteTypeId.toField().toShortString();
|
|
124
|
-
log(` ${text} type ${type} at ${contract}`);
|
|
125
|
-
log(` Owner: ${toFriendlyAddress(note.owner, artifactMap)}`);
|
|
126
|
-
for (const field of note.note.items){
|
|
127
|
-
log(` ${field.toString()}`);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function toFriendlyAddress(address, artifactMap) {
|
|
131
|
-
const artifact = artifactMap[address.toString()];
|
|
132
|
-
if (!artifact) {
|
|
133
|
-
return address.toString();
|
|
134
|
-
}
|
|
135
|
-
return `${artifact.name}<${address.toString()}>`;
|
|
136
|
-
}
|
|
137
|
-
async function getKnownNullifiers(pxe, artifactMap) {
|
|
138
|
-
const knownContracts = await pxe.getContracts();
|
|
139
|
-
const deployerAddress = ProtocolContractAddress.ContractInstanceDeployer;
|
|
140
|
-
const registererAddress = ProtocolContractAddress.ContractClassRegisterer;
|
|
141
|
-
const initNullifiers = {};
|
|
142
|
-
const deployNullifiers = {};
|
|
143
|
-
const classNullifiers = {};
|
|
144
|
-
for (const contract of knownContracts){
|
|
145
|
-
initNullifiers[siloNullifier(contract, contract.toField()).toString()] = contract;
|
|
146
|
-
deployNullifiers[siloNullifier(deployerAddress, contract.toField()).toString()] = contract;
|
|
147
|
-
}
|
|
148
|
-
for (const artifact of Object.values(artifactMap)){
|
|
149
|
-
classNullifiers[siloNullifier(registererAddress, artifact.classId).toString()] = `${artifact.name}Class<${artifact.classId}>`;
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
initNullifiers,
|
|
153
|
-
deployNullifiers,
|
|
154
|
-
classNullifiers
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
async function getKnownArtifacts(pxe) {
|
|
158
|
-
const knownContractAddresses = await pxe.getContracts();
|
|
159
|
-
const knownContracts = (await Promise.all(knownContractAddresses.map((contractAddress)=>pxe.getContractMetadata(contractAddress)))).map((contractMetadata)=>contractMetadata.contractInstance);
|
|
160
|
-
const classIds = [
|
|
161
|
-
...new Set(knownContracts.map((contract)=>contract?.currentContractClassId))
|
|
162
|
-
];
|
|
163
|
-
const knownArtifacts = (await Promise.all(classIds.map((classId)=>classId ? pxe.getContractClassMetadata(classId) : undefined))).map((contractClassMetadata)=>contractClassMetadata ? {
|
|
164
|
-
...contractClassMetadata.artifact,
|
|
165
|
-
classId: contractClassMetadata.contractClass?.id
|
|
166
|
-
} : undefined);
|
|
167
|
-
const map = {};
|
|
168
|
-
for (const instance of knownContracts){
|
|
169
|
-
if (instance) {
|
|
170
|
-
const artifact = knownArtifacts.find((a)=>a?.classId?.equals(instance.currentContractClassId));
|
|
171
|
-
if (artifact) {
|
|
172
|
-
map[instance.address.toString()] = artifact;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return map;
|
|
177
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup_contracts.d.ts","sourceRoot":"","sources":["../../src/utils/setup_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAY9D,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,YAAY,CAAC,CAMpE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import { SPONSORED_FPC_SALT } from '@aztec/constants';
|
|
4
|
+
async function getSponsoredFPCContract() {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
|
+
// @ts-ignore - Importing noir-contracts.js even in devDeps results in a circular dependency error. Need to ignore because this line doesn't cause an error in a dev environment
|
|
7
|
+
const { SponsoredFPCContract } = await import('@aztec/noir-contracts.js/SponsoredFPC');
|
|
8
|
+
return SponsoredFPCContract;
|
|
9
|
+
}
|
|
10
|
+
export async function getSponsoredFPCAddress() {
|
|
11
|
+
const SponsoredFPCContract = await getSponsoredFPCContract();
|
|
12
|
+
const sponsoredFPCInstance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
13
|
+
salt: new Fr(SPONSORED_FPC_SALT)
|
|
14
|
+
});
|
|
15
|
+
return sponsoredFPCInstance.address;
|
|
16
|
+
}
|