Skip to content

Commit

Permalink
Merge branch 'main' into 148-create-workflow-to-check-pr-label-and-au…
Browse files Browse the repository at this point in the history
…to-label-pr
  • Loading branch information
izyak authored Sep 11, 2023
2 parents 4aadbed + 2e9f6b0 commit 2f99995
Show file tree
Hide file tree
Showing 35 changed files with 818 additions and 249 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/archway
1 change: 1 addition & 0 deletions .github/scripts/icon-ibc
Submodule icon-ibc added at 3886fa
1 change: 0 additions & 1 deletion .github/scripts/icon-ibc-setup
Submodule icon-ibc-setup deleted from ebf04b
150 changes: 113 additions & 37 deletions .github/scripts/start_relay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,82 @@ ARCHWAY_CONTAINER='archway-node-1'

cd $SUBMODULE_DIR

echo $PWD

# Correct path
sed -i "s|^CONTRACTS_DIR=.*|CONTRACTS_DIR=$PWD/IBC-Integration|" ./icon-ibc-setup/consts.sh
sed -i "s|^ICON_WALLET=.*|ICON_WALLET=$PWD/gochain-btp/data/godWallet.json|" ./icon-ibc-setup/consts.sh
sed -i "s|^ARCHWAY_WALLET=.*|ARCHWAY_WALLET=default|" ./icon-ibc-setup/consts.sh
search_strings=(
"export IBC_RELAY="
"export IBC_INTEGRATION="
"export ICON_DOCKER_PATH="
"export WASM_DOCKER_PATH="
)

replacement="\$GITHUB_WORKSPACE\/.github\/scripts"
for search_string in "${search_strings[@]}"; do
sed -i "/$search_string/ s/\$HOME/$replacement/g" ./icon-ibc/const.sh
done

sed -i 's/export WASM_WALLET=godWallet/export WASM_WALLET=default/' ./icon-ibc/const.sh
sed -i 's/\(export WASM_EXTRA=\)"\([^"]*\)"\(.*\)/\1"--keyring-backend test"\3/' ./icon-ibc/const.sh

# Use below lines until there is version fix on wasm file
sed -i 's/\.wasm/_\.wasm/g' ./icon-ibc/const.sh
sed -i 's/cw_xcall_.wasm/cw_xcall_0.1.0.wasm/g' ./icon-ibc/const.sh
sed -i 's/cw_mock_dapp_multi_.wasm/cw_mock_dapp_multi_0.1.0.wasm/g' ./icon-ibc/const.sh

cat ./icon-ibc/const.sh

# sed -i 's/ARCHWAY_NETWORK=localnet/ARCHWAY_NETWORK=docker/' consts.sh
mkdir -p ~/.relayer/config
mkdir -p ~/keystore
cp ./gochain-btp/data/godWallet.json ~/keystore/godWallet.json
# Import fd account
pass init $GPG_FINGERPRINT

echo "### Create default wallet"

wallet=$(archwayd keys add default --keyring-backend test | awk -F\: '/address/ {print $2}' | tr -d '[:space:]')
echo $wallet
archwayd keys list

echo "==> Starting icon node ..."
cd $SUBMODULE_DIR/gochain-btp
make ibc-ready
relay_wallet=$(archwayd keys add relayWallet --keyring-backend test | awk -F\: '/address/ {print $2}' | tr -d '[:space:]')

archwayd keys list --keyring-backend test




echo "==> Starting archway node ..."
cd ${SUBMODULE_DIR}/archway

sed -i '/^archwayd add-genesis-account.*/a archwayd add-genesis-account "'"$wallet"'" 1000000000stake --keyring-backend=test' contrib/localnet/localnet.sh
echo "## Before update .."
cat contrib/localnet/localnet.sh
# sed -i '/^archwayd add-genesis-account.*/a archwayd add-genesis-account "'"$wallet"'" 100000000000stake --keyring-backend=test' contrib/localnet/localnet.sh

sed -i '/archwayd add-genesis-account "\$addr" 1000000000000stake --keyring-backend=test/{p; a\
archwayd add-genesis-account "'"$wallet"'" 100000000000stake --keyring-backend=test\
archwayd add-genesis-account "'"$relay_wallet"'" 100000000000stake --keyring-backend=test
}' contrib/localnet/localnet.sh

awk '!seen[$0]++' contrib/localnet/localnet.sh > contrib/localnet/localnet_new.sh
mv contrib/localnet/localnet_new.sh contrib/localnet/localnet.sh
sed -i 's/latest/v0.4.0/' docker-compose.yaml
docker compose -f docker-compose.yaml up -d
sleep 60

echo "### Check archwayd keys list on local"
archwayd keys list --keyring-backend os

echo "### Check archwayd start script content"
cat contrib/localnet/localnet.sh
docker ps


cd $SUBMODULE_DIR/icon-ibc




# make nodes
bash -x ./nodes.sh start-all

sleep 30
echo "### Get fd wallet address"
fdwallet=$(docker exec $ARCHWAY_CONTAINER archwayd keys list --keyring-backend test | awk -F\: '/address/ {print $2}' | tr -d '[:space:]')

echo "### Check archwayd genesis file"
docker exec $ARCHWAY_CONTAINER cat /root/.archway/config/genesis.json
Expand All @@ -47,9 +94,13 @@ docker exec $ARCHWAY_CONTAINER archwayd keys list

echo "### Check archwayd keys list on local"
archwayd keys list --keyring-backend os
archwayd keys list --keyring-backend test

echo "default:"
archwayd query bank balances $wallet
echo "fd:"
docker exec $ARCHWAY_CONTAINER archwayd query bank balances $fdwallet

echo "### Get fd wallet address"
fdwallet=$(docker exec $ARCHWAY_CONTAINER archwayd keys list --keyring-backend test | awk -F\: '/address/ {print $2}' | tr -d '[:space:]')

echo "default: $wallet"
echo "fd: $fdwallet"
Expand All @@ -62,22 +113,55 @@ archwayd query bank balances $wallet
echo "fd:"
docker exec $ARCHWAY_CONTAINER archwayd query bank balances $fdwallet

cd $SUBMODULE_DIR/icon-ibc-setup

sed -i 's/ARCHWAY_NETWORK=localnet/ARCHWAY_NETWORK=docker/' consts.sh
mkdir -p ~/.relayer/config
echo "==> Setting up icon ..."
make icon
echo "==> Setting up archway ..."
make archway
echo "### Updating config ..."
make config

cat ~/.relayer/config/config.yaml

echo -e "\nCopy default key to relayer keyring ======"
mkdir -p /home/runner/.relayer/keys/localnet/keyring-test
cp ~/.archway/keyring-test/default.info ~/.relayer/keys/localnet/keyring-test/default.info
cp ~/.archway/keyring-test/relayWallet.info ~/.relayer/keys/localnet/keyring-test/relayWallet.info
ls ~/.archway/keyring-test/*
ls ~/.relayer/keys/localnet/keyring-test/*

# make contracts
echo
echo "++++ Setting up icon"
bash -x ./icon.sh --setup

echo
echo "++++ Setting up archway"
bash -x ./wasm.sh --setup
echo
echo "++++ Deploying xcall on icon"
bash -x ./icon.sh --deploy-dapp
echo
echo "++++ Deploying xcall on archway"
bash -x ./wasm.sh --deploy-dapp
bash -x ./cfg.sh

## Check Score Address
echo "Checking Score Address..."
grep . $SUBMODULE_DIR/icon-ibc/env/archway/.*
grep . $SUBMODULE_DIR/icon-ibc/env/icon/.*

echo
echo "++++ Starting handshake ..."
# make handshake
rly tx clients icon-archway --client-tp "10000000m"
rly tx conn icon-archway

echo
echo "+++ Icon - Configure Connection"
bash -x ./icon.sh -c
echo
echo "+++ Archway - Configure Connection"
bash -x ./wasm.sh -c
echo
echo "+++ Create Channel"
rly tx chan icon-archway --src-port=xcall --dst-port=xcall

echo "Checking containers..."
docker ps -a
# cat ~/.relayer/config/config.yaml




echo "### all archwayd keys:"
Expand All @@ -93,19 +177,11 @@ docker exec $ARCHWAY_CONTAINER archwayd keys list --keyring-backend test


echo "+++++++++++++++++++++"
echo "==> Starting link..."
rly tx link icon-archway --client-tp=10000m --src-port mock --dst-port mock -d
# Enable when debug is required
# rly tx link icon-archway --client-tp=10000m --src-port mock --dst-port mock --order=ordered -d
# for txhash in $(cat log.txt | grep 'Submitted transaction" provider_type=archway chain_id=localnet txHash=' | awk -F\= '{print $NF}')
# do
# echo -e "\n+++ Checking $txhash ...\n"
# archwayd query tx $txhash
# done
echo
echo
docker ps
echo "### Checking relay config"
find ./ -type f -name config.yaml
cat ~/.relayer/config/config.yaml
echo "==> Starting relayer..."
rly start icon-archway & sleep 60s; echo "* Stopping relay ..."; kill $!
Expand Down
93 changes: 67 additions & 26 deletions .github/workflows/test-relay.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Deploy Relayer Locally

name: Test Relayer Locally - Icon/Archway
on:
push:
branches:
Expand Down Expand Up @@ -32,18 +31,6 @@ jobs:
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
shell: bash

# Install rust toolchain
- name: Install rust stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.69.0
target: wasm32-unknown-unknown
override: true
profile: minimal

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

# Build relay
- name: Build relayer
run: make install
Expand All @@ -56,23 +43,75 @@ jobs:
- name: Build archwayd
working-directory: .github/scripts/archway
run: |
echo $PWD
echo $GITHUB_WORKSPACE
git clean -fdx
git checkout v4.0.0
make install
# Build comsmwasm
- name: Compile WASM
working-directory: .github/scripts/IBC-Integration
- name: Fetch Latest IBC-Integration Tag
id: fetch_ibc_tag
run: |
rustup component add rustfmt --toolchain 1.69.0-x86_64-unknown-linux-gnu
rustup component add clippy --toolchain 1.69.0-x86_64-unknown-linux-gnu
bash ./optimize_build.sh
TAG_IBC=$(curl -s "https://api.github.com/repos/icon-project/IBC-Integration/tags" | jq -r '.[0].name')
echo "TAG_IBC=$TAG_IBC" >> $GITHUB_ENV
- name: Fetch Latest xcall-multi Tag
id: fetch_xcall_tag
run: |
TAG_XCALL=$(curl -s "https://api.github.com/repos/icon-project/xcall-multi/tags" | jq -r '.[0].name')
echo "TAG_XCALL=$TAG_XCALL" >> $GITHUB_ENV
- name: Get Latest tag - IBC-Integration
id: ibc_tag
run: echo "tag=$(curl -s "https://api.github.com/repos/icon-project/IBC-Integration/tags" | jq -r '.[0].name')" >> $GITHUB_OUTPUT

- name: Get Latest tag - xcall-multi
id: xcall_tag
run: echo "tag=$(curl -s "https://api.github.com/repos/icon-project/xcall-multi/tags" | jq -r '.[0].name')" >> $GITHUB_OUTPUT


- name: Build javascore
working-directory: .github/scripts/IBC-Integration/contracts/javascore
- name: Download IBC Core Javascore Contracts
uses: robinraju/[email protected]
with:
repository: "icon-project/IBC-Integration"
tag: "${{ steps.ibc_tag.outputs.tag }}"
# latest: true
fileName: "*.jar"
out-file-path: "./.github/scripts/IBC-Integration/artifacts/icon"


- name: Download IBC Core Cosmwasm Contracts
uses: robinraju/[email protected]
with:
repository: "icon-project/IBC-Integration"
tag: "${{ steps.ibc_tag.outputs.tag }}"
# latest: true
fileName: "*.wasm"
out-file-path: "./.github/scripts/IBC-Integration/artifacts/archway"

- name: Download xcall-multi Javascore Contracts
uses: robinraju/[email protected]
with:
repository: "icon-project/xCall"
tag: "${{ steps.xcall_tag.outputs.tag }}"
# latest: true
fileName: "*.jar"
out-file-path: "./.github/scripts/IBC-Integration/artifacts/icon"

- name: Download xCall Cosmwasm Contracts
uses: robinraju/[email protected]
with:
repository: "icon-project/xCall"
tag: "${{ steps.xcall_tag.outputs.tag }}"
# latest: true
fileName: "*.wasm"
out-file-path: "./.github/scripts/IBC-Integration/artifacts/archway"

- name: List Download Files
run: |
./gradlew clean build
./gradlew optimizedJar
ls -l ${GITHUB_WORKSPACE}/.github/scripts/IBC-Integration/artifacts/icon
ls -l ${GITHUB_WORKSPACE}/.github/scripts/IBC-Integration/artifacts/archway
echo $GITHUB_WORKSPACE
echo "${GITHUB_REF##*/}"
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
Expand All @@ -84,6 +123,8 @@ jobs:

- name: start relay
working-directory: .github/scripts
run: bash ./start_relay.sh
run: |
git status
bash ./start_relay.sh
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
[submodule ".github/scripts/gochain-btp"]
path = .github/scripts/gochain-btp
url = https://github.com/izyak/gochain-btp.git
[submodule ".github/scripts/icon-ibc-setup"]
path = .github/scripts/icon-ibc-setup
url = https://github.com/izyak/icon-ibc-setup.git
[submodule ".github/scripts/icon-ibc"]
path = .github/scripts/icon-ibc
url = https://github.com/izyak/icon-ibc.git
Loading

0 comments on commit 2f99995

Please sign in to comment.