Skip to content

Commit 4522f84

Browse files
authored
Post Upgrade Changes (#1249)
* adding upgrade guide * removing wasm addition keys from upgrade handler
1 parent a1b4d2a commit 4522f84

File tree

2 files changed

+109
-16
lines changed

2 files changed

+109
-16
lines changed

UPGRADING.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# How to upgrade your node
2+
3+
There are two major kinds of upgrades:
4+
* Governance gated
5+
* Non-governance gated
6+
7+
In both cases, you can upgrade your node by replacing the binary manually or using Cosmovisor.
8+
9+
10+
## Governance Gated Upgrade
11+
12+
A governance gated upgrade occurs when an upgrade plan goes on chain through a software upgrade proposal.
13+
* Your node **will** stop at the height listed in the upgrade plan.
14+
15+
### Manual Binary Upgrade
16+
17+
1. Build or download the binary for the release you are upgrading to.
18+
2. Wait for the node to stop at the upgrade height.
19+
* The log will display something like this:
20+
```
21+
ERR UPGRADE "v3" NEEDED at height: <UPGRADE_HEIGHT>: upgrade to v3 and applying upgrade "v3" at height:<UPGRADE_HEIGHT>
22+
```
23+
* If the node service remains active, you can stop it now.
24+
3. Replace the binary listed in the unit file with the new release.
25+
4. Start the node service again.
26+
27+
### Cosmovisor Upgrade
28+
29+
1. Build or download the binary for the release you are upgrading to.
30+
2. Create a folder for the new binary in the relevant Cosmovisor directory.
31+
* If the upgrade name is `v3`, you would place the binary under `<node home>/cosmovisor/upgrades/v3/bin/elysd`:
32+
```
33+
.
34+
├── current -> genesis or upgrades/<name>
35+
├── genesis
36+
│ └── bin
37+
│ └── elysd # old: v2.2.0
38+
└── upgrades
39+
└── v3
40+
└── bin
41+
└── elysd # new: v3.0.0
42+
```
43+
3. Verify that Cosmovisor will use the binary you have prepared.
44+
* The Cosmovisor service should have the auto-download feature disabled. A sample Cosmovisor unit file will look like this:
45+
```
46+
[Unit]
47+
Description=Cosmovisor service
48+
After=network-online.target
49+
50+
[Service]
51+
User=ubuntu
52+
ExecStart=/home/ubuntu/go/bin/cosmovisor run start --home /home/ubuntu/.elys
53+
Restart=on-failure
54+
RestartSec=3
55+
LimitNOFILE=50000
56+
Environment="DAEMON_NAME=elysd"
57+
Environment="DAEMON_HOME=/home/ubuntu/.elys"
58+
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true"
59+
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
60+
Environment="UNSAFE_SKIP_BACKUP=true"
61+
62+
[Install]
63+
WantedBy=multi-user.target
64+
```
65+
* If you must change the contents of the unit file, run `systemctl daemon-reload` before restarting the service.
66+
4. Wait for the node to reach the upgrade height. Cosmovisor will restart the node using the new binary.
67+
68+
69+
## Non-governance Gated Upgrade
70+
71+
A non-governance gated upgrade occurs when nodes upgrade their binary at an agreed-upon height.
72+
73+
* You **must** stop your node at the relevant height and replace the binary before starting it again.
74+
* ⚠️ Monitor your logs when the halt height is about to be reached. If your node does not stop at the specified height using the instructions below, stop the service manually and replace the binary before starting the service again.
75+
76+
### Manual Binary Upgrade
77+
78+
1. Build or download the binary for the release you are upgrading to.
79+
2. Stop the node service.
80+
3. Update the app.toml file in your node's config folder to set the `halt-height` variable.
81+
* A sample app.toml line will look like this for an upgrade height of `24666000`:
82+
```
83+
halt-height = 24666000
84+
```
85+
4. Restart the service.
86+
5. Wait for the halt height.
87+
* The log will display something like this when height is reached:
88+
```
89+
ERR CONSENSUS FAILURE!!! err="failed to apply block; error halt per configuration height 24666000 time 0"
90+
```
91+
7. Stop the node service.
92+
8. Replace the binary listed in the unit file with the new release.
93+
* For Cosmovisor, this will be `<node home>/cosmovisor/current/bin/elysd`.
94+
9. Update app.toml to set the `halt-height` back to 0.
95+
10. Start the node service.
96+
97+
### Cosmovisor `add-upgrade`
98+
99+
#### ⚠️ Be aware that there are reported issues with using Cosmovisor for non-governance upgrades: the instructions below may result in unexpected behaviour, such as an immediate upgrade or failure to stop at the specified height.
100+
101+
1. Build or download the binary for the release you are upgrading to.
102+
2. Run the `add-upgrade` command. This command will look as follows using the example values listed below.
103+
* New binary: `elysd-v3.0.0-linux-amd64`
104+
* Upgrade name: `v3.0.0`
105+
* Halt height: `24666000`
106+
```
107+
cosmovisor add-upgrade v3.0.0 elysd-v3.0.0-linux-amd64 --upgrade-height 24666000 --force
108+
```
109+
3. Wait for the node to reach the upgrade height. Cosmovisor will restart the node using the new binary.

app/setup_handlers.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package app
22

33
import (
44
"context"
5-
errorsmod "cosmossdk.io/errors"
65
"fmt"
76
"strings"
87

@@ -11,7 +10,6 @@ import (
1110

1211
sdk "github.com/cosmos/cosmos-sdk/types"
1312

14-
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
1513
m "github.com/cosmos/cosmos-sdk/types/module"
1614
"github.com/cosmos/cosmos-sdk/version"
1715
)
@@ -62,10 +60,6 @@ func (app *ElysApp) setUpgradeHandler() {
6260
ctx := sdk.UnwrapSDKContext(goCtx)
6361
app.Logger().Info("Running upgrade handler for " + upgradeVersion)
6462

65-
if ctx.ChainID() == "elysicstestnet-1" {
66-
app.StablestakeKeeper.TestnetMigrate(ctx)
67-
}
68-
6963
vm, vmErr := app.mm.RunMigrations(ctx, app.configurator, vm)
7064

7165
//oracleParams := app.OracleKeeper.GetParams(ctx)
@@ -76,15 +70,6 @@ func (app *ElysApp) setUpgradeHandler() {
7670
// }
7771
//}
7872

79-
// Set cosmwasm params
80-
wasmParams := wasmTypes.DefaultParams()
81-
wasmParams.CodeUploadAccess = wasmTypes.AllowNobody
82-
wasmParams.InstantiateDefaultPermission = wasmTypes.AccessTypeNobody
83-
if err := app.WasmKeeper.SetParams(ctx, wasmParams); err != nil {
84-
return vm, errorsmod.Wrapf(err, "unable to set CosmWasm params")
85-
}
86-
app.Logger().Info("Successfully set wasm Params in UpgradeHandler")
87-
8873
return vm, vmErr
8974
},
9075
)
@@ -104,7 +89,6 @@ func (app *ElysApp) setUpgradeStore() {
10489

10590
if shouldLoadUpgradeStore(app, upgradeInfo) {
10691
storeUpgrades := storetypes.StoreUpgrades{
107-
Added: []string{wasmTypes.StoreKey},
10892
//Added: []string{},
10993
//Renamed: []storetypes.StoreRename{},
11094
//Deleted: []string{},

0 commit comments

Comments
 (0)