Skip to content

Commit

Permalink
feat(cli): merge in cli-2.0 (v4.0.0) (#3981)
Browse files Browse the repository at this point in the history
CLI v4.0.0
  • Loading branch information
paulbalaji authored Jun 27, 2024
2 parents 44cc9bf + 653bbcf commit 892efd4
Show file tree
Hide file tree
Showing 169 changed files with 7,344 additions and 2,975 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-emus-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': patch
---

Removes default pattern for chain name when creating a new chain.
6 changes: 6 additions & 0 deletions .changeset/calm-eels-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Gracefully handle RPC failures during warp send & fix deriving hook error that prevents warp and core test messages on the cli.
6 changes: 6 additions & 0 deletions .changeset/clean-bees-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Use metadata builders in message relaying
5 changes: 5 additions & 0 deletions .changeset/five-baboons-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': minor
---

Add EvmWarpModule with create()
5 changes: 5 additions & 0 deletions .changeset/five-owls-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperlane-xyz/cli": patch
---

Add xerc20 limit lookups to warp read
5 changes: 5 additions & 0 deletions .changeset/giant-lies-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Rename hyperlane config create chain -> hyperlane registry init. Rename all `configure` to `init`
5 changes: 5 additions & 0 deletions .changeset/hip-melons-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Add a validator preFlightCheck command verifying that the validator has been announced for a given chain
6 changes: 6 additions & 0 deletions .changeset/late-rings-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': patch
'@hyperlane-xyz/sdk': patch
---

Adds deployment support for IsmConfig within a WarpRouteConfig
5 changes: 5 additions & 0 deletions .changeset/lovely-boxes-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Add command to support creating agent configs
7 changes: 7 additions & 0 deletions .changeset/mean-books-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@hyperlane-xyz/cli": minor
"@hyperlane-xyz/helloworld": minor
"@hyperlane-xyz/infra": minor
---

feat(cli): add `warp --symbol` flag
5 changes: 5 additions & 0 deletions .changeset/new-taxis-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Reintroduce `ism read` and `hook read` commands
5 changes: 5 additions & 0 deletions .changeset/new-timers-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Add chain displayName prompt with default
5 changes: 5 additions & 0 deletions .changeset/sharp-geckos-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Fix createDefaultWarpIsmConfig to default to trusted relayer and fallback routing without prompts
5 changes: 5 additions & 0 deletions .changeset/shiny-cups-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': minor
---

Add logic to set smart provider log level to disable provider logs during Warp TokenType derive
6 changes: 6 additions & 0 deletions .changeset/shy-countries-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/sdk': minor
---

- Enables creation of new Hooks through the `EvmHookModule`.
- Introduces an `EvmModuleDeployer` to perform the barebones tasks of deploying contracts/proxies.
6 changes: 6 additions & 0 deletions .changeset/slimy-toys-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Implement hyperlane warp deploy
5 changes: 5 additions & 0 deletions .changeset/slimy-ways-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': major
---

Release CLI v4.0.0.
5 changes: 5 additions & 0 deletions .changeset/sour-squids-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Updates ci-test.sh to ci-advanced-test.sh.
5 changes: 5 additions & 0 deletions .changeset/wise-cobras-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': minor
---

Add stdout.rows to pagesize calculation with DEFAULT_PAGE_SIZE
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"no-extra-boolean-cast": ["error"],
"no-ex-assign": ["error"],
"no-constant-condition": ["off"],
"no-return-await": ["error"],
"guard-for-in": ["error"],
"@typescript-eslint/ban-ts-comment": ["off"],
"@typescript-eslint/explicit-module-boundary-types": ["off"],
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-skipped.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Instant pass
run: echo "e2e job passed"

cli-e2e:
cli-advanced-e2e:
runs-on: ubuntu-latest
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'main') || github.event_name == 'merge_group'
strategy:
Expand All @@ -81,7 +81,7 @@ jobs:
- test-type: pi_with_core_chain
steps:
- name: Instant pass
run: echo "cli-e2e job passed"
run: echo "cli-advanced-e2e job passed"

env-test:
runs-on: ubuntu-latest
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: test

on:
# Triggers the workflow on push or pull request against main
# Triggers the workflow on pushes to main branch
push:
branches: [main]
paths-ignore:
- '*.md'
# Triggers on pull requests ignoring md files
pull_request:
branches:
- '*' # run against all branches
Expand Down Expand Up @@ -187,7 +188,7 @@ jobs:
e2e-matrix:
runs-on: larger-runner
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'main') || github.event_name == 'merge_group'
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'main' || github.base_ref == 'cli-2.0') || github.event_name == 'merge_group'
needs: [yarn-build]
strategy:
matrix:
Expand Down Expand Up @@ -281,7 +282,7 @@ jobs:
prebuild-cli-e2e:
runs-on: larger-runner
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'main') || github.event_name == 'merge_group'
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'main' || github.base_ref == 'cli-2.0') || github.event_name == 'merge_group'
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -328,9 +329,9 @@ jobs:
env:
RUST_BACKTRACE: 'full'

cli-e2e:
cli-advanced-e2e:
runs-on: larger-runner
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'main') || github.event_name == 'merge_group'
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'main' || github.base_ref == 'cli-2.0') || github.event_name == 'merge_group'
needs: [yarn-build, prebuild-cli-e2e]
strategy:
matrix:
Expand Down Expand Up @@ -399,7 +400,7 @@ jobs:
uses: ./.github/actions/checkout-registry

- name: cli e2e tests
run: ./typescript/cli/ci-test.sh ${{ matrix.test-type }}
run: ./typescript/cli/ci-advanced-test.sh ${{ matrix.test-type }}

env-test:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This CoC applies to all members of the Hyperlane Network's community including,
1. Never harass or bully anyone. Not verbally, not physically, not sexually. Harassment will not be tolerated.
2. Never discriminate on the basis of personal characteristics or group membership.
3. Treat your fellow contributors with respect, fairness, and professionalism, especially in situations of high pressure.
4. Seek, offer, and accept objective criticism of yours and others work, strive to acknowledge the contributions of others.
4. Seek, offer, and accept objective criticism of yours and others work, strive to acknowledge the contributions of others.
5. Be transparent and honest about your qualifications and any potential conflicts of interest. Transparency is a key tenet of the Hyperlane project and we expect it from all contributors.
6. Bring an open and curious mind, the Hyperlane project is designed to enable developers to express their curiosity, experiment, and build things we couldn't have imagined ourselves.
7. Stay on track - Do your best to avoid off-topic discussion and make sure you are posting to the correct channel and repositories. Distractions are costly and it is far too easy for work to go off track.
Expand Down
43 changes: 25 additions & 18 deletions typescript/cli/ci-test.sh → typescript/cli/ci-advanced-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ _main() {
# with the routing over igp hook (which is closer to production deployment)
TEST_TYPE=$1
if [ -z "$TEST_TYPE" ]; then
echo "Usage: ci-test.sh <$TEST_TYPE_PRESET_HOOK | $TEST_TYPE_CONFIGURED_HOOK | $TEST_TYPE_PI_CORE>"
echo "Usage: ci-advanced-test.sh <$TEST_TYPE_PRESET_HOOK | $TEST_TYPE_CONFIGURED_HOOK | $TEST_TYPE_PI_CORE>"
exit 1
fi

Expand All @@ -34,11 +34,11 @@ _main() {
run_hyperlane_deploy_warp;
run_hyperlane_send_message;

cd ./rust;
# cd ./rust;

run_validator;
run_relayer;
run_hyperlane_status;
# run_validator;
# run_relayer;
# run_hyperlane_status;

kill_anvil;

Expand Down Expand Up @@ -75,6 +75,7 @@ prepare_environment_vars() {
}

prepare_anvil() {

CHAIN1_PORT=8545
CHAIN2_PORT=8555

Expand Down Expand Up @@ -142,12 +143,11 @@ run_hyperlane_deploy_core_dry_run() {
update_deployer_balance;

echo -e "\nDry-running contract deployments to Alfajores"
yarn workspace @hyperlane-xyz/cli run hyperlane deploy core \
yarn workspace @hyperlane-xyz/cli run hyperlane core deploy \
--dry-run alfajores \
--registry ${TEST_CONFIGS_PATH}/dry-run \
--overrides " " \
$(if [ "$HOOK_FLAG" == "true" ]; then echo "--hook ${EXAMPLES_PATH}/hooks.yaml"; fi) \
--ism ${TEST_CONFIGS_PATH}/dry-run/ism.yaml \
--config ${EXAMPLES_PATH}/core-config.yaml \
--from-address 0xfaD1C94469700833717Fa8a3017278BC1cA8031C \
--yes

Expand All @@ -162,7 +162,7 @@ run_hyperlane_deploy_warp_dry_run() {
update_deployer_balance;

echo -e "\nDry-running warp route deployments to Alfajores"
yarn workspace @hyperlane-xyz/cli run hyperlane deploy warp \
yarn workspace @hyperlane-xyz/cli run hyperlane warp deploy \
--dry-run alfajores \
--overrides ${TEST_CONFIGS_PATH}/dry-run \
--config ${TEST_CONFIGS_PATH}/dry-run/warp-route-deployment.yaml \
Expand All @@ -175,14 +175,21 @@ run_hyperlane_deploy_warp_dry_run() {
run_hyperlane_deploy_core() {
update_deployer_balance;

echo -e "\nDeploying contracts to ${CHAIN1} and ${CHAIN2}"
yarn workspace @hyperlane-xyz/cli run hyperlane deploy core \
echo -e "\nDeploying contracts to ${CHAIN1}"
yarn workspace @hyperlane-xyz/cli run hyperlane core deploy \
--registry $REGISTRY_PATH \
--overrides " " \
--config ${EXAMPLES_PATH}/core-config.yaml \
--chain $CHAIN1 \
--key $ANVIL_KEY \
--yes

echo -e "\nDeploying contracts to ${CHAIN2}"
yarn workspace @hyperlane-xyz/cli run hyperlane core deploy \
--registry $REGISTRY_PATH \
--overrides " " \
--targets ${CHAIN1},${CHAIN2} \
$(if [ "$HOOK_FLAG" == "true" ]; then echo "--hook ${EXAMPLES_PATH}/hooks.yaml"; fi) \
--ism $CORE_ISM_PATH \
--agent /tmp/agent-config.json \
--config ${EXAMPLES_PATH}/core-config.yaml \
--chain $CHAIN2 \
--key $ANVIL_KEY \
--yes

Expand All @@ -193,7 +200,7 @@ run_hyperlane_deploy_warp() {
update_deployer_balance;

echo -e "\nDeploying hypNative warp route"
yarn workspace @hyperlane-xyz/cli run hyperlane deploy warp \
yarn workspace @hyperlane-xyz/cli run hyperlane warp deploy \
--registry $REGISTRY_PATH \
--overrides " " \
--config $WARP_DEPLOY_CONFIG_PATH \
Expand All @@ -206,7 +213,7 @@ run_hyperlane_deploy_warp() {
/tmp/warp-collateral-deployment.json \

echo "Deploying hypCollateral warp route"
yarn workspace @hyperlane-xyz/cli run hyperlane deploy warp \
yarn workspace @hyperlane-xyz/cli run hyperlane warp deploy \
--registry $REGISTRY_PATH \
--overrides " " \
--config /tmp/warp-collateral-deployment.json \
Expand Down Expand Up @@ -238,7 +245,7 @@ run_hyperlane_send_message() {
WARP_CONFIG_FILE="$REGISTRY_PATH/deployments/warp_routes/FAKE/${CHAIN1}-${CHAIN2}-config.yaml"

echo -e "\nSending test warp transfer"
yarn workspace @hyperlane-xyz/cli run hyperlane send transfer \
yarn workspace @hyperlane-xyz/cli run hyperlane warp send \
--registry $REGISTRY_PATH \
--overrides " " \
--origin ${CHAIN1} \
Expand Down
8 changes: 6 additions & 2 deletions typescript/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { LogFormat, LogLevel } from '@hyperlane-xyz/utils';

import './env.js';
import { avsCommand } from './src/commands/avs.js';
import { chainsCommand } from './src/commands/chains.js';
import { configCommand } from './src/commands/config.js';
import { coreCommand } from './src/commands/core.js';
import { deployCommand } from './src/commands/deploy.js';
import { hookCommand } from './src/commands/hook.js';
import { ismCommand } from './src/commands/ism.js';
Expand All @@ -19,9 +19,11 @@ import {
registryUriCommandOption,
skipConfirmationOption,
} from './src/commands/options.js';
import { registryCommand } from './src/commands/registry.js';
import { sendCommand } from './src/commands/send.js';
import { statusCommand } from './src/commands/status.js';
import { validatorCommand } from './src/commands/validator.js';
import { warpCommand } from './src/commands/warp.js';
import { contextMiddleware } from './src/context/context.js';
import { configureLogger, errorRed } from './src/logger.js';
import { checkVersion } from './src/utils/version-check.js';
Expand Down Expand Up @@ -51,14 +53,16 @@ try {
contextMiddleware,
])
.command(avsCommand)
.command(chainsCommand)
.command(configCommand)
.command(coreCommand)
.command(deployCommand)
.command(hookCommand)
.command(ismCommand)
.command(registryCommand)
.command(sendCommand)
.command(statusCommand)
.command(validatorCommand)
.command(warpCommand)
.version(VERSION)
.demandCommand()
.strict()
Expand Down
19 changes: 19 additions & 0 deletions typescript/cli/examples/core-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# A config to define the core contract deployments
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
defaultIsm:
type: 'testIsm'
threshold: 1 # Number: Signatures required to approve a message
validators: # Array: List of validator addresses
- '0xa0ee7a142d267c1f36714e4a8f75612f20a79720'
defaultHook:
type: protocolFee
maxProtocolFee: '1000000000000000000' # in wei (string)
protocolFee: '200000000000000' # in wei (string)
beneficiary: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
requiredHook:
type: protocolFee
maxProtocolFee: '1000000000000000000' # in wei (string)
protocolFee: '200000000000000' # in wei (string)
beneficiary: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
owner: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
Loading

0 comments on commit 892efd4

Please sign in to comment.