De-fullnode variable names (#4420)
This commit is contained in:
@ -23,8 +23,8 @@ Start a validator or a replicator
|
||||
|
||||
--blockstream PATH - open blockstream at this unix domain socket location
|
||||
--init-complete-file FILE - create this file, if it doesn't already exist, once node initialization is complete
|
||||
--label LABEL - Append the given label to the fullnode configuration files, useful when running
|
||||
multiple fullnodes from the same filesystem location
|
||||
--label LABEL - Append the given label to the configuration files, useful when running
|
||||
multiple fullnodes in the same workspace
|
||||
--stake LAMPORTS - Number of lamports to stake
|
||||
--no-voting - start node without vote signer
|
||||
--rpc-port port - custom RPC port for this node
|
||||
@ -129,13 +129,6 @@ setup_validator_accounts() {
|
||||
return 0
|
||||
}
|
||||
|
||||
ledger_not_setup() {
|
||||
echo "Error: $*"
|
||||
echo
|
||||
echo "Please run: ${here}/setup.sh"
|
||||
exit 1
|
||||
}
|
||||
|
||||
setup_replicator_account() {
|
||||
declare entrypoint_ip=$1
|
||||
declare node_keypair_path=$2
|
||||
@ -163,12 +156,19 @@ setup_replicator_account() {
|
||||
return 0
|
||||
}
|
||||
|
||||
ledger_not_setup() {
|
||||
echo "Error: $*"
|
||||
echo
|
||||
echo "Please run: ${here}/setup.sh"
|
||||
exit 1
|
||||
}
|
||||
|
||||
args=()
|
||||
node_type=validator
|
||||
stake=42 # number of lamports to assign as stake
|
||||
poll_for_new_genesis_block=0
|
||||
label=
|
||||
fullnode_keypair_path=
|
||||
identity_keypair_path=
|
||||
no_restart=0
|
||||
|
||||
positional_args=()
|
||||
@ -197,7 +197,7 @@ while [[ -n $1 ]]; do
|
||||
args+=("$1" "$2")
|
||||
shift 2
|
||||
elif [[ $1 = --identity ]]; then
|
||||
fullnode_keypair_path=$2
|
||||
identity_keypair_path=$2
|
||||
args+=("$1" "$2")
|
||||
shift 2
|
||||
elif [[ $1 = --enable-rpc-exit ]]; then
|
||||
@ -236,7 +236,40 @@ while [[ -n $1 ]]; do
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $node_type = bootstrap_leader ]]; then
|
||||
|
||||
if [[ $node_type = replicator ]]; then
|
||||
if [[ ${#positional_args[@]} -gt 2 ]]; then
|
||||
fullnode_usage "$@"
|
||||
fi
|
||||
|
||||
read -r entrypoint entrypoint_address shift < <(find_entrypoint "${positional_args[@]}")
|
||||
shift "$shift"
|
||||
|
||||
: "${identity_keypair_path:=$SOLANA_CONFIG_DIR/replicator-keypair$label.json}"
|
||||
storage_keypair_path="$SOLANA_CONFIG_DIR"/replicator-storage-keypair$label.json
|
||||
ledger_config_dir=$SOLANA_CONFIG_DIR/replicator-ledger$label
|
||||
|
||||
mkdir -p "$SOLANA_CONFIG_DIR"
|
||||
[[ -r "$identity_keypair_path" ]] || $solana_keygen -o "$identity_keypair_path"
|
||||
[[ -r "$storage_keypair_path" ]] || $solana_keygen -o "$storage_keypair_path"
|
||||
|
||||
identity_pubkey=$($solana_keygen pubkey "$identity_keypair_path")
|
||||
storage_pubkey=$($solana_keygen pubkey "$storage_keypair_path")
|
||||
|
||||
cat <<EOF
|
||||
======================[ $node_type configuration ]======================
|
||||
replicator pubkey: $identity_pubkey
|
||||
storage pubkey: $storage_pubkey
|
||||
ledger: $ledger_config_dir
|
||||
======================================================================
|
||||
EOF
|
||||
program=$solana_replicator
|
||||
default_arg --entrypoint "$entrypoint_address"
|
||||
default_arg --identity "$identity_keypair_path"
|
||||
default_arg --storage-keypair "$storage_keypair_path"
|
||||
default_arg --ledger "$ledger_config_dir"
|
||||
|
||||
elif [[ $node_type = bootstrap_leader ]]; then
|
||||
if [[ ${#positional_args[@]} -ne 0 ]]; then
|
||||
fullnode_usage "Unknown argument: ${positional_args[0]}"
|
||||
fi
|
||||
@ -246,42 +279,17 @@ if [[ $node_type = bootstrap_leader ]]; then
|
||||
|
||||
$solana_ledger_tool --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger verify
|
||||
|
||||
: "${fullnode_keypair_path:="$SOLANA_CONFIG_DIR"/bootstrap-leader-keypair.json}"
|
||||
fullnode_vote_keypair_path="$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-keypair.json
|
||||
: "${identity_keypair_path:=$SOLANA_CONFIG_DIR/bootstrap-leader-keypair.json}"
|
||||
vote_keypair_path="$SOLANA_CONFIG_DIR"/bootstrap-leader-vote-keypair.json
|
||||
ledger_config_dir="$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger
|
||||
accounts_config_dir="$SOLANA_CONFIG_DIR"/bootstrap-leader-accounts
|
||||
fullnode_storage_keypair_path=$SOLANA_CONFIG_DIR/bootstrap-leader-storage-keypair.json
|
||||
storage_keypair_path=$SOLANA_CONFIG_DIR/bootstrap-leader-storage-keypair.json
|
||||
|
||||
default_arg --rpc-port 8899
|
||||
default_arg --rpc-drone-address 127.0.0.1:9900
|
||||
default_arg --gossip-port 8001
|
||||
|
||||
elif [[ $node_type = replicator ]]; then
|
||||
|
||||
if [[ ${#positional_args[@]} -gt 2 ]]; then
|
||||
fullnode_usage "Unknown arguments for replicator"
|
||||
fi
|
||||
|
||||
read -r entrypoint entrypoint_address shift < <(find_entrypoint "${positional_args[@]}")
|
||||
shift "$shift"
|
||||
|
||||
replicator_keypair_path=$SOLANA_CONFIG_DIR/replicator-keypair$label.json
|
||||
replicator_storage_keypair_path="$SOLANA_CONFIG_DIR"/replicator-storage-keypair$label.json
|
||||
ledger_config_dir=$SOLANA_CONFIG_DIR/replicator-ledger$label
|
||||
|
||||
mkdir -p "$SOLANA_CONFIG_DIR"
|
||||
[[ -r "$replicator_keypair_path" ]] || $solana_keygen -o "$replicator_keypair_path"
|
||||
[[ -r "$replicator_storage_keypair_path" ]] || $solana_keygen -o "$replicator_storage_keypair_path"
|
||||
|
||||
replicator_pubkey=$($solana_keygen pubkey "$replicator_keypair_path")
|
||||
replicator_storage_pubkey=$($solana_keygen pubkey "$replicator_storage_keypair_path")
|
||||
|
||||
default_arg --entrypoint "$entrypoint_address"
|
||||
default_arg --identity "$replicator_keypair_path"
|
||||
default_arg --storage-keypair "$replicator_storage_keypair_path"
|
||||
default_arg --ledger "$ledger_config_dir"
|
||||
|
||||
else
|
||||
elif [[ $node_type = validator ]]; then
|
||||
if [[ ${#positional_args[@]} -gt 2 ]]; then
|
||||
fullnode_usage "$@"
|
||||
fi
|
||||
@ -289,56 +297,48 @@ else
|
||||
read -r entrypoint entrypoint_address shift < <(find_entrypoint "${positional_args[@]}")
|
||||
shift "$shift"
|
||||
|
||||
: "${fullnode_keypair_path:=$SOLANA_CONFIG_DIR/fullnode-keypair$label.json}"
|
||||
fullnode_vote_keypair_path=$SOLANA_CONFIG_DIR/fullnode-vote-keypair$label.json
|
||||
fullnode_stake_keypair_path=$SOLANA_CONFIG_DIR/fullnode-stake-keypair$label.json
|
||||
fullnode_storage_keypair_path=$SOLANA_CONFIG_DIR/fullnode-storage-keypair$label.json
|
||||
ledger_config_dir=$SOLANA_CONFIG_DIR/fullnode-ledger$label
|
||||
accounts_config_dir=$SOLANA_CONFIG_DIR/fullnode-accounts$label
|
||||
: "${identity_keypair_path:=$SOLANA_CONFIG_DIR/validator-keypair$label.json}"
|
||||
vote_keypair_path=$SOLANA_CONFIG_DIR/validator-vote-keypair$label.json
|
||||
stake_keypair_path=$SOLANA_CONFIG_DIR/validator-stake-keypair$label.json
|
||||
storage_keypair_path=$SOLANA_CONFIG_DIR/validator-storage-keypair$label.json
|
||||
ledger_config_dir=$SOLANA_CONFIG_DIR/validator-ledger$label
|
||||
accounts_config_dir=$SOLANA_CONFIG_DIR/validator-accounts$label
|
||||
|
||||
mkdir -p "$SOLANA_CONFIG_DIR"
|
||||
[[ -r "$fullnode_keypair_path" ]] || $solana_keygen -o "$fullnode_keypair_path"
|
||||
[[ -r "$fullnode_vote_keypair_path" ]] || $solana_keygen -o "$fullnode_vote_keypair_path"
|
||||
[[ -r "$fullnode_stake_keypair_path" ]] || $solana_keygen -o "$fullnode_stake_keypair_path"
|
||||
[[ -r "$fullnode_storage_keypair_path" ]] || $solana_keygen -o "$fullnode_storage_keypair_path"
|
||||
[[ -r "$identity_keypair_path" ]] || $solana_keygen -o "$identity_keypair_path"
|
||||
[[ -r "$vote_keypair_path" ]] || $solana_keygen -o "$vote_keypair_path"
|
||||
[[ -r "$stake_keypair_path" ]] || $solana_keygen -o "$stake_keypair_path"
|
||||
[[ -r "$storage_keypair_path" ]] || $solana_keygen -o "$storage_keypair_path"
|
||||
|
||||
default_arg --entrypoint "$entrypoint_address"
|
||||
default_arg --rpc-drone-address "${entrypoint_address%:*}:9900"
|
||||
|
||||
rsync_entrypoint_url=$(rsync_url "$entrypoint")
|
||||
else
|
||||
echo "Error: Unknown node_type: $node_type"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [[ $node_type = replicator ]]; then
|
||||
cat <<EOF
|
||||
======================[ Replicator configuration ]======================
|
||||
replicator pubkey: $replicator_pubkey
|
||||
storage pubkey: $replicator_storage_pubkey
|
||||
ledger: $ledger_config_dir
|
||||
======================================================================
|
||||
EOF
|
||||
program=$solana_replicator
|
||||
|
||||
else
|
||||
|
||||
fullnode_pubkey=$($solana_keygen pubkey "$fullnode_keypair_path")
|
||||
fullnode_vote_pubkey=$($solana_keygen pubkey "$fullnode_vote_keypair_path")
|
||||
fullnode_storage_pubkey=$($solana_keygen pubkey "$fullnode_storage_keypair_path")
|
||||
if [[ $node_type != replicator ]]; then
|
||||
identity_pubkey=$($solana_keygen pubkey "$identity_keypair_path")
|
||||
vote_pubkey=$($solana_keygen pubkey "$vote_keypair_path")
|
||||
storage_pubkey=$($solana_keygen pubkey "$storage_keypair_path")
|
||||
|
||||
cat <<EOF
|
||||
======================[ Validator configuration ]======================
|
||||
node pubkey: $fullnode_pubkey
|
||||
vote pubkey: $fullnode_vote_pubkey
|
||||
storage pubkey: $fullnode_storage_pubkey
|
||||
======================[ $node_type configuration ]======================
|
||||
identity pubkey: $identity_pubkey
|
||||
vote pubkey: $vote_pubkey
|
||||
storage pubkey: $storage_pubkey
|
||||
ledger: $ledger_config_dir
|
||||
accounts: $accounts_config_dir
|
||||
======================================================================
|
||||
========================================================================
|
||||
EOF
|
||||
|
||||
default_arg --identity "$fullnode_keypair_path"
|
||||
default_arg --voting-keypair "$fullnode_vote_keypair_path"
|
||||
default_arg --vote-account "$fullnode_vote_pubkey"
|
||||
default_arg --storage-keypair "$fullnode_storage_keypair_path"
|
||||
default_arg --identity "$identity_keypair_path"
|
||||
default_arg --voting-keypair "$vote_keypair_path"
|
||||
default_arg --vote-account "$vote_pubkey"
|
||||
default_arg --storage-keypair "$storage_keypair_path"
|
||||
default_arg --ledger "$ledger_config_dir"
|
||||
default_arg --accounts "$accounts_config_dir"
|
||||
|
||||
@ -347,7 +347,6 @@ EOF
|
||||
else
|
||||
program=$solana_validator
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [[ -z $CI ]]; then # Skip in CI
|
||||
@ -375,7 +374,7 @@ while true; do
|
||||
(
|
||||
set -x
|
||||
rm -rf "$ledger_config_dir" "$accounts_config_dir" \
|
||||
"$fullnode_vote_keypair_path".configured "$replicator_storage_keypair_path".configured
|
||||
"$vote_keypair_path".configured "$storage_keypair_path".configured
|
||||
)
|
||||
fi
|
||||
|
||||
@ -386,18 +385,20 @@ while true; do
|
||||
|
||||
trap '[[ -n $pid ]] && kill "$pid" >/dev/null 2>&1 && wait "$pid"' INT TERM ERR
|
||||
|
||||
if [[ $node_type = validator ]] && ((stake)); then
|
||||
setup_validator_accounts "${entrypoint_address%:*}" \
|
||||
"$fullnode_keypair_path" \
|
||||
"$fullnode_vote_keypair_path" \
|
||||
"$fullnode_stake_keypair_path" \
|
||||
"$fullnode_storage_keypair_path" \
|
||||
"$stake"
|
||||
elif [[ $node_type = replicator ]] && ((stake)); then
|
||||
setup_replicator_account "${entrypoint_address%:*}" \
|
||||
"$replicator_keypair_path" \
|
||||
"$replicator_storage_keypair_path" \
|
||||
"$stake"
|
||||
if ((stake)); then
|
||||
if [[ $node_type = validator ]]; then
|
||||
setup_validator_accounts "${entrypoint_address%:*}" \
|
||||
"$identity_keypair_path" \
|
||||
"$vote_keypair_path" \
|
||||
"$stake_keypair_path" \
|
||||
"$storage_keypair_path" \
|
||||
"$stake"
|
||||
elif [[ $node_type = replicator ]]; then
|
||||
setup_replicator_account "${entrypoint_address%:*}" \
|
||||
"$identity_keypair_path" \
|
||||
"$storage_keypair_path" \
|
||||
"$stake"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$PS4$program ${args[*]}"
|
||||
|
Reference in New Issue
Block a user