From 9e9bd3019f8a67cdbd237823d0f81e93584e662b Mon Sep 17 00:00:00 2001 From: Isha Venikar <145848618+IshaVenikar@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:20:40 +0530 Subject: [PATCH] Update stack with testnet onboarding changes (#1) * Add enable onboarding flag in fixturenet script * Use genesis file if present * Modify setup repos link * Update readme steps to run fixturenet stack using s0 genesis file * Update genesis file mount path * Update instructions for onboarding module flag --- .../docker-compose-fixturenet-laconicd.yml | 3 +++ .../fixturenet-laconicd/create-fixturenet.sh | 13 +++++++++++++ .../stacks/fixturenet-laconicd/README.md | 18 +++++++++++++++++- .../stacks/fixturenet-laconicd/stack.yml | 2 +- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-fixturenet-laconicd.yml b/stack-orchestrator/compose/docker-compose-fixturenet-laconicd.yml index a47d3bc..500cfba 100644 --- a/stack-orchestrator/compose/docker-compose-fixturenet-laconicd.yml +++ b/stack-orchestrator/compose/docker-compose-fixturenet-laconicd.yml @@ -6,8 +6,10 @@ services: environment: TEST_AUCTION_ENABLED: ${TEST_AUCTION_ENABLED:-false} TEST_REGISTRY_EXPIRY: ${TEST_REGISTRY_EXPIRY:-false} + ONBOARDING_ENABLED: ${ONBOARDING_ENABLED:-false} volumes: - laconicd-data:/root/.laconicd + - genesis-config:/var/tmp - ../config/fixturenet-laconicd/create-fixturenet.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh ports: - "6060" @@ -25,3 +27,4 @@ services: volumes: laconicd-data: + genesis-config: diff --git a/stack-orchestrator/config/fixturenet-laconicd/create-fixturenet.sh b/stack-orchestrator/config/fixturenet-laconicd/create-fixturenet.sh index 4b9225e..d9de757 100644 --- a/stack-orchestrator/config/fixturenet-laconicd/create-fixturenet.sh +++ b/stack-orchestrator/config/fixturenet-laconicd/create-fixturenet.sh @@ -6,6 +6,8 @@ MONIKER="localtestnet" KEYRING="test" LOGLEVEL="${LOGLEVEL:-info}" +input_genesis_file=/var/tmp/genesis.json + if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then # validate dependencies are installed command -v jq > /dev/null 2>&1 || { @@ -29,6 +31,11 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then # Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer) laconicd init $MONIKER --chain-id $CHAINID --default-denom photon + if [ -f ${input_genesis_file} ]; then + # Use provided genesis config + cp $input_genesis_file $HOME/.laconicd/config/genesis.json + fi + update_genesis() { jq "$1" $HOME/.laconicd/config/genesis.json > $HOME/.laconicd/config/tmp_genesis.json && mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json @@ -52,6 +59,12 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then update_genesis '.app_state["registry"]["params"]["authority_auction_reveals_duration"]="60s"' fi + if [[ "$ONBOARDING_ENABLED" == "true" ]]; then + echo "Enabling validator onboarding." + + update_genesis '.app_state["onboarding"]["params"]["onboarding_enabled"]=true' + fi + # increase block time (?) update_genesis '.consensus["params"]["block"]["time_iota_ms"]="1000"' diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/README.md b/stack-orchestrator/stacks/fixturenet-laconicd/README.md index 891835f..d5c879a 100644 --- a/stack-orchestrator/stacks/fixturenet-laconicd/README.md +++ b/stack-orchestrator/stacks/fixturenet-laconicd/README.md @@ -51,7 +51,7 @@ Instructions for running a laconicd fixturenet along with registry CLI and conso * Edit `network` in the spec file to map container ports to host ports as required: ```bash - # testnet-laconicd-spec.yml + # fixturenet-laconicd-spec.yml ... network: ports: @@ -82,8 +82,24 @@ Instructions for running a laconicd fixturenet along with registry CLI and conso cp fixturenet-laconicd-deployment/deployment.yml laconic-console-deployment/deployment.yml ``` +* (Optional) Copy over the genesis file (`.json`) containing the onboarding module state with funded participants to data directory in deployment (`fixturenet-laconicd-deployment/data/genesis-config`): + + ```bash + # Example + cp genesis.json fixturenet-laconicd-deployment/data/genesis-config/genesis.json + ``` + ## Configuration +* Inside the `fixturenet-laconicd-deployment` deployment directory, open `config.env` file and set the following env variable: + + ```bash + # Optional + + # Set to true to enable adding participants functionality of the onboarding module + ONBOARDING_ENABLED= + ``` + * Inside the `laconic-console-deployment` deployment directory, open `config.env` file and set following env variables: ```bash diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/stack.yml b/stack-orchestrator/stacks/fixturenet-laconicd/stack.yml index 85c2ba1..59610af 100644 --- a/stack-orchestrator/stacks/fixturenet-laconicd/stack.yml +++ b/stack-orchestrator/stacks/fixturenet-laconicd/stack.yml @@ -2,7 +2,7 @@ version: "1.0" name: fixturenet-laconicd description: "A laconicd fixturenet" repos: - - git.vdb.to/cerc-io/laconic2d + - github.com/deep-stack/laconic2d@testnet-onboarding containers: - cerc/laconic2d pods: