diff --git a/demos/upgrade-handler/v3.0.0/draft_metadata.json b/demos/upgrade-handler/v3.0.0/draft_metadata.json new file mode 100644 index 000000000..4351a7243 --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/draft_metadata.json @@ -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" +} \ No newline at end of file diff --git a/demos/upgrade-handler/v3.0.0/draft_proposal.json b/demos/upgrade-handler/v3.0.0/draft_proposal.json new file mode 100644 index 000000000..25fd440a1 --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/draft_proposal.json @@ -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" +} \ No newline at end of file diff --git a/demos/upgrade-handler/v3.0.0/go-relayer-config/chains/osmosis.json b/demos/upgrade-handler/v3.0.0/go-relayer-config/chains/osmosis.json new file mode 100644 index 000000000..8feb65401 --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/go-relayer-config/chains/osmosis.json @@ -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" + } +} diff --git a/demos/upgrade-handler/v3.0.0/go-relayer-config/chains/quasar.json b/demos/upgrade-handler/v3.0.0/go-relayer-config/chains/quasar.json new file mode 100644 index 000000000..f266631b1 --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/go-relayer-config/chains/quasar.json @@ -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" + } +} diff --git a/demos/upgrade-handler/v3.0.0/go-relayer-config/paths/quasar_osmosis.json b/demos/upgrade-handler/v3.0.0/go-relayer-config/paths/quasar_osmosis.json new file mode 100644 index 000000000..8979f1b43 --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/go-relayer-config/paths/quasar_osmosis.json @@ -0,0 +1,12 @@ +{ + "src": { + "chain-id": "quasar" + }, + "dst": { + "chain-id": "osmosis" + }, + "src-channel-filter": { + "rule": null, + "channel-list": [] + } +} diff --git a/demos/upgrade-handler/v3.0.0/keys/osmo.key b/demos/upgrade-handler/v3.0.0/keys/osmo.key new file mode 100644 index 000000000..771f7031a --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/keys/osmo.key @@ -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 diff --git a/demos/upgrade-handler/v3.0.0/keys/qsr.key b/demos/upgrade-handler/v3.0.0/keys/qsr.key new file mode 100644 index 000000000..d47463aa4 --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/keys/qsr.key @@ -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 diff --git a/demos/upgrade-handler/v3.0.0/osmosis_localnet.sh b/demos/upgrade-handler/v3.0.0/osmosis_localnet.sh new file mode 100755 index 000000000..8da39ad78 --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/osmosis_localnet.sh @@ -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 \ No newline at end of file diff --git a/demos/upgrade-handler/v3.0.0/post_upgrade.sh b/demos/upgrade-handler/v3.0.0/post_upgrade.sh new file mode 100755 index 000000000..10eec0b6a --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/post_upgrade.sh @@ -0,0 +1,352 @@ +#!/bin/bash + +# Variables +NODE="http://127.0.0.1:26659" + +# Function to check if a value is true +check_true() { + local key="$1" + local value="$2" + if [ "$value" == "true" ]; then + echo "$key is true." + else + echo "$key is not true." + exit 1 + fi +} + +# Function to check if a value is greater than a threshold +check_greater() { + local key="$1" + local value="$2" + local threshold="$3" + if (( $(echo "$value > $threshold" | bc -l) )); then + echo "$key is greater than $threshold." + else + echo "$key is not greater than $threshold." + exit 1 + fi +} + +# Function to check if a value is equal to an expected value +check_equal() { + local key="$1" + local value="$2" + local expected="$3" + if [ "$value" == "$expected" ]; then + echo "$key is $expected." + else + echo "$key is not $expected. Got: $value" + exit 1 + fi +} + +# Check ibc-transfer params +IBC_TRANSFER_PARAMS=$(quasard q ibc-transfer params --output json --node $NODE) +SEND_ENABLED=$(echo $IBC_TRANSFER_PARAMS | jq -r '.send_enabled') +RECEIVE_ENABLED=$(echo $IBC_TRANSFER_PARAMS | jq -r '.receive_enabled') +check_true "send_enabled" "$SEND_ENABLED" +check_true "receive_enabled" "$RECEIVE_ENABLED" + +# Check ibc-wasm checksums +IBC_WASM_CHECKSUMS=$(quasard q ibc-wasm checksums --output json --node $NODE) +CHECKSUMS_LENGTH=$(echo $IBC_WASM_CHECKSUMS | jq -r '.checksums | length') +check_equal "checksums length" "$CHECKSUMS_LENGTH" "0" + +# Check interchain-accounts controller params +ICA_CONTROLLER_PARAMS=$(quasard q interchain-accounts controller params --output json --node $NODE) +CONTROLLER_ENABLED=$(echo $ICA_CONTROLLER_PARAMS | jq -r '.controller_enabled') +check_true "controller_enabled" "$CONTROLLER_ENABLED" + +# Check interchain-accounts host params +ICA_HOST_PARAMS=$(quasard q interchain-accounts host params --output json --node $NODE) +HOST_ENABLED=$(echo $ICA_HOST_PARAMS | jq -r '.host_enabled') +ALLOW_MESSAGES_LENGTH=$(echo $ICA_HOST_PARAMS | jq -r '.allow_messages | length') +check_true "host_enabled" "$HOST_ENABLED" +check_equal "allow_messages length" "$ALLOW_MESSAGES_LENGTH" "1" + +# Check mint params +MINT_PARAMS=$(quasard q mint params --output json --node $NODE) +MINT_DENOM=$(echo $MINT_PARAMS | jq -r '.params.mint_denom') +INFLATION_RATE_CHANGE=$(echo $MINT_PARAMS | jq -r '.params.inflation_rate_change') +check_equal "mint_denom" "$MINT_DENOM" "uqsr" +check_greater "inflation_rate_change" "$INFLATION_RATE_CHANGE" "0" + +# Check params subspace slashing SignedBlocksWindow +#SLASHING_PARAMS=$(quasard q params subspace slashing SignedBlocksWindow --output json --node $NODE) +#SIGNED_BLOCKS_WINDOW=$(echo $SLASHING_PARAMS | jq -r '.value' | tr -d '"') +#check_greater "SignedBlocksWindow" "$SIGNED_BLOCKS_WINDOW" "0" + +# Check slashing params +SLASHING_PARAMS=$(quasard q slashing params --output json --node $NODE) +SIGNED_BLOCKS_WINDOW=$(echo $SLASHING_PARAMS | jq -r '.params.signed_blocks_window') +check_greater "signed_blocks_window" "$SIGNED_BLOCKS_WINDOW" "99" + +# Check staking params +STAKING_PARAMS=$(quasard q staking params --output json --node $NODE) +UNBONDING_TIME=$(echo $STAKING_PARAMS | jq -r '.params.unbonding_time' | sed 's/s//') +MAX_VALIDATORS=$(echo $STAKING_PARAMS | jq -r '.params.max_validators') +check_equal "unbonding_time" "$UNBONDING_TIME" "504h0m0" +check_equal "max_validators" "$MAX_VALIDATORS" "100" + +# Check tendermint-validator-set +VALIDATOR_SET=$(quasard q tendermint-validator-set --output json --node $NODE) +VALIDATORS_COUNT=$(echo $VALIDATOR_SET | jq -r '.validators | length') +check_greater "validators count" "$VALIDATORS_COUNT" "0" + +# Check tokenfactory params +TOKENFACTORY_PARAMS=$(quasard q tokenfactory params --output json --node $NODE) +DENOM_CREATION_FEE_AMOUNT=$(echo $TOKENFACTORY_PARAMS | jq -r '.params.denom_creation_fee[] | select(.denom=="uqsr") | .amount') +check_greater "denom_creation_fee_amount" "$DENOM_CREATION_FEE_AMOUNT" "0" + +# Check upgrade module_versions +UPGRADE_MODULE_VERSIONS=$(quasard q upgrade module_versions --output json --node $NODE) +MODULE_VERSIONS_COUNT=$(echo $UPGRADE_MODULE_VERSIONS | jq -r '.module_versions | length') +check_greater "module_versions count" "$MODULE_VERSIONS_COUNT" "0" + +# Check wasm params +WASM_PARAMS=$(quasard q wasm params --output json --node $NODE) +CODE_UPLOAD_ACCESS=$(echo $WASM_PARAMS | jq -r '.code_upload_access.permission') +check_equal "code_upload_access permission" "$CODE_UPLOAD_ACCESS" "Everybody" + +# Check account info +ACCOUNT_INFO=$(quasard q auth account quasar1sqlsc5024sszglyh7pswk5hfpc5xtl77gqjwec --output json --node $NODE) +ACCOUNT_NUMBER=$(echo $ACCOUNT_INFO | jq -r '.account.value.account_number') +check_greater "account_number" "$ACCOUNT_NUMBER" "0" + +# Check auth params +AUTH_PARAMS=$(quasard q auth params --output json --node $NODE) +MAX_MEMO_CHARACTERS=$(echo $AUTH_PARAMS | jq -r '.params.max_memo_characters') +TX_SIG_LIMIT=$(echo $AUTH_PARAMS | jq -r '.params.tx_sig_limit') +check_greater "max_memo_characters" "$MAX_MEMO_CHARACTERS" "0" +check_greater "tx_sig_limit" "$TX_SIG_LIMIT" "0" + +# Check bank total +BANK_TOTAL=$(quasard q bank total --output json --node $NODE) +UQSR_AMOUNT=$(echo $BANK_TOTAL | jq -r '.supply[] | select(.denom=="uqsr") | .amount') +check_greater "uqsr amount" "$UQSR_AMOUNT" "100000000" + +# Check distribution params +DISTRIBUTION_PARAMS=$(quasard q distribution params --output json --node $NODE) +COMMUNITY_TAX=$(echo $DISTRIBUTION_PARAMS | jq -r '.params.community_tax') +check_greater "community_tax" "$COMMUNITY_TAX" "0" + +# Check epochs info +EPOCHS_INFO=$(quasard q epochs epoch-infos --output json --node $NODE) +CURRENT_EPOCHS=$(echo $EPOCHS_INFO | jq -r '.epochs[].current_epoch') +ALL_VALID=true +for EPOCH in $CURRENT_EPOCHS; do + if [ "$EPOCH" -lt 1 ]; then + ALL_VALID=false + break + fi +done +if [ "$ALL_VALID" = true ]; then + echo "All current epochs are greater than or equal to 1." +else + echo "One or more current epochs are less than 1." + exit 1 +fi + +# Check evidence +EVIDENCE=$(quasard q evidence list --height 21 --output json --node $NODE) +EVIDENCE_COUNT=$(echo $EVIDENCE | jq -r '.pagination | length') +check_equal "evidence count" "$EVIDENCE_COUNT" "0" + +# Check gov params +GOV_PARAMS=$(quasard q gov params --output json --node $NODE) +MIN_DEPOSIT_AMOUNT=$(echo $GOV_PARAMS | jq -r '.params.min_deposit[] | select(.denom=="uqsr") | .amount') +MAX_DEPOSIT_PERIOD=$(echo $GOV_PARAMS | jq -r '.params.max_deposit_period') +check_equal "min_deposit_amount" "$MIN_DEPOSIT_AMOUNT" "1" +check_equal "max_deposit_period" "$MAX_DEPOSIT_PERIOD" "48h0m0s" + +echo "qwuery testing finished" + + + +# Variables +NODE="http://127.0.0.1:26659" +CHAIN_ID="quasar" +KEYRING_BACKEND="test" +HOME_DIR="$HOME/.quasarnode" +SENDER="bob" +RECEIVER="my_treasury" +SENDER_ADDRESS="quasar1828z63g9wp3qwyn4p64adc3ungsv56ux5aacmu" +RECEIVER_ADDRESS="quasar1sqlsc5024sszglyh7pswk5hfpc5xtl77gqjwec" +VALIDATOR="quasarvaloper1sqlsc5024sszglyh7pswk5hfpc5xtl77v7z632" +DENOM="uqsr" +GAS_PRICES="0.1uqsr" +CONTRACT_WASM_PATH="./artifacts/airdrop.wasm" +CONTRACT_LABEL="Test Contract" +CONTRACT_INIT_MSG='{"config": {"airdrop_amount": "11000000000","airdrop_asset": {"native": "uqsr"},"airdrop_title":"Test Title","airdrop_description": "Test description","end_height": 0,"start_height": 0,"total_claimed": "0"}}' +SLEEP_DURATION=6 + +# Function to print and execute commands +execute() { + echo "Executing: $*" + eval $* +} + +OLD_CONTRACT_ADDRESS="quasar14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sy9numu" +echo "Interact with old Contract" +CONTRACT_EXECUTE_MSG='{"admin": {"add_users": {"users": [{"address": "quasar1sqlsc5024sszglyh7pswk5hfpc5xtl77gqjwec", "amount": "2500000000"}]}}}' +execute "quasard tx wasm execute $OLD_CONTRACT_ADDRESS '$CONTRACT_EXECUTE_MSG' --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --gas-adjustment 1.5 --gas auto" +sleep $SLEEP_DURATION + +# Query Contract State +echo "Query old Contract State" +CONTRACT_QUERY_MSG='{"airdrop_config_query": {}}' +execute "quasard query wasm contract-state smart $OLD_CONTRACT_ADDRESS '$CONTRACT_QUERY_MSG' --node $NODE --output json" + +# Bank Send +echo "1. Bank Send" +execute "quasard query bank balances $RECEIVER_ADDRESS --node $NODE" +execute "quasard tx bank send $SENDER_ADDRESS $RECEIVER_ADDRESS 10000000$DENOM --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --gas auto --gas-adjustment 1.5" +sleep $SLEEP_DURATION +execute "quasard query bank balances $RECEIVER_ADDRESS --node $NODE" + +# Staking +echo "2. Staking" +execute "quasard tx staking delegate $VALIDATOR 1000000$DENOM --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --gas auto --gas-adjustment 1.5" +sleep $SLEEP_DURATION +execute "quasard query staking delegations $SENDER_ADDRESS --node $NODE" + +# Claim Rewards +echo "3. Claim Rewards" +execute "quasard tx distribution withdraw-rewards $VALIDATOR --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --gas --gas-adjustment 1.5" +sleep $SLEEP_DURATION +execute "quasard query distribution rewards-by-validator $SENDER_ADDRESS $VALIDATOR --node $NODE" + +# Upload Contract +echo "4. Upload Contract" +execute "quasard tx wasm store $CONTRACT_WASM_PATH --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --gas auto --gas-adjustment 1.5" +sleep $SLEEP_DURATION + +# Get the code ID +CODE_ID=$(quasard query wasm list-code --node $NODE --output json | jq -r '.code_infos[-1].code_id') +echo "Contract Code ID: $CODE_ID" + +# Instantiate Contract +echo "5. Instantiate Contract" +execute "quasard tx wasm instantiate $CODE_ID '$CONTRACT_INIT_MSG' --from $SENDER --label '$CONTRACT_LABEL' --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --admin $SENDER_ADDRESS --gas auto --gas-adjustment 1.5" +sleep $SLEEP_DURATION + +# Get the contract address +CONTRACT_ADDRESS=$(quasard query wasm list-contract-by-code $CODE_ID --node $NODE --output json | jq -r '.contracts[-1]') +echo "Contract Address: $CONTRACT_ADDRESS" + +# Interact with Contract +echo "6. Interact with Contract" +CONTRACT_EXECUTE_MSG='{"admin": {"add_users": {"users": [{"address": "quasar1sqlsc5024sszglyh7pswk5hfpc5xtl77gqjwec", "amount": "2500000000"}]}}}' +execute "quasard tx wasm execute $CONTRACT_ADDRESS '$CONTRACT_EXECUTE_MSG' --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --gas auto --gas-adjustment 1.5" +sleep $SLEEP_DURATION + +# Query Contract State +echo "7. Query Contract State" +CONTRACT_QUERY_MSG='{"airdrop_config_query": {}}' +execute "quasard query wasm contract-state smart $CONTRACT_ADDRESS '$CONTRACT_QUERY_MSG' --node $NODE --output json" + +echo "8. Submit Governance Proposal" +PROPOSAL_TITLE="Test Proposal" +PROPOSAL_DESCRIPTION="This is a test proposal." +PROPOSAL_TYPE="Text" +PROPOSAL_DEPOSIT="1$DENOM" +execute "quasard tx gov submit-legacy-proposal --title '$PROPOSAL_TITLE' --description '$PROPOSAL_DESCRIPTION' --type '$PROPOSAL_TYPE' --deposit $PROPOSAL_DEPOSIT --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --gas auto --gas-adjustment 1.5" +sleep $SLEEP_DURATION + +# Get the proposal ID +PROPOSAL_ID=$(quasard query gov proposals --output json --node $NODE | jq -r '.proposals[-1].id') +echo "Proposal ID: $PROPOSAL_ID" + +# Deposit to the Proposal +echo "9. Deposit to the Proposal" +execute "quasard tx gov deposit $PROPOSAL_ID 5000000$DENOM --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --gas auto --gas-adjustment 1.5" +sleep $SLEEP_DURATION + +# Vote on the Proposal +echo "10. Vote on the Proposal" +execute "quasard tx gov vote $PROPOSAL_ID yes --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --gas auto --gas-adjustment 1.5" +sleep $SLEEP_DURATION + +# Query Proposal Status +echo "11. Query Proposal Status" +execute "quasard query gov proposal $PROPOSAL_ID --node $NODE --output json" + +# IBC testing post upgrade +OSMOSIS_NODE="http://127.0.0.1:26679" +OSMOSIS_CHANNEL="channel-0" +OSMOSIS_SENDER="bob" +OSMOSIS_RECEIVER="quasar1sqlsc5024sszglyh7pswk5hfpc5xtl77gqjwec" +OSMOSIS_DENOM="uosmo" +OSMOSIS_AMOUNT="10000" +OSMOSIS_CHAIN_ID="osmosis" +OSMOSIS_HOME="$HOME/.osmosis" + +QUASAR_NODE="http://127.0.0.1:26659" +QUASAR_CHANNEL="channel-0" +QUASAR_SENDER="my_treasury" +QUASAR_RECEIVER="osmo1ez43ye5qn3q2zwh8uvswppvducwnkq6wjqc87d" +QUASAR_DENOM="uqsr" +QUASAR_AMOUNT="10000" +QUASAR_CHAIN_ID="quasar" +QUASAR_HOME="$HOME/.quasarnode" +LOOP_COUNT=15 +SLEEP_DURATION=10 + +SENDER_ADDRESS="quasar1828z63g9wp3qwyn4p64adc3ungsv56ux5aacmu" +RECEIVER_ADDRESS="quasar1sqlsc5024sszglyh7pswk5hfpc5xtl77gqjwec" +VALIDATOR="quasarvaloper1sqlsc5024sszglyh7pswk5hfpc5xtl77v7z632" + +echo "12. IBC testing" +# Execute and check balances +for ((i=1; i<=LOOP_COUNT; i++)) +do + echo "Iteration $i" + + # Osmosis to Quasar transfer + echo "Transferring from Osmosis to Quasar" + INITIAL_BALANCE=$(quasard query bank balances $OSMOSIS_RECEIVER --output json | jq -r --arg denom "ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518" '.balances[] | select(.denom==$denom) | .amount') + osmosisd tx ibc-transfer transfer transfer $OSMOSIS_CHANNEL $OSMOSIS_RECEIVER ${OSMOSIS_AMOUNT}${OSMOSIS_DENOM} --from $OSMOSIS_SENDER --keyring-backend test --home $OSMOSIS_HOME --node $OSMOSIS_NODE --chain-id $OSMOSIS_CHAIN_ID -y --gas-prices 1$OSMOSIS_DENOM + sleep $SLEEP_DURATION + rly transact flush + sleep $SLEEP_DURATION + FINAL_BALANCE=$(quasard query bank balances $OSMOSIS_RECEIVER --output json | jq -r --arg denom "ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518" '.balances[] | select(.denom==$denom) | .amount') + check_greater "Balance" "$FINAL_BALANCE" "$INITIAL_BALANCE" + + + # Quasar to Osmosis transfer + echo "Transferring from Quasar to Osmosis" + INITIAL_BALANCE=$(osmosisd query bank balances $QUASAR_RECEIVER --node $OSMOSIS_NODE --output json | jq -r --arg denom "ibc/6BEEEE6CC17BA0EE37857A1E2AF6EC53C50DB6B6F89463A3933D0859C4CF6087" '.balances[] | select(.denom==$denom) | .amount') + quasard tx ibc-transfer transfer transfer $QUASAR_CHANNEL $QUASAR_RECEIVER ${QUASAR_AMOUNT}${QUASAR_DENOM} --from $QUASAR_SENDER --keyring-backend test --home $QUASAR_HOME --chain-id $QUASAR_CHAIN_ID -y --gas-prices 1$QUASAR_DENOM --node $QUASAR_NODE + sleep $SLEEP_DURATION + rly transact flush + sleep $SLEEP_DURATION + FINAL_BALANCE=$(osmosisd query bank balances $QUASAR_RECEIVER --node $OSMOSIS_NODE --output json | jq -r --arg denom "ibc/6BEEEE6CC17BA0EE37857A1E2AF6EC53C50DB6B6F89463A3933D0859C4CF6087" '.balances[] | select(.denom==$denom) | .amount') + check_greater "Balance" "$FINAL_BALANCE" "$INITIAL_BALANCE" + + # other module actions + INITIAL_BALANCE=$(quasard query bank balances $RECEIVER_ADDRESS --output json | jq -r --arg denom "$QUASAR_DENOM" '.balances[] | select(.denom==$denom) | .amount') + quasard tx bank send $SENDER_ADDRESS $RECEIVER_ADDRESS 10000000$DENOM --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y + sleep $SLEEP_DURATION + FINAL_BALANCE=$(quasard query bank balances $RECEIVER_ADDRESS --output json | jq -r --arg denom "$QUASAR_DENOM" '.balances[] | select(.denom==$denom) | .amount') + check_greater "Balance" "$FINAL_BALANCE" "$INITIAL_BALANCE" + + REWARDS=$(quasard query distribution rewards-by-validator $SENDER_ADDRESS $VALIDATOR --output json) + INITIAL_REWARDS=$(echo $REWARDS | jq -r '.rewards[] | sub("uqsr$"; "") | tonumber' ) + quasard tx distribution withdraw-rewards $VALIDATOR --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y + sleep $SLEEP_DURATION + REWARDS=$(quasard query distribution rewards-by-validator $SENDER_ADDRESS $VALIDATOR --output json) + FINAL_REWARDS=$(echo $REWARDS | jq -r '.rewards[] | sub("uqsr$"; "") | tonumber' ) + check_greater "Rewards" "$INITIAL_REWARDS" "$FINAL_REWARDS" + + INITIAL_STAKING=$(quasard query staking delegations $SENDER_ADDRESS --output json) + INITIAL_STAKING_AMOUNT=$(echo $INITIAL_STAKING | jq -r '.delegation_responses[0].balance.amount') + quasard tx staking delegate $VALIDATOR 1000000$DENOM --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y + sleep $SLEEP_DURATION + POST_STAKING=$(quasard query staking delegations $SENDER_ADDRESS --output json) + POST_STAKING_AMOUNT=$(echo $POST_STAKING | jq -r '.delegation_responses[0].balance.amount') + check_greater "Staked Amount" "$POST_STAKING_AMOUNT" "$INITIAL_STAKING_AMOUNT" + +done + +echo "Script completed." diff --git a/demos/upgrade-handler/v3.0.0/pre_upgrade.sh b/demos/upgrade-handler/v3.0.0/pre_upgrade.sh new file mode 100755 index 000000000..2e2539401 --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/pre_upgrade.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +# Variables +NODE="http://127.0.0.1:26659" +CHAIN_ID="quasar" +KEYRING_BACKEND="test" +HOME_DIR="$HOME/.quasarnode" +SENDER="bob" +SENDER_ADDRESS="quasar1828z63g9wp3qwyn4p64adc3ungsv56ux5aacmu" +GAS_PRICES="0.1uqsr" +CONTRACT_WASM_PATH="./artifacts/airdrop.wasm" +CONTRACT_LABEL="Test Contract" +CONTRACT_INIT_MSG='{"config": {"airdrop_amount": "11000000000","airdrop_asset": {"native": "uqsr"},"airdrop_title":"Test Title","airdrop_description": "Test description","end_height": 0,"start_height": 0,"total_claimed": "0"}}' +SLEEP_DURATION=6 + +# Function to print and execute commands +execute() { + echo "Executing: $*" + eval $* +} + +# Upload Contract +echo "1. Upload Contract" +execute "quasarnoded tx wasm store $CONTRACT_WASM_PATH --from $SENDER --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --gas 2000000" +sleep $SLEEP_DURATION + +# Get the code ID +CODE_ID=$(quasarnoded query wasm list-code --node $NODE --output json | jq -r '.code_infos[-1].code_id') +echo "Contract Code ID: $CODE_ID" + +# Instantiate Contract +echo "2. Instantiate Contract" +execute "quasarnoded tx wasm instantiate $CODE_ID '$CONTRACT_INIT_MSG' --from $SENDER --label '$CONTRACT_LABEL' --chain-id $CHAIN_ID --gas-prices $GAS_PRICES --keyring-backend $KEYRING_BACKEND --home $HOME_DIR -y --admin $SENDER_ADDRESS" +sleep $SLEEP_DURATION + +# Get the contract address +CONTRACT_ADDRESS=$(quasarnoded query wasm list-contract-by-code $CODE_ID --node $NODE --output json | jq -r '.contracts[-1]') +echo "Contract Address: $CONTRACT_ADDRESS" + +# IBC testing post upgrade +OSMOSIS_NODE="http://127.0.0.1:26679" +OSMOSIS_CHANNEL="channel-0" +OSMOSIS_SENDER="bob" +OSMOSIS_RECEIVER="quasar1sqlsc5024sszglyh7pswk5hfpc5xtl77gqjwec" +OSMOSIS_DENOM="uosmo" +OSMOSIS_AMOUNT="10000" +OSMOSIS_CHAIN_ID="osmosis" +OSMOSIS_HOME="$HOME/.osmosis" + +QUASAR_NODE="http://127.0.0.1:26659" +QUASAR_CHANNEL="channel-0" +QUASAR_SENDER="my_treasury" +QUASAR_RECEIVER="osmo1ez43ye5qn3q2zwh8uvswppvducwnkq6wjqc87d" +QUASAR_DENOM="uqsr" +QUASAR_AMOUNT="10000" +QUASAR_CHAIN_ID="quasar" +QUASAR_HOME="$HOME/.quasarnode" +LOOP_COUNT=1 +SLEEP_DURATION=6 + +echo "12. IBC testing" +# Execute and check balances +for ((i=1; i<=LOOP_COUNT; i++)) +do + echo "Iteration $i" + + # Osmosis to Quasar transfer + echo "Transferring from Osmosis to Quasar" + osmosisd tx ibc-transfer transfer transfer $OSMOSIS_CHANNEL $OSMOSIS_RECEIVER ${OSMOSIS_AMOUNT}${OSMOSIS_DENOM} --from $OSMOSIS_SENDER --keyring-backend test --home $OSMOSIS_HOME --node $OSMOSIS_NODE --chain-id $OSMOSIS_CHAIN_ID -y --gas-prices 1$OSMOSIS_DENOM + sleep $SLEEP_DURATION + rly transact flush + sleep $SLEEP_DURATION + quasarnoded query bank balances $OSMOSIS_RECEIVER + + # Quasar to Osmosis transfer + echo "Transferring from Quasar to Osmosis" + quasarnoded tx ibc-transfer transfer transfer $QUASAR_CHANNEL $QUASAR_RECEIVER ${QUASAR_AMOUNT}${QUASAR_DENOM} --from $QUASAR_SENDER --keyring-backend test --home $QUASAR_HOME --chain-id $QUASAR_CHAIN_ID -y --gas-prices $GAS_PRICES --node $QUASAR_NODE + sleep $SLEEP_DURATION + rly transact flush + sleep $SLEEP_DURATION + osmosisd query bank balances $QUASAR_RECEIVER --node $OSMOSIS_NODE +done + +echo "Script completed." \ No newline at end of file diff --git a/demos/upgrade-handler/v3.0.0/quasar_localnet.sh b/demos/upgrade-handler/v3.0.0/quasar_localnet.sh new file mode 100755 index 000000000..f11977e2a --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/quasar_localnet.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +## This script helps to create a basic version of the quasar chain genesis file for development purposes. +## However it will need some manual modifications before you start the chain to incorporate the custom fields. + +# Configure variables +BINARY=quasarnoded +HOME_QSR=$HOME/.quasarnode +CHAIN_ID=quasar +MY_TREASURY="edge victory hurry slight dog exit company bike hill erupt shield aspect turkey retreat stairs summer sadness crush absorb draft viable orphan chuckle exhibit" +BOB="harvest ill mean warfare gospel slide tragic palace model excess surprise distance voyage change bus grant special artwork win width group dwarf today jar" +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/qsr.key)" +MY_TREASURY_GENESIS_COINS=20000token,200000000stake,1000000000uqsr +BOB_GENESIS_COINS=10000token,100000000stake,1000000000uqsr +USER_1_GENESIS_COINS=10000000000stake,10000000000uqsr +USER_2_GENESIS_COINS=10000000000stake,10000000000uqsr +RELAYER_ACC_GENESIS_COINS=10000000uqsr,10000000000stake + +# Remove previous setup + +rm -rf $HOME_QSR + +$BINARY init $CHAIN_ID --chain-id $CHAIN_ID + +# Bootstrap the quasar local network with single node + +echo $MY_TREASURY | $BINARY keys add my_treasury --keyring-backend test --recover +echo $BOB | $BINARY keys add bob --keyring-backend test --recover +echo $USER_1 | $BINARY keys add user1 --keyring-backend test --recover +echo $USER_2 | $BINARY keys add user2 --keyring-backend test --recover +echo $RELAYER_ACC | $BINARY keys add relayer_acc --keyring-backend test --recover + +$BINARY add-genesis-account $($BINARY keys show bob --keyring-backend test -a) $BOB_GENESIS_COINS +$BINARY add-genesis-account $($BINARY keys show user1 --keyring-backend test -a) $USER_1_GENESIS_COINS +$BINARY add-genesis-account $($BINARY keys show user2 --keyring-backend test -a) $USER_2_GENESIS_COINS +$BINARY add-genesis-account $($BINARY keys show my_treasury --keyring-backend test -a) $MY_TREASURY_GENESIS_COINS +$BINARY add-genesis-account $($BINARY keys show relayer_acc --keyring-backend test -a) $RELAYER_ACC_GENESIS_COINS +$BINARY add-genesis-account quasar1mxdu6enz8lzmajpsk9nxsyaw0aysy0e35qrlkd $RELAYER_ACC_GENESIS_COINS + +echo "Creating gentx" +$BINARY gentx my_treasury 100000000uqsr --chain-id $CHAIN_ID --keyring-backend test +echo "Collecting gentx" +$BINARY collect-gentxs + +# 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_QSR/config/app.toml + sed -i 's/swagger = false/swagger = true/g' $HOME_QSR/config/app.toml + sed -i 's/minimum-gas-prices = "0uqsr"/minimum-gas-prices = "0.1uqsr"/g' $HOME_QSR/config/app.toml + sed -i 's+laddr = "tcp://127.0.0.1:26657"+laddr = "tcp://127.0.0.1:26659"+g' $HOME_QSR/config/config.toml + sed -i 's+node = "tcp://localhost:26657"+node = "tcp://localhost:26659"+g' $HOME_QSR/config/client.toml + sed -i 's+laddr = "tcp://0.0.0.0:26656"+laddr = "tcp://0.0.0.0:26661"+g' $HOME_QSR/config/config.toml + sed -i 's+pprof_laddr = "localhost:6060"+pprof_laddr = "localhost:6061"+g' $HOME_QSR/config/config.toml + sed -i 's+address = "localhost:9090"+address = "localhost:9095"+g' $HOME_QSR/config/app.toml + sed -i 's+address = "localhost:9091"+address = "localhost:8091"+g' $HOME_QSR/config/app.toml + sed -i 's+address = "tcp://localhost:1317"+address = "tcp://localhost:1311"+g' $HOME_QSR/config/app.toml + sed -i 's+address = ":8080"+address = ":8081"+g' $HOME_QSR/config/app.toml +elif [ $platform = 'macos' ]; then + sed -i'.original' -e 's/enable = false/enable = true/g' $HOME_QSR/config/app.toml + sed -i'.original' -e 's/swagger = false/swagger = true/g' $HOME_QSR/config/app.toml + sed -i'.original' -e 's/minimum-gas-prices = "0uqsr"/minimum-gas-prices = "0.1uqsr"/g' $HOME_QSR/config/app.toml + sed -i'.original' -e 's+laddr = "tcp://127.0.0.1:26657"+laddr = "tcp://127.0.0.1:26659"+g' $HOME_QSR/config/config.toml + sed -i'.original' -e 's+node = "tcp://localhost:26657"+node = "tcp://localhost:26659"+g' $HOME_QSR/config/client.toml + sed -i'.original' -e 's+laddr = "tcp://0.0.0.0:26656"+laddr = "tcp://0.0.0.0:26661"+g' $HOME_QSR/config/config.toml + sed -i'.original' -e 's+pprof_laddr = "localhost:6060"+pprof_laddr = "localhost:6061"+g' $HOME_QSR/config/config.toml + sed -i'.original' -e 's+address = "localhost:9090"+address = "localhost:9095"+g' $HOME_QSR/config/app.toml + sed -i'.original' -e 's+address = "localhost:9091"+address = "localhost:8091"+g' $HOME_QSR/config/app.toml + sed -i'.original' -e 's+address = "tcp://localhost:1317"+address = "tcp://localhost:1311"+g' $HOME_QSR/config/app.toml + sed -i'.original' -e 's+address = ":8080"+address = ":8081"+g' $HOME_QSR/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 +fi + +cp $HOME_QSR/config/genesis.json $HOME_QSR/config/genesis_original.json +cat $HOME_QSR/config/genesis_original.json | + jq '.app_state.crisis.constant_fee.denom="uqsr"' | + jq '.app_state.staking.params.bond_denom="uqsr"' | + jq '.app_state.mint.params.mint_denom="uqsr"' | + jq '.app_state.gov.params.min_deposit=[{denom:"uqsr",amount:"1"}]' | + jq '.app_state.gov.params.voting_period="30s"' | + jq '.app_state.gov.tally_params={quorum:"0.000000000000000001",threshold:"0.5",veto_threshold:"0.334"}' >$HOME_QSR/config/genesis.json + +# jq '.app_state.feemarket.params.min_base_gas_price="0.10000000000000000"' | +# jq '.app_state.feemarket.params.max_block_utilization="120000000"' | +# jq '.app_state.feemarket.state.base_gas_price="0.10000000000000000"' | +# jq '.app_state.feemarket.params."fee_denom"="uqsr" + +# Start +echo "Starting the chain" +$BINARY start --home $HOME_QSR > ./logs/quasar_localnet.log 2>&1 & diff --git a/demos/upgrade-handler/v3.0.0/setup_go_relayer.sh b/demos/upgrade-handler/v3.0.0/setup_go_relayer.sh new file mode 100755 index 000000000..def20a60c --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/setup_go_relayer.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# remove any old configs +RELAYER_CONF="$HOME/.relayer" +rm -rf $RELAYER_CONF &> /dev/null + +rly config init + +# add configs for each chain, +rly chains add-dir ./go-relayer-config/chains + +# restore the keys from the mnemomic phrases, same phrases as the hermes script +OSMOKEY="$(cat ./keys/osmo.key)" +QUASARKEY="$(cat ./keys/qsr.key)" + +rly keys restore quasar quasarkey "$QUASARKEY" +rly keys restore osmosis osmokey "$OSMOKEY" + +rly q balance quasar +rly q balance osmosis + +rly paths add-dir ./go-relayer-config/paths +rly tx link quasar_osmosis --debug --override >> ./logs/rly_qo_setup.log 2>&1 + +rly start quasar_osmosis --debug-addr "localhost:7598" -p events --time-threshold 300s >>./logs/quasar_osmosis.log 2>&1 & diff --git a/demos/upgrade-handler/v3.0.0/upgrade_test.sh b/demos/upgrade-handler/v3.0.0/upgrade_test.sh new file mode 100644 index 000000000..d33fd75b4 --- /dev/null +++ b/demos/upgrade-handler/v3.0.0/upgrade_test.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +# TODO: Before running this script go to the main branch, execute a "git checkout v2.0.1" and "make install" the binary in order to start from the mainnet version. +# TODO: Now checkout the upgrade branch and you are able to execute this test script. + +# Kill existing quasarnodedv1 processes +echo ">>> Killing existing quasarnoded processes..." +pkill quasarnoded || true +pkill quasard || true + +echo ">>> Killing existing osmosisd processes..." +pkill osmosisd || true + +echo ">>> Killing existing rly processes..." +pkill rly || true + +rm -rf ./logs +mkdir ./logs + +# Entry point to run quasar_localnet.sh and osmosis_localnet.sh +./quasar_localnet.sh +sleep 5 +./osmosis_localnet.sh +sleep 5 + +# starting a relayer between the two +./setup_go_relayer.sh +sleep 20 + +# pre upgrade test +./pre_upgrade.sh + +# Define variables +CHAIN_ID=quasar +UPGRADE_HEIGHT=80 + +echo ">>> Sleeping 10 seconds to create some initial blocks" +sleep 5 + +# Submit governance proposal for software-upgrade to v2 +echo ">>> Submitting proposal for software-upgrade" +quasarnoded tx gov submit-proposal draft_proposal.json --from my_treasury --chain-id $CHAIN_ID --keyring-backend test -y --fees 100000uqsr --gas 1000000 + +echo ">>> Sleeping 10 seconds after submitting proposal" +sleep 6 + +echo ">>> Voting yes to proposal" +quasarnoded tx gov vote 1 yes --from my_treasury --chain-id $CHAIN_ID --keyring-backend test -y --fees 100000uqsr --gas 1000000 + +# Wait for the block height to reach 50, cosmovisor should handle the upgrade +echo ">>> Waiting for the block height to reach $UPGRADE_HEIGHT" +while true; do + CURRENT_HEIGHT=$(quasarnoded status | jq -r '.SyncInfo.latest_block_height') + echo "Current height: "$CURRENT_HEIGHT + if [ "$CURRENT_HEIGHT" -ge "$UPGRADE_HEIGHT" ]; then + break + fi + sleep 5 +done + +# Check if the upgrade has been successful +quasarnoded query gov proposal 1 --chain-id $CHAIN_ID --output json + +sleep 10 + +# Kill existing quasarnoded processes for new version to start +echo ">>> Killing existing quasarnoded processes..." +pkill quasarnoded || true + +quasard start --home $HOME/.quasarnode > ./logs/quasar_post_upgrade.log 2>&1 & + +sleep 10 +# run ibc send manually and monitor +./post_upgrade.sh \ No newline at end of file