Skip to content

Commit

Permalink
End to end testing scripts for v3 upgrade. (#830)
Browse files Browse the repository at this point in the history
  • Loading branch information
arhamchordia authored Aug 27, 2024
1 parent 0d37cc5 commit a9c8552
Show file tree
Hide file tree
Showing 13 changed files with 804 additions and 0 deletions.
10 changes: 10 additions & 0 deletions demos/upgrade-handler/v3.0.0/draft_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "Uprgade to v3",
"authors": [
"Quasar"
],
"summary": "Software upgrade to v3",
"details": "a",
"proposal_forum_url": "test.com",
"vote_option_context": "a"
}
19 changes: 19 additions & 0 deletions demos/upgrade-handler/v3.0.0/draft_proposal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"messages": [
{
"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade",
"authority": "quasar10d07y265gmmuvt4z0w9aw880jnsr700j5pfcmk",
"plan": {
"name": "v3",
"time": "0001-01-01T00:00:00Z",
"height": "80",
"info": "v3",
"upgraded_client_state": null
}
}
],
"metadata": "ipfs://CID",
"deposit": "10000uqsr",
"title": "Uprgade to v3",
"summary": "Software upgrade to v3"
}
16 changes: 16 additions & 0 deletions demos/upgrade-handler/v3.0.0/go-relayer-config/chains/osmosis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "cosmos",
"value": {
"key": "osmokey",
"chain-id": "osmosis",
"rpc-addr": "http://127.0.0.1:26679",
"account-prefix": "osmo",
"keyring-backend": "test",
"gas-adjustment": 1.5,
"gas-prices": "0.1uosmo",
"debug": true,
"timeout": "20s",
"output-format": "json",
"sign-mode": "direct"
}
}
16 changes: 16 additions & 0 deletions demos/upgrade-handler/v3.0.0/go-relayer-config/chains/quasar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"type": "cosmos",
"value": {
"key": "quasarkey",
"chain-id": "quasar",
"rpc-addr": "http://localhost:26659",
"account-prefix": "quasar",
"keyring-backend": "test",
"gas-adjustment": 2.0,
"gas-prices": "0.1uqsr",
"debug": true,
"timeout": "20s",
"output-format": "json",
"sign-mode": "direct"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"src": {
"chain-id": "quasar"
},
"dst": {
"chain-id": "osmosis"
},
"src-channel-filter": {
"rule": null,
"channel-list": []
}
}
1 change: 1 addition & 0 deletions demos/upgrade-handler/v3.0.0/keys/osmo.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rabbit garlic monitor wish pony magic budget someone room torch celery empower word assume digital rack electric weapon urban foot sketch jelly wet myself
1 change: 1 addition & 0 deletions demos/upgrade-handler/v3.0.0/keys/qsr.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
old cinnamon boy hurry pipe upset exhibit title copy squirrel grit eye love toy cotton connect inhale cost quarter mistake ahead endless bless license
93 changes: 93 additions & 0 deletions demos/upgrade-handler/v3.0.0/osmosis_localnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/sh

# Configure variables
BINARY=osmosisd
HOME_OSMOSIS=$HOME/.osmosis
CHAIN_ID=osmosis
ALICE="cruise scene law sea push expose scorpion wire trick repair wave quote task dose inner denial alpha favorite certain blouse motion flash split lunch"
BOB="lizard garlic canyon winner cheese tent drip task because ecology clay bridge junk critic track artefact gather harsh deliver unit vacant earth diesel stool"
USER_1="guard cream sadness conduct invite crumble clock pudding hole grit liar hotel maid produce squeeze return argue turtle know drive eight casino maze host"
USER_2="fuel obscure melt april direct second usual hair leave hobby beef bacon solid drum used law mercy worry fat super must ritual bring faculty"
RELAYER_ACC="$(cat ./keys/osmo.key)"

ALICE_GENESIS_COINS=20000000uosmo,2000000000stake,1000000000000fakestake
BOB_GENESIS_COINS=10000000000000uosmo,1000000000stake,1000000000000fakestake,100000000000000usdc
USER_1_GENESIS_COINS=10000000000stake,10000000000uosmo
USER_2_GENESIS_COINS=10000000000stake,10000000000uosmo
RELAYER_ACC_GENESIS_COINS=10000000uosmo,10000000000stake

echo $HOME_OSMOSIS

rm -rf $HOME_OSMOSIS
# Bootstrap
$BINARY init $CHAIN_ID --chain-id $CHAIN_ID --home $HOME_OSMOSIS

echo $ALICE | $BINARY keys add alice --keyring-backend test --recover --home $HOME_OSMOSIS
echo $BOB | $BINARY keys add bob --keyring-backend test --recover --home $HOME_OSMOSIS
echo $USER_1 | $BINARY keys add user1 --keyring-backend test --recover --home $HOME_OSMOSIS
echo $USER_2 | $BINARY keys add user2 --keyring-backend test --recover --home $HOME_OSMOSIS
echo $RELAYER_ACC | $BINARY keys add relayer_acc --keyring-backend test --recover --home $HOME_OSMOSIS
$BINARY add-genesis-account $($BINARY keys show alice --keyring-backend test -a --home $HOME_OSMOSIS) $ALICE_GENESIS_COINS --home $HOME_OSMOSIS
$BINARY add-genesis-account $($BINARY keys show bob --keyring-backend test -a --home $HOME_OSMOSIS) $BOB_GENESIS_COINS --home $HOME_OSMOSIS
$BINARY add-genesis-account $($BINARY keys show user1 --keyring-backend test -a --home $HOME_OSMOSIS) $USER_1_GENESIS_COINS --home $HOME_OSMOSIS
$BINARY add-genesis-account $($BINARY keys show user2 --keyring-backend test -a --home $HOME_OSMOSIS) $USER_2_GENESIS_COINS --home $HOME_OSMOSIS
$BINARY add-genesis-account $($BINARY keys show relayer_acc --keyring-backend test -a --home $HOME_OSMOSIS) $RELAYER_ACC_GENESIS_COINS --home $HOME_OSMOSIS
$BINARY add-genesis-account osmo15td5pfjkmfn8d6l4t8dc67l3apgt9epw4ct298 $RELAYER_ACC_GENESIS_COINS --home $HOME_OSMOSIS
$BINARY gentx alice 10000000uosmo --chain-id $CHAIN_ID --keyring-backend test --home $HOME_OSMOSIS
$BINARY collect-gentxs --home $HOME_OSMOSIS

# Check platform
platform='unknown'
unamestr=$(uname)
if [ "$unamestr" = 'Linux' ]; then
platform='linux'
elif [ "$unamestr" = 'Darwin' ]; then
platform='macos'
fi

if [ $platform = 'linux' ]; then
sed -i 's/enable = false/enable = true/g' $HOME_OSMOSIS/config/app.toml
sed -i 's/swagger = false/swagger = true/g' $HOME_OSMOSIS/config/app.toml
sed -i 's/minimum-gas-prices = ""/minimum-gas-prices = "0uosmo"/g' $HOME_OSMOSIS/config/app.toml
sed -i 's+laddr = "tcp://127.0.0.1:26657"+laddr = "tcp://127.0.0.1:26679"+g' $HOME_OSMOSIS/config/config.toml
sed -i 's+node = "tcp://localhost:26657"+node = "tcp://localhost:26679"+g' $HOME_OSMOSIS/config/client.toml
sed -i 's+laddr = "tcp://0.0.0.0:26656"+laddr = "tcp://0.0.0.0:26662"+g' $HOME_OSMOSIS/config/config.toml
sed -i 's+pprof_laddr = "localhost:6060"+pprof_laddr = "localhost:6062"+g' $HOME_OSMOSIS/config/config.toml
sed -i 's+address = "0.0.0.0:9090"+address = "0.0.0.0:9096"+g' $HOME_OSMOSIS/config/app.toml
sed -i 's+address = "0.0.0.0:9091"+address = "0.0.0.0:8092"+g' $HOME_OSMOSIS/config/app.toml
sed -i 's+address = "tcp://0.0.0.0:1317"+address = "tcp://0.0.0.0:1312"+g' $HOME_OSMOSIS/config/app.toml
sed -i 's+address = ":8080"+address = ":8082"+g' $HOME_OSMOSIS/config/app.toml
elif [ $platform = 'macos' ]; then
sed -i'.original' -e 's/enable = false/enable = true/g' $HOME_OSMOSIS/config/app.toml
sed -i'.original' -e 's/swagger = false/swagger = true/g' $HOME_OSMOSIS/config/app.toml
sed -i'.original' -e 's/minimum-gas-prices = ""/minimum-gas-prices = "0uosmo"/g' $HOME_OSMOSIS/config/app.toml
sed -i'.original' -e 's+laddr = "tcp://127.0.0.1:26657"+laddr = "tcp://127.0.0.1:26679"+g' $HOME_OSMOSIS/config/config.toml
sed -i'.original' -e 's+node = "tcp://localhost:26657"+node = "tcp://localhost:26679"+g' $HOME_OSMOSIS/config/client.toml
sed -i'.original' -e 's+laddr = "tcp://0.0.0.0:26656"+laddr = "tcp://0.0.0.0:26662"+g' $HOME_OSMOSIS/config/config.toml
sed -i'.original' -e 's+pprof_laddr = "localhost:6060"+pprof_laddr = "localhost:6062"+g' $HOME_OSMOSIS/config/config.toml
sed -i'.original' -e 's+address = "0.0.0.0:9090"+address = "0.0.0.0:9096"+g' $HOME_OSMOSIS/config/app.toml
sed -i'.original' -e 's+address = "0.0.0.0:9091"+address = "0.0.0.0:8092"+g' $HOME_OSMOSIS/config/app.toml
sed -i'.original' -e 's+address = "tcp://0.0.0.0:1317"+address = "tcp://0.0.0.0:1312"+g' $HOME_OSMOSIS/config/app.toml
sed -i'.original' -e 's+address = ":8080"+address = ":8082"+g' $HOME_OSMOSIS/config/app.toml
else
echo "only linux and macos platforms are supported, if you are using other platforms you should probably improve this script."

exit 1
sed -i '' 's/enable = false/enable = true/g' $HOME_OSMOSIS/config/app.toml
sed -i '' 's/swagger = false/swagger = true/g' $HOME_OSMOSIS/config/app.toml
fi

cp $HOME_OSMOSIS/config/genesis.json $HOME_OSMOSIS/config/genesis_original.json
cat $HOME_OSMOSIS/config/genesis_original.json |

jq '.app_state.crisis.constant_fee.denom="uosmo"' |
jq '.app_state.staking.params.bond_denom="uosmo"' |
jq '.app_state.txfees.basedenom="uosmo"' |
jq '.app_state.gov.deposit_params.min_deposit=[{denom:"uosmo",amount:"1"}]' |
jq '.app_state.gov.voting_params.voting_period="30s"' |
jq '.app_state.gov.tally_params={quorum:"0.000000000000000001",threshold:"0.5",veto_threshold:"0.334"}' >$HOME_OSMOSIS/config/genesis.json


# Start
$BINARY start --home $HOME_OSMOSIS >>./logs/osmo_localnet.log 2>&1 &
#$BINARY start --home $HOME_OSMOSIS
Loading

0 comments on commit a9c8552

Please sign in to comment.