Skip to content

Commit

Permalink
add test-channel-upgrade to tm2tm
Browse files Browse the repository at this point in the history
Signed-off-by: Masanori Yoshida <[email protected]>
  • Loading branch information
siburu committed Jul 5, 2024
1 parent 4cb4124 commit db6cd9c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/cases/tm2tm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test:
./scripts/fixture
./scripts/init-rly
./scripts/handshake
./scripts/test-channel-upgrade
./scripts/test-create-client-success-single
./scripts/test-create-client-fail-already-created
./scripts/test-create-client-fail-unexist
Expand Down
44 changes: 44 additions & 0 deletions tests/cases/tm2tm/scripts/test-channel-upgrade
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

set -eux

source $(cd $(dirname "$0"); pwd)/../../../scripts/util

SCRIPT_DIR=$(cd $(dirname $0); pwd)
RELAYER_CONF="$HOME/.yui-relayer"
RLY_BINARY=${SCRIPT_DIR}/../../../../build/yrly
RLY="${RLY_BINARY} --debug"

CHAINID_ONE=ibc0
CHAINID_TWO=ibc1
RLYKEY=testkey
PATH_NAME=ibc01

# back up the original connection identifiers
srcOrigConnectionId=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].src."connection-id"')
dstOrigConnectionId=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].dst."connection-id"')

# back up the original config.json and make connection identifiers empty
origconfig=`mktemp`
cp "$RELAYER_CONF/config/config.json" $origconfig
$RLY paths edit $PATH_NAME src connection-id ''
$RLY paths edit $PATH_NAME dst connection-id ''

# create a new connection and save the new connection identifiers
retry 5 $RLY tx connection $PATH_NAME
srcConnectionId=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].src."connection-id"')
dstConnectionId=$($RLY paths list --json | jq --raw-output --arg path_name "$PATH_NAME" '.[$path_name].dst."connection-id"')

# resume the original config.json
mv $origconfig "$RELAYER_CONF/config/config.json"

# test channel upgrade (crossing-hello)
$RLY tx channel-upgrade init ibc01 ibc0 --ordering ORDER_UNORDERED --connection-hops $srcConnectionId --version ics20-1
$RLY tx channel-upgrade init ibc01 ibc1 --ordering ORDER_UNORDERED --connection-hops $dstConnectionId --version ics20-1
$RLY tx channel-upgrade execute ibc01

# test channel upgrade (non-crossing-hello)
$RLY tx channel-upgrade init ibc01 ibc0 --ordering ORDER_UNORDERED --connection-hops $srcOrigConnectionId --version ics20-1
$RLY tx channel-upgrade init ibc01 ibc0 --ordering ORDER_UNORDERED --connection-hops $srcOrigConnectionId --version ics20-1
$RLY tx channel-upgrade init ibc01 ibc1 --ordering ORDER_UNORDERED --connection-hops $dstOrigConnectionId --version ics20-1
$RLY tx channel-upgrade execute ibc01

0 comments on commit db6cd9c

Please sign in to comment.