From ea08d3fac747437797c4ef060470598c09648107 Mon Sep 17 00:00:00 2001 From: J M Rossy Date: Mon, 27 Nov 2023 04:48:26 -0500 Subject: [PATCH] Restructure CI jobs (#2973) ### Description - Rename node.yml to test.yml - Rename `test` job to `yarn-test` - Move e2e.yml into test.yml (aka node) - Re-enable CLI E2E delivery checking - Delete unused mergify file ### Related issues https://github.com/hyperlane-xyz/issues/issues/734 ### Backward compatibility Yes ### Testing CI --------- Co-authored-by: nambrot --- .github/workflows/e2e.yml | 77 ----------- .github/workflows/mergify.yml.bak | 65 --------- .github/workflows/monorepo-docker.yml | 4 +- .github/workflows/release.yml | 2 +- .github/workflows/rust-docker.yml | 4 +- .github/workflows/rust-skipped.yml | 9 +- .github/workflows/rust.yml | 3 +- .github/workflows/static-analysis.yml | 2 +- .github/workflows/{node.yml => test.yml} | 154 ++++++++++++++++------ typescript/cli/ci-test-docker.sh | 159 ----------------------- typescript/cli/ci-test.sh | 130 +++++++++--------- 11 files changed, 196 insertions(+), 413 deletions(-) delete mode 100644 .github/workflows/e2e.yml delete mode 100644 .github/workflows/mergify.yml.bak rename .github/workflows/{node.yml => test.yml} (56%) delete mode 100755 typescript/cli/ci-test-docker.sh diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml deleted file mode 100644 index 9481b2d145..0000000000 --- a/.github/workflows/e2e.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: e2e - -on: - push: - branches: [main] - pull_request: - workflow_dispatch: - -concurrency: - group: e2e-${{ github.ref }} - cancel-in-progress: ${{ github.ref_name != 'main' }} - -env: - CARGO_TERM_COLOR: always - RUST_BACKTRACE: full - -defaults: - run: - working-directory: ./rust - -jobs: - e2e: - runs-on: larger-runner - steps: - - uses: actions/setup-node@v3 - with: - node-version: 16 - - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: setup rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - - - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 - - - name: Free disk space - run: | - # Based on https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - - name: Install mold linker - uses: rui314/setup-mold@v1 - with: - mold-version: 2.0.0 - make-default: true - - name: rust cache - uses: Swatinem/rust-cache@v2 - with: - prefix-key: 'v2-rust' - shared-key: 'e2e' - workspaces: | - ./rust - - name: node module cache - uses: actions/cache@v3 - with: - path: | - **/node_modules - .yarn/cache - key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }} - - name: build test - run: cargo build --release --bin run-locally - - name: run CosmWasm test - run: RUST_BACKTRACE=1 cargo test --package run-locally --bin run-locally -- cosmos::test --nocapture - - name: run test (excluding CosmWasm) - run: ./target/release/run-locally - env: - E2E_CI_MODE: 'true' - E2E_CI_TIMEOUT_SEC: '600' - E2E_KATHY_MESSAGES: '20' diff --git a/.github/workflows/mergify.yml.bak b/.github/workflows/mergify.yml.bak deleted file mode 100644 index 2adc55518f..0000000000 --- a/.github/workflows/mergify.yml.bak +++ /dev/null @@ -1,65 +0,0 @@ -name: automerge - -on: - pull_request: - types: - - labeled - - unlabeled - - synchronize - - opened - - edited - - ready_for_review - - reopened - - unlocked - - pull_request_review: - types: - - submitted - - repository_dispatch: - types: [rust-tests-successful, solidity-tests-successful] - - status: {} - -jobs: - automerge: - - runs-on: larger-runner - - steps: - - name: automerge - if: ${{ secrets.ACTIONS_PAT }} - uses: pascalgn/automerge-action@v0.13.1 - env: - GITHUB_TOKEN: "${{ secrets.ACTIONS_PAT }}" - MERGE_LABELS: "automerge" - MERGE_REMOVE_LABELS: "automerge" - MERGE_METHOD: "squash" - -# in rust.yml - complete: - runs-on: larger-runner - needs: [build, test, lint] - - steps: - - name: Rust tests successful - if: success() - uses: peter-evans/repository-dispatch@v1 - with: - token: ${{ secrets.ACTIONS_PAT }} - repository: ${{ github.repository }} - event-type: rust-tests-successful - -# in solidity.yml - complete: - runs-on: larger-runner - needs: [install, lint, test] - - steps: - - name: Solidity tests successful - if: success() - uses: peter-evans/repository-dispatch@v1 - with: - token: ${{ secrets.ACTIONS_PAT }} - repository: ${{ github.repository }} - event-type: solidity-tests-successful diff --git a/.github/workflows/monorepo-docker.yml b/.github/workflows/monorepo-docker.yml index af71889120..9952c3507e 100644 --- a/.github/workflows/monorepo-docker.yml +++ b/.github/workflows/monorepo-docker.yml @@ -13,7 +13,7 @@ concurrency: cancel-in-progress: true jobs: check-env: - runs-on: larger-runner + runs-on: ubuntu-latest # assign output from step to job output outputs: gcloud-service-key: ${{ steps.gcloud-service-key.outputs.defined }} @@ -27,7 +27,7 @@ jobs: run: echo "::set-output name=defined::true" build-and-push-to-gcr: - runs-on: larger-runner + runs-on: ubuntu-latest # uses check-env to determine if secrets.GCLOUD_SERVICE_KEY is defined needs: [check-env] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25e82feead..84c0164c0a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: contents: write pull-requests: write name: Release - runs-on: larger-runner + runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@v3 diff --git a/.github/workflows/rust-docker.yml b/.github/workflows/rust-docker.yml index 4c64a7cb1c..7c75426f97 100644 --- a/.github/workflows/rust-docker.yml +++ b/.github/workflows/rust-docker.yml @@ -12,7 +12,7 @@ concurrency: cancel-in-progress: true jobs: check-env: - runs-on: larger-runner + runs-on: ubuntu-latest # assign output from step to job output outputs: gcloud-service-key: ${{ steps.gcloud-service-key.outputs.defined }} @@ -26,7 +26,7 @@ jobs: run: echo "::set-output name=defined::true" build-and-push-to-gcr: - runs-on: larger-runner + runs-on: ubuntu-latest # uses check-env to determine if secrets.GCLOUD_SERVICE_KEY is defined needs: [check-env] diff --git a/.github/workflows/rust-skipped.yml b/.github/workflows/rust-skipped.yml index 9a8d0e07ed..b6e6c51cd7 100644 --- a/.github/workflows/rust-skipped.yml +++ b/.github/workflows/rust-skipped.yml @@ -2,23 +2,26 @@ name: rust on: + push: + branches: [main] pull_request: - branches: [main, v3] + branches: [main] paths-ignore: - 'rust/**' + - .github/workflows/rust.yml env: CARGO_TERM_COLOR: always jobs: test-rs: - runs-on: larger-runner + runs-on: ubuntu-latest steps: - run: 'echo "No test required" ' lint-rs: - runs-on: larger-runner + runs-on: ubuntu-latest steps: - run: 'echo "No lint required" ' diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ebb5623de5..bfda6c1aca 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,9 +1,8 @@ name: rust on: - push: - branches: [main] pull_request: + branches: [main] paths: - 'rust/**' - .github/workflows/rust.yml diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 9154cd520e..5dcf53bad9 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -9,7 +9,7 @@ on: jobs: slither: - runs-on: larger-runner + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/node.yml b/.github/workflows/test.yml similarity index 56% rename from .github/workflows/node.yml rename to .github/workflows/test.yml index d39b37c0db..7b7d9d5c99 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: node +name: test on: # Triggers the workflow on push or pull request against main @@ -9,13 +9,23 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +concurrency: + group: e2e-${{ github.ref }} + cancel-in-progress: ${{ github.ref_name != 'main' }} + env: DEBUG: 'hyperlane:*' + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full jobs: yarn-install: - runs-on: larger-runner + runs-on: ubuntu-latest steps: + - uses: actions/setup-node@v3 + with: + node-version: 18 + - uses: actions/checkout@v3 with: submodules: recursive @@ -25,7 +35,7 @@ jobs: with: path: | **/node_modules - .yarn/cache + .yarn key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }} - name: yarn-install @@ -39,7 +49,7 @@ jobs: fi yarn-build: - runs-on: larger-runner + runs-on: ubuntu-latest needs: [yarn-install] steps: - uses: actions/checkout@v3 @@ -47,29 +57,27 @@ jobs: submodules: recursive fetch-depth: 0 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: yarn-cache uses: actions/cache@v3 with: path: | **/node_modules - .yarn/cache + .yarn key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }} - name: build-cache uses: actions/cache@v3 with: - path: ./* + path: | + ./* + !./rust key: ${{ github.sha }} - name: build run: yarn build lint-prettier: - runs-on: larger-runner + runs-on: ubuntu-latest needs: [yarn-install] steps: - uses: actions/checkout@v3 @@ -77,11 +85,12 @@ jobs: # check out full history fetch-depth: 0 - - uses: actions/cache@v3 + - name: yarn-cache + uses: actions/cache@v3 with: path: | **/node_modules - .yarn/cache + .yarn key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }} - name: lint @@ -96,8 +105,8 @@ jobs: exit 1 fi - test: - runs-on: larger-runner + yarn-test: + runs-on: ubuntu-latest needs: [yarn-build] steps: - uses: actions/checkout@v3 @@ -105,38 +114,99 @@ jobs: submodules: recursive fetch-depth: 0 - - name: Install Foundry + - name: foundry-install uses: onbjerg/foundry-toolchain@v1 - - uses: actions/cache@v3 + - name: build-cache + uses: actions/cache@v3 with: - path: ./* + path: | + ./* + !./rust key: ${{ github.sha }} - name: Unit Tests run: yarn test - test-cli: + e2e: runs-on: larger-runner needs: [yarn-build] steps: + - uses: actions/setup-node@v3 + with: + node-version: 18 + - uses: actions/checkout@v3 with: submodules: recursive - - name: Install Foundry + - name: foundry-install uses: onbjerg/foundry-toolchain@v1 - - uses: actions/cache@v3 + - name: setup rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + + - name: Free disk space + run: | + # Based on https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + + - name: Install mold linker + uses: rui314/setup-mold@v1 + with: + mold-version: 2.0.0 + make-default: true + + - name: yarn-cache + uses: actions/cache@v3 with: - path: ./* + path: | + **/node_modules + .yarn + key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }} + + - name: build-cache + uses: actions/cache@v3 + with: + path: | + ./* + !./rust key: ${{ github.sha }} - - name: test + - name: cargo-cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo + key: ${{ runner.os }}-cargo-cache-${{ hashFiles('./rust/Cargo.lock') }} + + - name: agent build + run: cargo build --release --bin run-locally + working-directory: ./rust + + - name: agent tests with CosmWasm + run: RUST_BACKTRACE=1 cargo test --package run-locally --bin run-locally -- cosmos::test --nocapture + working-directory: ./rust + + - name: agent tests excluding CosmWasm + run: ./target/release/run-locally + working-directory: ./rust + env: + E2E_CI_MODE: 'true' + E2E_CI_TIMEOUT_SEC: '600' + E2E_KATHY_MESSAGES: '20' + + - name: cli e2e tests run: ./typescript/cli/ci-test.sh - test-env: - runs-on: larger-runner + env-test: + runs-on: ubuntu-latest needs: [yarn-build] strategy: matrix: @@ -145,19 +215,23 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/cache@v3 - with: - path: ./* - key: ${{ github.sha }} - - name: Install Foundry + - name: foundry-install uses: onbjerg/foundry-toolchain@v1 + - name: build-cache + uses: actions/cache@v3 + with: + path: | + ./* + !./rust + key: ${{ github.sha }} + - name: Test ${{ matrix.environment }} ${{ matrix.module }} deployment (check, deploy, govern, check again) run: cd typescript/infra && ./fork.sh ${{ matrix.environment }} ${{ matrix.module }} coverage: - runs-on: larger-runner + runs-on: ubuntu-latest needs: [yarn-build] steps: @@ -165,21 +239,21 @@ jobs: with: fetch-depth: 0 - - uses: actions/cache@v3 - with: - path: ./* - key: ${{ github.sha }} - - name: yarn-cache uses: actions/cache@v3 with: path: | **/node_modules - .yarn/cache + .yarn key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }} - - name: Install Foundry - uses: onbjerg/foundry-toolchain@v1 + - name: build-cache + uses: actions/cache@v3 + with: + path: | + ./* + !./rust + key: ${{ github.sha }} - name: Run tests with coverage run: yarn coverage @@ -189,4 +263,4 @@ jobs: - name: Upload coverage reports to Codecov with GitHub Action uses: codecov/codecov-action@v3 with: - token: ${{ secrets.CODECOV_TOKEN }} + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/typescript/cli/ci-test-docker.sh b/typescript/cli/ci-test-docker.sh deleted file mode 100755 index 416f3847ef..0000000000 --- a/typescript/cli/ci-test-docker.sh +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/bin/env bash - -# Optional cleanup for previous runs, useful when running locally -pkill -f anvil -docker ps -aq | xargs docker stop | xargs docker rm -rm -rf /tmp/anvil* -rm -rf /tmp/relayer - -# Setup directories for anvil chains -for CHAIN in anvil1 anvil2 -do - mkdir -p /tmp/$CHAIN /tmp/$CHAIN/state /tmp/$CHAIN/validator /tmp/relayer - chmod -R 777 /tmp/relayer /tmp/$CHAIN -done - -anvil --chain-id 31337 -p 8545 --state /tmp/anvil1/state > /dev/null & -anvil --chain-id 31338 -p 8555 --state /tmp/anvil2/state > /dev/null & -sleep 1 - -set -e - -echo "{}" > /tmp/empty-artifacts.json - -export DEBUG=hyperlane:* - -echo "Deploying contracts to anvil1 and anvil2" -yarn workspace @hyperlane-xyz/cli run hyperlane deploy core \ - --targets anvil1,anvil2 \ - --chains ./examples/anvil-chains.yaml \ - --artifacts /tmp/empty-artifacts.json \ - --ism ./examples/multisig-ism.yaml \ - --hook ./examples/hook-config.yaml \ - --out /tmp \ - --key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \ - --yes - -CORE_ARTIFACTS_PATH=`find /tmp/core-deployment* -type f -exec ls -t1 {} + | head -1` -echo "Core artifacts:" -echo $CORE_ARTIFACTS_PATH - -AGENT_CONFIG_FILENAME=`ls -t1 /tmp | grep agent-config | head -1` - -echo "Deploying warp routes" -yarn workspace @hyperlane-xyz/cli run hyperlane deploy warp \ - --chains ./examples/anvil-chains.yaml \ - --core $CORE_ARTIFACTS_PATH \ - --config ./examples/warp-tokens.yaml \ - --out /tmp \ - --key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \ - --yes - -echo "Sending test message" -yarn workspace @hyperlane-xyz/cli run hyperlane send message \ - --origin anvil1 \ - --destination anvil2 \ - --chains ./examples/anvil-chains.yaml \ - --core $CORE_ARTIFACTS_PATH \ - --quick \ - --key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \ - | tee /tmp/message1 - -MESSAGE1_ID=`cat /tmp/message1 | grep "Message ID" | grep -E -o '0x[0-9a-f]+'` -echo "Message 1 ID: $MESSAGE1_ID" - -WARP_ARTIFACTS_FILE=`find /tmp/warp-deployment* -type f -exec ls -t1 {} + | head -1` -ANVIL1_ROUTER=`cat $WARP_ARTIFACTS_FILE | jq -r ".anvil1.router"` - -echo "Sending test warp transfer" -yarn workspace @hyperlane-xyz/cli run hyperlane send transfer \ - --origin anvil1 \ - --destination anvil2 \ - --chains ./examples/anvil-chains.yaml \ - --core $CORE_ARTIFACTS_PATH \ - --router $ANVIL1_ROUTER \ - --type native \ - --quick \ - --key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \ - | tee /tmp/message2 - -MESSAGE2_ID=`cat /tmp/message2 | grep "Message ID" | grep -E -o '0x[0-9a-f]+'` -echo "Message 2 ID: $MESSAGE2_ID" - - -if [[ $OSTYPE == 'darwin'* ]]; then - # Required because the -net=host driver only works on linux - DOCKER_CONNECTION_URL="http://host.docker.internal" -else - DOCKER_CONNECTION_URL="http://127.0.0.1" -fi - -for i in "anvil1 8545 ANVIL1" "anvil2 8555 ANVIL2" -do - set -- $i - echo "Running validator on $1" - docker run \ - --mount type=bind,source="/tmp",target=/data --net=host \ - -e CONFIG_FILES=/data/${AGENT_CONFIG_FILENAME} -e HYP_ORIGINCHAINNAME=$1 \ - -e HYP_VALIDATOR_REORGPERIOD=0 -e HYP_VALIDATOR_INTERVAL=1 \ - -e HYP_CHAINS_${3}_CUSTOMRPCURLS=${DOCKER_CONNECTION_URL}:${2} \ - -e HYP_CHAINS_${3}_BLOCKS_REORGPERIOD=0 \ - -e HYP_VALIDATOR_TYPE=hexKey \ - -e HYP_VALIDATOR_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 \ - -e HYP_CHECKPOINTSYNCER_TYPE=localStorage \ - -e HYP_CHECKPOINTSYNCER_PATH=/data/${1}/validator \ - -e HYP_TRACING_LEVEL=debug -e HYP_TRACING_FMT=compact \ - gcr.io/abacus-labs-dev/hyperlane-agent:b92ecd3-20231115-182824 ./validator > /tmp/${1}/validator-logs.txt & -done - -echo "Validator running, sleeping to let it sync" -sleep 15 -echo "Done sleeping" - -echo "Validator Announcement:" -cat /tmp/anvil1/validator/announcement.json - -echo "Running relayer" - -docker run \ - --mount type=bind,source="/tmp",target=/data --net=host \ - -e CONFIG_FILES=/data/${AGENT_CONFIG_FILENAME} \ - -e HYP_CHAINS_ANVIL1_CUSTOMRPCURLS=${DOCKER_CONNECTION_URL}:8545 \ - -e HYP_CHAINS_ANVIL2_CUSTOMRPCURLS=${DOCKER_CONNECTION_URL}:8555 \ - -e HYP_CHAINS_ANVIL1_BLOCKS_REORGPERIOD=0 \ - -e HYP_CHAINS_ANVIL2_BLOCKS_REORGPERIOD=0 \ - -e HYP_TRACING_LEVEL=debug -e HYP_TRACING_FMT=compact \ - -e HYP_RELAYCHAINS=anvil1,anvil2 \ - -e HYP_ALLOWLOCALCHECKPOINTSYNCERS=true \ - -e HYP_DB=/data/relayer \ - -e HYP_GASPAYMENTENFORCEMENT='[{"type":"none"}]' \ - -e HYP_CHAINS_ANVIL1_SIGNER_TYPE=hexKey \ - -e HYP_CHAINS_ANVIL1_SIGNER_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 \ - -e HYP_CHAINS_ANVIL2_SIGNER_TYPE=hexKey \ - -e HYP_CHAINS_ANVIL2_SIGNER_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 \ - gcr.io/abacus-labs-dev/hyperlane-agent:b92ecd3-20231115-182824 ./relayer > /tmp/relayer/relayer-logs.txt & - -sleep 10 -echo "Done running relayer, checking message delivery statuses" - -for i in "1 $MESSAGE1_ID" "2 $MESSAGE2_ID" -do - set -- $i - echo "Checking delivery status of $1: $2" - yarn workspace @hyperlane-xyz/cli run hyperlane status \ - --id $2 \ - --destination anvil2 \ - --chains ./examples/anvil-chains.yaml \ - --core $CORE_ARTIFACTS_PATH \ - | tee /tmp/message-status-$1 - if ! grep -q "$2 was delivered" /tmp/message-status-$1; then - echo "ERROR: Message $1 was not delivered" - exit 1 - else - echo "Message $1 was delivered!" - fi -done - -docker ps -aq | xargs docker stop | xargs docker rm -pkill -f anvil -echo "Done" diff --git a/typescript/cli/ci-test.sh b/typescript/cli/ci-test.sh index 2c185f8357..de3d887cc6 100755 --- a/typescript/cli/ci-test.sh +++ b/typescript/cli/ci-test.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +# NOTE: This script is intended to be run from the root of the repo + # Optional cleanup for previous runs, useful when running locally pkill -f anvil rm -rf /tmp/anvil* @@ -103,67 +105,73 @@ yarn workspace @hyperlane-xyz/cli run hyperlane send transfer \ MESSAGE2_ID=`cat /tmp/message2 | grep "Message ID" | grep -E -o '0x[0-9a-f]+'` echo "Message 2 ID: $MESSAGE2_ID" -# ANVIL_CONNECTION_URL="http://127.0.0.1" -# cd ../../rust -# for i in "anvil1 8545 ANVIL1" "anvil2 8555 ANVIL2" -# do -# set -- $i -# echo "Running validator on $1" -# export CONFIG_FILES=/tmp/${AGENT_CONFIG_FILENAME} -# export HYP_ORIGINCHAINNAME=$1 -# export HYP_CHAINS_${3}_BLOCKS_REORGPERIOD=0 -# export HYP_VALIDATOR_INTERVAL=1 -# export HYP_CHAINS_${3}_CUSTOMRPCURLS=${ANVIL_CONNECTION_URL}:${2} -# export HYP_VALIDATOR_TYPE=hexKey -# export HYP_VALIDATOR_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 -# export HYP_CHECKPOINTSYNCER_TYPE=localStorage -# export HYP_CHECKPOINTSYNCER_PATH=/tmp/${1}/validator -# export HYP_TRACING_LEVEL=debug -# export HYP_TRACING_FMT=compact - -# cargo run --bin validator > /tmp/${1}/validator-logs.txt & -# done - -# echo "Validator running, sleeping to let it sync" -# sleep 15 -# echo "Done sleeping" - -# echo "Validator Announcement:" -# cat /tmp/anvil1/validator/announcement.json - -# echo "Running relayer" - -# export HYP_RELAYCHAINS=anvil1,anvil2 -# export HYP_ALLOWLOCALCHECKPOINTSYNCERS=true -# export HYP_DB=/tmp/relayer -# export HYP_GASPAYMENTENFORCEMENT='[{"type":"none"}]' -# export HYP_CHAINS_ANVIL1_SIGNER_TYPE=hexKey -# export HYP_CHAINS_ANVIL1_SIGNER_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 -# export HYP_CHAINS_ANVIL2_SIGNER_TYPE=hexKey -# export HYP_CHAINS_ANVIL2_SIGNER_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 - -# cargo run --bin relayer > /tmp/relayer/relayer-logs.txt & - -# sleep 10 -# echo "Done running relayer, checking message delivery statuses" - -# for i in "1 $MESSAGE1_ID" "2 $MESSAGE2_ID" -# do -# set -- $i -# echo "Checking delivery status of $1: $2" -# yarn workspace @hyperlane-xyz/cli run hyperlane status \ -# --id $2 \ -# --destination anvil2 \ -# --chains ./examples/anvil-chains.yaml \ -# --core $CORE_ARTIFACTS_PATH \ -# | tee /tmp/message-status-$1 -# if ! grep -q "$2 was delivered" /tmp/message-status-$1; then -# echo "ERROR: Message $1 was not delivered" -# exit 1 -# else -# echo "Message $1 was delivered!" -# fi -# done +cd ./rust +echo "Pre-building validator with cargo" +cargo build --bin validator + +ANVIL_CONNECTION_URL="http://127.0.0.1" +for i in "anvil1 8545 ANVIL1" "anvil2 8555 ANVIL2" +do + set -- $i + echo "Running validator on $1" + export CONFIG_FILES=/tmp/${AGENT_CONFIG_FILENAME} + export HYP_ORIGINCHAINNAME=$1 + export HYP_CHAINS_${3}_BLOCKS_REORGPERIOD=0 + export HYP_VALIDATOR_INTERVAL=1 + export HYP_CHAINS_${3}_CUSTOMRPCURLS=${ANVIL_CONNECTION_URL}:${2} + export HYP_VALIDATOR_TYPE=hexKey + export HYP_VALIDATOR_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 + export HYP_CHECKPOINTSYNCER_TYPE=localStorage + export HYP_CHECKPOINTSYNCER_PATH=/tmp/${1}/validator + export HYP_TRACING_LEVEL=debug + export HYP_TRACING_FMT=compact + + cargo run --bin validator > /tmp/${1}/validator-logs.txt & +done + +echo "Validator running, sleeping to let it sync" +# This needs to be long to allow time for the cargo build to finish +sleep 15 +echo "Done sleeping" + +echo "Validator Announcement:" +cat /tmp/anvil1/validator/announcement.json + +echo "Pre-building relayer with cargo" +cargo build --bin relayer + +echo "Running relayer" +export HYP_RELAYCHAINS=anvil1,anvil2 +export HYP_ALLOWLOCALCHECKPOINTSYNCERS=true +export HYP_DB=/tmp/relayer +export HYP_GASPAYMENTENFORCEMENT='[{"type":"none"}]' +export HYP_CHAINS_ANVIL1_SIGNER_TYPE=hexKey +export HYP_CHAINS_ANVIL1_SIGNER_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 +export HYP_CHAINS_ANVIL2_SIGNER_TYPE=hexKey +export HYP_CHAINS_ANVIL2_SIGNER_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 +cargo run --bin relayer > /tmp/relayer/relayer-logs.txt & + +# This needs to be long to allow time for the cargo build to finish +sleep 20 +echo "Done running relayer, checking message delivery statuses" + +for i in "1 $MESSAGE1_ID" "2 $MESSAGE2_ID" +do + set -- $i + echo "Checking delivery status of $1: $2" + yarn workspace @hyperlane-xyz/cli run hyperlane status \ + --id $2 \ + --destination anvil2 \ + --chains ./examples/anvil-chains.yaml \ + --core $CORE_ARTIFACTS_PATH \ + | tee /tmp/message-status-$1 + if ! grep -q "$2 was delivered" /tmp/message-status-$1; then + echo "ERROR: Message $1 was not delivered" + exit 1 + else + echo "Message $1 was delivered!" + fi +done pkill -f anvil echo "Done"