Skip to content

Instantly share code, notes, and snippets.

@gartnera
Last active May 30, 2024 17:13
Show Gist options
  • Save gartnera/f18e501da5d2ab4fe34def6d47446aeb to your computer and use it in GitHub Desktop.
Save gartnera/f18e501da5d2ab4fe34def6d47446aeb to your computer and use it in GitHub Desktop.

submit upgrade proposal

wait for passed

root@zetacore0:~# zetacored query gov proposals
pagination:
  next_key: null
  total: "0"
proposals:
- deposit_end_time: "2024-06-01T17:06:48.115493728Z"
  final_tally_result:
    abstain_count: "0"
    no_count: "0"
    no_with_veto_count: "0"
    yes_count: "1000000000000000000000"
  id: "1"
  messages:
  - '@type': /cosmos.upgrade.v1beta1.MsgSoftwareUpgrade
    authority: zeta10d07y265gmmuvt4z0w9aw880jnsr700jvxasvr
    plan:
      height: "250"
      info: |-
        {
            "binaries": {
                "linux/arm64": "http://upgrade-host:8000/zetacored",
                "zetaclientd-linux/arm64": "http://upgrade-host:8000/zetaclientd"
            }
        }
      name: v0.0.1717088769-dirty
      time: "0001-01-01T00:00:00Z"
      upgraded_client_state: null
  metadata: ""
  status: PROPOSAL_STATUS_PASSED
  submit_time: "2024-05-30T17:06:48.115493728Z"
  total_deposit:
  - amount: "100000000"
    denom: azeta
  voting_end_time: "2024-05-30T17:08:28.115493728Z"
  voting_start_time: "2024-05-30T17:06:48.115493728Z"

get active plan

root@zetacore0:/usr/local/bin# zetacored query upgrade plan
height: "250"
info: |-
  {
      "binaries": {
          "linux/arm64": "http://upgrade-host:8000/zetacored",
          "zetaclientd-linux/arm64": "http://upgrade-host:8000/zetaclientd"
      }
  }
name: v0.0.1717088769-dirty
time: "0001-01-01T00:00:00Z"
upgraded_client_state: null

submit cancel proposal

CHAINID="athens_101-1"
UPGRADE_AUTHORITY_ACCOUNT="zeta10d07y265gmmuvt4z0w9aw880jnsr700jvxasvr"


while ! curl -s -o /dev/null zetacore0:26657/status ; do
    echo "Waiting for zetacore0 rpc"
    sleep 1
done

cat > upgrade.json <<EOF
{
  "messages": [
    {
      "@type": "/cosmos.upgrade.v1beta1.MsgCancelUpgrade",
      "authority": "${UPGRADE_AUTHORITY_ACCOUNT}"
    }
  ],
  "metadata": "",
  "deposit": "100000000azeta",
  "title": "Cancel upgrade",
  "summary": "Cancel upgrade"
}
EOF

echo "Submitting upgrade proposal"

zetacored tx gov submit-proposal upgrade.json --from operator --keyring-backend test --chain-id $CHAINID --yes --fees 2000000000000000azeta -o json | tee proposal.json
PROPOSAL_TX_HASH=$(jq -r .txhash proposal.json)
PROPOSAL_ID=""
# WARN: this seems to be unstable
while [[ -z $PROPOSAL_ID ]]; do
    echo "waiting to get proposal_id"
    sleep 1
    # v0.47 version
    # proposal_id=$(zetacored query tx $PROPOSAL_TX_HASH -o json | jq -r '.events[] | select(.type == "submit_proposal") | .attributes[] | select(.key == "proposal_id") | .value')

    # v0.46 version
    PROPOSAL_ID=$(zetacored query tx $PROPOSAL_TX_HASH -o json | jq -r '.logs[0].events[] | select(.type == "proposal_deposit") | .attributes[] | select(.key == "proposal_id") | .value')
done
echo "proposal id is ${PROPOSAL_ID}"

zetacored tx gov vote "${PROPOSAL_ID}" yes --from operator --keyring-backend test --chain-id $CHAINID --yes --fees=2000000000000000azeta

wait for cancel to pass

root@zetacore0:~# zetacored query gov proposal 2
deposit_end_time: "2024-06-01T17:10:01.794838059Z"
final_tally_result:
  abstain_count: "0"
  no_count: "0"
  no_with_veto_count: "0"
  yes_count: "1000000000000000000000"
id: "2"
messages:
- '@type': /cosmos.upgrade.v1beta1.MsgCancelUpgrade
  authority: zeta10d07y265gmmuvt4z0w9aw880jnsr700jvxasvr
metadata: ""
status: PROPOSAL_STATUS_PASSED
submit_time: "2024-05-30T17:10:01.794838059Z"
total_deposit:
- amount: "100000000"
  denom: azeta
voting_end_time: "2024-05-30T17:11:41.794838059Z"
voting_start_time: "2024-05-30T17:10:01.794838059Z"

ensure no active upgrade plan

root@zetacore0:~# zetacored query upgrade plan
Error: no upgrade scheduled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment