Last active
September 9, 2022 23:21
-
-
Save julienrbrt/951b2c89d840733e28afc5d922c49efa to your computer and use it in GitHub Desktop.
migrate simapp with cosmovisor hacky test script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Usage SIMD_BIN=$(which simd) SIMD_NEW_BIN=<path to new binary> ./migrate_simapp.sh | |
| go install https://github.com/cosmos/cosmos-sdk/cosmosvisor/cmd/cosmovisor@latest | |
| if [[ -z $SIMD_BIN || -z $SIMD_NEW_BIN ]]; then | |
| echo "SIMD_BIN and SIMD_NEW_BIN must be set." | |
| exit 1 | |
| fi | |
| echo "init simapp" | |
| ./init_simapp.sh | |
| echo "setup cosmovisor" | |
| export DAEMON_NAME=simd | |
| export DAEMON_HOME=$HOME/.simapp | |
| export DAEMON_RESTART_AFTER_UPGRADE=false | |
| cosmovisor init $SIMD_BIN | |
| echo "reduce voting period to 20s" | |
| cat <<< $(jq '.app_state.gov.voting_params.voting_period = "20s"' $HOME/.simapp/config/genesis.json) > $HOME/.simapp/config/genesis.json | |
| echo "print cosmovisor version" | |
| cosmovisor version | |
| echo "start chain" | |
| cosmovisor run start & | |
| sleep 10 | |
| echo "prepare upgrade" | |
| mkdir -p $DAEMON_HOME/cosmovisor/upgrades/test1/bin | |
| cp $SIMD_NEW_BIN $DAEMON_HOME/cosmovisor/upgrades/test1/bin/simd | |
| echo "submit upgrade tx" | |
| $SIMD_BIN tx gov submit-proposal software-upgrade test1 --title upgrade --description upgrade --upgrade-height 15 --from alice --yes | |
| sleep 5 | |
| $SIMD_BIN tx gov deposit 1 10000000stake --from alice --yes | |
| sleep 5 | |
| $SIMD_BIN tx gov vote 1 yes --from alice --yes | |
| sleep 60 | |
| echo "verify correct binary" | |
| cosmovisor version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment