Skip to content

Commit 8219ff3

Browse files
fix: make consumer-democracy read the sovereign genesis from nodeHome (#2354)
1 parent b11da1b commit 8219ff3

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

app/consumer-democracy/app.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -681,12 +681,7 @@ func New(
681681
// upgrade handler code is application specific. However, as an example, standalone to consumer
682682
// changeover chains should utilize customized upgrade handler code similar to below.
683683

684-
// TODO: should have a way to read from current node home
685-
userHomeDir, err := os.UserHomeDir()
686-
if err != nil {
687-
stdlog.Println("Failed to get home dir %2", err)
688-
}
689-
nodeHome := userHomeDir + "/.sovereign/config/genesis.json"
684+
nodeHome := homePath + "/.sovereign/config/genesis.json"
690685
appState, _, err := genutiltypes.GenesisStateFromGenFile(nodeHome)
691686
if err != nil {
692687
return fromVM, fmt.Errorf("failed to unmarshal genesis state: %w", err)

tests/e2e/testnet-scripts/start-changeover.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,17 @@ TENDERMINT_CONFIG_TRANSFORM=$6
3838
echo "killing nodes"
3939
pkill -f "^"interchain-security-sd &> /dev/null || true
4040

41-
mkdir -p /root/.sovereign/config
42-
43-
# apply genesis changes to existing genesis -> this creates the changeover genesis file with initial validator set
44-
jq "$GENESIS_TRANSFORM" /sover/validatoralice/config/genesis.json > /root/.sovereign/config/genesis.json
45-
46-
4741
# Get number of nodes from length of validators array
4842
NODES=$(echo "$VALIDATORS" | jq '. | length')
4943

44+
for i in $(seq 0 $(($NODES - 1)));
45+
do
46+
VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$i].val_id")
47+
mkdir -p /$CHAIN_ID/validator$VAL_ID/.sovereign/config
48+
# apply genesis changes to existing genesis -> this creates the changeover genesis file with initial validator set
49+
jq "$GENESIS_TRANSFORM" /sover/validatoralice/config/genesis.json > /$CHAIN_ID/validator$VAL_ID/.sovereign/config/genesis.json
50+
done
51+
5052
# SETUP NETWORK NAMESPACES, see: https://adil.medium.com/container-networking-under-the-hood-network-namespaces-6b2b8fe8dc2a
5153

5254
# Create virtual bridge device (acts like a switch)
@@ -184,4 +186,4 @@ set -e
184186

185187
echo "done!!!!!!!!"
186188

187-
read -p "Press Return to Close..."
189+
read -p "Press Return to Close..."

0 commit comments

Comments
 (0)