Add a script and instructions for users to upgrade to testnet stage2

This commit is contained in:
Prathamesh Musale 2024-10-17 18:08:07 +05:30
parent 556d54baff
commit e313969088
4 changed files with 122 additions and 3 deletions

View File

@ -93,7 +93,7 @@ Once all the participants have completed their onboarding, stage0 laconicd chain
scp dev@<deployments-server-hostname>:/srv/laconicd/stage1-deployment/data/laconicd-data/config/genesis.json </path/to/local/directory> scp dev@<deployments-server-hostname>:/srv/laconicd/stage1-deployment/data/laconicd-data/config/genesis.json </path/to/local/directory>
``` ```
* Now users can follow the steps to [Join as a validator on stage1](https://git.vdb.to/cerc-io/testnet-laconicd-stack/src/branch/main/testnet-onboarding-validator.md#join-as-a-validator-on-stage1) * Now users can follow the steps to [Join as a validator on stage1](../testnet-onboarding-validator.md#join-as-a-validator-on-stage1)
## Bank Transfer ## Bank Transfer

View File

@ -46,7 +46,7 @@
* Initialize stage2 chain: * Initialize stage2 chain:
```bash ```bash
DEPLOYMENT_DIR=$pwd DEPLOYMENT_DIR=$(pwd)
cd ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd cd ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd
@ -94,7 +94,7 @@
scp dev@<deployments-server-hostname>:/srv/laconicd/stage2-deployment/data/laconicd-data/config/genesis.json </path/to/local/directory> scp dev@<deployments-server-hostname>:/srv/laconicd/stage2-deployment/data/laconicd-data/config/genesis.json </path/to/local/directory>
``` ```
* Now users can follow the steps to [Upgrade to testnet stage2](https://git.vdb.to/cerc-io/testnet-laconicd-stack/src/branch/main/testnet-onboarding-validator.md#upgrade-to-testnet-stage2) * Now users can follow the steps to [Upgrade to testnet stage2](../testnet-onboarding-validator.md#upgrade-to-testnet-stage2)
## Bank Transfer ## Bank Transfer

View File

@ -0,0 +1,25 @@
#!/bin/bash
# Exit on error
set -e
set -u
NODE_HOME="$HOME/.laconicd"
stage2_genesis="$NODE_HOME/tmp-stage2/genesis.json"
if [ ! -f ${stage2_genesis} ]; then
echo "stage2 genesis file not found, exiting..."
exit 1
fi
# Remove data but keep keys
laconicd cometbft unsafe-reset-all
# Use provided genesis config
cp $stage2_genesis $NODE_HOME/config/genesis.json
# Set chain id in config
chain_id=$(jq -r '.chain_id' $stage2_genesis)
laconicd config set client chain-id $chain_id --home $NODE_HOME
echo "Node data reset and ready for stage2!"

View File

@ -280,6 +280,100 @@ laconic-so deployment --dir testnet-laconicd-deployment start
sudo rm -r testnet-laconicd-deployment sudo rm -r testnet-laconicd-deployment
``` ```
## Upgrade to testnet stage2
### Prerequisites
* Testnet stage2 genesis file and peer node address
* Mnemonic from the [wallet](https://wallet.laconic.com)
* Have a testnet stage1 node running
### Setup
* Clone / pull the stack repo:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack --pull
```
* Clone / pull the required repositories:
```bash
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd setup-repositories --pull
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories and re-run the command
```
* Build the container images:
```bash
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd build-containers --force-rebuild
```
This should create the following docker images locally with latest changes:
* `cerc/laconicd`
### Create a deployment
* The existing deployment used for stage1 can be used for stage2
* Copy over the published testnet genesis file (`.json`) to data directory in deployment (`testnet-laconicd-deployment/data/laconicd-data/tmp-stage2`):
```bash
# In dir where stage1 deployment (`testnet-laconicd-deployment`) exists
TESTNET_DEPLOYMENT=$(pwd)/testnet-laconicd-deployment
# Example
mkdir -p $TESTNET_DEPLOYMENT/data/laconicd-data/tmp-stage2
cp genesis.json $TESTNET_DEPLOYMENT/data/laconicd-data/tmp-stage2/genesis.json
```
* Run script to reset node data and upgrade for stage2:
```bash
cd ~/cerc/testnet-laconicd-stack
docker run -it \
-v $TESTNET_DEPLOYMENT/data/laconicd-data:/root/.laconicd \
-v ./ops/stage2:/scripts \
cerc/laconicd:local bash -c "/scripts/upgrade-node-to-stage2.sh"
cd $TESTNET_DEPLOYMENT
```
### Configuration
* Inside the `testnet-laconicd-deployment` deployment directory, open `config.env` file and set following env variables:
```bash
CERC_CHAIN_ID=laconic_9000-2
# Comma separated list of nodes to keep persistent connections to
# Example: "node-1-id@laconicd.laconic.com:26656"
# Use the provided node id
CERC_PEERS=""
# A custom human readable name for this node
CERC_MONIKER=
```
### Start the deployment
```bash
laconic-so deployment --dir testnet-laconicd-deployment start
```
See [Check status](#check-status) to follow sync status of your node
See [Join as testnet validator](#join-as-testnet-validator) to join / rejoin as a validator using laconicd CLI
### Clean up
* Same as [Clean up](#clean-up)
## Troubleshooting ## Troubleshooting
* If you face any issues in the onboarding app or the web-wallet, clear your browser cache and reload * If you face any issues in the onboarding app or the web-wallet, clear your browser cache and reload