From 8e77af356162c69a5557c805a28def408ff5a9eb Mon Sep 17 00:00:00 2001 From: pr0n00gler Date: Mon, 27 Jan 2025 13:22:41 +0200 Subject: [PATCH 1/6] v5.1.0 --- upgrades/v5.1.0/README.md | 259 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 upgrades/v5.1.0/README.md diff --git a/upgrades/v5.1.0/README.md b/upgrades/v5.1.0/README.md new file mode 100644 index 0000000..b8dfd91 --- /dev/null +++ b/upgrades/v5.1.0/README.md @@ -0,0 +1,259 @@ +--- +title: Neutron v5.1.0 Upgrade +order: 2 +--- + + + +# Neutron v5.1.0 Upgrade, Instructions + +- Chain upgrade point: at height `19947000`, `February 12th 2025, 14:00 UTC` (approximately); +- Go version: `v1.23` +- Release: https://github.com/neutron-org/neutron/releases/tag/v5.1.0 + +This document describes the steps for validators and full node operators, to upgrade successfully to the Neutron v5.1.0 release. For more details on the release, please see the [release notes](https://github.com/neutron-org/neutron/releases/tag/v5.1.0). + +## Upgrade date + +The upgrade will take place approximately on December 20th at `14:00 UTC` at height `19947000`; + +## Chain-id will remain the same + +The chain-id of the network will remain the same, `neutron-1`. This is because an in-place migration of state will take place, i.e., this upgrade does not export any state. + +### System requirement + +- 64GB RAM is recommended to ensure a smooth upgrade. + +If you have less than 64GB RAM, you might try creating a swapfile to swap an idle program onto the hard disk to free up memory. This can allow your machine to run the binary than it could run in RAM alone. + +```shell +sudo fallocate -l 64G /swapfile +sudo chmod 600 /swapfile +sudo mkswap /swapfile +sudo swapon /swapfile +``` + +- Make sure you have enough disk space for upgrade, the state can grow twice durng upgrade. + +### Backups + +Prior to the upgrade, validators are encouraged to take a full data snapshot. Snapshotting depends heavily on infrastructure, but generally this can be done by backing up the `.neutrond` directory. +If you use Cosmovisor to upgrade, by default, Cosmovisor will backup your data upon upgrade. See below [upgrade using cosmovisor](#method-ii-upgrade-using-cosmovisor) section. + +It is critically important for validator operators to back-up the `.neutrond/data/priv_validator_state.json` file after stopping the neutrond process. This file is updated every block as your validator participates in consensus rounds. It is a critical file needed to prevent double-signing, in case the upgrade fails and the previous chain needs to be restarted. + +### Current runtime + +The Neutron mainnet network, `neutron-1`, is currently running [Neutron v5.0.6](https://github.com/neutron-org/neutron/releases/tag/v5.0.6). We anticipate that operators who are running on v5.0.6, will be able to upgrade successfully. Validators are expected to ensure that their systems are up-to-date and capable of performing the upgrade. This includes running the correct binary, or if building from source, building with go `1.22`. + +_Note: the v5.0.3 release that can be found in the Neutron repo was created only for RPC nodes, and we do no expect validators to be running it._ + +### Target runtime + +The Neutron mainnet network, `neutron-1`, will run [Neutron v5.1.0](https://github.com/neutron-org/neutron/releases/tag/v5.1.0). Operators _**MUST**_ use this version post-upgrade to remain connected to the network. + +## Upgrade steps + +There are 2 major ways to upgrade a node: + +- Manual upgrade +- Upgrade using [Cosmovisor](https://pkg.go.dev/cosmossdk.io/tools/cosmovisor) + - Either by manually preparing the new binary + - Or by using the auto-download functionality (this is not yet recommended) + +If you prefer to use Cosmovisor to upgrade, some preparation work is needed before upgrade. + +## Create the updated Neutron binary of v5.1.0 + +### Go to neutron directory if present else clone the repository + +```shell + git clone https://github.com/neutron-org/neutron.git +``` + +### Follow these steps if neutron repo already present + +```shell + cd $HOME/neutron + git pull + git fetch --tags + git checkout v5.1.0 + make install +``` + +### Check the new neutron version, verify the latest commit hash +```shell + $ neutrond version --long + commit: 4ae1215c197f5d00f2462f5ce48cf1eaf68bf938 + cosmos_sdk_version: v0.50.11-neutron + go: go version go1.23.4 linux/amd64 + name: neutron + version: 5.1.0 + ... +``` + +### Or check checksum of the binary if you decided to [download it](https://github.com/neutron-org/neutron/releases/tag/v5.1.0) + +```shell +$ shasum -a 256 neutrond-linux-amd64 +40663d2a113d639eedfc29670d0c4996c5143386dabfd559624b4a9679959a03 neutrond-linux-amd64 +``` + + +### Make sure you are using the proper version of libwasm + +You can check the version you are currently using by running the following command: +``` +$ neutrond q wasm libwasmvm-version + +2.1.4 +``` +The proper version is `2.1.4`. + +**If the version on your machine is different you MUST change it immediately!** + +#### Ways to change libwasmvm + +- Use a statically built Neutrond binary from an official Neutron release: [https://github.com/neutron-org/neutron/releases/tag/v5.1.0](https://github.com/neutron-org/neutron/releases/tag/v5.1.0) +- If you built Neutron binary by yourself, `libwasmvm` should be loaded dynamically in your binary and somehow, the wrong `libwasmvm` library was present on your machine. You can change it by downloading the proper one and linking it to the Neutron binary manually: +1. download a proper version of `libwasmvm`: + +``` +$ wget https://github.com/CosmWasm/wasmvm/releases/download/v2.1.4/libwasmvm.x86_64.so +``` + +2. tell the linker where to find it: +``` +$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib/ +``` + +3. check that libwasmvm version is correct: +``` +$ neutrond q wasm libwasmvm-version +2.1.4 +``` + +### Method I: Manual Upgrade + +Make sure Neutron v5.1.0 is installed by either downloading a [compatible binary](https://github.com/neutron-org/neutron/releases/tag/v5.1.0), or building from source. Building from source requires **Golang 1.22.x**. + +Run Neutron v5.0.6 till upgrade height, the node will panic: + +```shell +ERR UPGRADE "v5.1.0" NEEDED at height: 19947000: upgrade to v5.1.0 and applying upgrade "v5.1.0" at height: 19947000 +``` + +Stop the node, and switch the binary to **Neutron v5.1.0** and re-start by `neutrond start`. + +It may take several minutes to a few hours until validators with a total sum voting power > 2/3 to complete their node upgrades. After that, the chain can continue to produce blocks. + +### Method II: Upgrade using Cosmovisor + +### Manually preparing the binary + +##### Preparation + +Install the latest version of Cosmovisor (`1.5.0`): + +```shell +go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0 +``` + +**Verify Cosmovisor Version** + +```shell +cosmovisor version +cosmovisor version: v1.5.0 +``` + +Create a cosmovisor folder: + +create a Cosmovisor folder inside `$NEUTRON_HOME` and move Neutron v5.0.6 into `$NEUTRON_HOME/cosmovisor/genesis/bin` + +```shell +mkdir -p $NEUTRON_HOME/cosmovisor/genesis/bin +cp $(which neutrond) $NEUTRON_HOME/cosmovisor/genesis/bin +``` + +build **Neutron v5.1.0**, and move neutrond v5.1.0 to `$NEUTRON_HOME/cosmovisor/upgrades/v5.1.0/bin` + +```shell +mkdir -p $NEUTRON_HOME/cosmovisor/upgrades/v5.1.0/bin +cp $(which neutrond) $NEUTRON_HOME/cosmovisor/upgrades/v5.1.0/bin +``` + +Then you should get the following structure: + +```shell +. +├── current -> genesis or upgrades/ +├── genesis +│ └── bin +│ └── neutrond #v5.0.6 +└── upgrades + └── v5.1.0 + └── bin + └── neutrond #v5.1.0 +``` + +Export the environmental variables: + +```shell +export DAEMON_NAME=neutrond +# please change to your own neutron home dir +# please note `DAEMON_HOME` has to be absolute path +export DAEMON_HOME=$NEUTRON_HOME +export DAEMON_RESTART_AFTER_UPGRADE=true +``` + +Start the node: + +```shell +cosmovisor run start --x-crisis-skip-assert-invariants --home $DAEMON_HOME +``` + +Skipping the invariant checks is strongly encouraged since it decreases the upgrade time significantly and since there are some other improvements coming to the crisis module in the next release of the Cosmos SDK. + +#### Expected upgrade result + +When the upgrade block height is reached, Neutron will panic and stop. + +After upgrade, the chain will continue to produce blocks when validators with a total sum voting power > 2/3 complete their node upgrades. + +## Upgrade duration + +Most likely it takes around 20 minutes, given that all nodes will stop at halt time, and we mind need to wait for larger validators to come back online.. + +## Rollback plan + +During the network upgrade, core Neutron team will be keeping an ever vigilant eye and communicating with operators on the status of their upgrades. During this time, the core team will listen to operator needs to determine if the upgrade is experiencing unintended challenges. In the event of unexpected challenges, the core team, after conferring with operators and attaining social consensus, may choose to declare that the upgrade will be skipped. + +Steps to skip this upgrade proposal are simply to resume the neutron-1 network with the (downgraded) v5.0.6 binary using the following command: + +> neutrond start --unsafe-skip-upgrade 19947000 + +Note: There is no particular need to restore a state snapshot prior to the upgrade height, unless specifically directed by core Neutron team. + +Important: A social consensus decision to skip the upgrade will be based solely on technical merits, thereby respecting and maintaining the decentralized governance process of the upgrade proposal's successful YES vote. + +## Communications + +Operators are encouraged to join the `#validator-chat` [channel](https://discord.com/channels/986573321023942708/1030043854637899816) in the `HUB VALIDATOR` section of the Neutron Discord. This channel is the primary communication tool for operators to ask questions, report upgrade status, report technical issues, and to build social consensus should the need arise. This channel is restricted to known operators and requires verification beforehand. Request to join the `#validator-chat` channel by opening a ticket or asking in the `general` channel. + +## Risks + +As a validator performing the upgrade procedure on your consensus nodes carries a heightened risk of double-signing and being slashed. The most important piece of this procedure is verifying your software version and genesis file hash before starting your validator and signing. + +The riskiest thing a validator can do is discover that they made a mistake and repeat the upgrade procedure again during the network startup. If you discover a mistake in the process, the best thing to do is wait for the network to start before correcting it. + +## FAQ + +1. Q: My node restarted in the middle of upgrade process (OOM killed, hardware issues, etc), is it safe to just proceed with the upgrade + + A: No. Most likely the upgrade will be completed successfully. But you get AppHash error after the network gets up. It's a lot safer to restart full process from scratch(recover the node from a backup). + + To perform an upgrade you need to keep your `./data/priv_validator_state.json` file when you are applying a snapshot from the backup. + This will help you avoid the risk of slashing due to double signing. + + From 1d16c3ec3d8f072bbe1e3e7f2e3cf28b9022ccdb Mon Sep 17 00:00:00 2001 From: Mike Mozhaev Date: Mon, 27 Jan 2025 13:32:37 +0200 Subject: [PATCH 2/6] Update upgrades/v5.1.0/README.md Co-authored-by: swelf19 <62722506+swelf19@users.noreply.github.com> --- upgrades/v5.1.0/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrades/v5.1.0/README.md b/upgrades/v5.1.0/README.md index b8dfd91..9dffdb9 100644 --- a/upgrades/v5.1.0/README.md +++ b/upgrades/v5.1.0/README.md @@ -45,7 +45,7 @@ It is critically important for validator operators to back-up the `.neutrond/dat ### Current runtime -The Neutron mainnet network, `neutron-1`, is currently running [Neutron v5.0.6](https://github.com/neutron-org/neutron/releases/tag/v5.0.6). We anticipate that operators who are running on v5.0.6, will be able to upgrade successfully. Validators are expected to ensure that their systems are up-to-date and capable of performing the upgrade. This includes running the correct binary, or if building from source, building with go `1.22`. +The Neutron mainnet network, `neutron-1`, is currently running [Neutron v5.0.6](https://github.com/neutron-org/neutron/releases/tag/v5.0.6). We anticipate that operators who are running on v5.0.6, will be able to upgrade successfully. Validators are expected to ensure that their systems are up-to-date and capable of performing the upgrade. This includes running the correct binary, or if building from source, building with go `1.23`. _Note: the v5.0.3 release that can be found in the Neutron repo was created only for RPC nodes, and we do no expect validators to be running it._ From c224cc5118d00b46d33546bcfb4f2d346ca74689 Mon Sep 17 00:00:00 2001 From: Mike Mozhaev Date: Mon, 27 Jan 2025 13:32:43 +0200 Subject: [PATCH 3/6] Update upgrades/v5.1.0/README.md Co-authored-by: swelf19 <62722506+swelf19@users.noreply.github.com> --- upgrades/v5.1.0/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrades/v5.1.0/README.md b/upgrades/v5.1.0/README.md index 9dffdb9..94c4ede 100644 --- a/upgrades/v5.1.0/README.md +++ b/upgrades/v5.1.0/README.md @@ -136,7 +136,7 @@ $ neutrond q wasm libwasmvm-version ### Method I: Manual Upgrade -Make sure Neutron v5.1.0 is installed by either downloading a [compatible binary](https://github.com/neutron-org/neutron/releases/tag/v5.1.0), or building from source. Building from source requires **Golang 1.22.x**. +Make sure Neutron v5.1.0 is installed by either downloading a [compatible binary](https://github.com/neutron-org/neutron/releases/tag/v5.1.0), or building from source. Building from source requires **Golang 1.23.x**. Run Neutron v5.0.6 till upgrade height, the node will panic: From 3124d2ef1890a8a3a920c99f9534bfd21653d6b4 Mon Sep 17 00:00:00 2001 From: pr0n00gler Date: Mon, 27 Jan 2025 13:34:28 +0200 Subject: [PATCH 4/6] v5.1.0 --- upgrades/v5.1.0/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrades/v5.1.0/README.md b/upgrades/v5.1.0/README.md index b8dfd91..bc44986 100644 --- a/upgrades/v5.1.0/README.md +++ b/upgrades/v5.1.0/README.md @@ -47,7 +47,7 @@ It is critically important for validator operators to back-up the `.neutrond/dat The Neutron mainnet network, `neutron-1`, is currently running [Neutron v5.0.6](https://github.com/neutron-org/neutron/releases/tag/v5.0.6). We anticipate that operators who are running on v5.0.6, will be able to upgrade successfully. Validators are expected to ensure that their systems are up-to-date and capable of performing the upgrade. This includes running the correct binary, or if building from source, building with go `1.22`. -_Note: the v5.0.3 release that can be found in the Neutron repo was created only for RPC nodes, and we do no expect validators to be running it._ +_Note: the v5.0.6 release that can be found in the Neutron repo was created only for RPC nodes, and we do no expect validators to be running it._ ### Target runtime From 731fe3176d040c333738bc8b2f1f38c661921d53 Mon Sep 17 00:00:00 2001 From: Mike Mozhaev Date: Tue, 28 Jan 2025 18:46:19 +0200 Subject: [PATCH 5/6] Update README.md --- upgrades/v5.1.0/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/upgrades/v5.1.0/README.md b/upgrades/v5.1.0/README.md index 1ae3da2..4f170ff 100644 --- a/upgrades/v5.1.0/README.md +++ b/upgrades/v5.1.0/README.md @@ -85,10 +85,11 @@ If you prefer to use Cosmovisor to upgrade, some preparation work is needed befo ### Check the new neutron version, verify the latest commit hash ```shell $ neutrond version --long - commit: 4ae1215c197f5d00f2462f5ce48cf1eaf68bf938 + commit: be5316562479044804bcb94b1e3289e0e029f05d cosmos_sdk_version: v0.50.11-neutron - go: go version go1.23.4 linux/amd64 + go: go version go1.23.4 darwin/arm64 name: neutron + server_name: neutrond version: 5.1.0 ... ``` From 502f223bd2cefd633c53608aa972830e8e454ab5 Mon Sep 17 00:00:00 2001 From: Mike Mozhaev Date: Tue, 28 Jan 2025 18:54:32 +0200 Subject: [PATCH 6/6] Update README.md --- upgrades/v5.1.0/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgrades/v5.1.0/README.md b/upgrades/v5.1.0/README.md index 4f170ff..643b812 100644 --- a/upgrades/v5.1.0/README.md +++ b/upgrades/v5.1.0/README.md @@ -98,7 +98,7 @@ If you prefer to use Cosmovisor to upgrade, some preparation work is needed befo ```shell $ shasum -a 256 neutrond-linux-amd64 -40663d2a113d639eedfc29670d0c4996c5143386dabfd559624b4a9679959a03 neutrond-linux-amd64 +3a7d51e1bd4a7a2fbe8cc69e18c959a188eac94a7ccc7c0a64d527455df0990f neutrond-linux-amd64 ```