Upgrade Step-by-step
Archived on 2022/06/14. Information is out of date.
Overview
Preparation
Upgrade to
likecoin/likecoin-chain:sheungwan-2
image to supporthalt-time
parameter for upgrade purpose.
Pre-upgrade
Make sure you have all keys
operator key in
.likecli
folder, or in mnemonic format,node key in
.liked/config/node_key.json
consensus key in
.liked/config/priv_validator_key.json
backed up properly, in case anything disastrous happens.
Pass the proposal, determining the date, time, software version and parameters of the upgrade
Change the node config, so it will automatically halt at the determined upgrade time
During upgrade
Run a web conference with other validators
Need to discuss export height and genesis time in realtime
Export keys and files
Export node key and consensus key by copying the key files
Export address book by copying the key files
Create new genesis
Determine export height
Determine new chain genesis time
Export old chain state
Migrate old chain state to new chain genesis
Verify new chain state
Setup new chain node
Initialize new chain node
Import new chain state
Import operator key
Import node key and consensus key
Import address book
Migrate operator key
Start the node and wait for what would happen at the new chain genesis time
Setup sheungwan-2 node software
Requirements
Setup procedure
Go into the running likecoin-chain node folder:
Fetch the latest repo:
Switch to the
sheungwan-2
software commit:Shutdown the current node:
Replace
docker-compose.yml
withdocker-compose.yml.template
:Edit
.env
file to fill in the details, including chain parameters and custom parameters:LIKECOIN_DOCKER_IMAGE
:"likecoin/likecoin-chain:sheungwan-2"
LIKECOIN_CHAIN_ID
:"likecoin-chain-sheungwan"
LIKECOIN_UID
: normally keep it as"1000"
is fine, but if you are using root user under Linux (e.g. in some VPS) then you should change it to"0"
.LIKECOIN_MONIKER
: any name you want to call your node. Will be displayed on validator list as the name of the validator.LIKECOIN_SEED_NODES
:"913bd0f4bea4ef512ffba39ab90eae84c1420862@34.82.131.35:26656"
Start the node
Check the logs:
You should see the node synchronizing the blocks from the network. You may stop the display of the logs by
Ctrl+C
at anytime, it won't stop the node operation.Check the software version:
You should see
sheungwan-2
as output.
Pre-upgrade: proposal & preparation
Pre-upgrade
Raise and pass a proposal on the upgrade.
To raise a proposal, one of the validators run the following command:
Modify the parameters:
<DESCRIPTION>
: the content of the proposal, which should include some introduction to the upgrade, and also the following contents:the halt time (in both human-readable format with timezone, and also Unix timestamp)
the new chain parameters for the new ISCN module, namely:
ISCN registry name
ISCN fee per byte
the new software version (in Git commit hash)
and the new chain ID (e.g.
likecoin-fotan-1
)
After the creation of the proposal, one may query the content of the proposal by:
This will also show the proposal ID (should be
1
for the first proposal).To pass the proposal, all validators vote for the proposal by running:
Which means
vote "yes" in proposal ID 1
.After the proposal is passed, setup chain halt time by modifying
.env
file and changingLIKECOIN_HALT_TIME
to the Unix timestamp of the halt time in the proposal.Restart the chain node by running:
Run the following command:
Check the number after
--halt-time
below theCMD
column. You should see the Unix timestamp you have just set in the.env
file instead of0
.Jot down the content of the proposal, since chain explorers and APIs may not work during upgrade.
During upgrade
Right before the upgrade, validators should jot down the content of the proposal, since chain explorers and APIs may not work during the upgrade.
Validators should hold a meeting right before the upgrade time for discussing issues during the upgrade.
When the upgrade time comes, the chain node should be halt automatically.
Go into the node folder:
Turn down the node:
Check the consensus public key:
Record the output as consensus public key for later verification.
Check the node ID:
Record the output as node ID for later verification
Check the halting height of the node by:
Confirm with other validators for the minimum height of exporting the state. The principle is to have consent and prevent state lost. For example, if the heights are
1234
,1234
,1234
,1233
,1233
for different validators, then validators may use1233
as the height for exporting state.Export chain state:
Where the
<HEIGHT>
is the height confirmed with other validators in the previous step.Copy
node_key.json
(node key),priv_validator_key.json
(consensus key) andaddrbook.json
(address book) from.liked/config
into the fotan node folder:This is to preserve the same keys and address book for the new fotan node.
Discuss with others the new genesis time, should have consensus according to the progress of the majority.
Fetch the newest software branch for the upgrade:
Checkout to the new software:
Use new template of
docker-compose.yml
from the new software:Modify
.env
for the new chain:LIKECOIN_DOCKER_IMAGE
:likecoin/likecoin-chain:fotan-1
LIKECOIN_CHAIN_ID
: the new chain ID specified in the proposal.LIKECOIN_HALT_TIME
:"0"
so that the new chain node can start up.LIKECOIN_GENESIS_URL
:"genesis.json"
. The init script will detect that it is a local file and copy it from the migrated genesis file generated in the next step.
Migrate genesis state:
Where
<NEW_CHAIN_ID>
,<ISCN_REGISTRY_NAME>
and<ISCN_FEE_PER_BYTE>
should be modified to the values specified in the upgrade proposal, and<GENESIS_TIME>
is determined in the previous step (format:YYYY-MM-DDThh:mm:ssZ
, in UTC).Archive the old
.liked
folder:Compute the checksum of genesis state with others:
For Mac, use the following command instead:
Verify the output checksum with other validators.
Re-initialize the node:
Note that this will create and write a new consensus public key at the end of
.env
file, which won't be used since we will use the original key instead. If you are already a validator, you will probably never use the field again so this is fine, but you are free to delete this line.(optional) Configure the new node (
config.toml
&app.toml
, both are in.liked/config
)in
app.toml
:setup
minimum-gas-prices
if needed, see the setting in your sheungwan node configunder
[api]
section, if you need a local RESTful API server, then setenable
totrue
, and also setup the corresponding port mapping indocker-compose.yml
in
config.toml
:under
[p2p]
section, if you don't want to use the--get-ip
option in the command parameter when starting the node for retrieving your externally accessible IP from third parties, then you need to enter your external address and port inexternal_address
(e.g.123.123.123.123:26656
)
Migrate the operator key:
Follow the instructions to migrate the keys in the old keystore.
For passphrases, the first one is for decrypting the old keystore, and the following 2 are for creating the new keystore.
Note that when it asks
Skip key migration? [y/N]:
,N
actually meansnot skipping
, which is what we need.Verify the operator key is properly imported:
Check if the key with operator's address is listed and is the same address as before.
Re-import node key, consensus key and address book:
Verify the consensus key has been properly imported:
Verify that the output is the same as the previous recorded consensus public key.
Verify the node key has been properly imported:
Verify that the output is the same as the previous recorded node ID.
Restart the node:
Monitor the logs:
Wait for the new genesis time to see if anything goes wrong.
Properly process the
.liked-old
,.likecli
andkeys
folders, so the credentials are not leaked.
When Upgrade failed
If fatal issues happened during the upgrade (e.g. serious software bugs), then with the consent from the majority of the validators, validators may give up the upgrade and restart the SheungWan chain.
The procedure is simple:
Revert changes to
docker-compose.yml
and.env
.Set
halt-time
to"0"
in.env
.Revert
.liked
folder from.liked-bak
.Start the node by
docker-compose up -d
.Wait for enough validators to get online.
Last updated