Skip to content

Commit

Permalink
upgrade integration tests for v17 (#1073)
Browse files Browse the repository at this point in the history
```
integration_tests.bats
 ✓ [INTEGRATION-BASIC-GAIA] host zones successfully registered
 ✓ [INTEGRATION-BASIC-GAIA] ibc transfer
 ✓ [INTEGRATION-BASIC-GAIA] liquid stake mint and transfer
 ✓ [INTEGRATION-BASIC-GAIA] delegation on GAIA
 ✓ [INTEGRATION-BASIC-GAIA] LSM liquid stake
 ✓ [INTEGRATION-BASIC-GAIA] LSM liquid stake with slash query
 ✓ [INTEGRATION-BASIC-GAIA] autopilot liquid stake
 ✓ [INTEGRATION-BASIC-GAIA] autopilot liquid stake and transfer
 ✓ [INTEGRATION-BASIC-GAIA] autopilot redeem stake
 ✓ [INTEGRATION-BASIC-GAIA] redemption and undelegation on GAIA
 ✓ [INTEGRATION-BASIC-GAIA] claim redeemed tokens
 ✓ [INTEGRATION-BASIC-GAIA] rewards are being reinvested, exchange rate updating
 ✓ [INTEGRATION-BASIC-GAIA] rewards are being distributed to stakers

13 tests, 0 failures

integration_tests.bats
 ✓ [INTEGRATION-BASIC-EVMOS] host zones successfully registered
 ✓ [INTEGRATION-BASIC-EVMOS] ibc transfer
 ✓ [INTEGRATION-BASIC-EVMOS] liquid stake mint and transfer
 ✓ [INTEGRATION-BASIC-EVMOS] delegation on EVMOS
 - [INTEGRATION-BASIC-EVMOS] LSM liquid stake (skipped: Skipping LSM liquid stake for chains without LSM support)
 - [INTEGRATION-BASIC-EVMOS] LSM liquid stake with slash query (skipped: Skipping LSM liquid stake for chains without LSM support)
 ✓ [INTEGRATION-BASIC-EVMOS] autopilot liquid stake
 ✓ [INTEGRATION-BASIC-EVMOS] autopilot liquid stake and transfer
 ✓ [INTEGRATION-BASIC-EVMOS] autopilot redeem stake
 ✓ [INTEGRATION-BASIC-EVMOS] redemption and undelegation on EVMOS
 ✓ [INTEGRATION-BASIC-EVMOS] claim redeemed tokens
 ✓ [INTEGRATION-BASIC-EVMOS] rewards are being reinvested, exchange rate updating
 ✓ [INTEGRATION-BASIC-EVMOS] rewards are being distributed to stakers

13 tests, 0 failures, 2 skipped

integration_tests.bats
 ✓ [INTEGRATION-BASIC-HOST] host zones successfully registered
 ✓ [INTEGRATION-BASIC-HOST] ibc transfer
 ✓ [INTEGRATION-BASIC-HOST] liquid stake mint and transfer
 ✓ [INTEGRATION-BASIC-HOST] delegation on HOST
 - [INTEGRATION-BASIC-HOST] LSM liquid stake (skipped: Skipping LSM liquid stake for chains without LSM support)
 - [INTEGRATION-BASIC-HOST] LSM liquid stake with slash query (skipped: Skipping LSM liquid stake for chains without LSM support)
 ✓ [INTEGRATION-BASIC-HOST] autopilot liquid stake
 ✓ [INTEGRATION-BASIC-HOST] autopilot liquid stake and transfer
 ✓ [INTEGRATION-BASIC-HOST] autopilot redeem stake
 ✓ [INTEGRATION-BASIC-HOST] redemption and undelegation on HOST
 ✓ [INTEGRATION-BASIC-HOST] claim redeemed tokens
 ✓ [INTEGRATION-BASIC-HOST] rewards are being reinvested, exchange rate updating
 ✓ [INTEGRATION-BASIC-HOST] rewards are being distributed to stakers

13 tests, 0 failures, 2 skipped
```
  • Loading branch information
riley-stride authored Jan 12, 2024
1 parent 1d161c6 commit fcfcada
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ submit-upgrade-immediately:
UPGRADE_HEIGHT=150 bash $(DOCKERNET_HOME)/upgrades/submit_upgrade.sh

submit-upgrade-after-tests:
UPGRADE_HEIGHT=700 bash $(DOCKERNET_HOME)/upgrades/submit_upgrade.sh
UPGRADE_HEIGHT=500 bash $(DOCKERNET_HOME)/upgrades/submit_upgrade.sh

start-upgrade-integration-tests:
PART=1 bash $(DOCKERNET_HOME)/tests/run_tests_upgrade.sh
Expand Down
1 change: 1 addition & 0 deletions dockernet/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ IBC_DYDX_CHANNEL_3_DENOM='ibc/6301148031C0AC9A392C2DDB1B2D1F11B3B9D0A3ECF20C6B51

IBC_GAIA_STDENOM='ibc/054A44EC8D9B68B9A6F0D5708375E00A5569A28F21E0064FF12CADC3FEF1D04F'
IBC_HOST_STDENOM='ibc/E3AF56419340E719710C088D3855F65C4717E1A0C3B405F0C1D16F2A54E89421'
IBC_EVMOS_STDENOM='ibc/04CDA5EBB8A7E94BB60879B7F43EF0EDD2604990D8AB5BA18ADCB173F66FF874'

# COIN TYPES
# Coin types can be found at https://github.com/satoshilabs/slips/blob/master/slip-0044.md
Expand Down
2 changes: 1 addition & 1 deletion dockernet/dockerfiles/Dockerfile.evmos
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-alpine3.15 AS builder
FROM golang:1.20-alpine3.19 AS builder

WORKDIR /opt/

Expand Down
55 changes: 7 additions & 48 deletions dockernet/tests/integration_tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ setup_file() {
HOST_TRANSFER_CHANNEL="channel-0"

# IBC sttoken is only needed for autopilot tests which run on GAIA and HOST
IBC_STTOKEN="N/A"
if [[ "$CHAIN_NAME" == "GAIA" || "$CHAIN_NAME" == "HOST" ]]; then
IBC_STTOKEN=$(GET_VAR_VALUE IBC_${CHAIN_NAME}_STDENOM)
fi
IBC_STTOKEN=$(GET_VAR_VALUE IBC_${CHAIN_NAME}_STDENOM)

TRANSFER_AMOUNT=50000000
STAKE_AMOUNT=10000000
Expand Down Expand Up @@ -158,34 +155,6 @@ setup_file() {
assert_equal "$diff" $STAKE_AMOUNT
}

@test "[INTEGRATION-BASIC-$CHAIN_NAME] packet forwarding automatically liquid stake and ibc transfer stAsset to original network" {
memo='{ "autopilot": { "receiver": "'"$(STRIDE_ADDRESS)"'", "stakeibc": { "action": "LiquidStake", "ibc_receiver": "'$HOST_VAL_ADDRESS'" } } }'

# get initial balances
stibctoken_balance_start=$($HOST_MAIN_CMD q bank balances $HOST_VAL_ADDRESS --denom $IBC_GAIA_STATOM_DENOM | GETBAL)

# Send the IBC transfer with the JSON memo
transfer_msg_prefix="$HOST_MAIN_CMD tx ibc-transfer transfer transfer $HOST_TRANSFER_CHANNEL"
if [[ "$CHAIN_NAME" == "GAIA" ]]; then
# For GAIA (ibc-v3), pass the memo into the receiver field
$transfer_msg_prefix "$memo" ${PACKET_FORWARD_STAKE_AMOUNT}${HOST_DENOM} --from $HOST_VAL -y
elif [[ "$CHAIN_NAME" == "HOST" ]]; then
# For HOST (ibc-v5), pass an address for a receiver and the memo in the --memo field
$transfer_msg_prefix $(STRIDE_ADDRESS) ${PACKET_FORWARD_STAKE_AMOUNT}${HOST_DENOM} --memo "$memo" --from $HOST_VAL -y
else
# For all other hosts, skip this test
skip "Packet forward liquid stake test is only run on GAIA and HOST"
fi

# Wait for the transfer to complete
WAIT_FOR_BALANCE_CHANGE $CHAIN_NAME $HOST_VAL_ADDRESS $IBC_GAIA_STATOM_DENOM

# make sure stATOM balance increased
stibctoken_balance_end=$($HOST_MAIN_CMD q bank balances $HOST_VAL_ADDRESS --denom $IBC_GAIA_STATOM_DENOM | GETBAL)
stibctoken_balance_diff=$(($stibctoken_balance_end-$stibctoken_balance_start))
assert_equal "$stibctoken_balance_diff" "$PACKET_FORWARD_STAKE_AMOUNT"
}

# check that tokens on the host are staked
@test "[INTEGRATION-BASIC-$CHAIN_NAME] delegation on $CHAIN_NAME" {
# wait for another epoch to pass so that tokens are staked
Expand Down Expand Up @@ -292,12 +261,9 @@ setup_file() {
if [[ "$CHAIN_NAME" == "GAIA" ]]; then
# For GAIA (ibc-v3), pass the memo into the receiver field
$transfer_msg_prefix "$memo" ${PACKET_FORWARD_STAKE_AMOUNT}${HOST_DENOM} --from $HOST_VAL -y
elif [[ "$CHAIN_NAME" == "HOST" ]]; then
# For HOST (ibc-v5), pass an address for a receiver and the memo in the --memo field
$transfer_msg_prefix $(STRIDE_ADDRESS) ${PACKET_FORWARD_STAKE_AMOUNT}${HOST_DENOM} --memo "$memo" --from $HOST_VAL -y
else
# For all other hosts, skip this test
skip "Packet forward liquid stake test is only run on GAIA and HOST"
# For all other hosts (ibc-v5), pass an address for a receiver and the memo in the --memo field
$transfer_msg_prefix $(STRIDE_ADDRESS) ${PACKET_FORWARD_STAKE_AMOUNT}${HOST_DENOM} --memo "$memo" --from $HOST_VAL -y
fi

# Wait for the transfer to complete
Expand All @@ -310,10 +276,6 @@ setup_file() {
}

@test "[INTEGRATION-BASIC-$CHAIN_NAME] autopilot liquid stake and transfer" {
if [[ "$CHAIN_NAME" != "GAIA" && "$CHAIN_NAME" != "HOST" ]]; then
skip "Packet forward liquid stake test is only run on GAIA and HOST"
fi

memo='{ "autopilot": { "receiver": "'"$(STRIDE_ADDRESS)"'", "stakeibc": { "action": "LiquidStake", "ibc_receiver": "'$HOST_VAL_ADDRESS'" } } }'

# get initial balances
Expand All @@ -324,8 +286,8 @@ setup_file() {
if [[ "$CHAIN_NAME" == "GAIA" ]]; then
# For GAIA (ibc-v3), pass the memo into the receiver field
$transfer_msg_prefix "$memo" ${PACKET_FORWARD_STAKE_AMOUNT}${HOST_DENOM} --from $HOST_VAL -y
elif [[ "$CHAIN_NAME" == "HOST" ]]; then
# For HOST (ibc-v5), pass an address for a receiver and the memo in the --memo field
else
# For all other hosts (ibc-v5), pass an address for a receiver and the memo in the --memo field
$transfer_msg_prefix $(STRIDE_ADDRESS) ${PACKET_FORWARD_STAKE_AMOUNT}${HOST_DENOM} --memo "$memo" --from $HOST_VAL -y
fi

Expand Down Expand Up @@ -354,12 +316,9 @@ setup_file() {
if [[ "$CHAIN_NAME" == "GAIA" ]]; then
# For GAIA (ibc-v3), pass the memo into the receiver field
$transfer_msg_prefix "$memo" ${REDEEM_AMOUNT}${IBC_STTOKEN} --from $HOST_VAL -y
elif [[ "$CHAIN_NAME" == "HOST" ]]; then
# For HOST (ibc-v5), pass an address for a receiver and the memo in the --memo field
$transfer_msg_prefix $(STRIDE_ADDRESS)${REDEEM_AMOUNT}${IBC_STTOKEN} --memo "$memo" --from $HOST_VAL -y
else
# For all other hosts, skip this test
skip "Packet forward liquid stake test is only run on GAIA and HOST"
# For all other hosts (ibc-v5), pass an address for a receiver and the memo in the --memo field
$transfer_msg_prefix $(STRIDE_ADDRESS) ${REDEEM_AMOUNT}${IBC_STTOKEN} --memo "$memo" --from $HOST_VAL -y
fi
WAIT_FOR_BLOCK $STRIDE_LOGS 2

Expand Down

0 comments on commit fcfcada

Please sign in to comment.