You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue documents how to upgrade a Gaia v4 chain, i.e., start and complete a software-upgrade proposal. These are post-meeting notes w/ @greg-szabo and @mircea-c .
Unclear where to put this, so we keep it here until we find the best place for it.
Originally, we drafted this guide to help with testing the client upgrade CLI (#357). We ended up with a different guide that details how to test client upgrades, however. This guide might move somewhere into gaia or a IBC developer knowledge base.
Prerequisites
gaiad version 4.0.0
we will need to patch and make build this later on
If all went well, we should have the home folder for this instance in ./data/ibc-0:
$ ls -l data/
total 392
drwxr-xr-x 7 adi staff 224 Mar 4 18:57 ibc-0
-rw-r--r-- 1 adi staff 174147 Mar 4 18:57 ibc-0.log
Parametrize the voting period
By default, the voting period is 2 days. This is parametrized in the genesis file, gov section. Reconfigure that to something smaller, e.g., 200 seconds.
The chain should be regularly creating blocks at this point (average block rate slightly above 1 second).
Submit the governance proposal for undergoing an upgrade
NOTE: It's important to do this step (submit) and the following step (vote) within 200 seconds from each other.
There are two important parameters when submitting the proposal:
the proposal name: we'll use simply name-test (this will be relevant later on)
the height: parameter --upgrade-height
this denotes the height where the chain should halt (assuming the proposal is accepted);
it's important that the height specified with --upgrade-height occurs after the voting period is exhausted, that is, sometime at least 200 seconds in the future;
as a rule of thumb, use a height that is around 300 blocks in the future (i.e., higher than the current height of the chain);
Use the command below, replacing 900 for the correct height:
Note the height (900) and the 200 seconds period of voting (from voting_start_time to voting_end_time).
When the chain ibc-0 attains the upgrade height, we should see the chain halt, as follows:
ERR UPGRADE "name-test" NEEDED at height: 900:
ERR CONSENSUS FAILURE!!! err="UPGRADE \"name-test\" NEEDED at height: 900:
Once this error appears, we can quit (or kill) the gaiad process that was running.
Patch the app in the gaia binary:
The name-test string below coincides with the proposal name we submitted earlier.
cd~/go/src/github.com/cosmos/gaia
Make the following modifications:
$ git diff app/app.go
diff --git a/app/app.go b/app/app.go
index 6aeef44..730970d 100644
--- a/app/app.go+++ b/app/app.go@@ -265,6 +265,10 @@ func NewGaiaApp(
)
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath)
+ app.UpgradeKeeper.SetUpgradeHandler("name-test", func(ctx sdk.Context, plan upgradetypes.Plan) {+ })+
// register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
app.StakingKeeper = *stakingKeeper.SetHooks(
Now re-build the gaiad binary.
make build
Start the patched binary
The previous step should place the patched binary in ~/go/src/github.com/cosmos/gaia/build/gaiad. We'll start the ibc-0 chain using this upgraded binary:
Summary
This issue documents how to upgrade a Gaia v4 chain, i.e., start and complete a
software-upgrade
proposal. These are post-meeting notes w/ @greg-szabo and @mircea-c .Prerequisites
gaiad version 4.0.0
make build
this later onProcedure
Start a vanilla gaia instance
killall gaiad cd ibc-rs/ ./scripts/one-chain gaiad ibc-0 ./data 26657 26656 6060 9090 100000000000
If all went well, we should have the home folder for this instance in
./data/ibc-0
:Parametrize the voting period
By default, the voting period is 2 days. This is parametrized in the genesis file,
gov
section. Reconfigure that to something smaller, e.g., 200 seconds.Do a fresh start the ibc-0 chain
$ killall gaiad $ $ gaiad unsafe-reset-all --home data/ibc-0/ 7:11PM INF Removed existing address book file=data/ibc-0/config/addrbook.json 7:11PM INF Removed all blockchain history dir=data/ibc-0/data 7:11PM INF Reset private validator file to genesis state keyFile=data/ibc-0/config/priv_validator_key.json stateFile=data/ibc-0/data/priv_validator_state.json
In a separate terminal, start the chain
The chain should be regularly creating blocks at this point (average block rate slightly above 1 second).
Submit the governance proposal for undergoing an upgrade
NOTE: It's important to do this step (submit) and the following step (vote) within 200 seconds from each other.
There are two important parameters when submitting the proposal:
name-test
(this will be relevant later on)--upgrade-height
--upgrade-height
occurs after the voting period is exhausted, that is, sometime at least 200 seconds in the future;Use the command below, replacing
900
for the correct height:Once submitted, press
y
andEnter
.The output is rather dense, but we're mostly interested in the proposal identifier, which should be
1
:Submit a 'yes' vote
We'll now vote for this proposal.
Query the proposal and wait until it passes
To read the state of the proposal, execute:
An example output follows:
Note the height (
900
) and the 200 seconds period of voting (fromvoting_start_time
tovoting_end_time
).When the chain
ibc-0
attains the upgrade height, we should see the chain halt, as follows:Once this error appears, we can quit (or kill) the gaiad process that was running.
Patch the app in the gaia binary:
The
name-test
string below coincides with the proposal name we submitted earlier.Make the following modifications:
Now re-build the gaiad binary.
Start the patched binary
The previous step should place the patched binary in
~/go/src/github.com/cosmos/gaia/build/gaiad
. We'll start theibc-0
chain using this upgraded binary:The chain should pick up where it left from.
Further resources
The text was updated successfully, but these errors were encountered: