LogoLogo
  • 🏠Getting Started
  • 📖Overview
    • CrossFi Chain Overview
    • Architecture
      • Cosmos and EVM Role
  • Economy Overview
    • Native Coins Overview
    • XFI Coin
    • MPX Coin
      • eMPX Token
    • Get coins
  • Concepts
    • Vision and Mission
    • Use Cases
    • Lore
    • Glossary
    • Roles
    • FAQ
  • Ecosystem
    • CrossFi App (Web3 Banking)
    • XFI Scan
    • XFI Console
      • XFI-MPX Staking
      • Governance (DAO)
      • XDS
    • xApp
      • Swap
      • LP Tokens
      • Staking
      • Escrow/Vesting
    • XFI Bridge
    • EXE Interchain Protocol
  • ⚒️Developers
    • Why Develop on CrossFi Chain?
    • Quickstart
    • EVM
      • Deploying Smart Contracts
    • Connect a Frontend
      • Mainnet Cosmos Part
      • Mainnet EVM Part
      • Testnet Cosmos Part
      • Testnet EVM part
    • Configuring a Wallet
    • Integrating Developer Tools
  • API and Endpoints
    • XFI Scan API
    • API and Available Endpoints
    • Available RPC / API Validators
  • 🏗️Node Operators
    • Join a Network
    • Becoming a Validator
      • Introduction to Validating
      • Creating A Validator
      • Securing A Validator
      • Running a Validator
    • Setting Up the CrossFi Chain Client
      • Upgrading the Chain
      • Sending Transactions
      • Upgrade Your Node
  • ℹ️SEE Also
    • Contact and Media Channels
      • Telegram Channel
      • Telegram Chat
      • Discord
      • Medium
      • X (ex. Twitter)
      • LinkedIn
  • GitHub
  • Cross Finance Ecosystem Website
Powered by GitBook
On this page
  • Start the Network
  • Performing an upgrade
  • Compile the New Binary
  1. Node Operators
  2. Setting Up the CrossFi Chain Client

Upgrading the Chain

This document demonstrates how a live upgrade can be performed on-chain through a governance process.

Start the Network

Start the network and trigger upgrade after the the proposal has passed.

# start a gaia application full-node
$ crossfid start

# set up the cli config
$ crossfid config trust-node true
$ crossfid config chain-id testing

# create an upgrade governance proposal
$ crossfid tx gov submit-proposal software-upgrade <plan-name> \
--title <proposal-title> --description <proposal-description> \
--from <name-or-key> --upgrade-height <desired-upgrade-height> --deposit 10000000mpx

# once the proposal passes you can query the pending plan
$ crossfid query upgrade plan

Performing an upgrade

Assuming the proposal passes the chain will stop at given upgrade height.

You can stop and start the original binary all you want, but it will refuse to run after the upgrade height.

We need a new binary with the upgrade handler installed. The logs should look something like:

E[2019-11-05|12:44:18.913] UPGRADE "<plan-name>" NEEDED at height: <desired-upgrade-height>:       module=main
E[2019-11-05|12:44:18.914] CONSENSUS FAILURE!!!
...

Note that the process will hang indefinitely (doesn't exit to avoid restart loops). So, you must manually kill the process and replace it with a new binary. Do so now with Ctrl+C or killall crossfid.

In gaia/app/app.go, after upgrade.Keeper is initialized and set in the app, set the corresponding upgrade Handler with the correct <plan-name>:

    app.upgradeKeeper.SetUpgradeHandler("<plan-name>", func(ctx sdk.Context, plan upgrade.Plan) {
        // custom logic after the network upgrade has been executed
    })

You will recieve a panic on any error - this would cause the upgrade to fail if the migration could not be run, and no node would advance - allowing a manual recovery. If we ignored the errors, then we would proceed with an incomplete upgrade and have a very difficult time every recovering the proper state.

Compile the New Binary

Now, compile the new binary and run the upgraded code to complete the upgrade:

# create a new binary of gaia with the added upgrade handler
$ make install

# Restart the chain using the new binary. You should see the chain resume from
# the upgrade height:
# `I[2019-11-05|12:48:15.184] applying upgrade <plan-name> at height: <desired-upgrade-height>      module=main`
$ crossfid start

# verify there is no pending plan
$ crossfid query upgrade plan

# verify you can query the block header of the completed upgrade
$ crossfid query upgrade applied <plan-name>
PreviousSetting Up the CrossFi Chain ClientNextSending Transactions

Last updated 1 year ago

🏗️