Skip to content

Commit

Permalink
perf: tweak blocktime, and run upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
duvbell committed Apr 2, 2024
1 parent 0898bf1 commit 233636c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
3 changes: 2 additions & 1 deletion scripts/localnode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ TRACE=""
HOME_DIR=mytestnet
DENOM=${2:-ppica}


if [ "$CONTINUE" == "true" ]; then
echo "\n ->> continuing from previous state"
$BINARY start --home $HOME_DIR --log_level debug
Expand Down Expand Up @@ -44,7 +45,7 @@ $BINARY add-genesis-account $KEY 100000000000000000000000000$DENOM --keyring-bac
# Sign genesis transaction
$BINARY gentx $KEY 1000000000000000000000$DENOM --keyring-backend $KEYRING --chain-id $CHAINID --home $HOME_DIR

update_test_genesis '.app_state["gov"]["params"]["voting_period"]="50s"'
update_test_genesis '.app_state["gov"]["params"]["voting_period"]="5s"'
update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="'$DENOM'"'
update_test_genesis '.app_state["gov"]["params"]["min_deposit"]=[{"denom":"'$DENOM'","amount": "1000000"}]'
update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom":"'$DENOM'","amount":"1000"}'
Expand Down
25 changes: 12 additions & 13 deletions scripts/tweak-test-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ ADDITIONAL_AFTER_SCRIPTS="./scripts/upgrade/v6_to_7/post_08_wasm.sh"

SLEEP_TIME=1

KEY="mykey"
KEY1="test1"
KEY2="test2"

if [[ "$FORK" == "true" ]]; then
export PICA_HALT_HEIGHT=20
fi
Expand Down Expand Up @@ -77,7 +81,6 @@ if [ ! -z "$ADDITIONAL_PRE_SCRIPTS" ]; then
done
fi

exit 0

run_fork () {
echo "forking"
Expand All @@ -100,7 +103,7 @@ run_upgrade () {

# Get upgrade height, 12 block after (6s)
STATUS_INFO=($(./_build/old/centaurid status --home $HOME | jq -r '.NodeInfo.network,.SyncInfo.latest_block_height'))
UPGRADE_HEIGHT=$((STATUS_INFO[1] + 50))
UPGRADE_HEIGHT=$((STATUS_INFO[1] + 22))
echo "UPGRADE_HEIGHT = $UPGRADE_HEIGHT"

tar -cf ./_build/new/centaurid.tar -C ./_build/new centaurid
Expand All @@ -113,21 +116,21 @@ run_upgrade () {
}')


./_build/old/centaurid tx gov submit-legacy-proposal software-upgrade "$SOFTWARE_UPGRADE_NAME" --upgrade-height $UPGRADE_HEIGHT --upgrade-info "$UPGRADE_INFO" --title "upgrade" --description "upgrade" --from test1 --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null
./_build/old/centaurid tx gov submit-legacy-proposal software-upgrade "$SOFTWARE_UPGRADE_NAME" --upgrade-height $UPGRADE_HEIGHT --upgrade-info "$UPGRADE_INFO" --title "upgrade" --description "upgrade" --from $KEY --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null

sleep $SLEEP_TIME

./_build/old/centaurid tx gov deposit 1 "20000000${DENOM}" --from test1 --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null
./_build/old/centaurid tx gov deposit 1 "20000000${DENOM}" --from $KEY --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null

sleep $SLEEP_TIME

./_build/old/centaurid tx gov vote 1 yes --from test0 --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null
./_build/old/centaurid tx gov vote 1 yes --from $KEY --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null

sleep $SLEEP_TIME

./_build/old/centaurid tx gov vote 1 yes --from test1 --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null
# ./_build/old/centaurid tx gov vote 1 yes --from $KEY2 --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null

sleep $SLEEP_TIME
# sleep $SLEEP_TIME

# determine block_height to halt
while true; do
Expand Down Expand Up @@ -156,12 +159,8 @@ fi
sleep 1

# run new node
echo -e "\n\n=> =>continue running nodes after upgrade"
if [[ "$OSTYPE" == "darwin"* ]]; then
screen -L -dmS new-node CONTINUE="true" bash scripts/localnode.sh _build/new/centaurid $DENOM
else
CONTINUE="true" bash scripts/localnode.sh _build/new/centaurid $DENOM
fi
echo -e "\n\n=> =>continue running nodes after upgrade"
CONTINUE="true" screen -dms new-node bash scripts/localnode.sh _build/new/centaurid $DENOM

sleep 5

Expand Down

0 comments on commit 233636c

Please sign in to comment.