Add instructions for testnet2 deployment ops (#31)

Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

- Add instructions to setup stage2 laconicd deployment
- Add instructions for stage1 to stage2 migration
- Add a script and instructions for users to upgrade their nodes to testnet stage2

Reviewed-on: cerc-io/testnet-laconicd-stack#31
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
2024-10-30 12:05:54 +00:00
committed by nabarun
parent a8ffb987b1
commit eef72ec9c3
12 changed files with 1092 additions and 572 deletions
File diff suppressed because it is too large Load Diff
+1 -1
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>
```
* 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
+150
View File
@@ -0,0 +1,150 @@
# Halt stage1 and start stage2
## Login
* Log in as `dev` user on the deployments VM
* All the deployments are placed in the `/srv` directory:
```bash
cd /srv
```
## Halt stage1
* Confirm the the currently running node is for stage1 chain:
```bash
# On stage1 deployment machine
STAGE1_DEPLOYMENT=/srv/laconicd/testnet-laconicd-deployment
laconic-so deployment --dir $STAGE1_DEPLOYMENT logs laconicd -f --tail 30
# Note: stage1 node on deployments VM has been changed to run from /srv/laconicd/testnet-laconicd-deployment instead of /srv/laconicd/stage1-deployment
```
* Stop the stage1 deployment:
```bash
laconic-so deployment --dir $STAGE1_DEPLOYMENT stop
# Stopping this deployment marks the end of testnet stage1
```
## Export stage1 state
* Export the chain state:
```bash
docker run -it \
-v $STAGE1_DEPLOYMENT/data/laconicd-data:/root/.laconicd \
cerc/laconicd-stage1:local bash -c "laconicd export | jq > /root/.laconicd/stage1-state.json"
```
* Archive the state and node config and keys:
```bash
sudo tar -czf /srv/laconicd/stage1-laconicd-export.tar.gz --exclude="./data" --exclude="./tmp" -C $STAGE1_DEPLOYMENT/data/laconicd-data .
sudo chown dev:dev /srv/laconicd/stage1-laconicd-export.tar.gz
```
## Initialize stage2
* Copy over the stage1 state and node export archive to stage2 deployment machine
* Extract the stage1 state and node config to stage2 deployment dir:
```bash
# On stage2 deployment machine
cd /srv/laconicd
# Unarchive
tar -xzf stage1-laconicd-export.tar.gz -C stage2-deployment/data/laconicd-data
# Verify contents
ll stage2-deployment/data/laconicd-data
```
* Initialize stage2 chain:
```bash
DEPLOYMENT_DIR=$(pwd)
cd ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd
STAGE2_CHAIN_ID=laconic-testnet-2
./scripts/initialize-stage2.sh $DEPLOYMENT_DIR/stage2-deployment $STAGE2_CHAIN_ID LaconicStage2 os 1000000000000000
# Enter the keyring passphrase for account from stage1 when prompted
cd $DEPLOYMENT_DIR
```
* Resets the node data (`unsafe-reset-all`)
* Initializes the `stage2-deployment` node
* Generates the genesis file for stage2 with stage1 state
* Carries over accounts, balances and laconicd modules from stage1
* Skips staking and validator data
* Copy over the genesis file outside data directory:
```bash
cp stage2-deployment/data/laconicd-data/config/genesis.json stage2-deployment
```
## Start stage2
* Start the stage2 deployment:
```bash
laconic-so deployment --dir stage2-deployment start
```
* Check status of stage2 laconicd:
```bash
# List down the container and check health status
docker ps -a | grep laconicd
# Follow logs for laconicd container, check that new blocks are getting created
laconic-so deployment --dir stage2-deployment logs laconicd -f
```
* Get the node's peer adddress and stage2 genesis file to share with the participants:
* Get the node id:
```bash
echo $(laconic-so deployment --dir stage2-deployment exec laconicd "laconicd cometbft show-node-id")@laconicd-sapo.laconic.com:36656
```
* Get the genesis file:
```bash
scp dev@<deployments-server-hostname>:/srv/laconicd/stage2-deployment/genesis.json </path/to/local/directory>
```
* Now users can follow the steps to [Upgrade to SAPO testnet](../testnet-onboarding-validator.md#upgrade-to-sapo-testnet)
## Bank Transfer
* Transfer tokens to an address:
```bash
cd /srv/laconicd
RECEIVER_ADDRESS=
AMOUNT=
laconic-so deployment --dir stage2-deployment exec laconicd "laconicd tx bank send alice ${RECEIVER_ADDRESS} ${AMOUNT}alnt --from alice --fees 1000alnt"
```
* Check balance:
```bash
laconic-so deployment --dir stage2-deployment exec laconicd "laconicd query bank balances ${RECEIVER_ADDRESS}"
```
+25
View File
@@ -0,0 +1,25 @@
#!/bin/bash
# Exit on error
set -e
set -u
NODE_HOME="$HOME/.laconicd"
testnet2_genesis="$NODE_HOME/tmp-testnet2/genesis.json"
if [ ! -f ${testnet2_genesis} ]; then
echo "testnet2 genesis file not found, exiting..."
exit 1
fi
# Remove data but keep keys
laconicd cometbft unsafe-reset-all
# Use provided genesis config
cp $testnet2_genesis $NODE_HOME/config/genesis.json
# Set chain id in config
chain_id=$(jq -r '.chain_id' $testnet2_genesis)
laconicd config set client chain-id $chain_id --home $NODE_HOME
echo "Node data reset and ready for testnet2!"