From 0ef2f8252e40e3785245504069856ea4de54bd85 Mon Sep 17 00:00:00 2001 From: DK Date: Thu, 5 Oct 2023 17:58:06 -0700 Subject: [PATCH] also address constantly changing files --- .gitignore | 8 +++----- Makefile | 2 +- localnet/regenesis.sh | 37 ------------------------------------- 3 files changed, 4 insertions(+), 43 deletions(-) delete mode 100644 localnet/regenesis.sh diff --git a/.gitignore b/.gitignore index 3676a5a41..bc51906d9 100644 --- a/.gitignore +++ b/.gitignore @@ -24,12 +24,10 @@ go.work bin !bin/.keep -# Why: pocketd CLI should use the same keys as the node that runs inside the cluster to -# allow commands such as `pocketd tx stake` for work. +# Before we provision the localnet, `ignite` creates the accounts, genesis, etc. for us +# As many of the files are dynamic, we only preserve the config files in git history. localnet/pocketd/* -# !localnet/pocketd/keyring-test/ -# !localnet/pocketd/keyring-test/* -!localnet/*/config/ +localnet/*/config/ !localnet/*/config/{app.toml,client.toml,config.toml} # Macos diff --git a/Makefile b/Makefile index ab8085b8e..30b947ec8 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,7 @@ localnet_regenesis: # Regenerate the localnet genesis file ignite chain init --skip-proto cp -r ${HOME}/.pocket/keyring-test $(POCKETD_HOME) cp ${HOME}/.pocket/config/*_key.json $(POCKETD_HOME)/config/ - cp ${HOME}/.pocket/config/genesis.json ./localnet/ + cp ${HOME}/.pocket/config/genesis.json $(POCKETD_HOME)/config/ ############# ### Tests ### diff --git a/localnet/regenesis.sh b/localnet/regenesis.sh deleted file mode 100644 index aa020e5a4..000000000 --- a/localnet/regenesis.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -# Re-generate genesis.json file - -GENESIS_PATH="./localnet/genesis.json" -POCKETD_HOME="./localnet/pocketd" -BEGINNING_OF_TIMES="2023-04-20T20:04:20.069420Z" - -# If no `jq`, then error and exit -if ! command -v jq &>/dev/null; then - echo "jq is required but not installed. Please install jq and try again." - exit 1 -fi - -# Save existing values that will change after regenesis, -# so we can restore them later (and avoid unnecessary changes in git history) -GENTX0_PUBKEY=$(jq -r '.app_state.genutil.gen_txs[0].body.messages[0].pubkey.key' $GENESIS_PATH) -GENTX0_MEMO=$(jq -r '.app_state.genutil.gen_txs[0].body.memo' $GENESIS_PATH) -GENTX0_SIGNATURE=$(jq -r '.app_state.genutil.gen_txs[0].signatures[0]' $GENESIS_PATH) - -# Run regenesis -# NOTE: intentionally not using --home flag to avoid overwriting the test keyring -faketime "$BEGINNING_OF_TIMES" /bin/bash -c 'ignite chain init --skip-proto' - -# only copy new files, without changin the existing keys -# cp -rn ${HOME}/.pocket/keyring-test ${POCKETD_HOME} -cp -r ${HOME}/.pocket/keyring-test ${POCKETD_HOME} - -# copy the new genesis into the git repo -cp ${HOME}/.pocket/config/genesis.json ./localnet/ - -# Now, let's put old values back and set the "correct" date -# jq --arg pubkey "$GENTX0_PUBKEY" \ -# --arg signature "$GENTX0_SIGNATURE" \ -# --arg memo "$GENTX0_MEMO" \ -# '.app_state.genutil.gen_txs[0].body.messages[0].pubkey.key=$pubkey | -# .app_state.genutil.gen_txs[0].body.memo=$memo | -# .app_state.genutil.gen_txs[0].signatures[0]=$signature' $GENESIS_PATH > tmp.json && mv tmp.json $GENESIS_PATH