Update demo cleanup and cleanup steps

This commit is contained in:
IshaVenikar 2024-07-22 14:43:04 +05:30
parent c0391d19ea
commit de8f52b1c2

View File

@ -86,7 +86,7 @@
- Follow these steps to install laconic-so: <https://git.vdb.to/cerc-io/stack-orchestrator#install>
### Fixturenet laconicd Stack and laconic-faucet
### fixturenet-laconicd and laconic-faucet Stacks
1. Clone the stack repos:
@ -154,20 +154,10 @@
laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy init --output stage1-spec.yml
```
- Edit `network` in the spec file to map container ports to host ports as required:
- Copy the contents of `stage0-spec.yml` to `stage1-spec.yml`:
```bash
# stage1-spec.yml
...
network:
ports:
laconicd:
- '6060'
- '26657:26657'
- '26656:26656'
- '9473:9473'
- '9090:9090'
- '1317:1317'
cp stage0-spec.yml stage1-spec.yml
```
- Create a deployment from the spec file:
@ -203,7 +193,7 @@
cp stage0-deployment/deployment.yml laconic-faucet-deployment/deployment.yml
```
### L1 eth and L2 optimism stacks
### L1 eth and L2 Optimism Stacks
1. Clone the stack repo:
@ -310,64 +300,41 @@
### Go Nitro
Clone the stack repo:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull
```
#### Bridge Stack
1. Clone the stack repos:
1. Clone required repositories:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull
```
2. Clone required repositories:
```bash
# laconicd
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge setup-repositories --git-ssh --pull
```
3. Build the container images:
2. Build the container images:
```bash
# laconicd
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge build-containers --force-rebuild
```
4. Create a deployment for the bridge:
- Create a spec-file for the deployment, map container ports to host ports and set env variables:
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy init --map-ports-to-host any-same --output bridge-nitro-spec.yml --config 'CERC_NITRO_L1_CHAIN_URL=ws://host.docker.internal:8546,CERC_NITRO_L2_CHAIN_URL=ws://host.docker.internal:9546,CERC_NITRO_CHAIN_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,CERC_NITRO_SC_PK=0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4,CERC_GETH_URL=http://host.docker.internal:8545,CERC_OPTIMISM_URL=http://host.docker.internal:9545,CERC_GETH_DEPLOYER_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,CERC_OPTIMISM_DEPLOYER_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,CERC_TOKEN_NAME=LaconicNetworkToken,CERC_TOKEN_SYMBOL=LNT,CERC_INITIAL_TOKEN_SUPPLY=129600'
```
- Create a deployment from the spec file:
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy create --spec-file bridge-nitro-spec.yml --deployment-dir bridge-deployment
```
#### Nitro-node Stack
1. Clone the stack repos:
1. Clone required repositories:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull
```
2. Clone required repositories:
```bash
# laconicd
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node setup-repositories --git-ssh --pull
```
3. Build the container images:
2. Build the container images:
```bash
# laconicd
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild
```
4. Create a deployment spec-file for Alice's L1 nitro-node:
3. Create a deployment spec-file for Alice's L1 nitro-node:
- Create spec files for the deployment:
```bash
@ -386,7 +353,7 @@
- 4007:4005
```
5. Create a deployment spec-file for Charlie's L1 nitro-node:
4. Create a deployment spec-file for Charlie's L1 nitro-node:
- Create spec file for the deployment:
```bash
@ -405,7 +372,7 @@
- 4008:4005
```
6. Create a deployment spec-file for Alice's L2 nitro-node:
5. Create a deployment spec-file for Alice's L2 nitro-node:
- Create spec files for the deployment:
```bash
@ -424,7 +391,7 @@
- 4009:4005
```
7. Create a deployment spec-file for Charlie's L2 nitro-node:
6. Create a deployment spec-file for Charlie's L2 nitro-node:
- Create spec file for the deployment:
```bash
@ -530,20 +497,31 @@
# 100000000000000000
```
- Start the nitro bridge
- Create a deployment for the bridge:
- Create a spec-file for the deployment, map container ports to host ports and set env variables:
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy init --map-ports-to-host any-same --output bridge-nitro-spec.yml --config 'CERC_NITRO_L1_CHAIN_URL=ws://host.docker.internal:8546,CERC_NITRO_L2_CHAIN_URL=ws://host.docker.internal:9546,CERC_NITRO_CHAIN_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,CERC_NITRO_SC_PK=0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4,CERC_GETH_URL=http://host.docker.internal:8545,CERC_OPTIMISM_URL=http://host.docker.internal:9545,CERC_GETH_DEPLOYER_PK=$ACCOUNT_PK,CERC_OPTIMISM_DEPLOYER_PK=$ACCOUNT_PK,CERC_TOKEN_NAME=LaconicNetworkToken,CERC_TOKEN_SYMBOL=LNT,CERC_INITIAL_TOKEN_SUPPLY=129600'
```
```bash
laconic-so deployment --dir bridge-deployment start
- Create a deployment from the spec file:
# Check the logs, ensure that the node is running
laconic-so deployment --dir bridge-deployment logs nitro-bridge -f
```
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy create --spec-file bridge-nitro-spec.yml --deployment-dir bridge-deployment
```
- Start the nitro bridge
```bash
laconic-so deployment --dir bridge-deployment start
# Check the logs, ensure that the node is running
laconic-so deployment --dir bridge-deployment logs nitro-bridge -f
```
- Send custom tokens to Alice and Charlie on L1
- Export variables for L1 token address
<!-- TODO: Export token address from contract deployment env in go-nitro -->
```bash
export L1_ASSET_ADDRESS="$(laconic-so deployment --dir bridge-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")"
export A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
@ -663,7 +641,12 @@
export BRIDGE_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"42069\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json")
```
- Get Ethereum private keys for accounts Alice and Charlie from `laconic-wallet` (to be used as statechannel PKs)
- Get Ethereum private keys for accounts Alice and Charlie from `laconic-wallet` using the `Show private key` link (to be used as statechannel PKs)
```bash
export A_PRIVATE_KEY=<Alice Ethereum Private Key>
export C_PRIVATE_KEY=<Charllie Ethereum Private Key>
```
- Prepare deployments for the nodes
- Set the env variables for L1 Alice's nitro-node:
@ -671,7 +654,7 @@
```bash
cat <<EOF >> lialice-nitro-deployment/config.env
CERC_NITRO_CHAIN_URL=ws://host.docker.internal:8546
CERC_NITRO_SC_PK=<Private key of Alice>
CERC_NITRO_SC_PK=$A_PRIVATE_KEY
CERC_NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
CERC_NA_ADDRESS=$CERC_NA_ADDRESS
CERC_VPA_ADDRESS=$CERC_VPA_ADDRESS
@ -692,7 +675,7 @@
```bash
cat <<EOF >> l1charlie-nitro-deployment/config.env
CERC_NITRO_CHAIN_URL=ws://host.docker.internal:8546
CERC_NITRO_SC_PK=<Private key of Charlie>
CERC_NITRO_SC_PK=$C_PRIVATE_KEY
CERC_NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
CERC_NA_ADDRESS=$CERC_NA_ADDRESS
CERC_VPA_ADDRESS=$CERC_VPA_ADDRESS
@ -713,7 +696,7 @@
```bash
cat <<EOF >> l2alice-nitro-deployment/config.env
CERC_NITRO_CHAIN_URL=ws://host.docker.internal:9546
CERC_NITRO_SC_PK=<Private key of Alice>
CERC_NITRO_SC_PK=$A_PRIVATE_KEY
CERC_NITRO_CHAIN_PK=111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f
CERC_NITRO_MSG_PORT=3008
CERC_NITRO_RPC_PORT=4008
@ -737,7 +720,7 @@
```bash
cat <<EOF >> l2charlie-nitro-deployment/config.env
CERC_NITRO_CHAIN_URL=ws://host.docker.internal:9546
CERC_NITRO_SC_PK=<Private key of Charlie>
CERC_NITRO_SC_PK=$C_PRIVATE_KEY
CERC_NITRO_CHAIN_PK=111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f
CERC_NITRO_MSG_PORT=3010
CERC_NITRO_RPC_PORT=4010
@ -758,40 +741,32 @@
- Start nitro nodes for Alice and Charlie on L1 and L2:
- Start the deployements for L1 Alice's node
- Start the deployments for L1 Alice's node
```bash
laconic-so deployment --dir l1alice-nitro-deployment start
```
- Start the deployements for L1 Charlie's node
- Start the deployments for L1 Charlie's node
```bash
laconic-so deployment --dir l1charlie-nitro-deployment start
```
- Start the deployements for L2 Alice's node
- Start the deployments for L2 Alice's node
```bash
laconic-so deployment --dir l2alice-nitro-deployment start
```
- Start the deployements for L2 Charlie's node
- Start the deployments for L2 Charlie's node
```bash
laconic-so deployment --dir l2charlie-nitro-deployment start
```
- Create ledger channels on L1 and mirrored channel on L2s
- Open new terminal
- Set the `NODE_EXTRA_CA_CERTS` environment variable to the path of mkcert's root CA certificate. This allows Node.js to trust locally-trusted development certificates created by mkcert
```bash
export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"
```
- Check that no channels exist on L2
- Open new terminal, check that no channels exist on L2
```bash
nitro-rpc-client get-all-l2-channels -p 4006
@ -805,8 +780,6 @@
export L1_ASSET_ADDRESS="<Token Address on L1>"
```
NOTE: Replace `<Token Address on L1>` with LNT token address deployed previously on L1 in [Run](#run) section
- Create ledger channel between A and Bridge with custom token
```bash
@ -913,20 +886,20 @@
- Use the scripts in fixturenet-laconicd stack to generate genesis file for stage 1 with token allocations:
```bash
cd ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd
```bash
cd ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd
./scripts/generate-stage1-genesis.sh <stage0-deployment-absolute-path>
./scripts/generate-stage1-genesis.sh <stage0-deployment-absolute-path>
# Expected output:
# Genesis file for stage1 written to output/genesis.json
# Expected output:
# Genesis file for stage1 written to output/genesis.json
# Remove the temporary data directory
sudo rm -rf stage1-genesis
# Remove the temporary data directory
sudo rm -rf stage1-genesis
# Go back to the directory where deployments are created
cd -
```
# Go back to the directory where deployments are created
cd -
```
- Copy over the generated genesis file (`.json`) containing the onboarding module state with funded participants to data directory in stage1 deployment (`stage1-deployment/data/genesis-config`):
@ -1054,14 +1027,31 @@
## Demo cleanup
- Stop the bridge, A, A', C and C' terminals
- Change directory to go-nitro repo root
- Clear the durable store
- Reset nitro-node deployments:
- Stop nitro-node deployments and remove volumes:
```bash
rm -rf ./data/
# Run where deployments are created
laconic-so deployment --dir l1alice-nitro-deployment stop --delete-volumes
laconic-so deployment --dir l1charlie-nitro-deployment stop --delete-volumes
laconic-so deployment --dir l2alice-nitro-deployment stop --delete-volumes
laconic-so deployment --dir l2charlie-nitro-deployment stop --delete-volumes
```
- Clear nitro-node deployments:
```bash
# Run where deployments are created
sudo rm -rf 'l1alice-nitro-deployment'
sudo rm -rf 'l1charlie-nitro-deployment'
sudo rm -rf 'l2alice-nitro-deployment'
sudo rm -rf 'l2charlie-nitro-deployment'
```
- Reset wallet:
- In laconic-wallet, click on the `Reset Wallet` button to disconnect all apps and clear the accounts
- Reset stage 0 and stage 1 laconicd deployments:
- Stop deployment and remove volumes:
@ -1095,25 +1085,33 @@
# Run where deployments are created
sudo rm -rf 'laconic-faucet-deployment/data/faucet-data/*'
```
## Re-run
- After running demo cleanup, follow the steps from [Demo](#demo) to re-run the demo
## Cleanup
- Stop Nitro nodes:
- Stop (`Ctrl+C`) the bridge, A, A', C and C' nitro nodes
- Clean up nitro-node deployments and remove volumes:
- Clear out nitro nodes data and configurations:
- Change directory to go-nitro repo root
```bash
# Run where deployments are created
laconic-so deployment --dir l1alice-nitro-deployment stop --delete-volumes
laconic-so deployment --dir l1charlie-nitro-deployment stop --delete-volumes
laconic-so deployment --dir l2alice-nitro-deployment stop --delete-volumes
laconic-so deployment --dir l2charlie-nitro-deployment stop --delete-volumes
laconic-so deployment --dir bridge-deployment stop --delete-volumes
```
- Cleanup:
- Clear nitro-node deployments:
```bash
# In go-nitro
git clean -xdf
```
```bash
# Run where deployments are created
sudo rm -rf 'l1alice-nitro-deployment'
sudo rm -rf 'l1charlie-nitro-deployment'
sudo rm -rf 'l2alice-nitro-deployment'
sudo rm -rf 'l2charlie-nitro-deployment'
sudo rm -rf 'bridge-deployment'
```
- Reset wallet and stop the app:
- In laconic-wallet, click on the `Reset Wallet` button to disconnect all apps and clear the accounts