Skip to content

Instantly share code, notes, and snippets.

@julienrbrt
Last active September 9, 2022 23:21
Show Gist options
  • Save julienrbrt/951b2c89d840733e28afc5d922c49efa to your computer and use it in GitHub Desktop.
Save julienrbrt/951b2c89d840733e28afc5d922c49efa to your computer and use it in GitHub Desktop.

Revisions

  1. julienrbrt revised this gist Sep 9, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions migrate_simapp.sh
    Original file line number Diff line number Diff line change
    @@ -27,11 +27,11 @@ 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 12 --from alice --yes
    $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 30
    sleep 60
    echo "verify correct binary"
    cosmovisor version
  2. julienrbrt created this gist Sep 9, 2022.
    37 changes: 37 additions & 0 deletions migrate_simapp.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    #!/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 12 --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 30
    echo "verify correct binary"
    cosmovisor version