De-fullnode variable names (#4420)

This commit is contained in:
Michael Vines 2019-05-24 04:31:39 -07:00 committed by GitHub
parent cf4bb70d80
commit 2e251ccc5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 96 additions and 95 deletions

View File

@ -154,20 +154,20 @@ validator to ports 11000-11011.
When `validator.sh` starts, it will output a validator configuration that looks When `validator.sh` starts, it will output a validator configuration that looks
similar to: similar to:
```bash ```bash
======================[ Validator configuration ]====================== ======================[ validator configuration ]======================
node pubkey: 4ceWXsL3UJvn7NYZiRkw7NsryMpviaKBDYr8GK7J61Dm identity pubkey: 4ceWXsL3UJvn7NYZiRkw7NsryMpviaKBDYr8GK7J61Dm
vote pubkey: 2ozWvfaXQd1X6uKh8jERoRGApDqSqcEy6fF1oN13LL2G vote pubkey: 2ozWvfaXQd1X6uKh8jERoRGApDqSqcEy6fF1oN13LL2G
ledger: ... ledger: ...
accounts: ... accounts: ...
====================================================================== ======================================================================
``` ```
The **node pubkey** for your validator can also be found by running: The **identity pubkey** for your validator can also be found by running:
```bash ```bash
$ solana-keygen pubkey validator-keypair.json $ solana-keygen pubkey validator-keypair.json
``` ```
From another console, confirm the IP address and **node pubkey** of your validator is visible in the From another console, confirm the IP address and **identity pubkey** of your validator is visible in the
gossip network by running: gossip network by running:
```bash ```bash
$ solana-gossip --entrypoint testnet.solana.com:8001 spy $ solana-gossip --entrypoint testnet.solana.com:8001 spy
@ -190,7 +190,7 @@ $ solana-keygen pubkey ./config-local/validator-vote-keypair.json
### Sharing Metrics From Your Validator ### Sharing Metrics From Your Validator
If you have obtained a metrics username/password from the Solana maintainers to If you have obtained a metrics username/password from the Solana maintainers to
help us monitor the health of the testnet, please perform the following steps help us monitor the health of the testnet, please perform the following steps
before starting the validator node to activate metrics reporting: before starting the validator to activate metrics reporting:
```bash ```bash
export u="username obtained from the Solana maintainers" export u="username obtained from the Solana maintainers"
export p="password obtained from the Solana maintainers" export p="password obtained from the Solana maintainers"

View File

@ -256,7 +256,7 @@ rollingNodeRestart() {
} }
verifyLedger() { verifyLedger() {
for ledger in bootstrap-leader fullnode; do for ledger in bootstrap-leader validator; do
echo "--- $ledger ledger verification" echo "--- $ledger ledger verification"
( (
source multinode-demo/common.sh source multinode-demo/common.sh

View File

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