//
🗳️
Perform network upgrade with gov proposal
Search
Duplicate
Try Notion
🗳️
Perform network upgrade with gov proposal
We are going to create the release 9.1.1 that will disable the erc20 module’s EVMHook . We already disabled the EVMHook in the previous step, so now we are going to reenable it using an upgrade.
In practice, params changes should be directly changed using the params-change proposal instead of making a new release and upgrade just to modify it.
Create the upgrade
Git checkout to a new branch
cd cd evmos git checkout -b v9.1.1-branch
Bash
Create the upgrade logic
Create the file app/upgrades/v9_1_1/upgrade.go
package v911 import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" erc20 "github.com/evmos/evmos/v9/x/erc20/keeper" ) // CreateUpgradeHandler creates an SDK upgrade handler for v9 func CreateUpgradeHandler( mm *module.Manager, configurator module.Configurator, erc20k erc20.Keeper, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { logger := ctx.Logger().With("upgrade", "v9.1.1") params := erc20k.GetParams(ctx) params.EnableEVMHook = true erc20k.SetParams(ctx, params) // Leave modules are as-is to avoid running InitGenesis. logger.Debug("running module migrations ...") return mm.RunMigrations(ctx, configurator, vm) } }
Go
Add the upgrade to the app.go file
In the file app/app.go modify the function setUpgradeHandlers to support our new version
// v911 "github.com/evmos/evmos/v9/app/upgrades/v9_1_1" // v9.1.1 upgrade handler app.UpgradeKeeper.SetUpgradeHandler( "v9.1.1", v911.CreateUpgradeHandler( app.mm, app.configurator, app.Erc20Keeper, ), )
Go
Commit and create the correct tag
git add . git commit -m "feat: upgrade v9.1.1" git tag v9.1.1 git push origin HEAD --tags
Bash
Build the v9.1.1 in all of the validators
cd cd evmos git fetch --tags git checkout v9.1.1 rm -rf build make install cp $(which evmosd) ~/evmosd9.1.1
Bash
Create a new upgrade proposal
We are going to build the binary locally, so the links to the binaries doesn’t need to be correct.
~/evmosd tx gov submit-proposal software-upgrade "v9.1.1" \ --title "Evmos Workshop v9.1.1 Upgrade" \ --upgrade-height 15700 \ --upgrade-info '{"binaries":{"darwin/arm64":"https://github.com/hanchon/evmos/releases/download/v9.1.1/evmos_9.1.1_Darwin_arm64.tar.gz","darwin/amd64":"https://github.com/hanchon/evmos/releases/download/v9.1.1/evmos_9.1.1_Darwin_amd64.tar.gz","linux/arm64":"https://github.com/hanchon/evmos/releases/download/v9.1.1/evmos_9.1.1_Linux_arm64.tar.gz","linux/amd64":"https://github.com/hanchon/evmos/releases/download/v9.1.1/evmos_9.1.1_Linux_amd64.tar.gz","windows/x86_64":"https://github.com/hanchon/evmos/releases/download/v9.1.1/evmos_9.1.1_Windows_x86_64.zip"}}' \ --description "Trying an upgrade proposal to reactivate the EVMHook" \ --from=validator --keyring-backend=file \ --fees=17500000000000000aevmos --gas=700000 -b block \ --chain-id=evmos_9999-1
Bash
Get the proposal id:
~/evmosd q gov proposals
Bash
Deposit:
~/evmosd tx gov deposit 2 20000000aevmos --from=validator --keyring-backend file --fees=20aevmos -b block --chain-id=evmos_9999-1
Bash
Vote:
~/evmosd tx gov vote "2" "yes" --from validator --keyring-backend file --fees=20aevmos -b=block --chain-id=evmos_9999-1
Bash
Wait for the upgrade height
When we reach the upgrade height it will log something like:
The screen shot is not clear but it will log 2 errors talking about the upgrade and printing the evmosd version needed to restart the network.
control + c to kill the process.
Run the evmos9.1.1 version and wait for the rest of the validators to connect
~/evmosd9.1.1 start
Bash
The node will log something like this on start up:
6:28PM INF applying upgrade "v9.1.1" at height: 15700
Bash
Make sure that the change was applied
~/evmosd9.1.1/build/evmosd q erc20 params # params: # enable_erc20: true # enable_evm_hook: true
Bash