* ledger-storage-bigtable boilerplate (cherry picked from commit9d2293bb32
) * $ wget https://pki.goog/roots.pem -O pki-goog-roots.pem (cherry picked from commit1617a025ce
) * Add access_token module (cherry picked from commit59d266a111
) * Add root_ca_certificate (cherry picked from commitfaa016e4b7
) * Add build-proto (cherry picked from commitc31e1f5bf0
) * UiTransactionEncoding is now copy (cherry picked from commit494968be66
) * Increase timeout (cherry picked from commit57dfebc5ba
) * Add build-proto/build.sh output (cherry picked from commit54dae6ba2c
) * Supress doctest errors (cherry picked from commit019c75797d
) * Add compression (cherry picked from commit243e05d59f
) * Add bigtable (cherry picked from commit6e0353965a
) * Add configuration info (cherry picked from commit98cca1e774
) * Add ledger-tool bigtable subcommands (cherry picked from commitf9049d6ee4
) # Conflicts: # ledger-tool/Cargo.toml * Make room for tokio 0.2 (cherry picked from commitb876fb84ba
) # Conflicts: # core/Cargo.toml * Setup a tokio 0.2 runtime for RPC usage (cherry picked from commit0e02740565
) # Conflicts: # core/Cargo.toml * Plumb Bigtable ledger storage into the RPC subsystem (cherry picked from commitdfae9a9864
) # Conflicts: # core/Cargo.toml * Add RPC transaction history design (cherry picked from commite56ea138c7
) * Simplify access token refreshing (cherry picked from commit1f7af14386
) * Report block status more frequently (cherry picked from commit22c46ebf96
) * after -> before (cherry picked from commit227ea934ff
) * Rebase * Cargo.lock Co-authored-by: Michael Vines <mvines@gmail.com>
145 lines
3.0 KiB
Bash
Executable File
145 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Start the bootstrap validator node
|
|
#
|
|
set -e
|
|
|
|
here=$(dirname "$0")
|
|
# shellcheck source=multinode-demo/common.sh
|
|
source "$here"/common.sh
|
|
|
|
if [[ "$SOLANA_GPU_MISSING" -eq 1 ]]; then
|
|
echo "Testnet requires GPUs, but none were found! Aborting..."
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -n $SOLANA_CUDA ]]; then
|
|
program=$solana_validator_cuda
|
|
else
|
|
program=$solana_validator
|
|
fi
|
|
|
|
no_restart=0
|
|
|
|
args=()
|
|
while [[ -n $1 ]]; do
|
|
if [[ ${1:0:1} = - ]]; then
|
|
if [[ $1 = --init-complete-file ]]; then
|
|
args+=("$1" "$2")
|
|
shift 2
|
|
elif [[ $1 = --gossip-host ]]; then
|
|
args+=("$1" "$2")
|
|
shift 2
|
|
elif [[ $1 = --gossip-port ]]; then
|
|
args+=("$1" "$2")
|
|
shift 2
|
|
elif [[ $1 = --dev-halt-at-slot ]]; then
|
|
args+=("$1" "$2")
|
|
shift 2
|
|
elif [[ $1 = --dynamic-port-range ]]; then
|
|
args+=("$1" "$2")
|
|
shift 2
|
|
elif [[ $1 = --limit-ledger-size ]]; then
|
|
args+=("$1" "$2")
|
|
shift 2
|
|
elif [[ $1 = --no-rocksdb-compaction ]]; then
|
|
args+=("$1")
|
|
shift
|
|
elif [[ $1 = --enable-rpc-transaction-history ]]; then
|
|
args+=("$1")
|
|
shift
|
|
elif [[ $1 = --enable-rpc-bigtable-ledger-storage ]]; then
|
|
args+=("$1")
|
|
shift
|
|
elif [[ $1 = --skip-poh-verify ]]; then
|
|
args+=("$1")
|
|
shift
|
|
elif [[ $1 = --log ]]; then
|
|
args+=("$1" "$2")
|
|
shift 2
|
|
elif [[ $1 = --no-restart ]]; then
|
|
no_restart=1
|
|
shift
|
|
elif [[ $1 == --wait-for-supermajority ]]; then
|
|
args+=("$1" "$2")
|
|
shift 2
|
|
else
|
|
echo "Unknown argument: $1"
|
|
$program --help
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "Unknown argument: $1"
|
|
$program --help
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
# These keypairs are created by ./setup.sh and included in the genesis config
|
|
identity=$SOLANA_CONFIG_DIR/bootstrap-validator/identity.json
|
|
vote_account="$SOLANA_CONFIG_DIR"/bootstrap-validator/vote-account.json
|
|
|
|
ledger_dir="$SOLANA_CONFIG_DIR"/bootstrap-validator
|
|
[[ -d "$ledger_dir" ]] || {
|
|
echo "$ledger_dir does not exist"
|
|
echo
|
|
echo "Please run: $here/setup.sh"
|
|
exit 1
|
|
}
|
|
|
|
args+=(
|
|
--enable-rpc-exit
|
|
--enable-rpc-set-log-filter
|
|
--ledger "$ledger_dir"
|
|
--rpc-port 8899
|
|
--snapshot-interval-slots 200
|
|
--identity "$identity"
|
|
--vote-account "$vote_account"
|
|
--rpc-faucet-address 127.0.0.1:9900
|
|
)
|
|
default_arg --gossip-port 8001
|
|
default_arg --log -
|
|
|
|
|
|
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
|