Skip to content

Commit

Permalink
fix ibc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atheeshp committed Feb 29, 2024
1 parent 1bc8b74 commit 5af7694
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
2 changes: 2 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ import (
porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
ibctmmigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
Expand Down Expand Up @@ -157,6 +158,7 @@ var (
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
ibc.AppModuleBasic{},
ibctm.AppModuleBasic{},
transfer.AppModuleBasic{},
ica.AppModuleBasic{},
upgrade.AppModuleBasic{},
Expand Down
4 changes: 2 additions & 2 deletions tests/ibc-defi/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
entrypoint: tail -f /dev/null

osmosis:
image: osmolabs/osmosis:13-alpine
image: osmolabs/osmosis:23.0.1-alpine
ports:
- "26666:26656" # p2p
- "26667:26657" # rpc
Expand All @@ -23,7 +23,7 @@ services:
entrypoint: tail -f /dev/null

hermes:
image: informalsystems/hermes:1.2.0
image: informalsystems/hermes:v1.8.0
configs:
- source: hermes-config
target: /home/hermes/.hermes/config.toml
Expand Down
6 changes: 3 additions & 3 deletions tests/ibc-defi/hermes/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ port = 3001
id = 'cheqd'
rpc_addr = 'http://cheqd:26657'
grpc_addr = 'http://cheqd:9090'
websocket_addr = 'ws://cheqd:26657/websocket'
event_source = { mode = 'push', url = 'ws://cheqd:26657/websocket', batch_delay = '500ms' }
rpc_timeout = '10s'
account_prefix = 'cheqd'
key_name = 'cheqd-key'
Expand All @@ -58,14 +58,14 @@ trust_threshold = { numerator = '1', denominator = '3' }
id = 'osmosis'
rpc_addr = 'http://osmosis:26657'
grpc_addr = 'http://osmosis:9090'
websocket_addr = 'ws://osmosis:26657/websocket'
event_source = { mode = 'push', url = 'ws://osmosis:26657/websocket', batch_delay = '500ms' }
rpc_timeout = '10s'
account_prefix = 'osmo'
key_name = 'osmosis-key'
store_prefix = 'ibc'
default_gas = 100000
max_gas = 400000
gas_price = { price = 0, denom = 'uosmo' }
gas_price = { price = 1, denom = 'uosmo' }
gas_multiplier = 1.3
max_msg_num = 30
max_tx_size = 2097152
Expand Down
12 changes: 8 additions & 4 deletions tests/ibc-defi/ibc-transfer-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ docker compose exec -d cheqd cheqd-noded start

info "Running osmosis network"
docker compose up -d osmosis
docker compose cp osmosis/osmosis-init.sh osmosis:/home/osmosis/osmosis-init.sh
docker compose exec osmosis bash /home/osmosis/osmosis-init.sh
docker compose cp osmosis/osmosis-init.sh osmosis:/osmosis/osmosis-init.sh
docker compose exec osmosis apk add bash
docker compose exec osmosis bash /osmosis/osmosis-init.sh
docker compose exec -d osmosis osmosisd start

info "Waiting for chains"
Expand All @@ -78,7 +79,7 @@ CHEQD_RELAYER_MNEMONIC=$(echo "${CHEQD_RELAYER_ACCOUNT}" | jq --raw-output '.mne
echo "${CHEQD_RELAYER_MNEMONIC}" > cheqd_relayer_mnemonic.txt

info "Send some tokens to it" # ---
RES=$(docker compose exec cheqd cheqd-noded tx bank send cheqd-user "${CHEQD_RELAYER_ADDRESS}" 1000000000000ncheq --gas-prices 50ncheq --chain-id cheqd -y --keyring-backend test)
RES=$(docker compose exec cheqd cheqd-noded tx bank send cheqd-user "${CHEQD_RELAYER_ADDRESS}" 500000000000000000ncheq --gas-prices 50ncheq --chain-id cheqd -y --keyring-backend test)
assert_tx_successful "${RES}"

info "Create relayer user on osmosis" # ---
Expand All @@ -90,7 +91,7 @@ OSMOSIS_RELAYER_MNEMONIC=$(echo "${OSMOSIS_RELAYER_ACCOUNT}" | jq --raw-output '
echo "${OSMOSIS_RELAYER_MNEMONIC}" > osmo_relayer_mnemonic.txt

info "Send some tokens to it" # ---
RES=$(docker compose exec osmosis osmosisd tx bank send osmosis-user "${OSMOSIS_RELAYER_ADDRESS}" 10000000uosmo --chain-id osmosis -y --keyring-backend test --output json)
RES=$(docker compose exec osmosis osmosisd tx bank send osmosis-user "${OSMOSIS_RELAYER_ADDRESS}" 1000000000uosmo --fees 500uosmo --chain-id osmosis -y --keyring-backend test --output json)
assert_tx_successful "${RES}"
sleep 10 # Wait for state

Expand All @@ -113,6 +114,9 @@ docker compose cp osmo_relayer_mnemonic.txt hermes:/home/hermes
docker compose exec hermes hermes keys add --chain cheqd --mnemonic-file cheqd_relayer_mnemonic.txt --key-name cheqd-key
docker compose exec hermes hermes keys add --chain osmosis --mnemonic-file osmo_relayer_mnemonic.txt --key-name osmosis-key

# docker compose exec hermes keys list --chain cheqd
# docker compose exec hermes keys list --chain osmosis

info "Open channel" # ---
docker compose exec hermes hermes create channel --a-chain cheqd --b-chain osmosis --a-port transfer --b-port transfer --new-client-connection

Expand Down
11 changes: 4 additions & 7 deletions tests/ibc-defi/osmosis/osmosis-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ CHAIN_ID="osmosis"
# Node
osmosisd init --chain-id "$CHAIN_ID" testing

# User
# Config
sed -i $SED_EXT 's/"stake"/"uosmo"/' "$HOME/.osmosisd/config/genesis.json"
sed -i $SED_EXT 's|laddr = "tcp://127.0.0.1:26657"|laddr = "tcp://0.0.0.0:26657"|g' "$HOME/.osmosisd/config/config.toml"

osmosisd keys add osmosis-user --keyring-backend=test

# Genesis
osmosisd add-genesis-account "$(osmosisd keys show osmosis-user -a --keyring-backend=test)" 2000000000uosmo
osmosisd gentx osmosis-user 500000000uosmo --keyring-backend=test --chain-id "$CHAIN_ID"
osmosisd collect-gentxs

jq '.app_state["gov"]["voting_params"]["voting_period"]="10s"' "$HOME/.osmosisd/config/genesis.json" > "$HOME/.osmosisd/config/tmp_genesis.json" && \
mv "$HOME/.osmosisd/config/tmp_genesis.json" "$HOME/.osmosisd/config/genesis.json"

# Config
sed -i $SED_EXT 's|laddr = "tcp://127.0.0.1:26657"|laddr = "tcp://0.0.0.0:26657"|g' "$HOME/.osmosisd/config/config.toml"

0 comments on commit 5af7694

Please sign in to comment.