From 4b1fcd791f259fd322c1840b6aa6d75a7a93cc17 Mon Sep 17 00:00:00 2001 From: Solovyov1796 Date: Fri, 21 Jun 2024 09:42:33 +0800 Subject: [PATCH] update testnet deploy scripts --- networks/testnet/deploy.sh | 8 +++++++- networks/testnet/init-genesis.sh | 16 ++++++++++------ networks/testnet/install.sh | 1 + 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/networks/testnet/deploy.sh b/networks/testnet/deploy.sh index a2723591..3df07e49 100755 --- a/networks/testnet/deploy.sh +++ b/networks/testnet/deploy.sh @@ -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 diff --git a/networks/testnet/init-genesis.sh b/networks/testnet/init-genesis.sh index 67a624e7..0000df53 100755 --- a/networks/testnet/init-genesis.sh +++ b/networks/testnet/init-genesis.sh @@ -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 diff --git a/networks/testnet/install.sh b/networks/testnet/install.sh index 52f288c3..2211e8b5 100755 --- a/networks/testnet/install.sh +++ b/networks/testnet/install.sh @@ -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