From 12833bb8402053e206b4dad04cec30c9cf5b8ffa Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 22 Jul 2024 18:18:46 +0530 Subject: [PATCH 1/6] Fix CORS issue --- .../config/fixturenet-laconicd/create-fixturenet.sh | 3 +++ stack-orchestrator/stacks/fixturenet-laconicd/README.md | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/stack-orchestrator/config/fixturenet-laconicd/create-fixturenet.sh b/stack-orchestrator/config/fixturenet-laconicd/create-fixturenet.sh index d9de757..5e24c0f 100644 --- a/stack-orchestrator/config/fixturenet-laconicd/create-fixturenet.sh +++ b/stack-orchestrator/config/fixturenet-laconicd/create-fixturenet.sh @@ -89,6 +89,9 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then sed -i 's/prometheus = false/prometheus = true/g' $HOME/.laconicd/config/config.toml fi + # Run this to allow requests from any origin + sed -i 's/cors_allowed_origins.*$/cors_allowed_origins = ["*"]/' $HOME/.laconicd/config/config.toml + # Allocate genesis accounts (cosmos formatted addresses) laconicd genesis add-genesis-account $KEY 100000000000000000000000000photon --keyring-backend $KEYRING diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/README.md b/stack-orchestrator/stacks/fixturenet-laconicd/README.md index 356950d..ee898b7 100644 --- a/stack-orchestrator/stacks/fixturenet-laconicd/README.md +++ b/stack-orchestrator/stacks/fixturenet-laconicd/README.md @@ -34,9 +34,9 @@ Instructions for running a laconicd fixturenet along with registry CLI and conso This should create the following docker images locally: * `cerc/laconic2d` - * `cerc/laconic2-registry-cli` + * `cerc/laconic-registry-cli` * `cerc/webapp-base` - * `cerc/laconic2-console-host` + * `cerc/laconic-console-host` ## Create a deployment -- 2.45.2 From e53fe7bce7cc1948ce451520fb72e3d1a1f2e945 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 22 Jul 2024 18:28:33 +0530 Subject: [PATCH 2/6] Replace laconic2 with laconic --- .../compose/docker-compose-fixturenet-laconicd.yml | 2 +- stack-orchestrator/container-build/cerc-laconic2d/build.sh | 4 ++-- stack-orchestrator/stacks/fixturenet-laconicd/README.md | 2 +- .../fixturenet-laconicd/scripts/generate-stage1-genesis.sh | 6 +++--- .../stacks/fixturenet-laconicd/scripts/genesis.sh | 2 +- stack-orchestrator/stacks/fixturenet-laconicd/stack.yml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-fixturenet-laconicd.yml b/stack-orchestrator/compose/docker-compose-fixturenet-laconicd.yml index 5d8e73f..528831a 100644 --- a/stack-orchestrator/compose/docker-compose-fixturenet-laconicd.yml +++ b/stack-orchestrator/compose/docker-compose-fixturenet-laconicd.yml @@ -1,7 +1,7 @@ services: laconicd: restart: unless-stopped - image: cerc/laconic2d:local + image: cerc/laconicd:local command: ["bash", "/docker-entrypoint-scripts.d/create-fixturenet.sh"] environment: TEST_AUCTION_ENABLED: ${TEST_AUCTION_ENABLED:-false} diff --git a/stack-orchestrator/container-build/cerc-laconic2d/build.sh b/stack-orchestrator/container-build/cerc-laconic2d/build.sh index 2265c85..8811ea9 100755 --- a/stack-orchestrator/container-build/cerc-laconic2d/build.sh +++ b/stack-orchestrator/container-build/cerc-laconic2d/build.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build cerc/laconic2d +# Build cerc/laconicd source ${CERC_CONTAINER_BASE_DIR}/build-base.sh -docker build -t cerc/laconic2d:local ${build_command_args} ${CERC_REPO_BASE_DIR}/laconic2d +docker build -t cerc/laconicd:local ${build_command_args} ${CERC_REPO_BASE_DIR}/laconic2d diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/README.md b/stack-orchestrator/stacks/fixturenet-laconicd/README.md index ee898b7..38eea37 100644 --- a/stack-orchestrator/stacks/fixturenet-laconicd/README.md +++ b/stack-orchestrator/stacks/fixturenet-laconicd/README.md @@ -33,7 +33,7 @@ Instructions for running a laconicd fixturenet along with registry CLI and conso This should create the following docker images locally: - * `cerc/laconic2d` + * `cerc/laconicd` * `cerc/laconic-registry-cli` * `cerc/webapp-base` * `cerc/laconic-console-host` diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh index 33f7080..cc6afbf 100755 --- a/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh +++ b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh @@ -37,7 +37,7 @@ echo "Fetched Ethereum account holdings" onboarding_state_file="$STAGE1_GENESIS_DIR/stage0-onboarding-state.json" docker run -it \ -v ${STAGE0_DEPLOYMENT_DIR}/data/laconicd-data:/root/stage0-deployment/.laconicd \ - cerc/laconic2d:local bash -c "laconicd export --home /root/stage0-deployment/.laconicd" \ + cerc/laconicd:local bash -c "laconicd export --home /root/stage0-deployment/.laconicd" \ | jq .app_state.onboarding > "$onboarding_state_file" stage0_participants=$(cat "$onboarding_state_file" | jq .participants) @@ -64,12 +64,12 @@ echo "Calculated allocations for stage 1 chain" # -------- -# Run a script with cerc/laconic2d:local to generate the genesis file +# Run a script with cerc/laconicd:local to generate the genesis file # with onboarding module state and given allocations docker run -it \ -v ./stage1-genesis:/root/.laconicd \ -v ./scripts:/scripts \ - cerc/laconic2d:local bash -c "/scripts/genesis.sh" + cerc/laconicd:local bash -c "/scripts/genesis.sh" # Copy over the genesis file to output folder OUTPUT_DIR=output diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/scripts/genesis.sh b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/genesis.sh index e45326c..c9a8018 100755 --- a/stack-orchestrator/stacks/fixturenet-laconicd/scripts/genesis.sh +++ b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/genesis.sh @@ -3,7 +3,7 @@ # Exit on error set -e -# Note: Needs to be run in a docker container with image cerc/laconic2d:local +# Note: Needs to be run in a docker container with image cerc/laconicd:local CHAINID="laconic_9000-1" STAGE1_MONIKER=localtestnet-stage-1 diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/stack.yml b/stack-orchestrator/stacks/fixturenet-laconicd/stack.yml index 85c2ba1..3517f56 100644 --- a/stack-orchestrator/stacks/fixturenet-laconicd/stack.yml +++ b/stack-orchestrator/stacks/fixturenet-laconicd/stack.yml @@ -4,6 +4,6 @@ description: "A laconicd fixturenet" repos: - git.vdb.to/cerc-io/laconic2d containers: - - cerc/laconic2d + - cerc/laconicd pods: - fixturenet-laconicd -- 2.45.2 From f1cddc72ab25b44701f4e36382b5fd6aa794a4b0 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Mon, 22 Jul 2024 18:30:42 +0530 Subject: [PATCH 3/6] Update directory name --- .../container-build/{cerc-laconic2d => cerc-laconicd}/build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename stack-orchestrator/container-build/{cerc-laconic2d => cerc-laconicd}/build.sh (100%) diff --git a/stack-orchestrator/container-build/cerc-laconic2d/build.sh b/stack-orchestrator/container-build/cerc-laconicd/build.sh similarity index 100% rename from stack-orchestrator/container-build/cerc-laconic2d/build.sh rename to stack-orchestrator/container-build/cerc-laconicd/build.sh -- 2.45.2 From 20f6d163d283f13c5f03f2afcb4ef78b02be89b2 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 23 Jul 2024 10:15:33 +0530 Subject: [PATCH 4/6] Use laconicd repo --- stack-orchestrator/container-build/cerc-laconicd/build.sh | 2 +- stack-orchestrator/stacks/fixturenet-laconicd/stack.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stack-orchestrator/container-build/cerc-laconicd/build.sh b/stack-orchestrator/container-build/cerc-laconicd/build.sh index 8811ea9..65bab74 100755 --- a/stack-orchestrator/container-build/cerc-laconicd/build.sh +++ b/stack-orchestrator/container-build/cerc-laconicd/build.sh @@ -2,4 +2,4 @@ # Build cerc/laconicd source ${CERC_CONTAINER_BASE_DIR}/build-base.sh -docker build -t cerc/laconicd:local ${build_command_args} ${CERC_REPO_BASE_DIR}/laconic2d +docker build -t cerc/laconicd:local ${build_command_args} ${CERC_REPO_BASE_DIR}/laconicd diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/stack.yml b/stack-orchestrator/stacks/fixturenet-laconicd/stack.yml index 3517f56..191dcec 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 + - git.vdb.to/cerc-io/laconicd containers: - cerc/laconicd pods: -- 2.45.2 From 03f48840188454c7d6149ef9d1c0a09aa4ba4e56 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 23 Jul 2024 10:25:14 +0530 Subject: [PATCH 5/6] Run nitro-rpc-client command in the bridge-deployment --- .../scripts/generate-stage1-genesis.sh | 21 ++++++++++--------- .../fixturenet-laconicd/scripts/genesis.sh | 1 + 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh index cc6afbf..fb1ed34 100755 --- a/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh +++ b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh @@ -2,17 +2,16 @@ # Exit on error set -e - -# Prerequisite: nitro-rpc-client package installed globally -# https://github.com/cerc-io/go-nitro/blob/main/packages/nitro-rpc-client/readme.md#global-install +set -u # Check args -if [ "$#" -ne 1 ]; then - echo "Usage: $0 " +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " exit 1 fi -STAGE0_DEPLOYMENT_DIR="$1" +BRIDGE_DEPLOYMENT_DIR="$1" +STAGE0_DEPLOYMENT_DIR="$2" STAGE1_GENESIS_DIR=stage1-genesis # Create a temporary target directory @@ -22,11 +21,13 @@ mkdir -p $STAGE1_GENESIS_DIR # Fetch ETH account holdings from the bridge node -# Trust locally-trusted development certificates created by mkcert -export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem" - # Run the nitro-rpc-client command and process the output with jq -eth_account_holdings=$(nitro-rpc-client get-all-l2-channels -p 4006 | jq -s '[.[] | {nitro_address: .Balance.Them, balance: .Balance.TheirBalance}]') +cd $BRIDGE_DEPLOYMENT_DIR + +eth_account_holdings=$(laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge" | jq -s '[.[] | {nitro_address: .Balance.Them, balance: .Balance.TheirBalance}]') + +# Change back to the original directory +cd - echo "Fetched Ethereum account holdings" diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/scripts/genesis.sh b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/genesis.sh index c9a8018..a92c67f 100755 --- a/stack-orchestrator/stacks/fixturenet-laconicd/scripts/genesis.sh +++ b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/genesis.sh @@ -2,6 +2,7 @@ # Exit on error set -e +set -u # Note: Needs to be run in a docker container with image cerc/laconicd:local -- 2.45.2 From ddbbe49aa6bb0adfeb65b43726a4d653aec0a1ee Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 23 Jul 2024 11:47:47 +0530 Subject: [PATCH 6/6] Fix bridge deployment dir path usage --- .../fixturenet-laconicd/scripts/generate-stage1-genesis.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh index fb1ed34..6f827b9 100755 --- a/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh +++ b/stack-orchestrator/stacks/fixturenet-laconicd/scripts/generate-stage1-genesis.sh @@ -22,12 +22,7 @@ mkdir -p $STAGE1_GENESIS_DIR # Fetch ETH account holdings from the bridge node # Run the nitro-rpc-client command and process the output with jq -cd $BRIDGE_DEPLOYMENT_DIR - -eth_account_holdings=$(laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge" | jq -s '[.[] | {nitro_address: .Balance.Them, balance: .Balance.TheirBalance}]') - -# Change back to the original directory -cd - +eth_account_holdings=$(laconic-so deployment --dir $BRIDGE_DEPLOYMENT_DIR exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge" | jq -s '[.[] | {nitro_address: .Balance.Them, balance: .Balance.TheirBalance}]') echo "Fetched Ethereum account holdings" -- 2.45.2