update script files for devnet

This commit is contained in:
Solovyov1796 2024-06-18 18:08:11 +08:00
parent d380335dd4
commit 30e8370024
2 changed files with 12 additions and 9 deletions

View File

@ -22,6 +22,7 @@ shift
PEM_FLAG="" PEM_FLAG=""
KEYRING_PASSWORD="" KEYRING_PASSWORD=""
NETWORK="devnet" NETWORK="devnet"
TAG_OR_BRANCH="testnet/v0.2.x"
INIT_GENESIS_ENV="" INIT_GENESIS_ENV=""
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
@ -56,11 +57,11 @@ NUM_NODES=${#IPS[@]}
# Install dependent libraries and binary # Install dependent libraries and binary
for ((i=0; i<$NUM_NODES; i++)) do 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 patch_testnet_1; ./networks/devnet/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 $TAG_OR_BRANCH; ./networks/$NETWORK/install.sh"
done done
# Create genesis config on node0 # Create genesis config on node0
ssh $PEM_FLAG ubuntu@${IPS[0]} "cd 0g-chain/networks/devnet; $INIT_GENESIS_ENV ./init-genesis.sh $IP_LIST $KEYRING_PASSWORD; tar czf ~/$NETWORK.tar.gz $NETWORK; rm -rf $NETWORK" ssh $PEM_FLAG ubuntu@${IPS[0]} "cd 0g-chain/networks/$NETWORK; $INIT_GENESIS_ENV ./init-genesis.sh $IP_LIST $KEYRING_PASSWORD; tar czf ~/$NETWORK.tar.gz $NETWORK; rm -rf $NETWORK"
scp $PEM_FLAG ubuntu@${IPS[0]}:$NETWORK.tar.gz . scp $PEM_FLAG ubuntu@${IPS[0]}:$NETWORK.tar.gz .
ssh $PEM_FLAG ubuntu@${IPS[0]} "rm $NETWORK.tar.gz" ssh $PEM_FLAG ubuntu@${IPS[0]} "rm $NETWORK.tar.gz"
@ -71,7 +72,7 @@ cd $NETWORK
for ((i=0; i<$NUM_NODES; i++)) do for ((i=0; i<$NUM_NODES; i++)) do
tar czf node$i.tar.gz node$i tar czf node$i.tar.gz node$i
scp $PEM_FLAG node$i.tar.gz ubuntu@${IPS[$i]}:~ scp $PEM_FLAG node$i.tar.gz ubuntu@${IPS[$i]}:~
ssh $PEM_FLAG ubuntu@${IPS[$i]} "rm -rf 0gchaind-prod; tar xzf node$i.tar.gz; rm node$i.tar.gz; mv node$i 0gchaind-prod" ssh $PEM_FLAG ubuntu@${IPS[$i]} "rm -rf 0gchaind-$NETWORK; tar xzf node$i.tar.gz; rm node$i.tar.gz; mv node$i 0gchaind-$NETWORK"
rm node$i.tar.gz rm node$i.tar.gz
done done

View File

@ -33,9 +33,10 @@ set -e
IFS=","; declare -a IPS=($1); unset IFS IFS=","; declare -a IPS=($1); unset IFS
NUM_NODES=${#IPS[@]} NUM_NODES=${#IPS[@]}
VLIDATOR_BALANCE=15000000000000000000ua0gi VALIDATOR_BALANCE=25000000000000ua0gi
FAUCET_BALANCE=40000000000000000000ua0gi FAUCET_BALANCE=500000000000000ua0gi
STAKING=10000000000000000000ua0gi STAKING=5000000000000ua0gi
VESTING_BALANCE=400000000000000ua0gi
# Init configs # Init configs
for ((i=0; i<$NUM_NODES; i++)) do for ((i=0; i<$NUM_NODES; i++)) do
@ -146,12 +147,13 @@ fi
for ((i=0; i<$NUM_NODES; i++)) do for ((i=0; i<$NUM_NODES; i++)) do
for ((j=0; j<$NUM_NODES; j++)) do for ((j=0; j<$NUM_NODES; j++)) do
if [[ "$OS_NAME" = "GNU/Linux" ]]; then 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 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 fi
done done
0gchaind add-genesis-account 0g17n8707c20e8gge2tk2gestetjcs4536p4fhqcs $FAUCET_BALANCE --home "$ROOT_DIR/node$i" 0gchaind add-genesis-account 0g1zyvrkyr8pmczkguxztxpp3qcd0uhkt0tfxjupt $FAUCET_BALANCE --home "$ROOT_DIR/node$i"
0gchaind add-genesis-account 0g1jwuhghh6qrln4tthhqrdt3qrmjn9zm05xns46u $VESTING_BALANCE --home "$ROOT_DIR/node$i"
done done
# Prepare genesis txs # Prepare genesis txs