ci: make init-simapp v1 / v2 consistent (#21082)
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#? init-simapp: Initializes a single local node network
|
||||
init-simapp:
|
||||
./scripts/init-simapp.sh
|
||||
init-simapp-v2:
|
||||
./scripts/init-simapp-v2.sh
|
||||
|
||||
#? test: Run `make test-unit`
|
||||
test: test-unit
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SIMD_BIN=${SIMD_BIN:=$(which simdv2 2>/dev/null)}
|
||||
|
||||
if [ -z "$SIMD_BIN" ]; then echo "SIMD_BIN is not set. Make sure to run 'COSMOS_BUILD_OPTIONS=v2 make install' before"; exit 1; fi
|
||||
echo "using $SIMD_BIN"
|
||||
SIMD_HOME=$($SIMD_BIN config home)
|
||||
if [ -d "$SIMD_HOME" ]; then rm -rv $SIMD_HOME; fi
|
||||
$SIMD_BIN config set client chain-id simapp-v2-chain
|
||||
$SIMD_BIN config set client keyring-backend test
|
||||
$SIMD_BIN config set client keyring-default-keyname alice
|
||||
$SIMD_BIN config set app api.enable true
|
||||
$SIMD_BIN keys add alice --indiscreet
|
||||
$SIMD_BIN keys add bob --indiscreet
|
||||
$SIMD_BIN init simapp-v2-node --chain-id simapp-v2-chain
|
||||
# to change the voting_period
|
||||
jq '.app_state.gov.params.voting_period = "600s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json
|
||||
jq '.app_state.gov.params.expedited_voting_period = "300s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json
|
||||
jq '.app_state.mint.minter.inflation = "0.300000000000000000"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json # to change the inflation
|
||||
$SIMD_BIN genesis add-genesis-account alice 5000000000stake --keyring-backend test
|
||||
$SIMD_BIN genesis add-genesis-account bob 5000000000stake --keyring-backend test
|
||||
$SIMD_BIN genesis gentx alice 1000000stake --chain-id demo
|
||||
$SIMD_BIN genesis collect-gentxs
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
SIMD_BIN=${SIMD_BIN:=$(which simd 2>/dev/null)}
|
||||
|
||||
if [ -z "$SIMD_BIN" ]; then echo "SIMD_BIN is not set. Make sure to run make install before"; exit 1; fi
|
||||
echo "using $SIMD_BIN"
|
||||
if [ -d "$($SIMD_BIN config home)" ]; then rm -rv $($SIMD_BIN config home); fi
|
||||
if [ -z "$SIMD_BIN" ]; then echo "SIMD_BIN is not set. Make sure to run 'make install' before"; exit 1; fi
|
||||
SIMD_HOME=$($SIMD_BIN config home)
|
||||
if [ -d "$SIMD_HOME" ]; then rm -rv $SIMD_HOME; fi
|
||||
$SIMD_BIN config set client chain-id demo
|
||||
$SIMD_BIN config set client keyring-backend test
|
||||
$SIMD_BIN config set client keyring-default-keyname alice
|
||||
@@ -12,6 +12,10 @@ $SIMD_BIN config set app api.enable true
|
||||
$SIMD_BIN keys add alice --indiscreet
|
||||
$SIMD_BIN keys add bob --indiscreet
|
||||
$SIMD_BIN init test --chain-id demo
|
||||
# to change the voting_period
|
||||
jq '.app_state.gov.params.voting_period = "600s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json
|
||||
jq '.app_state.gov.params.expedited_voting_period = "300s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json
|
||||
jq '.app_state.mint.minter.inflation = "0.300000000000000000"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json # to change the inflation
|
||||
$SIMD_BIN genesis add-genesis-account alice 5000000000stake --keyring-backend test
|
||||
$SIMD_BIN genesis add-genesis-account bob 5000000000stake --keyring-backend test
|
||||
$SIMD_BIN genesis gentx alice 1000000stake --chain-id demo
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -x
|
||||
|
||||
ROOT=$PWD
|
||||
|
||||
SIMD="$ROOT/build/simdv2"
|
||||
CONFIG="${CONFIG:-$HOME/.simappv2/config}"
|
||||
|
||||
COSMOS_BUILD_OPTIONS=v2 make build
|
||||
|
||||
if [ -d "$($SIMD config home)" ]; then rm -rv $($SIMD config home); fi
|
||||
|
||||
$SIMD init simapp-v2-node --chain-id simapp-v2-chain
|
||||
|
||||
cd "$CONFIG"
|
||||
|
||||
# to change the voting_period
|
||||
jq '.app_state.gov.voting_params.voting_period = "600s"' genesis.json > temp.json && mv temp.json genesis.json
|
||||
|
||||
# to change the inflation
|
||||
jq '.app_state.mint.minter.inflation = "0.300000000000000000"' genesis.json > temp.json && mv temp.json genesis.json
|
||||
|
||||
$SIMD config set client chain-id simapp-v2-chain
|
||||
$SIMD keys add test_validator --indiscreet
|
||||
VALIDATOR_ADDRESS=$($SIMD keys show test_validator -a --keyring-backend test)
|
||||
|
||||
$SIMD genesis add-genesis-account "$VALIDATOR_ADDRESS" 1000000000stake
|
||||
$SIMD genesis gentx test_validator 1000000000stake --keyring-backend test
|
||||
$SIMD genesis collect-gentxs
|
||||
|
||||
$SIMD start &
|
||||
SIMD_PID=$!
|
||||
|
||||
cnt=0
|
||||
while ! $SIMD query block --type=height 5; do
|
||||
cnt=$((cnt + 1))
|
||||
if [ $cnt -gt 30 ]; then
|
||||
kill -9 "$SIMD_PID"
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
kill -9 "$SIMD_PID"
|
||||
Reference in New Issue
Block a user