forked from ComposableFi/picasso
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: run locanode and push wasm code * feat: setup relayer * feat: using ngit for repo with nix * chore: update notes install deps * feat: script to upgrade * fix: upgrade scripts * fix: init deps script * fix/migration: wrong prefix relay addresS
- Loading branch information
Showing
10 changed files
with
217 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,70 @@ | ||
#!/bin/bash | ||
|
||
echo "starting localnode" | ||
|
||
KEY="mykey" | ||
KEY1="mykey1" | ||
CHAINID="centauri-dev" | ||
MONIKER="localtestnet" | ||
KEYALGO="secp256k1" | ||
KEYRING="test" | ||
LOGLEVEL="info" | ||
BINARY=$1 | ||
CONTINUE=${CONTINUE:-"false"} | ||
# to trace evm | ||
#TRACE="--trace" | ||
TRACE="" | ||
|
||
HOME_DIR=mytestnet | ||
ENV=${ENV:-""} | ||
DENOM=ppica | ||
|
||
|
||
if [ "$CONTINUE" == "true" ]; then | ||
echo "\n ->> continuing from previous state" | ||
$BINARY start --home $HOME_DIR --log_level debug | ||
exit 0 | ||
fi | ||
|
||
rm -rf mytestnet | ||
pkill centaurid | ||
|
||
# check DENOM is set. If not, set to upica | ||
DENOM=${2:-upica} | ||
echo "denom: $DENOM" | ||
COMMISSION_RATE=0.01 | ||
COMMISSION_MAX_RATE=0.02 | ||
|
||
SED_BINARY=sed | ||
# check if this is OS X | ||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
# check if gsed is installed | ||
if ! command -v gsed &> /dev/null | ||
then | ||
echo "gsed could not be found. Please install it with 'brew install gnu-sed'" | ||
exit | ||
else | ||
SED_BINARY=gsed | ||
fi | ||
fi | ||
$BINARY config keyring-backend $KEYRING | ||
$BINARY config chain-id $CHAINID | ||
|
||
# check BINARY is set. If not, build picad and set BINARY | ||
if [ -z "$BINARY" ]; then | ||
make build | ||
BINARY=build/picad | ||
fi | ||
# remove existing daemon | ||
rm -rf $HOME_DIR | ||
|
||
CHAIN_ID="localpica" | ||
KEYRING="test" | ||
KEY="test0" | ||
KEY1="test1" | ||
KEY2="test2" | ||
# 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 init $CHAINID --chain-id $CHAINID --default-denom "ppica" --home $HOME_DIR | ||
|
||
# Function updates the config based on a jq argument as a string | ||
update_test_genesis () { | ||
# update_test_genesis '.consensus_params["block"]["max_gas"]="100000000"' | ||
cat $HOME_DIR/config/genesis.json | jq "$1" > $HOME_DIR/config/tmp_genesis.json && mv $HOME_DIR/config/tmp_genesis.json $HOME_DIR/config/genesis.json | ||
cat $HOME_DIR/config/genesis.json | jq "$1" > $HOME_DIR/config/tmp_genesis.json && cp $HOME_DIR/config/tmp_genesis.json $HOME_DIR/config/genesis.json | ||
} | ||
|
||
$BINARY init --chain-id $CHAIN_ID moniker --home $HOME_DIR | ||
|
||
$BINARY keys add $KEY --keyring-backend $KEYRING --home $HOME_DIR | ||
$BINARY keys add $KEY1 --keyring-backend $KEYRING --home $HOME_DIR | ||
$BINARY keys add $KEY2 --keyring-backend $KEYRING --home $HOME_DIR | ||
|
||
# Allocate genesis accounts (cosmos formatted addresses) | ||
$BINARY add-genesis-account $KEY "1000000000000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR | ||
$BINARY add-genesis-account $KEY1 "1000000000000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR | ||
$BINARY add-genesis-account $KEY2 "1000000000000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR | ||
$BINARY add-genesis-account $KEY 100000000000000000000000000ppica --keyring-backend $KEYRING --home $HOME_DIR | ||
$BINARY add-genesis-account $KEY1 100000000000000000000000000ppica --keyring-backend $KEYRING --home $HOME_DIR | ||
|
||
# Sign genesis transaction | ||
$BINARY gentx $KEY 10030009994127689ppica --keyring-backend $KEYRING --chain-id $CHAINID --home $HOME_DIR | ||
|
||
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["gov"]["params"]["min_deposit"]=[{"denom":"'$DENOM'","amount": "1"}]' | ||
update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom":"'$DENOM'","amount":"1000"}' | ||
update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="'$DENOM'"' | ||
|
||
# enable rest server and swagger | ||
$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 | ||
|
||
## Adjust block time | ||
$SED_BINARY -i 's/timeout_commit = "5s"/timeout_commit = "500ms"/' $HOME_DIR/config/config.toml | ||
|
||
|
||
|
||
# Sign genesis transaction | ||
$BINARY gentx $KEY "1000000000000000000000${DENOM}" --commission-rate=$COMMISSION_RATE --commission-max-rate=$COMMISSION_MAX_RATE --keyring-backend $KEYRING --chain-id $CHAIN_ID --home $HOME_DIR | ||
|
||
# Collect genesis tx | ||
$BINARY collect-gentxs --home $HOME_DIR | ||
|
||
# Run this to ensure everything worked and that the genesis file is setup correctly | ||
$BINARY validate-genesis --home $HOME_DIR | ||
$BINARY start --home $HOME_DIR | ||
|
||
if [[ $1 == "pending" ]]; then | ||
echo "pending mode is on, please wait for the first block committed." | ||
fi | ||
|
||
# update request max size so that we can upload the light client | ||
# '' -e is a must have params on mac, if use linux please delete before run | ||
sed -i'' -e 's/max_body_bytes = /max_body_bytes = 1/g' $HOME_DIR/config/config.toml | ||
sed -i'' -e 's/max_tx_bytes = 1048576/max_tx_bytes = 10000000/g' $HOME_DIR/config/config.toml | ||
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
ADDITIONAL_SCRIPTS=( | ||
"./scripts/upgrade/v_6_4_8/setup-08-wasm.sh" | ||
) | ||
|
||
for SCRIPT in "${ADDITIONAL_SCRIPTS[@]}"; do | ||
if [ -f "$SCRIPT" ]; then | ||
echo "Running additional script: $SCRIPT" | ||
source $SCRIPT | ||
else | ||
echo "Additional script $SCRIPT does not exist." | ||
fi | ||
done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# the upgrade is a fork, "true" otherwise | ||
FORK=${FORK:-"false"} | ||
|
||
|
||
BINARY=_build/old/centaurid | ||
HOME=mytestnet | ||
ROOT=$(pwd) | ||
DENOM=ppica | ||
CHAIN_ID=centaurid | ||
|
||
ADDITIONAL_PRE_SCRIPTS="./scripts/upgrade/old-node-scripts.sh" | ||
|
||
SLEEP_TIME=1 | ||
|
||
|
||
screen -L -dmS node1 bash scripts/localnode.sh $BINARY $DENOM --Logfile $HOME/log-screen.txt | ||
#scripts/localnode.sh $BINARY | ||
|
||
sleep 4 # wait for note to start | ||
|
||
# execute additional pre scripts | ||
source $ADDITIONAL_PRE_SCRIPTS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ROOT=$(pwd) | ||
|
||
cd $ROOT/_build/composable | ||
|
||
# This start the node | ||
nix run .#zombienet-rococo-local-picasso-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
ROOT=$(pwd) | ||
|
||
cd $ROOT/_build/composable/ | ||
|
||
# init clients | ||
nix run .#picasso-centauri-ibc-init | ||
sleep 1 | ||
|
||
# init connection | ||
nix run .#picasso-centauri-ibc-connection-init | ||
sleep 1 | ||
|
||
# init channel | ||
nix run .#picasso-centauri-ibc-channels-init | ||
sleep 1 | ||
|
||
# run relayer | ||
nix run .#picasso-centauri-ibc-relay | ||
sleep 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# the upgrade is a fork, "true" otherwise | ||
FORK=${FORK:-"false"} | ||
|
||
UPGRADE_WAIT=${UPGRADE_WAIT:-20} | ||
HOME=mytestnet | ||
ROOT=$(pwd) | ||
DENOM=ppica | ||
CHAIN_ID=centauri-dev | ||
SOFTWARE_UPGRADE_NAME="v6_6_0" | ||
ADDITIONAL_PRE_SCRIPTS="./scripts/upgrade/v_6_4_8/pre-script.sh" | ||
ADDITIONAL_AFTER_SCRIPTS="./scripts/upgrade/v_6_4_8/post-script.sh" | ||
KEY="mykey" | ||
KEY1="mykey1" | ||
|
||
SLEEP_TIME=1 | ||
|
||
|
||
UPGRADE_PROPOSAL_ID=2 | ||
run_upgrade () { | ||
echo -e "\n\n=> =>start upgrading" | ||
|
||
# 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] + 12)) | ||
echo "UPGRADE_HEIGHT = $UPGRADE_HEIGHT" | ||
|
||
tar -cf ./_build/new/picad.tar -C ./_build/new picad | ||
SUM=$(shasum -a 256 ./_build/new/picad.tar | cut -d ' ' -f1) | ||
UPGRADE_INFO=$(jq -n ' | ||
{ | ||
"binaries": { | ||
"linux/amd64": "file://'$(pwd)'/_build/new/picad.tar?checksum=sha256:'"$SUM"'", | ||
} | ||
}') | ||
|
||
|
||
./_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 --fees 100000${DENOM} --keyring-backend test --chain-id $CHAIN_ID --home $HOME -y > /dev/null | ||
|
||
sleep $SLEEP_TIME | ||
|
||
./_build/old/centaurid tx gov deposit $UPGRADE_PROPOSAL_ID "20000000${DENOM}" --from $KEY --keyring-backend test --fees 100000${DENOM} --chain-id $CHAIN_ID --home $HOME -y | ||
|
||
sleep $SLEEP_TIME | ||
|
||
./_build/old/centaurid tx gov vote $UPGRADE_PROPOSAL_ID yes --from $KEY --keyring-backend test --fees 100000${DENOM} --chain-id $CHAIN_ID --home $HOME -y | ||
|
||
sleep $SLEEP_TIME | ||
|
||
|
||
# determine block_height to halt | ||
while true; do | ||
BLOCK_HEIGHT=$(./_build/old/centaurid status | jq '.SyncInfo.latest_block_height' -r) | ||
if [ $BLOCK_HEIGHT = "$UPGRADE_HEIGHT" ]; then | ||
# assuming running only 1 centaurid | ||
echo "BLOCK HEIGHT = $UPGRADE_HEIGHT REACHED, KILLING OLD ONE" | ||
pkill centaurid | ||
break | ||
else | ||
./_build/old/centaurid q gov proposal $UPGRADE_PROPOSAL_ID --output=json | jq ".status" | ||
echo "BLOCK_HEIGHT = $BLOCK_HEIGHT" | ||
sleep 1 | ||
fi | ||
done | ||
} | ||
|
||
# if FORK = true | ||
if [[ "$FORK" == "true" ]]; then | ||
run_fork | ||
unset PICA_HALT_HEIGHT | ||
else | ||
run_upgrade | ||
fi | ||
|
||
sleep 1 | ||
|
||
# run new node | ||
echo -e "\n\n=> =>continue running nodes after upgrade" | ||
#CONTINUE="true" screen -L -dmS picad bash scripts/localnode.sh _build/new/picad $DENOM | ||
CONTINUE="true" bash scripts/localnode.sh _build/new/picad $DENOM | ||
|
Oops, something went wrong.