#!/bin/bash unset -v progdir case "${0}" in */*) progdir="${0%/*}" ;; *) progdir=. ;; esac ROOT="${progdir}/.." USER=$(whoami) . "${ROOT}/scripts/setup_bls_build_flags.sh" # set -x set -eo pipefail export GO111MODULE=on mkdir -p .hmy if [ -f ".hmy/blspass.txt" ] then echo ".hmy/blspass.txt already in local." else touch .hmy/blspass.txt fi function check_result() { find $log_folder -name leader-*.log > $log_folder/all-leaders.txt find $log_folder -name zerolog-validator-*.log > $log_folder/all-validators.txt find $log_folder -name archival-*.log >> $log_folder/all-validators.txt echo ====== RESULTS ====== results=$($ROOT/test/cal_tps.sh $log_folder/all-leaders.txt $log_folder/all-validators.txt) echo $results | tee -a $LOG_FILE echo $results > $log_folder/tps.log } function cleanup() { "${progdir}/kill_node.sh" } trap cleanup SIGINT SIGTERM function usage { local ME=$(basename $0) cat< $log_folder/bootnode.log 2>&1 | tee -a $LOG_FILE & sleep 1 BN_MA=$(grep "BN_MA" $log_folder/bootnode.log | awk -F\= ' { print $2 } ') echo "bootnode launched." + " $BN_MA" unset -v base_args declare -a base_args args base_args=(-log_folder "${log_folder}" -min_peers "${MIN}" -bootnodes "${BN_MA}" -network_type="$NETWORK" -blspass file:.hmy/blspass.txt -dns=false) NUM_NN=0 sleep 2 # Start nodes i=0 while IFS='' read -r line || [[ -n "$line" ]]; do IFS=' ' read ip port mode account blspub <<< $line if [ "${mode}" == "explorer" ] then args=("${base_args[@]}" -ip "${ip}" -port "${port}" -key "/tmp/${ip}-${port}.key" -db_dir "db-${ip}-${port}") else if [ ! -e .hmy/${blspub}.key ]; then echo "missing blskey .hmy/${blspub}.key" echo "skipping this node" continue fi args=("${base_args[@]}" -ip "${ip}" -port "${port}" -key "/tmp/${ip}-${port}.key" -db_dir "db-${ip}-${port}" -blskey_file ".hmy/${blspub}.key") fi case "${mode}" in leader*|validator*) args=("${args[@]}" -is_genesis);; esac case "${mode}" in leader*) args=("${args[@]}" -is_leader);; esac case "${mode}" in *archival|archival) args=("${args[@]}" -is_archival);; esac case "${mode}" in explorer*) args=("${args[@]}" -is_genesis=false -is_explorer=true -shard_id=0);; esac case "${mode}" in client) ;; *) $DRYRUN "${ROOT}/bin/harmony" "${args[@]}" "${extra_args[@]}" 2>&1 | tee -a "${LOG_FILE}" &;; esac i=$((i+1)) done < $config if [ "$TXGEN" == "true" ]; then echo "launching txgen ... wait" # sleep 2 line=$(grep client $config) IFS=' ' read ip port mode account <<< $line if [ "$mode" == "client" ]; then $DRYRUN $ROOT/bin/txgen -log_folder $log_folder -duration $DURATION -ip $ip -port $port -bootnodes "${BN_MA}" > $LOG_FILE 2>&1 fi else sleep $DURATION fi cleanup check_result