Skip to content

Commit

Permalink
Merge pull request #444 from hyphacoop/test-ics-downtime
Browse files Browse the repository at this point in the history
Add ICS downtime and v4.0.0 chain
  • Loading branch information
dasanchez authored Feb 8, 2024
2 parents 56885af + be8e129 commit 9bad073
Show file tree
Hide file tree
Showing 8 changed files with 640 additions and 1,405 deletions.
1,932 changes: 569 additions & 1,363 deletions .github/workflows/test-gaia-v15-fresh-upgrade.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/generate_upgrade_matrix_fresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
if upgrade not in SKIP_TARGET_VERSIONS:
if RELAYER:
includes.append({'gaia_version': version, 'upgrade_version': upgrade, 'upgrade_mechanism': 'binary', 'relayer': 'hermes'})
includes.append({'gaia_version': version, 'upgrade_version': upgrade, 'upgrade_mechanism': 'binary', 'relayer': 'rly'})
# includes.append({'gaia_version': version, 'upgrade_version': upgrade, 'upgrade_mechanism': 'binary', 'relayer': 'rly'})
else:
includes.append({'gaia_version': version, 'upgrade_version': upgrade, 'upgrade_mechanism': 'binary'})
# includes.append({'gaia_version': version, 'upgrade_version': upgrade, 'upgrade_mechanism': 'cv_manual', 'cv_version': 'v1.5.0'})
Expand All @@ -84,7 +84,7 @@
else: # Add main branch build
if RELAYER:
includes.append({'gaia_version': version, 'upgrade_version': 'main', 'upgrade_mechanism': 'binary', 'relayer': 'hermes'})
includes.append({'gaia_version': version, 'upgrade_version': 'main', 'upgrade_mechanism': 'binary', 'relayer': 'rly'})
# includes.append({'gaia_version': version, 'upgrade_version': 'main', 'upgrade_mechanism': 'binary', 'relayer': 'rly'})
else:
includes.append({'gaia_version': version, 'upgrade_version': 'main', 'upgrade_mechanism': 'binary'})
# includes.append({'gaia_version': version, 'upgrade_version': 'main', 'upgrade_mechanism': 'cv_manual', 'cv_version': 'v1.5.0'})
Expand Down
3 changes: 2 additions & 1 deletion tests/major_fresh_upgrade/init_consumer_assign_keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ mv genesis-1.json $CONSUMER_HOME_1/config/genesis.json

# Set slashing to $DOWNTIME_BLOCKS
jq -r --arg SLASH "$DOWNTIME_BLOCKS" '.app_state.slashing.params.signed_blocks_window |= $SLASH' $CONSUMER_HOME_1/config/genesis.json > consumer-slashing.json
mv consumer-slashing.json $CONSUMER_HOME_1/config/genesis.json
jq -r '.app_state.slashing.params.downtime_jail_duration |= "10s"' consumer-slashing.json > consumer-slashing-2.json
mv consumer-slashing-2.json $CONSUMER_HOME_1/config/genesis.json

# Create self-delegation accounts
echo $MNEMONIC_1 | $CONSUMER_CHAIN_BINARY keys add $MONIKER_1 --keyring-backend test --home $CONSUMER_HOME_1 --recover
Expand Down
34 changes: 8 additions & 26 deletions tests/major_fresh_upgrade/prepare_consumer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,6 @@

# echo "Submitting proposal..."

# if [ $COSMOS_SDK == "v45" ]; then
# echo "Preparing proposal with v45 command..."
# proposal="$CHAIN_BINARY tx gov submit-proposal consumer-addition proposal-add-$CONSUMER_CHAIN_ID.json --gas $GAS --gas-adjustment $GAS_ADJUSTMENT --gas-prices $GAS_PRICE$DENOM --from $WALLET_2 --keyring-backend test --home $HOME_1 --chain-id $CHAIN_ID -y -o json"
# elif [ $COSMOS_SDK == "v47" ]; then
# echo "Preparing proposal with v47 command..."
# proposal="$CHAIN_BINARY tx gov submit-legacy-proposal consumer-addition proposal-add-$CONSUMER_CHAIN_ID.json --gas $GAS --gas-adjustment $GAS_ADJUSTMENT --gas-prices $GAS_PRICE$DENOM --from $WALLET_2 --keyring-backend test --home $HOME_1 --chain-id $CHAIN_ID -y -o json"
# fi
# txhash=$($proposal | jq -r .txhash)
# # Wait for the proposal to go on chain
# sleep $(($COMMIT_TIMEOUT+2))

# # Get proposal ID from txhash
# echo "Getting proposal ID from txhash..."
# $CHAIN_BINARY q tx $txhash --home $HOME_1
# proposal_id=$($CHAIN_BINARY q tx $txhash --home $HOME_1 --output json | jq -r '.logs[].events[] | select(.type=="submit_proposal") | .attributes[] | select(.key=="proposal_id") | .value')

# echo "Voting on proposal $proposal_id..."
# $CHAIN_BINARY tx gov vote $proposal_id yes --gas $GAS --gas-adjustment $GAS_ADJUSTMENT --fees $BASE_FEES$DENOM --from $WALLET_1 --keyring-backend test --home $HOME_1 --chain-id $CHAIN_ID -y
# sleep $(($COMMIT_TIMEOUT+2))
# $CHAIN_BINARY q gov tally $proposal_id --home $HOME_1

# echo "Waiting for proposal to pass..."
# sleep $VOTING_PERIOD
# sleep $VOTING_PERIOD
#$CHAIN_BINARY q gov proposals --home $HOME_1

$CHAIN_BINARY q provider list-consumer-chains --home $HOME_1

echo "Collecting the CCV state..."
Expand Down Expand Up @@ -74,6 +48,14 @@ if [ "$CONSUMER_ICS" == "v3.3.0" ]; then
fi
fi

if [ "$CONSUMER_ICS" == "v4.0.0" ]; then
if [ "$PROVIDER_ICS" != "v4.0.0" ]; then
echo "Patching for ICS v4.0.0 consumer"
$CONSUMER_CHAIN_BINARY genesis transform ccv.json > ccv-400-1.json
cp ccv-400-1.json ccv.json
fi
fi

echo "Patching the consumer genesis file..."
jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' $CONSUMER_HOME_1/config/genesis.json ccv.json > consumer-genesis.json
cp consumer-genesis.json $CONSUMER_HOME_1/config/genesis.json
Expand Down
2 changes: 0 additions & 2 deletions tests/major_fresh_upgrade/test_consumer_ibc_transfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ if [ -z "$provider_end_balance" ]; then
provider_end_balance=0
fi
echo "Provider ending balance in expected denom: $provider_end_balance"
journalctl -u $RELAYER | tail -n 100


if [ $provider_end_balance -gt $provider_start_balance ]; then
echo "Provider balance has increased!"
Expand Down
36 changes: 36 additions & 0 deletions tests/v15_upgrade/hermes-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,42 @@ trust_threshold = { numerator = '1', denominator = '3' }
ccv_consumer_chain = true
type = "CosmosSdk"

[[chains]]
id = 'nine-v400'
rpc_addr = 'http://localhost:27901'
grpc_addr = 'http://localhost:26901'
event_source = { mode = 'push', url = 'ws://localhost:27901/websocket', batch_delay = '500ms' }
rpc_timeout = '15s'
account_prefix = 'consumer'
key_name = 'wallet'
store_prefix = 'ibc'
gas_price = { price = 0.0025, denom = 'ucon' }
gas_multiplier = 1.2
max_gas = 10000000
clock_drift = '10s'
trusting_period = '5days'
trust_threshold = { numerator = '1', denominator = '3' }
ccv_consumer_chain = true
type = "CosmosSdk"

[[chains]]
id = 'ten-v400'
rpc_addr = 'http://localhost:47901'
grpc_addr = 'http://localhost:46901'
event_source = { mode = 'push', url = 'ws://localhost:47901/websocket', batch_delay = '500ms' }
rpc_timeout = '15s'
account_prefix = 'consumer'
key_name = 'wallet'
store_prefix = 'ibc'
gas_price = { price = 0.0025, denom = 'ucon' }
gas_multiplier = 1.2
max_gas = 10000000
clock_drift = '10s'
trusting_period = '5days'
trust_threshold = { numerator = '1', denominator = '3' }
ccv_consumer_chain = true
type = "CosmosSdk"

[[chains]]
id = 'testnet'
rpc_addr = 'http://localhost:27001'
Expand Down
20 changes: 20 additions & 0 deletions tests/v15_upgrade/setup_relayer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ if [ $RELAYER == "hermes" ]; then
hermes keys add --chain six-v310 --mnemonic-file mnemonic.txt
hermes keys add --chain seven-v320 --mnemonic-file mnemonic.txt
hermes keys add --chain eight-v330 --mnemonic-file mnemonic.txt
hermes keys add --chain nine-v400 --mnemonic-file mnemonic.txt
hermes keys add --chain ten-v400 --mnemonic-file mnemonic.txt
hermes keys add --chain pfm1 --mnemonic-file mnemonic.txt
hermes keys add --chain pfm2 --mnemonic-file mnemonic.txt
hermes keys add --chain pfm3 --mnemonic-file mnemonic.txt
Expand Down Expand Up @@ -87,6 +89,22 @@ elif [ $RELAYER == "rly" ]; then
cat eight-v330.json
rly chains add --file eight-v330.json

# nine
jq '.value."chain-id" = "nine-v400"' tests/v15_upgrade/testnet.json > nine-1.json
jq '.value."rpc-addr" = "http://localhost:27901"' nine-1.json > nine-2.json
jq '.value."account-prefix" = "consumer"' nine-2.json > nine-3.json
jq '.value."gas-prices" = "0.005ucon"' nine-3.json > nine-v400.json
cat nine-v400.json
rly chains add --file nine-v400.json

# ten
jq '.value."chain-id" = "ten-v400"' tests/v15_upgrade/testnet.json > ten-1.json
jq '.value."rpc-addr" = "http://localhost:47901"' ten-1.json > ten-2.json
jq '.value."account-prefix" = "consumer"' ten-2.json > ten-3.json
jq '.value."gas-prices" = "0.005ucon"' ten-3.json > ten-v400.json
cat ten-v400.json
rly chains add --file ten-v400.json

# pfm-1
jq '.value."chain-id" = "pfm1"' tests/v15_upgrade/testnet.json > p.json
jq '.value."rpc-addr" = "http://localhost:27011"' p.json > pf.json
Expand Down Expand Up @@ -115,6 +133,8 @@ elif [ $RELAYER == "rly" ]; then
rly keys restore five default "$MNEMONIC_RELAYER"
rly keys restore six-v310 default "$MNEMONIC_RELAYER"
rly keys restore eight-v330 default "$MNEMONIC_RELAYER"
rly keys restore nine-v400 default "$MNEMONIC_RELAYER"
rly keys restore ten-v400 default "$MNEMONIC_RELAYER"
rly keys restore pfm1 default "$MNEMONIC_RELAYER"
rly keys restore pfm2 default "$MNEMONIC_RELAYER"
rly keys restore pfm3 default "$MNEMONIC_RELAYER"
Expand Down
14 changes: 3 additions & 11 deletions tests/v15_upgrade/test_clawback.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ if [ "$pre_upgrade_acc_type" != "/cosmos.vesting.v1beta1.ContinuousVestingAccoun
exit 1
fi

echo "Post upgrade account type is: $post_upgrade_acc_type"
echo "Post upgrade account type is: $post_upgrade_acc2_type"
if [ "$post_upgrade_acc_type" != "/cosmos.auth.v1beta1.BaseAccount" ]; then
echo "Post upgrade account is not a base account"
exit 2
fi

# Check if account type matches
echo "Pre upgrade account2 type is: $pre_upgrade_acc_type"
echo "Pre upgrade account2 type is: $pre_upgrade_acc2_type"
if [ "$pre_upgrade_acc2_type" != "/cosmos.vesting.v1beta1.ContinuousVestingAccount" ]; then
echo "Pre upgrade account is not a vesting account"
exit 3
fi

echo "Post upgrade account type is: $post_upgrade_acc_type"
echo "Post upgrade account2 type is: $post_upgrade_acc2_type"
if [ "$post_upgrade_acc2_type" != "/cosmos.vesting.v1beta1.ContinuousVestingAccount" ]; then
echo "Post upgrade account is not a vesting account, this account's type shouldn't change"
exit 4
Expand Down Expand Up @@ -147,11 +147,3 @@ else
echo "FAIL: Community pool did not increase by at least the unvested amount."
exit 1
fi

# if [ $(bc -l <<< "$post_upgrade_cp < 100000000") -eq 1 ]
# then
# echo "Community pool balance is less than 100000000uatom, funds did not returned from wallet"
# exit 7
# else
# echo "Community pool balance is more than 100000000uatom, funds have been returned"
# fi

0 comments on commit 9bad073

Please sign in to comment.