testnet-laconicd-stack/ops/stage0-to-stage1.md
2024-08-16 16:37:48 +05:30

4.7 KiB

Halt stage0 and start stage1

Once all the participants have completed their onboarding, stage0 laconicd chain can be halted and stage1 chain can be initialized and started

Prerequisite

  • A CSV having the subscribers (subscribers.csv) placed at /srv/laconicd/csvs

Login

  • Log in as dev user on the deployments VM

  • All the deployments are placed in the /srv directory:

    cd /srv
    

Map subscribers to participants

  • Fetch updated scripts in testnet-laconicd-stack:

    laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack --pull
    
  • Create a CSV with subscribers who have onboarded as participants:

    # Change to scripts dir
    cd ~/cerc/testnet-laconicd-stack/scripts
    
    # Install dependencies and build
    yarn && yarn build
    
    # Run script
    yarn map-subscribers-to-participants --subscribers-csv /srv/laconicd/csvs/subscribers.csv --output /srv/laconicd/csvs/subscribed-participants.csv
    
    # This should create the CSV file at /srv/laconicd/csvs/subscribed-participants.csv
    

Halt stage0

  • Confirm the the currently running node is for stage0 chain:

    cd /srv/laconicd
    
    laconic-so deployment --dir stage0-deployment logs laconicd -f --tail 30
    
  • List the participants on stage0:

    laconic-so deployment --dir stage0-deployment exec laconicd "laconicd query onboarding list"
    
  • Stop the stage0 deployment:

    laconic-so deployment --dir stage0-deployment stop
    

Start stage1

  • Fetch updated scripts in fixturenet-laconicd-stack:

    laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-laconicd-stack --pull
    
  • Rebuild laconicd container with >=v0.1.7 to enable slashing module:

    # laconicd source
    cd ~/cerc/laconicd
    
    # Pull latest changes
    git pull
    
    # Confirm the latest commit hash
    git log
    
    # Rebuild the containers
    cd /srv/laconicd
    
    laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd build-containers --force-rebuild
    
  • Use the scripts in fixturenet-laconicd-stack to generate genesis file for stage1 using CSV with subscribed participants with token allocations:

    cd /srv/laconicd
    
    # Set current working dir path in a variable
    DEPLOYMENTS_DIR=$(pwd)
    
    cd ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd
    
    # Generate the genesis file
    # Participant allocation: 1000000000000 (10^12)
    # Validator allocation:   2000000000000000 (10^15)
    # These amounts are used only if funding amount is not present in the input CSV
    ./scripts/generate-stage1-genesis-from-csv.sh /srv/laconicd/csvs/subscribed-participants.csv 1000000000000 2000000000000000
    
    # If you see the error "Error: genesis.json file already exists: /root/.laconicd/config/genesis.json",
    # remove the temporary data directory and try again
    sudo rm -rf stage1-genesis
    
    # Expected output:
    # Genesis file for stage1 written to output/genesis.json
    
    # Remove the temporary data directory
    sudo rm -rf stage1-genesis
    
    # Go back to the directory where deployments are created
    cd $DEPLOYMENTS_DIR
    
  • 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):

    cd /srv/laconicd
    
    cp ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd/output/genesis.json stage1-deployment/data/genesis-config/genesis.json
    
  • Start the stage1 deployment:

    laconic-so deployment --dir stage1-deployment start
    
  • Check status of stage1 laconicd:

    # 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 stage1-deployment logs laconicd -f
    
  • Query the list of registered participants in stage1 laconicd:

    laconic-so deployment --dir stage1-deployment exec laconicd "laconicd query onboarding list"
    
    # Confirm that all onboarded participants on stage0 appear in the list
    
  • Get the node's peer adddress and stage1 genesis file to share with the participants:

    • Get the node id:

      echo $(laconic-so deployment --dir stage1-deployment exec laconicd "laconicd cometbft show-node-id")@laconicd.laconic.com:26656
      
    • Get the genesis file:

      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