feat:Amended docs for migration (#571)

* feat:Amended docs for migration

* fix:Fixed typos and applied suggested changes
This commit is contained in:
Cryptobabybear 2020-06-10 10:25:31 +08:00 committed by GitHub
parent 2ed6fedc8b
commit b99f1160d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,16 +52,53 @@ Set your node to produce the final block of kava-2 at __13:00__ UTC June 10th, 2
kvd start --halt-time 1591794000 kvd start --halt-time 1591794000
``` ```
Note that the above command will not stop `kvd` from running, it merely stops proposal / validation for blocks after that time.Validators may safely exit by issuing `CTRL+C` if running as a process.
Kava developers will update this PR with the final block number when it is reached. __Make sure the kvd process is stopped before proceeding and that you have backed up your validator__. Failure to backup your validator could make it impossible to restart your node if the upgrade fails. Kava developers will update this PR with the final block number when it is reached. __Make sure the kvd process is stopped before proceeding and that you have backed up your validator__. Failure to backup your validator could make it impossible to restart your node if the upgrade fails.
The following up steps assume the directory structure below: change filepaths, directory names as needed
```bash
# Kvcli Folder
~/.kvcli
# Kvd Folder
~/.kvd
# Go Path
~/go
```
### Pre-Migration
1. Backup existing kava-2 .kvd and .kvcli
```sh
cp -R ~/.kvcli ~/.kvcli.bak
cp -R ~/.kvd ~/.kvd.bak
```
2. Backup existing kava-2 kvd and kvcli binaries (in case of rollback)
```sh
cp ~/go/bin/kvcli ~/go/bin/kvcli.bak
cp ~/go/bin/kvd ~/go/bin/kvd.bak
```
### Migration
We denote `(kava-2)kvd` as the previous client (0.3.5) to be used for commands e.g `(kava-2)kvd export` and `(kava-3)kvd` as the new client (0.8.1) to be used for commands.
1. Export state 1. Export state
- Ensure that all `kvd` processes have stopped running.
```sh ```sh
kvd export --for-zero-height > export-genesis.json (kava-2) kvd export --for-zero-height > kava_2_exported.json
# Check ShaSum for later reference
$ jq -S -c -M '' kava_2_exported.json | shasum -a 256
``` ```
2. Update to kava-3 2. Update to kava-3
This will replace the `kvd` and `kvcli` binaries in your GOPATH.
```sh ```sh
# in the `kava` folder # in the `kava` folder
git pull git pull
@ -77,27 +114,47 @@ kvd start --halt-time 1591794000
# commit: 869189054d68d6ec3e6446156ea0a91eb45af09c # commit: 869189054d68d6ec3e6446156ea0a91eb45af09c
# build_tags: netgo,ledger # build_tags: netgo,ledger
# go: go version go1.13.7 linux/amd64 # go: go version go1.13.7 linux/amd64
```
3. Migrate the kava-2 keys from previous key store to new key store
This will scan for any keys in `.kvcli` and produce new files ending in `kavaxxx.address` and `key_name.info` for the new keystore to access.
```sh
# Migrate keys # Migrate keys
kvcli keys migrate (kava-3) kvcli keys migrate
```
4. Migrate the exported genesis state
```sh
# Migrate genesis state # Migrate genesis state
kvd migrate export-genesis.json > migrated-genesis.json (kava-3) kvd migrate kava_2_exported.json > kava_3_migrated.json
# Check ShaSum for later reference
$ jq -S -c -M '' kava_3_migrated.json | shasum -a 256
```
5. Write Params to genesis state and validate
```sh
# Migrate parameters # Migrate parameters
kvd write-params migrated-genesis.json --chain-id kava-3 --genesis-time 2020-06-10T14:00:00Z > genesis.json (kava-3) kvd write-params kava_3_migrated.json --chain-id kava-3 --genesis-time 2020-06-10T14:00:00Z > genesis.json
# Check ShaSum for later reference
# Verify output of genesis migration # Note: jq must be installed
kvd validate-genesis genesis.json # should say it's valid
# Check the genesis hash. Note: jq must be installed
# DO NOT WRITE THE JQ OUTPUT TO FILE. Use only for calculating the hash. # DO NOT WRITE THE JQ OUTPUT TO FILE. Use only for calculating the hash.
jq -S -c -M '' genesis.json | shasum -a 256 $ jq -S -c -M '' genesis.json | shasum -a 256
# [PLACEHOLDER] # Verify output of genesis migration
(kava-3) kvd validate-genesis genesis.json # should say it's valid
```
# Restart node with migrated genesis state 6. Restart node with new kava-3 genesis state
```sh
cp genesis.json ~/.kvd/config/genesis.json cp genesis.json ~/.kvd/config/genesis.json
kvd unsafe-reset-all # Unsafe Reset All is a irreversible action that wipes on-chain data and prepares the chain for a start from genesis
kvd start # If you have not backed up your previous kava-2 state, do not proceed.
(kava-3) kvd unsafe-reset-all
(kava-3) kvd start
``` ```
### Coordination ### Coordination