From 03f48840188454c7d6149ef9d1c0a09aa4ba4e56 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 23 Jul 2024 10:25:14 +0530 Subject: [PATCH] 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