fixups, add validator-x to sanity
This commit is contained in:
parent
19792192a7
commit
c998199954
|
@ -9,7 +9,7 @@ source ci/upload_ci_artifact.sh
|
|||
|
||||
./multinode-demo/setup.sh
|
||||
|
||||
backgroundCommands="drone leader validator"
|
||||
backgroundCommands="drone leader validator validator-x"
|
||||
pids=()
|
||||
|
||||
for cmd in $backgroundCommands; do
|
||||
|
|
|
@ -77,8 +77,7 @@ mint_path="$SOLANA_CONFIG_PRIVATE_DIR"/mint.json
|
|||
|
||||
set -e
|
||||
|
||||
for i in "$SOLANA_CONFIG_DIR" "$SOLANA_CONFIG_PRIVATE_DIR" "$SOLANA_CONFIG_VALIDATOR_DIR"
|
||||
do
|
||||
for i in "$SOLANA_CONFIG_DIR" "$SOLANA_CONFIG_PRIVATE_DIR" "$SOLANA_CONFIG_VALIDATOR_DIR"; do
|
||||
echo "Cleaning $i"
|
||||
rm -rvf "$i"
|
||||
mkdir -p "$i"
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
here=$(dirname "$0")
|
||||
|
||||
exec "$here"/validator.sh -x "$@"
|
|
@ -4,78 +4,80 @@ here=$(dirname "$0")
|
|||
source "$here"/common.sh
|
||||
|
||||
usage() {
|
||||
if [[ -n "$1" ]]; then
|
||||
if [[ -n $1 ]]; then
|
||||
echo "$*"
|
||||
echo
|
||||
fi
|
||||
echo "usage: $0 [rsync network path to solana repo on leader machine] [network ip address of leader]"
|
||||
echo "usage: $0 [-x] [rsync network path to solana repo on leader machine] [network ip address of leader]"
|
||||
echo ""
|
||||
echo " -x: runs a new, dynamically-configured validator"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ "$1" = "-h" || -n "$3" ]]; then
|
||||
if [[ $1 = -h || -n $3 ]]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [[ "$1" == "-x" ]]; then
|
||||
if [[ $1 == -x ]]; then
|
||||
self_setup=1
|
||||
shift
|
||||
else
|
||||
self_setup=0
|
||||
fi
|
||||
|
||||
if [[ -d "$SNAP" ]]; then
|
||||
if [[ -d $SNAP ]]; then
|
||||
# Exit if mode is not yet configured
|
||||
# (typically the case after the Snap is first installed)
|
||||
[[ -n "$(snapctl get mode)" ]] || exit 0
|
||||
[[ -n $(snapctl get mode) ]] || exit 0
|
||||
|
||||
# Select leader from the Snap configuration
|
||||
leader_address="$(snapctl get leader-address)"
|
||||
if [[ -z "$leader_address" ]]; then
|
||||
if [[ -z $leader_address ]]; then
|
||||
# Assume public testnet by default
|
||||
leader_address=35.230.65.68 # testnet.solana.com
|
||||
fi
|
||||
leader="$leader_address"
|
||||
leader=$leader_address
|
||||
else
|
||||
if [[ -z "$1" ]]; then
|
||||
if [[ -z $1 ]]; then
|
||||
leader=${1:-${here}/..} # Default to local solana repo
|
||||
leader_address=${2:-127.0.0.1} # Default to local leader
|
||||
elif [[ -z "$2" ]]; then
|
||||
leader="$1"
|
||||
leader=$1
|
||||
leader_address=$(dig +short "$1" | head -n1)
|
||||
if [[ -z "$leader_address" ]]; then
|
||||
if [[ -z $leader_address ]]; then
|
||||
usage "Error: unable to resolve IP address for $leader"
|
||||
fi
|
||||
else
|
||||
leader="$1"
|
||||
leader_address="$2"
|
||||
leader=$1
|
||||
leader_address=$2
|
||||
fi
|
||||
fi
|
||||
leader_port=8001
|
||||
|
||||
if [[ -n "$SOLANA_CUDA" ]]; then
|
||||
program="$solana_fullnode_cuda"
|
||||
if [[ -n $SOLANA_CUDA ]]; then
|
||||
program=$solana_fullnode_cuda
|
||||
else
|
||||
program="$solana_fullnode"
|
||||
program=$solana_fullnode
|
||||
fi
|
||||
|
||||
if (( ! self_setup)); then
|
||||
[[ -f "$SOLANA_CONFIG_VALIDATOR_DIR"/validator.json ]] || {
|
||||
if ((!self_setup)); then
|
||||
[[ -f $SOLANA_CONFIG_VALIDATOR_DIR/validator.json ]] || {
|
||||
echo "$SOLANA_CONFIG_VALIDATOR_DIR/validator.json not found, create it by running:"
|
||||
echo
|
||||
echo " ${here}/setup.sh"
|
||||
exit 1
|
||||
}
|
||||
validator_json_path="$SOLANA_CONFIG_VALIDATOR_DIR"/validator.json
|
||||
SOLANA_LEADER_CONFIG_DIR="$SOLANA_CONFIG_VALIDATOR_DIR"/leader-config
|
||||
validator_json_path=$SOLANA_CONFIG_VALIDATOR_DIR/validator.json
|
||||
SOLANA_LEADER_CONFIG_DIR=$SOLANA_CONFIG_VALIDATOR_DIR/leader-config
|
||||
else
|
||||
|
||||
validator_id_path="$SOLANA_CONFIG_PRIVATE_DIR"/validator-id-x$$.json
|
||||
validator_id_path=$SOLANA_CONFIG_PRIVATE_DIR/validator-id-x$$.json
|
||||
$solana_keygen -o "$validator_id_path"
|
||||
|
||||
validator_json_path="$SOLANA_CONFIG_VALIDATOR_DIR"/validator-x$$.json
|
||||
$solana_fullnode_config --keypair="$validator_id_path" -l -b $((9000+($$%1000))) > "$validator_json_path"
|
||||
validator_json_path=$SOLANA_CONFIG_VALIDATOR_DIR/validator-x$$.json
|
||||
$solana_fullnode_config --keypair="$validator_id_path" -l -b $((9000 + ($$ % 1000))) > "$validator_json_path"
|
||||
|
||||
SOLANA_LEADER_CONFIG_DIR="$SOLANA_CONFIG_VALIDATOR_DIR"/leader-config-x$$
|
||||
SOLANA_LEADER_CONFIG_DIR=$SOLANA_CONFIG_VALIDATOR_DIR/leader-config-x$$
|
||||
fi
|
||||
|
||||
rsync_leader_url=$(rsync_url "$leader")
|
||||
|
@ -85,7 +87,7 @@ tune_networking
|
|||
rm -rf "$SOLANA_LEADER_CONFIG_DIR"
|
||||
set -ex
|
||||
$rsync -vPrz --max-size=100M "$rsync_leader_url"/config/ "$SOLANA_LEADER_CONFIG_DIR"
|
||||
[[ -r "$SOLANA_LEADER_CONFIG_DIR"/ledger.log ]] || {
|
||||
[[ -r $SOLANA_LEADER_CONFIG_DIR/ledger.log ]] || {
|
||||
echo "Unable to retrieve ledger.log from $rsync_leader_url"
|
||||
exit 1
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue