From 8219ff33ea0ca9a57fc0ba52a9b146249527d5f6 Mon Sep 17 00:00:00 2001 From: violet <158512193+fastfadingviolets@users.noreply.github.com> Date: Mon, 11 Nov 2024 11:59:52 -0500 Subject: [PATCH] fix: make consumer-democracy read the sovereign genesis from nodeHome (#2354) --- app/consumer-democracy/app.go | 7 +------ tests/e2e/testnet-scripts/start-changeover.sh | 16 +++++++++------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index 646babd205..865ea7711c 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -681,12 +681,7 @@ func New( // upgrade handler code is application specific. However, as an example, standalone to consumer // changeover chains should utilize customized upgrade handler code similar to below. - // TODO: should have a way to read from current node home - userHomeDir, err := os.UserHomeDir() - if err != nil { - stdlog.Println("Failed to get home dir %2", err) - } - nodeHome := userHomeDir + "/.sovereign/config/genesis.json" + nodeHome := homePath + "/.sovereign/config/genesis.json" appState, _, err := genutiltypes.GenesisStateFromGenFile(nodeHome) if err != nil { return fromVM, fmt.Errorf("failed to unmarshal genesis state: %w", err) diff --git a/tests/e2e/testnet-scripts/start-changeover.sh b/tests/e2e/testnet-scripts/start-changeover.sh index 7d1bd7c2a9..6a134ac4dc 100644 --- a/tests/e2e/testnet-scripts/start-changeover.sh +++ b/tests/e2e/testnet-scripts/start-changeover.sh @@ -38,15 +38,17 @@ TENDERMINT_CONFIG_TRANSFORM=$6 echo "killing nodes" pkill -f "^"interchain-security-sd &> /dev/null || true -mkdir -p /root/.sovereign/config - -# apply genesis changes to existing genesis -> this creates the changeover genesis file with initial validator set -jq "$GENESIS_TRANSFORM" /sover/validatoralice/config/genesis.json > /root/.sovereign/config/genesis.json - - # Get number of nodes from length of validators array NODES=$(echo "$VALIDATORS" | jq '. | length') +for i in $(seq 0 $(($NODES - 1))); +do + VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$i].val_id") + mkdir -p /$CHAIN_ID/validator$VAL_ID/.sovereign/config + # apply genesis changes to existing genesis -> this creates the changeover genesis file with initial validator set + jq "$GENESIS_TRANSFORM" /sover/validatoralice/config/genesis.json > /$CHAIN_ID/validator$VAL_ID/.sovereign/config/genesis.json +done + # SETUP NETWORK NAMESPACES, see: https://adil.medium.com/container-networking-under-the-hood-network-namespaces-6b2b8fe8dc2a # Create virtual bridge device (acts like a switch) @@ -184,4 +186,4 @@ set -e echo "done!!!!!!!!" -read -p "Press Return to Close..." \ No newline at end of file +read -p "Press Return to Close..."