CLI param default config path improvements (#2923)

### Description

- Use default config paths in more places
- Reorder some command args for clarity in help text
- Bump versions to 3.1.3
pull/2733/head
J M Rossy 1 year ago committed by GitHub
parent cb93eb63f5
commit 66d064a324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      solidity/package.json
  2. 6
      typescript/cli/ci-test-docker.sh
  3. 6
      typescript/cli/ci-test.sh
  4. 4
      typescript/cli/package.json
  5. 20
      typescript/cli/src/commands/config.ts
  6. 21
      typescript/cli/src/commands/deploy.ts
  7. 4
      typescript/cli/src/commands/options.ts
  8. 4
      typescript/cli/src/commands/send.ts
  9. 4
      typescript/cli/src/commands/status.ts
  10. 6
      typescript/cli/src/config/chain.ts
  11. 4
      typescript/cli/src/config/hooks.ts
  12. 4
      typescript/cli/src/config/multisig.ts
  13. 4
      typescript/cli/src/config/warp.ts
  14. 6
      typescript/cli/src/context.ts
  15. 2
      typescript/cli/src/deploy/core.ts
  16. 6
      typescript/helloworld/package.json
  17. 6
      typescript/infra/package.json
  18. 6
      typescript/sdk/package.json
  19. 2
      typescript/utils/package.json
  20. 26
      yarn.lock

@ -1,10 +1,10 @@
{
"name": "@hyperlane-xyz/core",
"description": "Core solidity contracts for Hyperlane",
"version": "3.1.2",
"version": "3.1.3",
"dependencies": {
"@eth-optimism/contracts": "^0.6.0",
"@hyperlane-xyz/utils": "3.1.2",
"@hyperlane-xyz/utils": "3.1.3",
"@openzeppelin/contracts": "^4.9.3",
"@openzeppelin/contracts-upgradeable": "^v4.9.3"
},

@ -25,12 +25,12 @@ export DEBUG=hyperlane:*
echo "Deploying contracts to anvil1 and anvil2"
yarn workspace @hyperlane-xyz/cli run hyperlane deploy core \
--chain-configs ./examples/anvil-chains.yaml \
--chains anvil1,anvil2 \
--targets anvil1,anvil2 \
--chains ./examples/anvil-chains.yaml \
--artifacts /tmp/empty-artifacts.json \
--out /tmp \
--ism ./examples/multisig-ism.yaml \
--hook ./examples/hook-config.yaml \
--out /tmp \
--key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--yes

@ -33,12 +33,12 @@ BEFORE=$(cast balance $DEPLOYER --rpc-url http://localhost:8545)
echo "Deploying contracts to anvil1 and anvil2"
yarn workspace @hyperlane-xyz/cli run hyperlane deploy core \
--chain-configs ./examples/anvil-chains.yaml \
--chains anvil1,anvil2 \
--targets anvil1,anvil2 \
--chains ./examples/anvil-chains.yaml \
--artifacts /tmp/empty-artifacts.json \
--out /tmp \
--ism ./examples/multisig-ism.yaml \
--hook ./examples/hook-config.yaml \
--out /tmp \
--key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--yes

@ -1,9 +1,9 @@
{
"name": "@hyperlane-xyz/cli",
"version": "3.1.2",
"version": "3.1.3",
"description": "A command-line utility for common Hyperlane operations",
"dependencies": {
"@hyperlane-xyz/sdk": "3.1.2",
"@hyperlane-xyz/sdk": "3.1.3",
"@inquirer/prompts": "^3.0.0",
"bignumber.js": "^9.1.1",
"chalk": "^5.3.0",

@ -1,7 +1,7 @@
import { CommandModule } from 'yargs';
import { log, logGreen } from '../../logger.js';
import { createChainConfig, readChainConfig } from '../config/chain.js';
import { createChainConfig, readChainConfigs } from '../config/chain.js';
import { createHookConfig } from '../config/hooks.js';
import {
createMultisigConfig,
@ -39,21 +39,21 @@ const createCommand: CommandModule = {
describe: 'Create a new Hyperlane config',
builder: (yargs) =>
yargs
.command(createChainCommand)
.command(createMultisigCommand)
.command(createChainConfigCommand)
.command(createMultisigConfigCommand)
.command(createHookConfigCommand)
.command(createWarpCommand)
.command(createWarpConfigCommand)
.version(false)
.demandCommand(),
handler: () => log('Command required'),
};
const createChainCommand: CommandModule = {
const createChainConfigCommand: CommandModule = {
command: 'chain',
describe: 'Create a new, minimal Hyperlane chain config (aka chain metadata)',
builder: (yargs) =>
yargs.options({
output: outputFileOption('./configs/chain-config.yaml'),
output: outputFileOption('./configs/chains.yaml'),
format: fileFormatOption,
}),
handler: async (argv: any) => {
@ -64,7 +64,7 @@ const createChainCommand: CommandModule = {
},
};
const createMultisigCommand: CommandModule = {
const createMultisigConfigCommand: CommandModule = {
command: 'multisig',
describe: 'Create a new Multisig ISM config',
builder: (yargs) =>
@ -87,7 +87,7 @@ const createHookConfigCommand: CommandModule = {
describe: 'Create a new Hook config',
builder: (yargs) =>
yargs.options({
output: outputFileOption('./configs/hook-config.yaml'),
output: outputFileOption('./configs/hooks.yaml'),
format: fileFormatOption,
chains: chainsCommandOption,
}),
@ -100,7 +100,7 @@ const createHookConfigCommand: CommandModule = {
},
};
const createWarpCommand: CommandModule = {
const createWarpConfigCommand: CommandModule = {
command: 'warp',
describe: 'Create a new Warp Route tokens config',
builder: (yargs) =>
@ -147,7 +147,7 @@ const validateChainCommand: CommandModule = {
}),
handler: async (argv) => {
const path = argv.path as string;
readChainConfig(path);
readChainConfigs(path);
process.exit(0);
},
};

@ -35,14 +35,12 @@ const coreCommand: CommandModule = {
describe: 'Deploy core Hyperlane contracts',
builder: (yargs) =>
yargs.options({
key: keyCommandOption,
'chain-configs': chainsCommandOption,
chains: {
targets: {
type: 'string',
description:
'Comma separated list of chain names to which contracts will be deployed',
},
out: outDirCommandOption,
chains: chainsCommandOption,
artifacts: coreArtifactsOption,
ism: {
type: 'string',
@ -54,15 +52,17 @@ const coreCommand: CommandModule = {
description:
'A path to a JSON or YAML file with Hook configs (for every chain)',
},
out: outDirCommandOption,
key: keyCommandOption,
yes: skipConfirmationOption,
}),
handler: async (argv: any) => {
logGray('Hyperlane permissionless core deployment');
logGray('----------------------------------------');
const key: string = argv.key || process.env.HYP_KEY;
const chainConfigPath: string = argv['chain-configs'];
const chainConfigPath: string = argv.chains;
const outPath: string = argv.out;
const chains: string[] | undefined = argv.chains
const chains: string[] | undefined = argv.targets
?.split(',')
.map((r: string) => r.trim());
const artifactsPath: string = argv.artifacts;
@ -91,14 +91,15 @@ const warpCommand: CommandModule = {
describe: 'Deploy Warp Route contracts',
builder: (yargs) =>
yargs.options({
key: keyCommandOption,
chains: chainsCommandOption,
out: outDirCommandOption,
core: coreArtifactsOption,
config: {
type: 'string',
description: 'A path to a JSON or YAML file with a warp config.',
default: './configs/warp-tokens.yaml',
},
core: coreArtifactsOption,
chains: chainsCommandOption,
out: outDirCommandOption,
key: keyCommandOption,
yes: skipConfirmationOption,
}),
handler: async (argv: any) => {

@ -11,8 +11,8 @@ export const keyCommandOption: Options = {
export const chainsCommandOption: Options = {
type: 'string',
description: 'A path to a JSON or YAML file with chain configs',
default: './configs/chain-config.yaml',
alias: 'cc',
default: './configs/chains.yaml',
alias: 'c',
};
export const outDirCommandOption: Options = {

@ -32,8 +32,6 @@ export const sendCommand: CommandModule = {
*/
const messageOptions: { [k: string]: Options } = {
key: keyCommandOption,
chains: chainsCommandOption,
core: coreArtifactsOption,
origin: {
type: 'string',
description: 'Origin chain to send message from',
@ -44,6 +42,8 @@ const messageOptions: { [k: string]: Options } = {
description: 'Destination chain to send message to',
demandOption: true,
},
core: coreArtifactsOption,
chains: chainsCommandOption,
timeout: {
type: 'number',
description: 'Timeout in seconds',

@ -9,8 +9,6 @@ export const statusCommand: CommandModule = {
describe: 'Check status of a message',
builder: (yargs) =>
yargs.options({
chains: chainsCommandOption,
core: coreArtifactsOption,
id: {
type: 'string',
description: 'Message ID',
@ -21,6 +19,8 @@ export const statusCommand: CommandModule = {
description: 'Destination chain name',
demandOption: true,
},
chains: chainsCommandOption,
core: coreArtifactsOption,
}),
handler: async (argv: any) => {
const chainConfigPath: string = argv.chains;

@ -12,7 +12,7 @@ import { errorRed, log, logBlue, logGreen } from '../../logger.js';
import { getMultiProvider } from '../context.js';
import { FileFormat, mergeYamlOrJson, readYamlOrJson } from '../utils/files.js';
export function readChainConfig(filePath: string) {
export function readChainConfigs(filePath: string) {
log(`Reading file configs in ${filePath}`);
const chainToMetadata = readYamlOrJson<ChainMap<ChainMetadata>>(filePath);
@ -47,12 +47,12 @@ export function readChainConfig(filePath: string) {
return chainToMetadata;
}
export function readChainConfigIfExists(filePath: string) {
export function readChainConfigsIfExists(filePath: string) {
if (!fs.existsSync(filePath)) {
log('No chain config file provided');
return {};
} else {
return readChainConfig(filePath);
return readChainConfigs(filePath);
}
}

@ -27,7 +27,7 @@ import { errorRed, log, logBlue, logGreen, logRed } from '../../logger.js';
import { runMultiChainSelectionStep } from '../utils/chains.js';
import { FileFormat, mergeYamlOrJson, readYamlOrJson } from '../utils/files.js';
import { readChainConfigIfExists } from './chain.js';
import { readChainConfigsIfExists } from './chain.js';
const ProtocolFeeSchema = z.object({
type: z.literal(HookType.PROTOCOL_FEE),
@ -151,7 +151,7 @@ export async function createHookConfig({
chainConfigPath: string;
}) {
logBlue('Creating a new hook config');
const customChains = readChainConfigIfExists(chainConfigPath);
const customChains = readChainConfigsIfExists(chainConfigPath);
const chains = await runMultiChainSelectionStep(customChains);
const result: HookConfigMap = {};

@ -8,7 +8,7 @@ import { errorRed, log, logBlue, logGreen } from '../../logger.js';
import { runMultiChainSelectionStep } from '../utils/chains.js';
import { FileFormat, mergeYamlOrJson, readYamlOrJson } from '../utils/files.js';
import { readChainConfigIfExists } from './chain.js';
import { readChainConfigsIfExists } from './chain.js';
const MultisigConfigMapSchema = z.object({}).catchall(
z.object({
@ -58,7 +58,7 @@ export async function createMultisigConfig({
chainConfigPath: string;
}) {
logBlue('Creating a new multisig config');
const customChains = readChainConfigIfExists(chainConfigPath);
const customChains = readChainConfigsIfExists(chainConfigPath);
const chains = await runMultiChainSelectionStep(customChains);
const result: MultisigConfigMap = {};

@ -11,7 +11,7 @@ import {
} from '../utils/chains.js';
import { FileFormat, readYamlOrJson, writeYamlOrJson } from '../utils/files.js';
import { readChainConfigIfExists } from './chain.js';
import { readChainConfigsIfExists } from './chain.js';
const ConnectionConfigSchema = {
mailbox: z.string().optional(),
@ -78,7 +78,7 @@ export async function createWarpConfig({
chainConfigPath: string;
}) {
logBlue('Creating a new warp route config');
const customChains = readChainConfigIfExists(chainConfigPath);
const customChains = readChainConfigsIfExists(chainConfigPath);
const baseChain = await runSingleChainSelectionStep(
customChains,
'Select base chain with the original token to warp',

@ -10,7 +10,7 @@ import {
} from '@hyperlane-xyz/sdk';
import { objMerge } from '@hyperlane-xyz/utils';
import { readChainConfigIfExists } from './config/chain.js';
import { readChainConfigsIfExists } from './config/chain.js';
import { keyToSigner } from './utils/keys.js';
export const sdkContractAddressesMap = {
@ -28,14 +28,14 @@ export function getMergedContractAddresses(
}
export function getContext(chainConfigPath: string) {
const customChains = readChainConfigIfExists(chainConfigPath);
const customChains = readChainConfigsIfExists(chainConfigPath);
const multiProvider = getMultiProvider(customChains);
return { customChains, multiProvider };
}
export function getContextWithSigner(key: string, chainConfigPath: string) {
const signer = keyToSigner(key);
const customChains = readChainConfigIfExists(chainConfigPath);
const customChains = readChainConfigsIfExists(chainConfigPath);
const multiProvider = getMultiProvider(customChains, signer);
return { signer, customChains, multiProvider };
}

@ -176,7 +176,7 @@ async function runHookStep(
_selectedChains: ChainName[],
hookConfigPath?: string,
) {
if ('TODO: Skip this step for now as values are unsused') return;
if ('TODO: Skip this step for now as values are unused') return;
// const presetConfigChains = Object.keys(presetHookConfigs);

@ -1,10 +1,10 @@
{
"name": "@hyperlane-xyz/helloworld",
"description": "A basic skeleton of an Hyperlane app",
"version": "3.1.2",
"version": "3.1.3",
"dependencies": {
"@hyperlane-xyz/core": "3.1.2",
"@hyperlane-xyz/sdk": "3.1.2",
"@hyperlane-xyz/core": "3.1.3",
"@hyperlane-xyz/sdk": "3.1.3",
"@openzeppelin/contracts-upgradeable": "^4.9.3",
"ethers": "^5.7.2"
},

@ -11,9 +11,9 @@
"@ethersproject/experimental": "^5.7.0",
"@ethersproject/hardware-wallets": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@hyperlane-xyz/helloworld": "3.1.2",
"@hyperlane-xyz/sdk": "3.1.2",
"@hyperlane-xyz/utils": "3.1.2",
"@hyperlane-xyz/helloworld": "3.1.3",
"@hyperlane-xyz/sdk": "3.1.3",
"@hyperlane-xyz/utils": "3.1.3",
"@nomiclabs/hardhat-etherscan": "^3.0.3",
"@safe-global/api-kit": "^1.3.0",
"@safe-global/protocol-kit": "^1.2.0",

@ -1,12 +1,12 @@
{
"name": "@hyperlane-xyz/sdk",
"description": "The official SDK for the Hyperlane Network",
"version": "3.1.2",
"version": "3.1.3",
"dependencies": {
"@cosmjs/cosmwasm-stargate": "^0.31.3",
"@cosmjs/stargate": "^0.31.3",
"@hyperlane-xyz/core": "3.1.2",
"@hyperlane-xyz/utils": "3.1.2",
"@hyperlane-xyz/core": "3.1.3",
"@hyperlane-xyz/utils": "3.1.3",
"@solana/spl-token": "^0.3.8",
"@solana/web3.js": "^1.78.0",
"@types/coingecko-api": "^1.0.10",

@ -1,7 +1,7 @@
{
"name": "@hyperlane-xyz/utils",
"description": "General utilities and types for the Hyperlane network",
"version": "3.1.2",
"version": "3.1.3",
"dependencies": {
"@cosmjs/encoding": "^0.31.3",
"@solana/web3.js": "^1.78.0",

@ -3978,7 +3978,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hyperlane-xyz/cli@workspace:typescript/cli"
dependencies:
"@hyperlane-xyz/sdk": "npm:3.1.2"
"@hyperlane-xyz/sdk": "npm:3.1.3"
"@inquirer/prompts": "npm:^3.0.0"
"@types/node": "npm:^18.14.5"
"@types/yargs": "npm:^17.0.24"
@ -3999,12 +3999,12 @@ __metadata:
languageName: unknown
linkType: soft
"@hyperlane-xyz/core@npm:3.1.2, @hyperlane-xyz/core@workspace:solidity":
"@hyperlane-xyz/core@npm:3.1.3, @hyperlane-xyz/core@workspace:solidity":
version: 0.0.0-use.local
resolution: "@hyperlane-xyz/core@workspace:solidity"
dependencies:
"@eth-optimism/contracts": "npm:^0.6.0"
"@hyperlane-xyz/utils": "npm:3.1.2"
"@hyperlane-xyz/utils": "npm:3.1.3"
"@nomiclabs/hardhat-ethers": "npm:^2.2.1"
"@nomiclabs/hardhat-waffle": "npm:^2.0.6"
"@openzeppelin/contracts": "npm:^4.9.3"
@ -4031,12 +4031,12 @@ __metadata:
languageName: unknown
linkType: soft
"@hyperlane-xyz/helloworld@npm:3.1.2, @hyperlane-xyz/helloworld@workspace:typescript/helloworld":
"@hyperlane-xyz/helloworld@npm:3.1.3, @hyperlane-xyz/helloworld@workspace:typescript/helloworld":
version: 0.0.0-use.local
resolution: "@hyperlane-xyz/helloworld@workspace:typescript/helloworld"
dependencies:
"@hyperlane-xyz/core": "npm:3.1.2"
"@hyperlane-xyz/sdk": "npm:3.1.2"
"@hyperlane-xyz/core": "npm:3.1.3"
"@hyperlane-xyz/sdk": "npm:3.1.3"
"@nomiclabs/hardhat-ethers": "npm:^2.2.1"
"@nomiclabs/hardhat-waffle": "npm:^2.0.6"
"@openzeppelin/contracts-upgradeable": "npm:^4.9.3"
@ -4081,9 +4081,9 @@ __metadata:
"@ethersproject/experimental": "npm:^5.7.0"
"@ethersproject/hardware-wallets": "npm:^5.7.0"
"@ethersproject/providers": "npm:^5.7.2"
"@hyperlane-xyz/helloworld": "npm:3.1.2"
"@hyperlane-xyz/sdk": "npm:3.1.2"
"@hyperlane-xyz/utils": "npm:3.1.2"
"@hyperlane-xyz/helloworld": "npm:3.1.3"
"@hyperlane-xyz/sdk": "npm:3.1.3"
"@hyperlane-xyz/utils": "npm:3.1.3"
"@nomiclabs/hardhat-ethers": "npm:^2.2.1"
"@nomiclabs/hardhat-etherscan": "npm:^3.0.3"
"@nomiclabs/hardhat-waffle": "npm:^2.0.6"
@ -4130,14 +4130,14 @@ __metadata:
languageName: unknown
linkType: soft
"@hyperlane-xyz/sdk@npm:3.1.2, @hyperlane-xyz/sdk@workspace:typescript/sdk":
"@hyperlane-xyz/sdk@npm:3.1.3, @hyperlane-xyz/sdk@workspace:typescript/sdk":
version: 0.0.0-use.local
resolution: "@hyperlane-xyz/sdk@workspace:typescript/sdk"
dependencies:
"@cosmjs/cosmwasm-stargate": "npm:^0.31.3"
"@cosmjs/stargate": "npm:^0.31.3"
"@hyperlane-xyz/core": "npm:3.1.2"
"@hyperlane-xyz/utils": "npm:3.1.2"
"@hyperlane-xyz/core": "npm:3.1.3"
"@hyperlane-xyz/utils": "npm:3.1.3"
"@nomiclabs/hardhat-ethers": "npm:^2.2.1"
"@nomiclabs/hardhat-waffle": "npm:^2.0.6"
"@solana/spl-token": "npm:^0.3.8"
@ -4173,7 +4173,7 @@ __metadata:
languageName: unknown
linkType: soft
"@hyperlane-xyz/utils@npm:3.1.2, @hyperlane-xyz/utils@workspace:typescript/utils":
"@hyperlane-xyz/utils@npm:3.1.3, @hyperlane-xyz/utils@workspace:typescript/utils":
version: 0.0.0-use.local
resolution: "@hyperlane-xyz/utils@workspace:typescript/utils"
dependencies:

Loading…
Cancel
Save