Cli: Remove units from various subcommands (#8301)

* Cli: Remove unit arg from various subcommands

* Update book usage page

* Update scripts and docs
This commit is contained in:
Tyera Eulberg
2020-02-15 12:53:52 -07:00
committed by GitHub
parent 9bcca268a3
commit b997d3eb4e
16 changed files with 491 additions and 401 deletions

View File

@ -8,7 +8,7 @@ here=$(dirname "$0")
# shellcheck source=multinode-demo/common.sh
source "$here"/common.sh
stake_lamports=1000000000 # default number of lamports to assign as stake (1 SOL)
stake_sol=1 # default number of SOL to assign as stake (1 SOL)
url=http://127.0.0.1:8899 # default RPC url
usage() {
@ -18,7 +18,7 @@ usage() {
fi
cat <<EOF
usage: $0 [OPTIONS] <lamports to stake ($stake_lamports)>
usage: $0 [OPTIONS] <SOL to stake ($stake_sol)>
Add stake to a validator
@ -75,7 +75,7 @@ if [[ ${#positional_args[@]} -gt 1 ]]; then
usage "$@"
fi
if [[ -n ${positional_args[0]} ]]; then
stake_lamports=${positional_args[0]}
stake_sol=${positional_args[0]}
fi
config_dir="$SOLANA_CONFIG_DIR/validator$label"
@ -93,7 +93,7 @@ if [[ -f $stake_keypair_path ]]; then
fi
if ((airdrops_enabled)); then
$solana_cli "${common_args[@]}" airdrop "$stake_lamports" lamports
$solana_cli "${common_args[@]}" airdrop "$stake_sol"
fi
$solana_keygen new --no-passphrase -so "$stake_keypair_path"
@ -102,7 +102,7 @@ set -x
$solana_cli "${common_args[@]}" \
vote-account "$vote_keypair_path"
$solana_cli "${common_args[@]}" \
create-stake-account "$stake_keypair_path" "$stake_lamports" lamports
create-stake-account "$stake_keypair_path" "$stake_sol"
$solana_cli "${common_args[@]}" \
delegate-stake $maybe_force "$stake_keypair_path" "$vote_keypair_path"
$solana_cli "${common_args[@]}" stakes "$stake_keypair_path"

View File

@ -8,7 +8,7 @@ source "$here"/common.sh
args=()
airdrops_enabled=1
node_lamports=500000000000 # 500 SOL: number of lamports to airdrop the node for transaction fees and vote account rent exemption (ignored if airdrops_enabled=0)
node_sol=500 # 500 SOL: number of SOL to airdrop the node for transaction fees and vote account rent exemption (ignored if airdrops_enabled=0)
label=
identity_keypair_path=
voting_keypair_path=
@ -33,7 +33,7 @@ OPTIONS:
--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 configuration files, useful when running
multiple validators in the same workspace
--node-lamports LAMPORTS - Number of lamports this node has been funded from the genesis config (default: $node_lamports)
--node-sol SOL - Number of SOL this node has been funded from the genesis config (default: $node_sol)
--no-voting - start node without vote signer
--rpc-port port - custom RPC port for this node
--no-restart - do not restart the node if it exits
@ -53,8 +53,8 @@ while [[ -n $1 ]]; do
elif [[ $1 = --no-restart ]]; then
no_restart=1
shift
elif [[ $1 = --node-lamports ]]; then
node_lamports="$2"
elif [[ $1 = --node-sol ]]; then
node_sol="$2"
shift 2
elif [[ $1 = --no-airdrop ]]; then
airdrops_enabled=0
@ -251,12 +251,12 @@ wallet() {
}
setup_validator_accounts() {
declare node_lamports=$1
declare node_sol=$1
if ! wallet vote-account "$voting_keypair_path"; then
if ((airdrops_enabled)); then
echo "Adding $node_lamports to validator identity account:"
wallet airdrop "$node_lamports" lamports || return $?
echo "Adding $node_sol to validator identity account:"
wallet airdrop "$node_sol" || return $?
fi
echo "Creating validator vote account"
@ -271,7 +271,7 @@ setup_validator_accounts() {
echo "Validator storage account configured"
echo "Validator identity account balance:"
wallet balance --lamports || return $?
wallet balance || return $?
return 0
}
@ -282,7 +282,7 @@ rpc_url=$($solana_gossip rpc-url --entrypoint "$gossip_entrypoint" --any)
[[ -r "$voting_keypair_path" ]] || $solana_keygen new --no-passphrase -so "$voting_keypair_path"
[[ -r "$storage_keypair_path" ]] || $solana_keygen new --no-passphrase -so "$storage_keypair_path"
setup_validator_accounts "$node_lamports"
setup_validator_accounts "$node_sol"
while true; do
echo "$PS4$program ${args[*]}"