update testnet deploy scripts

This commit is contained in:
Solovyov1796 2024-06-21 09:42:33 +08:00
parent 50c608c3af
commit 00b4923f94
3 changed files with 18 additions and 7 deletions

View File

@ -7,6 +7,7 @@ function help() {
echo " -k Keyring password to create key (for Linux only)"
echo " -n Network (default: testnet)"
echo " -c Chain ID (default: \"zgtendermint_16600-1\")"
echo " -v schedule end time (unix epoch) for vesting accounts"
echo ""
}
@ -23,6 +24,7 @@ PEM_FLAG=""
KEYRING_PASSWORD=""
NETWORK="testnet"
INIT_GENESIS_ENV=""
VESTING_ACCOUNT_END_TIME=0
while [[ $# -gt 0 ]]; do
case $1 in
@ -43,6 +45,10 @@ while [[ $# -gt 0 ]]; do
INIT_GENESIS_ENV="$INIT_GENESIS_ENV export CHAIN_ID=$2;"
shift; shift
;;
-v)
INIT_GENESIS_ENV="$INIT_GENESIS_ENV export VESTING_ACCOUNT_END_TIME=$2;"
shift; shift
;;
*)
help
echo "Unknown flag passed: \"$1\""
@ -56,7 +62,7 @@ NUM_NODES=${#IPS[@]}
# Install dependent libraries and binary
for ((i=0; i<$NUM_NODES; i++)) do
ssh $PEM_FLAG ubuntu@${IPS[$i]} "rm -rf 0g-chain; git clone https://github.com/0glabs/0g-chain.git; cd 0g-chain; git checkout v0.1.0; ./networks/testnet/install.sh"
ssh $PEM_FLAG ubuntu@${IPS[$i]} "rm -rf 0g-chain; git clone https://github.com/0glabs/0g-chain.git; cd 0g-chain; git checkout v0.2.2; ./networks/testnet/install.sh"
done
# Create genesis config on node0

View File

@ -33,9 +33,12 @@ set -e
IFS=","; declare -a IPS=($1); unset IFS
NUM_NODES=${#IPS[@]}
VLIDATOR_BALANCE=15000000000000000000ua0gi
FAUCET_BALANCE=40000000000000000000ua0gi
STAKING=10000000000000000000ua0gi
VALIDATOR_BALANCE=25000000000000ua0gi
FAUCET_BALANCE=500000000000000ua0gi
STAKING=5000000000000ua0gi
VESTING_BALANCE=400000000000000ua0gi
VESTING_ACCOUNT_START_TIME=$(date -u +%s)
# Init configs
for ((i=0; i<$NUM_NODES; i++)) do
@ -146,12 +149,13 @@ fi
for ((i=0; i<$NUM_NODES; i++)) do
for ((j=0; j<$NUM_NODES; j++)) do
if [[ "$OS_NAME" = "GNU/Linux" ]]; then
yes $PASSWORD | 0gchaind add-genesis-account "0gchain_validator_$j" $VLIDATOR_BALANCE --home "$ROOT_DIR/node$i"
yes $PASSWORD | 0gchaind add-genesis-account "0gchain_validator_$j" $VALIDATOR_BALANCE --home "$ROOT_DIR/node$i"
else
0gchaind add-genesis-account "0gchain_validator_$j" $VLIDATOR_BALANCE --home "$ROOT_DIR/node$i"
0gchaind add-genesis-account "0gchain_validator_$j" $VALIDATOR_BALANCE --home "$ROOT_DIR/node$i"
fi
done
0gchaind add-genesis-account 0g17n8707c20e8gge2tk2gestetjcs4536p4fhqcs $FAUCET_BALANCE --home "$ROOT_DIR/node$i"
0gchaind add-genesis-account 0g1e4t48fq42tqxpapvpnuc9n9k998eex9rnyqzwm $FAUCET_BALANCE --home "$ROOT_DIR/node$i"
0gchaind add-genesis-account 0g16yvxafe63uzuxu6xpvpxdz9agdvnh0zn8vnuj6 $VESTING_BALANCE --vesting-amount $VESTING_BALANCE --vesting-start-time $VESTING_ACCOUNT_START_TIME --vesting-end-time $VESTING_ACCOUNT_END_TIME --home "$ROOT_DIR/node$i"
done
# Prepare genesis txs

View File

@ -13,6 +13,7 @@ if [[ $? -ne 0 ]]; then
# Make under root dir
SCRIPT_DIR=`dirname "${BASH_SOURCE[0]}"`
cd $SCRIPT_DIR/../..
rm -rf $(go env GOPATH)/bin/0gchaind
make install
# Add gopath to path