2018-12-07 10:00:35 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2020-01-22 08:22:09 -08:00
|
|
|
# Start the bootstrap validator node
|
2018-12-07 10:00:35 -08:00
|
|
|
#
|
2019-07-29 21:25:28 -07:00
|
|
|
set -e
|
2018-12-07 10:00:35 -08:00
|
|
|
|
|
|
|
here=$(dirname "$0")
|
2019-07-29 21:25:28 -07:00
|
|
|
# shellcheck source=multinode-demo/common.sh
|
|
|
|
source "$here"/common.sh
|
|
|
|
|
2019-10-14 09:33:32 -07:00
|
|
|
if [[ "$SOLANA_GPU_MISSING" -eq 1 ]]; then
|
|
|
|
echo "Testnet requires GPUs, but none were found! Aborting..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-07-29 21:25:28 -07:00
|
|
|
if [[ -n $SOLANA_CUDA ]]; then
|
|
|
|
program=$solana_validator_cuda
|
|
|
|
else
|
|
|
|
program=$solana_validator
|
|
|
|
fi
|
|
|
|
|
2019-11-22 08:44:16 -08:00
|
|
|
no_restart=0
|
2021-08-18 22:02:28 -07:00
|
|
|
maybeRequireTower=true
|
2019-11-22 08:44:16 -08:00
|
|
|
|
2019-07-29 21:25:28 -07:00
|
|
|
args=()
|
|
|
|
while [[ -n $1 ]]; do
|
|
|
|
if [[ ${1:0:1} = - ]]; then
|
|
|
|
if [[ $1 = --init-complete-file ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2019-11-20 15:57:24 -08:00
|
|
|
elif [[ $1 = --gossip-host ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2019-07-30 15:53:03 -07:00
|
|
|
elif [[ $1 = --gossip-port ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2020-06-08 18:01:44 -07:00
|
|
|
elif [[ $1 = --dev-halt-at-slot ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2019-08-01 14:37:59 -07:00
|
|
|
elif [[ $1 = --dynamic-port-range ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2019-09-17 10:05:41 -07:00
|
|
|
elif [[ $1 = --limit-ledger-size ]]; then
|
2020-03-23 08:42:32 -07:00
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
|
|
|
elif [[ $1 = --no-rocksdb-compaction ]]; then
|
2019-09-17 10:05:41 -07:00
|
|
|
args+=("$1")
|
|
|
|
shift
|
2020-03-23 10:25:39 -07:00
|
|
|
elif [[ $1 = --enable-rpc-transaction-history ]]; then
|
2020-02-12 16:08:27 -08:00
|
|
|
args+=("$1")
|
|
|
|
shift
|
2022-01-14 18:53:34 -08:00
|
|
|
elif [[ $1 = --rpc-pubsub-enable-block-subscription ]]; then
|
|
|
|
args+=("$1")
|
|
|
|
shift
|
2021-02-01 13:00:51 -08:00
|
|
|
elif [[ $1 = --enable-cpi-and-log-storage ]]; then
|
|
|
|
args+=("$1")
|
|
|
|
shift
|
2022-03-22 15:17:05 -07:00
|
|
|
elif [[ $1 = --enable-extended-tx-metadata-storage ]]; then
|
|
|
|
args+=("$1")
|
|
|
|
shift
|
2020-07-23 09:54:57 -07:00
|
|
|
elif [[ $1 = --enable-rpc-bigtable-ledger-storage ]]; then
|
|
|
|
args+=("$1")
|
|
|
|
shift
|
2022-08-19 07:15:15 -07:00
|
|
|
elif [[ $1 = --tpu-disable-quic ]]; then
|
2022-04-21 12:43:08 -07:00
|
|
|
args+=("$1")
|
|
|
|
shift
|
2022-09-07 13:19:14 -07:00
|
|
|
elif [[ $1 = --tpu-enable-udp ]]; then
|
|
|
|
args+=("$1")
|
|
|
|
shift
|
2022-04-21 12:43:08 -07:00
|
|
|
elif [[ $1 = --rpc-send-batch-ms ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
|
|
|
elif [[ $1 = --rpc-send-batch-size ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2019-11-04 21:14:55 -08:00
|
|
|
elif [[ $1 = --skip-poh-verify ]]; then
|
2019-10-21 10:21:43 -07:00
|
|
|
args+=("$1")
|
|
|
|
shift
|
2019-11-06 11:47:34 -08:00
|
|
|
elif [[ $1 = --log ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2019-11-22 08:44:16 -08:00
|
|
|
elif [[ $1 = --no-restart ]]; then
|
|
|
|
no_restart=1
|
|
|
|
shift
|
2020-06-15 18:52:44 -07:00
|
|
|
elif [[ $1 == --wait-for-supermajority ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2020-06-03 17:50:57 -07:00
|
|
|
elif [[ $1 == --expected-bank-hash ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2021-01-05 20:01:57 -08:00
|
|
|
elif [[ $1 == --accounts ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2021-05-12 10:32:27 -07:00
|
|
|
elif [[ $1 == --maximum-snapshots-to-retain ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2021-06-04 15:55:16 -07:00
|
|
|
elif [[ $1 == --no-snapshot-fetch ]]; then
|
|
|
|
args+=("$1")
|
|
|
|
shift
|
2021-08-18 15:28:06 -07:00
|
|
|
elif [[ $1 == --accounts-db-skip-shrink ]]; then
|
|
|
|
args+=("$1")
|
|
|
|
shift
|
2021-08-18 22:02:28 -07:00
|
|
|
elif [[ $1 == --skip-require-tower ]]; then
|
|
|
|
maybeRequireTower=false
|
|
|
|
shift
|
2022-07-11 08:53:18 -07:00
|
|
|
elif [[ $1 = --log-messages-bytes-limit ]]; then
|
|
|
|
args+=("$1" "$2")
|
|
|
|
shift 2
|
2019-07-29 21:25:28 -07:00
|
|
|
else
|
|
|
|
echo "Unknown argument: $1"
|
|
|
|
$program --help
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Unknown argument: $1"
|
|
|
|
$program --help
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2019-11-08 20:56:57 -08:00
|
|
|
# These keypairs are created by ./setup.sh and included in the genesis config
|
2020-03-13 11:41:18 -07:00
|
|
|
identity=$SOLANA_CONFIG_DIR/bootstrap-validator/identity.json
|
|
|
|
vote_account="$SOLANA_CONFIG_DIR"/bootstrap-validator/vote-account.json
|
2019-07-29 21:25:28 -07:00
|
|
|
|
2020-01-22 08:22:09 -08:00
|
|
|
ledger_dir="$SOLANA_CONFIG_DIR"/bootstrap-validator
|
2019-07-30 22:43:47 -07:00
|
|
|
[[ -d "$ledger_dir" ]] || {
|
|
|
|
echo "$ledger_dir does not exist"
|
|
|
|
echo
|
|
|
|
echo "Please run: $here/setup.sh"
|
|
|
|
exit 1
|
|
|
|
}
|
2019-07-29 21:25:28 -07:00
|
|
|
|
2021-08-18 22:02:28 -07:00
|
|
|
if [[ $maybeRequireTower = true ]]; then
|
|
|
|
args+=(--require-tower)
|
|
|
|
fi
|
|
|
|
|
2019-07-29 21:25:28 -07:00
|
|
|
args+=(
|
2019-07-30 22:43:47 -07:00
|
|
|
--ledger "$ledger_dir"
|
2019-07-29 21:25:28 -07:00
|
|
|
--rpc-port 8899
|
2020-04-22 12:25:15 -07:00
|
|
|
--snapshot-interval-slots 200
|
2022-02-09 11:26:35 -08:00
|
|
|
--no-incremental-snapshots
|
2020-03-13 11:41:18 -07:00
|
|
|
--identity "$identity"
|
|
|
|
--vote-account "$vote_account"
|
2019-12-16 13:05:17 -08:00
|
|
|
--rpc-faucet-address 127.0.0.1:9900
|
2021-02-28 13:03:56 -08:00
|
|
|
--no-poh-speed-test
|
2021-10-25 18:25:55 -07:00
|
|
|
--no-os-network-limits-test
|
2021-03-25 18:54:51 -07:00
|
|
|
--no-wait-for-vote-to-start-leader
|
2022-01-28 18:00:18 -08:00
|
|
|
--full-rpc-api
|
2023-02-22 09:54:15 -08:00
|
|
|
--allow-private-addr
|
2019-07-29 21:25:28 -07:00
|
|
|
)
|
2019-07-30 15:53:03 -07:00
|
|
|
default_arg --gossip-port 8001
|
2019-11-06 11:47:34 -08:00
|
|
|
default_arg --log -
|
2019-07-29 21:25:28 -07:00
|
|
|
|
2019-11-22 08:44:16 -08:00
|
|
|
|
|
|
|
pid=
|
|
|
|
kill_node() {
|
|
|
|
# Note: do not echo anything from this function to ensure $pid is actually
|
|
|
|
# killed when stdout/stderr are redirected
|
|
|
|
set +ex
|
|
|
|
if [[ -n $pid ]]; then
|
|
|
|
declare _pid=$pid
|
|
|
|
pid=
|
|
|
|
kill "$_pid" || true
|
|
|
|
wait "$_pid" || true
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
kill_node_and_exit() {
|
|
|
|
kill_node
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
trap 'kill_node_and_exit' INT TERM ERR
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
echo "$program ${args[*]}"
|
|
|
|
$program "${args[@]}" &
|
|
|
|
pid=$!
|
|
|
|
echo "pid: $pid"
|
|
|
|
|
|
|
|
if ((no_restart)); then
|
|
|
|
wait "$pid"
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
if [[ -z $pid ]] || ! kill -0 "$pid"; then
|
|
|
|
echo "############## validator exited, restarting ##############"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
|
|
|
kill_node
|
|
|
|
done
|