Skip to content

Commit

Permalink
refactor: update script
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 committed Apr 22, 2024
1 parent ce0cde8 commit 4edf9b7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
16 changes: 14 additions & 2 deletions scripts/localnode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

KEY="mykey"
KEY1="mykey1"
CHAINID="centauri-dev"
CHAINID="localpica"
MONIKER="localtestnet"
KEYALGO="secp256k1"
KEYRING="test"
Expand All @@ -15,6 +15,10 @@ TRACE=""
HOME_DIR=mytestnet
DENOM=ppica

KEY00="test0"
KEY11="test1"
KEY22="test2"


if [ "$CONTINUE" == "true" ]; then
echo "\n ->> continuing from previous state"
Expand All @@ -31,6 +35,10 @@ rm -rf $HOME_DIR
# if $KEY exists it should be deleted
echo "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | $BINARY keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --recover --home $HOME_DIR
echo "bottom loan skill merry east cradle onion journey palm apology verb edit desert impose absurd oil bubble sweet glove shallow size build burst effort" | $BINARY keys add $KEY1 --keyring-backend $KEYRING --algo $KEYALGO --recover --home $HOME_DIR

$BINARY keys add $KEY00 --keyring-backend $KEYRING --home $HOME_DIR
$BINARY keys add $KEY11 --keyring-backend $KEYRING --home $HOME_DIR
$BINARY keys add $KEY22 --keyring-backend $KEYRING --home $HOME_DIR
$BINARY init $CHAINID --chain-id $CHAINID --default-denom "ppica" --home $HOME_DIR

update_test_genesis () {
Expand All @@ -41,6 +49,10 @@ update_test_genesis () {
# Allocate genesis accounts (cosmos formatted addresses)
$BINARY add-genesis-account $KEY 100000000000000000000000000ppica --keyring-backend $KEYRING --home $HOME_DIR
$BINARY add-genesis-account $KEY1 100000000000000000000000000ppica --keyring-backend $KEYRING --home $HOME_DIR
$BINARY add-genesis-account $KEY00 "1000000000000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR
$BINARY add-genesis-account $KEY11 "1000000000000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR
$BINARY add-genesis-account $KEY22 "1000000000000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR


# Sign genesis transaction
$BINARY gentx $KEY 10030009994127689ppica --keyring-backend $KEYRING --chain-id $CHAINID --home $HOME_DIR
Expand All @@ -67,4 +79,4 @@ sed -i'' -e 's/max_tx_bytes = 1048576/max_tx_bytes = 10000000/g' $HOME_DIR/confi
sed -i'' -e 's/timeout_commit = "5s"/timeout_commit = "1s"/' $HOME_DIR/config/config.toml


$BINARY start --rpc.unsafe --rpc.laddr tcp://0.0.0.0:26657 --pruning=nothing --minimum-gas-prices=0.001ppica --home=$HOME_DIR --log_level trace --trace --with-tendermint=true --transport=socket --grpc.enable=true --grpc-web.enable=false --api.enable=true --p2p.pex=false --p2p.upnp=false
$BINARY start --rpc.unsafe --rpc.laddr tcp://0.0.0.0:26657 --pruning=nothing --minimum-gas-prices=0.000ppica --home=$HOME_DIR --log_level trace --trace --with-tendermint=true --transport=socket --grpc.enable=true --grpc-web.enable=false --api.enable=true --p2p.pex=false --p2p.upnp=false
4 changes: 2 additions & 2 deletions scripts/run-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rm -rf mytestnet
pkill centaurid

# check DENOM is set. If not, set to upica
DENOM=${2:-upica}
DENOM=${2:-ppica}

COMMISSION_RATE=0.01
COMMISSION_MAX_RATE=0.02
Expand Down Expand Up @@ -71,7 +71,7 @@ update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="'$DENOM'"'
$SED_BINARY -i '0,/enable = false/s//enable = true/' $HOME_DIR/config/app.toml
$SED_BINARY -i 's/swagger = false/swagger = true/' $HOME_DIR/config/app.toml
$SED_BINARY -i -e 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' $HOME_DIR/config/app.toml
$SED_BINARY -i 's/minimum-gas-prices = "0.25upica"/minimum-gas-prices = "0.0upica"/' $HOME_DIR/config/app.toml
$SED_BINARY -i 's/minimum-gas-prices = "0.25ppica"/minimum-gas-prices = "0.0ppica"/' $HOME_DIR/config/app.toml


# Sign genesis transaction
Expand Down
10 changes: 5 additions & 5 deletions scripts/test-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# the upgrade is a fork, "true" otherwise
FORK=${FORK:-"false"}

OLD_VERSION=v6.5.4
OLD_VERSION=v6.5.41
UPGRADE_WAIT=${UPGRADE_WAIT:-20}
HOME=mytestnet
ROOT=$(pwd)
DENOM=upica
DENOM=ppica
CHAIN_ID=localpica
SOFTWARE_UPGRADE_NAME="v6_6_0"
ADDITIONAL_PRE_SCRIPTS="./scripts/upgrade/v_6_4_8/pre-script.sh"
Expand Down Expand Up @@ -106,19 +106,19 @@ 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 test1 --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y

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

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 mykey --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y

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 test1 --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y

sleep $SLEEP_TIME

Expand Down
2 changes: 1 addition & 1 deletion scripts/upgrade/v_6_4_8/post-script.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
echo -e "\n ********** Running Post-Scripts **********"

BINARY=$1
DENOM=${2:-upica}
DENOM=${2:-ppica}
CHAIN_DIR=$(pwd)/mytestnet

KEY="test0"
Expand Down
6 changes: 4 additions & 2 deletions scripts/upgrade/v_6_4_8/pre-script.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
echo -e "\n ********** Running Pre-Scripts **********"

BINARY=$1
DENOM=${2:-upica}
DENOM=${2:-ppica}
CHAIN_DIR=$(pwd)/mytestnet

KEY="test0"
Expand All @@ -24,7 +24,9 @@ echo "wallet 1: $WALLET_1 - balance: $BALANCE_1"

############ Settingup WASM environment ############
### Create a counter contract, then increment the counter to 1 ####
## Deploy the counter contract
## Deploy the counter contract
TX_RESULT=$($BINARY tx wasm store $COUNTER_CONTRACT_DIR --from $KEY1 $DEFAULT_ENV_FLAG $DEFAULT_GAS_FLAG -y -o json)
echo $TX_RESULT
TX_HASH=$($BINARY tx wasm store $COUNTER_CONTRACT_DIR --from $KEY1 $DEFAULT_ENV_FLAG $DEFAULT_GAS_FLAG -y -o json | jq -r '.txhash')

## Get CODE ID
Expand Down

0 comments on commit 4edf9b7

Please sign in to comment.