From 29fb79382c0a83663de2882b7cb223b568371092 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Fri, 13 Mar 2020 11:41:18 -0700 Subject: [PATCH] Rework validator vote account defaults to half voting fees --- archiver/src/main.rs | 2 +- ci/localnet-sanity.sh | 2 +- cli/src/cli.rs | 2 +- cli/src/vote.rs | 10 ++-- core/src/validator.rs | 19 ++++--- docs/src/paper-wallet/usage.md | 18 +++---- docs/src/running-validator/validator-start.md | 8 +-- .../connect-to-the-solana-network.md | 8 +-- genesis/src/main.rs | 5 +- multinode-demo/archiver.sh | 22 ++++---- multinode-demo/bootstrap-validator.sh | 8 +-- multinode-demo/delegate-stake.sh | 22 ++++---- multinode-demo/faucet.sh | 6 +-- multinode-demo/setup.sh | 20 ++++---- multinode-demo/validator.sh | 50 +++++++++---------- net/remote/remote-node.sh | 6 +-- programs/vote/src/vote_state/mod.rs | 20 ++++++-- run.sh | 4 +- system-test/automation_utils.sh | 2 +- validator/src/main.rs | 40 +++++++-------- 20 files changed, 140 insertions(+), 134 deletions(-) diff --git a/archiver/src/main.rs b/archiver/src/main.rs index 9d95bf7eb..e1d06c34c 100644 --- a/archiver/src/main.rs +++ b/archiver/src/main.rs @@ -28,7 +28,7 @@ fn main() { .arg( Arg::with_name("identity_keypair") .short("i") - .long("identity-keypair") + .long("identity") .value_name("PATH") .takes_value(true) .validator(is_keypair_or_ask_keyword) diff --git a/ci/localnet-sanity.sh b/ci/localnet-sanity.sh index c7fc62174..9fddf8786 100755 --- a/ci/localnet-sanity.sh +++ b/ci/localnet-sanity.sh @@ -178,7 +178,7 @@ startNodes() { ( set -x - $solana_cli --keypair config/bootstrap-validator/identity-keypair.json \ + $solana_cli --keypair config/bootstrap-validator/identity.json \ --url http://127.0.0.1:8899 genesis-hash ) | tee genesis-hash.log maybeExpectedGenesisHash="--expected-genesis-hash $(tail -n1 genesis-hash.log)" diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 4d2662cae..5490d59eb 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -684,7 +684,7 @@ pub fn parse_command( }, // Vote Commands ("create-vote-account", Some(matches)) => { - parse_vote_create_account(matches, default_signer_path, wallet_manager) + parse_create_vote_account(matches, default_signer_path, wallet_manager) } ("vote-update-validator", Some(matches)) => { parse_vote_update_validator(matches, default_signer_path, wallet_manager) diff --git a/cli/src/vote.rs b/cli/src/vote.rs index 9d8679b45..d683ea399 100644 --- a/cli/src/vote.rs +++ b/cli/src/vote.rs @@ -62,7 +62,7 @@ impl VoteSubCommands for App<'_, '_> { .value_name("PUBKEY") .takes_value(true) .validator(is_pubkey_or_keypair) - .help("Public key of the authorized voter [default: vote account]"), + .help("Public key of the authorized voter [default: validator identity pubkey]"), ) .arg( Arg::with_name("authorized_withdrawer") @@ -70,7 +70,7 @@ impl VoteSubCommands for App<'_, '_> { .value_name("PUBKEY") .takes_value(true) .validator(is_pubkey_or_keypair) - .help("Public key of the authorized withdrawer [default: cli config pubkey]"), + .help("Public key of the authorized withdrawer [default: validator identity pubkey]"), ) .arg( Arg::with_name("seed") @@ -225,7 +225,7 @@ impl VoteSubCommands for App<'_, '_> { } } -pub fn parse_vote_create_account( +pub fn parse_create_vote_account( matches: &ArgMatches<'_>, default_signer_path: &str, wallet_manager: Option<&Arc>, @@ -404,8 +404,8 @@ pub fn process_create_vote_account( let vote_init = VoteInit { node_pubkey: *identity_pubkey, - authorized_voter: authorized_voter.unwrap_or(vote_account_pubkey), - authorized_withdrawer: authorized_withdrawer.unwrap_or(vote_account_pubkey), + authorized_voter: authorized_voter.unwrap_or(*identity_pubkey), + authorized_withdrawer: authorized_withdrawer.unwrap_or(*identity_pubkey), commission, }; diff --git a/core/src/validator.rs b/core/src/validator.rs index 52df98828..e6b271592 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -144,7 +144,7 @@ impl Validator { keypair: &Arc, ledger_path: &Path, vote_account: &Pubkey, - voting_keypair: &Arc, + authorized_voter: &Arc, storage_keypair: &Arc, entrypoint_info_option: Option<&ContactInfo>, poh_verify: bool, @@ -153,8 +153,9 @@ impl Validator { let id = keypair.pubkey(); assert_eq!(id, node.info.id); - warn!("identity pubkey: {:?}", id); - warn!("vote pubkey: {:?}", vote_account); + warn!("identity: {}", id); + warn!("vote account: {}", vote_account); + warn!("authorized voter: {}", authorized_voter.pubkey()); report_target_features(); info!("entrypoint: {:?}", entrypoint_info_option); @@ -366,12 +367,6 @@ impl Validator { wait_for_supermajority(config, &bank, &cluster_info); - let voting_keypair = if config.voting_disabled { - None - } else { - Some(voting_keypair.clone()) - }; - let poh_service = PohService::new(poh_recorder.clone(), &poh_config, &exit); assert_eq!( blockstore.new_shreds_signals.len(), @@ -383,7 +378,11 @@ impl Validator { let tvu = Tvu::new( vote_account, - voting_keypair, + if config.voting_disabled { + None + } else { + Some(authorized_voter.clone()) + }, storage_keypair, &bank_forks, &cluster_info, diff --git a/docs/src/paper-wallet/usage.md b/docs/src/paper-wallet/usage.md index 603f7d054..c084ea622 100644 --- a/docs/src/paper-wallet/usage.md +++ b/docs/src/paper-wallet/usage.md @@ -233,25 +233,25 @@ done < public_keys.txt In order to run a validator, you will need to specify an "identity keypair" which will be used to fund all of the vote transactions signed by your validator. -Rather than specifying a path with `--identity-keypair ` you can pass +Rather than specifying a path with `--identity ` you can pass `ASK` to securely input the funding keypair. ```bash -solana-validator --identity-keypair ASK --ledger ... +solana-validator --identity ASK --ledger ... -[identity-keypair] seed phrase: 🔒 -[identity-keypair] If this seed phrase has an associated passphrase, enter it now. Otherwise, press ENTER to continue: +[identity] seed phrase: 🔒 +[identity] If this seed phrase has an associated passphrase, enter it now. Otherwise, press ENTER to continue: ``` You can use this input method for your voting keypair as well: ```bash -solana-validator --identity-keypair ASK --voting-keypair ASK --ledger ... +solana-validator --identity ASK --authorized-voter ASK --ledger ... -[identity-keypair] seed phrase: 🔒 -[identity-keypair] If this seed phrase has an associated passphrase, enter it now. Otherwise, press ENTER to continue: -[voting-keypair] seed phrase: 🔒 -[voting-keypair] If this seed phrase has an associated passphrase, enter it now. Otherwise, press ENTER to continue: +[identity] seed phrase: 🔒 +[identity] If this seed phrase has an associated passphrase, enter it now. Otherwise, press ENTER to continue: +[authorized-voter] seed phrase: 🔒 +[authorized-voter] If this seed phrase has an associated passphrase, enter it now. Otherwise, press ENTER to continue: ``` Refer to the following page for a comprehensive guide on running a validator: diff --git a/docs/src/running-validator/validator-start.md b/docs/src/running-validator/validator-start.md index e742e7d0b..4c557432c 100644 --- a/docs/src/running-validator/validator-start.md +++ b/docs/src/running-validator/validator-start.md @@ -137,16 +137,16 @@ Read more about the [difference between SOL and lamports here](../introduction.m If you haven’t already done so, create a vote-account keypair and create the vote account on the network. If you have completed this step, you should see the -“validator-vote-keypair.json” in your Solana runtime directory: +“vote-account-keypair.json” in your Solana runtime directory: ```bash -solana-keygen new -o ~/validator-vote-keypair.json +solana-keygen new -o ~/vote-account-keypair.json ``` Create your vote account on the blockchain: ```bash -solana create-vote-account ~/validator-vote-keypair.json ~/validator-keypair.json +solana create-vote-account ~/vote-account-keypair.json ~/validator-keypair.json ``` ## Connect Your Validator @@ -154,7 +154,7 @@ solana create-vote-account ~/validator-vote-keypair.json ~/validator-keypair.jso Connect to a testnet cluster by running: ```bash -solana-validator --identity-keypair ~/validator-keypair.json --voting-keypair ~/validator-vote-keypair.json \ +solana-validator --identity ~/validator-keypair.json --vote-account ~/vote-account-keypair.json \ --ledger ~/validator-ledger --rpc-port 8899 --entrypoint devnet.solana.com:8001 \ --limit-ledger-size ``` diff --git a/docs/src/tour-de-sol/participation/steps-to-create-a-validator/connect-to-the-solana-network.md b/docs/src/tour-de-sol/participation/steps-to-create-a-validator/connect-to-the-solana-network.md index d19dc9c1b..e336ac55b 100644 --- a/docs/src/tour-de-sol/participation/steps-to-create-a-validator/connect-to-the-solana-network.md +++ b/docs/src/tour-de-sol/participation/steps-to-create-a-validator/connect-to-the-solana-network.md @@ -4,16 +4,16 @@ Once you’ve confirmed the network is running, it’s time to connect your validator to the network. -If you haven’t already done so, create a vote-account keypair and create the vote account on the network. If you have completed this step, you should see the “validator-vote-keypair.json” in your Solana runtime directory: +If you haven’t already done so, create a vote-account keypair and create the vote account on the network. If you have completed this step, you should see the “vote-account-keypair.json” in your Solana runtime directory: ```bash -solana-keygen new -o ~/validator-vote-keypair.json +solana-keygen new -o ~/vote-account-keypair.json ``` Create your vote account on the blockchain: ```bash -solana create-vote-account ~/validator-vote-keypair.json ~/validator-keypair.json +solana create-vote-account ~/vote-account-keypair.json ~/validator-keypair.json ``` ## Connect Your Validator @@ -25,7 +25,7 @@ export SOLANA_METRICS_CONFIG="host=https://metrics.solana.com:8086,db=tds,u=tds_ ``` ```bash -solana-validator --identity-keypair ~/validator-keypair.json --voting-keypair ~/validator-vote-keypair.json \ +solana-validator --identity ~/validator-keypair.json --vote-account ~/vote-account-keypair.json \ --ledger ~/validator-ledger --rpc-port 8899 --entrypoint tds.solana.com:8001 \ --limit-ledger-size ``` diff --git a/genesis/src/main.rs b/genesis/src/main.rs index 4551a75cb..bef6099b0 100644 --- a/genesis/src/main.rs +++ b/genesis/src/main.rs @@ -467,8 +467,9 @@ fn main() -> Result<(), Box> { Account::new(bootstrap_validator_lamports, 0, &system_program::id()), ); - let vote_account = vote_state::create_account( - &vote_pubkey, + let vote_account = vote_state::create_account_with_authorized( + &identity_pubkey, + &identity_pubkey, &identity_pubkey, 100, VoteState::get_rent_exempt_reserve(&rent).max(1), diff --git a/multinode-demo/archiver.sh b/multinode-demo/archiver.sh index 10cce5736..778cc0e01 100755 --- a/multinode-demo/archiver.sh +++ b/multinode-demo/archiver.sh @@ -18,10 +18,10 @@ while [[ -n $1 ]]; do entrypoint=$2 args+=("$1" "$2") shift 2 - elif [[ $1 = --identity-keypair ]]; then - identity_keypair=$2 - [[ -r $identity_keypair ]] || { - echo "$identity_keypair does not exist" + elif [[ $1 = --identity ]]; then + identity=$2 + [[ -r $identity ]] || { + echo "$identity does not exist" exit 1 } args+=("$1" "$2") @@ -52,29 +52,29 @@ while [[ -n $1 ]]; do fi done -: "${identity_keypair:="$SOLANA_ROOT"/farf/archiver-identity-keypair"$label".json}" +: "${identity:="$SOLANA_ROOT"/farf/archiver-identity"$label".json}" : "${storage_keypair:="$SOLANA_ROOT"/farf/archiver-storage-keypair"$label".json}" ledger="$SOLANA_ROOT"/farf/archiver-ledger"$label" rpc_url=$($solana_gossip rpc-url --entrypoint "$entrypoint") -if [[ ! -r $identity_keypair ]]; then - $solana_keygen new --no-passphrase -so "$identity_keypair" +if [[ ! -r $identity ]]; then + $solana_keygen new --no-passphrase -so "$identity" # See https://github.com/solana-labs/solana/issues/4344 - $solana_cli --keypair "$identity_keypair" --url "$rpc_url" airdrop 1 + $solana_cli --keypair "$identity" --url "$rpc_url" airdrop 1 fi -identity_pubkey=$($solana_keygen pubkey "$identity_keypair") +identity_pubkey=$($solana_keygen pubkey "$identity") if [[ ! -r $storage_keypair ]]; then $solana_keygen new --no-passphrase -so "$storage_keypair" - $solana_cli --keypair "$identity_keypair" --url "$rpc_url" \ + $solana_cli --keypair "$identity" --url "$rpc_url" \ create-archiver-storage-account "$identity_pubkey" "$storage_keypair" fi default_arg --entrypoint "$entrypoint" -default_arg --identity-keypair "$identity_keypair" +default_arg --identity "$identity" default_arg --storage-keypair "$storage_keypair" default_arg --ledger "$ledger" diff --git a/multinode-demo/bootstrap-validator.sh b/multinode-demo/bootstrap-validator.sh index f0ebddf5c..d59846f02 100755 --- a/multinode-demo/bootstrap-validator.sh +++ b/multinode-demo/bootstrap-validator.sh @@ -64,8 +64,8 @@ while [[ -n $1 ]]; do done # These keypairs are created by ./setup.sh and included in the genesis config -identity_keypair=$SOLANA_CONFIG_DIR/bootstrap-validator/identity-keypair.json -vote_keypair="$SOLANA_CONFIG_DIR"/bootstrap-validator/vote-keypair.json +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" ]] || { @@ -81,8 +81,8 @@ args+=( --ledger "$ledger_dir" --rpc-port 8899 --snapshot-interval-slots 100 - --identity-keypair "$identity_keypair" - --voting-keypair "$vote_keypair" + --identity "$identity" + --vote-account "$vote_account" --rpc-faucet-address 127.0.0.1:9900 ) default_arg --gossip-port 8001 diff --git a/multinode-demo/delegate-stake.sh b/multinode-demo/delegate-stake.sh index 9e0e08ef6..cb68a7a9f 100755 --- a/multinode-demo/delegate-stake.sh +++ b/multinode-demo/delegate-stake.sh @@ -80,16 +80,16 @@ if [[ -n ${positional_args[0]} ]]; then fi config_dir="$SOLANA_CONFIG_DIR/validator$label" -vote_keypair_path="$config_dir"/vote-keypair.json -stake_keypair_path="$config_dir"/stake-keypair.json +vote_account="$config_dir"/vote-account.json +stake_account="$config_dir"/stake-account.json -if [[ ! -f $vote_keypair_path ]]; then - echo "Error: $vote_keypair_path not found" +if [[ ! -f $vote_account ]]; then + echo "Error: $vote_account not found" exit 1 fi -if [[ -f $stake_keypair_path ]]; then - echo "Error: $stake_keypair_path already exists" +if [[ -f $stake_account ]]; then + echo "Error: $stake_account already exists" exit 1 fi @@ -97,13 +97,13 @@ if ((airdrops_enabled)); then $solana_cli "${common_args[@]}" airdrop "$stake_sol" fi -$solana_keygen new --no-passphrase -so "$stake_keypair_path" +$solana_keygen new --no-passphrase -so "$stake_account" set -x $solana_cli "${common_args[@]}" \ - vote-account "$vote_keypair_path" + vote-account "$vote_account" $solana_cli "${common_args[@]}" \ - create-stake-account "$stake_keypair_path" "$stake_sol" + create-stake-account "$stake_account" "$stake_sol" $solana_cli "${common_args[@]}" \ - delegate-stake $maybe_force "$stake_keypair_path" "$vote_keypair_path" -$solana_cli "${common_args[@]}" stakes "$stake_keypair_path" + delegate-stake $maybe_force "$stake_account" "$vote_account" +$solana_cli "${common_args[@]}" stakes "$stake_account" diff --git a/multinode-demo/faucet.sh b/multinode-demo/faucet.sh index eaa9ef294..81aa36481 100755 --- a/multinode-demo/faucet.sh +++ b/multinode-demo/faucet.sh @@ -7,8 +7,8 @@ here=$(dirname "$0") # shellcheck source=multinode-demo/common.sh source "$here"/common.sh -[[ -f "$SOLANA_CONFIG_DIR"/faucet-keypair.json ]] || { - echo "$SOLANA_CONFIG_DIR/faucet-keypair.json not found, create it by running:" +[[ -f "$SOLANA_CONFIG_DIR"/faucet.json ]] || { + echo "$SOLANA_CONFIG_DIR/faucet.json not found, create it by running:" echo echo " ${here}/setup.sh" exit 1 @@ -16,4 +16,4 @@ source "$here"/common.sh set -x # shellcheck disable=SC2086 # Don't want to double quote $solana_faucet -exec $solana_faucet --keypair "$SOLANA_CONFIG_DIR"/faucet-keypair.json "$@" +exec $solana_faucet --keypair "$SOLANA_CONFIG_DIR"/faucet.json "$@" diff --git a/multinode-demo/setup.sh b/multinode-demo/setup.sh index dec27c9b1..c50d36bf3 100755 --- a/multinode-demo/setup.sh +++ b/multinode-demo/setup.sh @@ -11,29 +11,29 @@ mkdir -p "$SOLANA_CONFIG_DIR"/bootstrap-validator # Create genesis ledger if [[ -r $FAUCET_KEYPAIR ]]; then - cp -f "$FAUCET_KEYPAIR" "$SOLANA_CONFIG_DIR"/faucet-keypair.json + cp -f "$FAUCET_KEYPAIR" "$SOLANA_CONFIG_DIR"/faucet.json else - $solana_keygen new --no-passphrase -fso "$SOLANA_CONFIG_DIR"/faucet-keypair.json + $solana_keygen new --no-passphrase -fso "$SOLANA_CONFIG_DIR"/faucet.json fi if [[ -f $BOOTSTRAP_VALIDATOR_IDENTITY_KEYPAIR ]]; then - cp -f "$BOOTSTRAP_VALIDATOR_IDENTITY_KEYPAIR" "$SOLANA_CONFIG_DIR"/bootstrap-validator/identity-keypair.json + cp -f "$BOOTSTRAP_VALIDATOR_IDENTITY_KEYPAIR" "$SOLANA_CONFIG_DIR"/bootstrap-validator/identity.json else - $solana_keygen new --no-passphrase -so "$SOLANA_CONFIG_DIR"/bootstrap-validator/identity-keypair.json + $solana_keygen new --no-passphrase -so "$SOLANA_CONFIG_DIR"/bootstrap-validator/identity.json fi -$solana_keygen new --no-passphrase -so "$SOLANA_CONFIG_DIR"/bootstrap-validator/vote-keypair.json -$solana_keygen new --no-passphrase -so "$SOLANA_CONFIG_DIR"/bootstrap-validator/stake-keypair.json +$solana_keygen new --no-passphrase -so "$SOLANA_CONFIG_DIR"/bootstrap-validator/vote-account.json +$solana_keygen new --no-passphrase -so "$SOLANA_CONFIG_DIR"/bootstrap-validator/stake-account.json args=( "$@" --enable-warmup-epochs - --bootstrap-validator "$SOLANA_CONFIG_DIR"/bootstrap-validator/identity-keypair.json - "$SOLANA_CONFIG_DIR"/bootstrap-validator/vote-keypair.json - "$SOLANA_CONFIG_DIR"/bootstrap-validator/stake-keypair.json + --bootstrap-validator "$SOLANA_CONFIG_DIR"/bootstrap-validator/identity.json + "$SOLANA_CONFIG_DIR"/bootstrap-validator/vote-account.json + "$SOLANA_CONFIG_DIR"/bootstrap-validator/stake-account.json ) default_arg --ledger "$SOLANA_CONFIG_DIR"/bootstrap-validator -default_arg --faucet-pubkey "$SOLANA_CONFIG_DIR"/faucet-keypair.json +default_arg --faucet-pubkey "$SOLANA_CONFIG_DIR"/faucet.json default_arg --faucet-lamports 500000000000000000 default_arg --hashes-per-tick auto default_arg --operating-mode development diff --git a/multinode-demo/validator.sh b/multinode-demo/validator.sh index e03eb6903..951bc47f8 100755 --- a/multinode-demo/validator.sh +++ b/multinode-demo/validator.sh @@ -10,8 +10,8 @@ args=() airdrops_enabled=1 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= +identity= +vote_account= no_restart=0 gossip_entrypoint= ledger_dir= @@ -69,19 +69,19 @@ while [[ -n $1 ]]; do elif [[ $1 = --expected-shred-version ]]; then args+=("$1" "$2") shift 2 - elif [[ $1 = --identity-keypair ]]; then - identity_keypair_path=$2 + elif [[ $1 = --identity ]]; then + identity=$2 args+=("$1" "$2") shift 2 - elif [[ $1 = --voting-keypair ]]; then - voting_keypair_path=$2 + elif [[ $1 = --authorized-voter ]]; then args+=("$1" "$2") shift 2 elif [[ $1 = --vote-account ]]; then + vote_account=$2 args+=("$1" "$2") shift 2 elif [[ $1 = --storage-keypair ]]; then - storage_keypair_path=$2 + storage_keypair=$2 args+=("$1" "$2") shift 2 elif [[ $1 = --init-complete-file ]]; then @@ -174,11 +174,11 @@ if [[ -n $REQUIRE_LEDGER_DIR ]]; then fi if [[ -n $REQUIRE_KEYPAIRS ]]; then - if [[ -z $identity_keypair_path ]]; then - usage "Error: --identity-keypair not specified" + if [[ -z $identity ]]; then + usage "Error: --identity not specified" fi - if [[ -z $voting_keypair_path ]]; then - usage "Error: --voting-keypair not specified" + if [[ -z $vote_account ]]; then + usage "Error: --vote-account not specified" fi fi @@ -205,18 +205,18 @@ fi faucet_address="${gossip_entrypoint%:*}":9900 -: "${identity_keypair_path:=$ledger_dir/identity-keypair.json}" -: "${voting_keypair_path:=$ledger_dir/vote-keypair.json}" -: "${storage_keypair_path:=$ledger_dir/storage-keypair.json}" +: "${identity:=$ledger_dir/identity.json}" +: "${vote_account:=$ledger_dir/vote-account.json}" +: "${storage_keypair:=$ledger_dir/storage-keypair.json}" default_arg --entrypoint "$gossip_entrypoint" if ((airdrops_enabled)); then default_arg --rpc-faucet-address "$faucet_address" fi -default_arg --identity-keypair "$identity_keypair_path" -default_arg --voting-keypair "$voting_keypair_path" -default_arg --storage-keypair "$storage_keypair_path" +default_arg --identity "$identity" +default_arg --vote-account "$vote_account" +default_arg --storage-keypair "$storage_keypair" default_arg --ledger "$ledger_dir" default_arg --log - default_arg --enable-rpc-exit @@ -254,27 +254,27 @@ trap 'kill_node_and_exit' INT TERM ERR wallet() { ( set -x - $solana_cli --keypair "$identity_keypair_path" --url "$rpc_url" "$@" + $solana_cli --keypair "$identity" --url "$rpc_url" "$@" ) } setup_validator_accounts() { declare node_sol=$1 - if ! wallet vote-account "$voting_keypair_path"; then + if ! wallet vote-account "$vote_account"; then if ((airdrops_enabled)); then echo "Adding $node_sol to validator identity account:" wallet airdrop "$node_sol" || return $? fi echo "Creating validator vote account" - wallet create-vote-account "$voting_keypair_path" "$identity_keypair_path" || return $? + wallet create-vote-account "$vote_account" "$identity" || return $? fi echo "Validator vote account configured" - if ! wallet storage-account "$storage_keypair_path"; then + if ! wallet storage-account "$storage_keypair"; then echo "Creating validator storage account" - wallet create-validator-storage-account "$identity_keypair_path" "$storage_keypair_path" || return $? + wallet create-validator-storage-account "$identity" "$storage_keypair" || return $? fi echo "Validator storage account configured" @@ -286,9 +286,9 @@ setup_validator_accounts() { rpc_url=$($solana_gossip rpc-url --entrypoint "$gossip_entrypoint" --any) -[[ -r "$identity_keypair_path" ]] || $solana_keygen new --no-passphrase -so "$identity_keypair_path" -[[ -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" +[[ -r "$identity" ]] || $solana_keygen new --no-passphrase -so "$identity" +[[ -r "$vote_account" ]] || $solana_keygen new --no-passphrase -so "$vote_account" +[[ -r "$storage_keypair" ]] || $solana_keygen new --no-passphrase -so "$storage_keypair" setup_validator_accounts "$node_sol" diff --git a/net/remote/remote-node.sh b/net/remote/remote-node.sh index 62c3c6db8..debe26eda 100755 --- a/net/remote/remote-node.sh +++ b/net/remote/remote-node.sh @@ -256,7 +256,7 @@ EOF if [[ $skipSetup != true ]]; then solana --url http://"$entrypointIp":8899 \ - --keypair ~/solana/config/bootstrap-validator/identity-keypair.json \ + --keypair ~/solana/config/bootstrap-validator/identity.json \ validator-info publish "$(hostname)" -n team/solana --force || true fi ;; @@ -301,7 +301,7 @@ EOF if [[ ! -f config/validator-identity.json ]]; then solana-keygen new --no-passphrase -so config/validator-identity.json fi - args+=(--identity-keypair config/validator-identity.json) + args+=(--identity config/validator-identity.json) if [[ $airdropsEnabled != true ]]; then args+=(--no-airdrop) @@ -411,7 +411,7 @@ EOF ) if [[ $airdropsEnabled != true ]]; then - # If this ever becomes a problem, we need to provide the `--identity-keypair` + # If this ever becomes a problem, we need to provide the `--identity` # argument to an existing system account with lamports in it echo "Error: archivers not supported without airdrops" exit 1 diff --git a/programs/vote/src/vote_state/mod.rs b/programs/vote/src/vote_state/mod.rs index b6d6bf27f..aabda7237 100644 --- a/programs/vote/src/vote_state/mod.rs +++ b/programs/vote/src/vote_state/mod.rs @@ -678,10 +678,10 @@ pub fn process_vote( vote_account.set_state(&VoteStateVersions::Current(Box::new(vote_state))) } -// utility function, used by Bank, tests -pub fn create_account( - vote_pubkey: &Pubkey, +pub fn create_account_with_authorized( node_pubkey: &Pubkey, + authorized_voter: &Pubkey, + authorized_withdrawer: &Pubkey, commission: u8, lamports: u64, ) -> Account { @@ -690,8 +690,8 @@ pub fn create_account( let vote_state = VoteState::new( &VoteInit { node_pubkey: *node_pubkey, - authorized_voter: *vote_pubkey, - authorized_withdrawer: *vote_pubkey, + authorized_voter: *authorized_voter, + authorized_withdrawer: *authorized_withdrawer, commission, }, &Clock::default(), @@ -703,6 +703,16 @@ pub fn create_account( vote_account } +// create_account() should be removed, use create_account_with_authorized() instead +pub fn create_account( + vote_pubkey: &Pubkey, + node_pubkey: &Pubkey, + commission: u8, + lamports: u64, +) -> Account { + create_account_with_authorized(node_pubkey, vote_pubkey, vote_pubkey, commission, lamports) +} + #[cfg(test)] mod tests { use super::*; diff --git a/run.sh b/run.sh index 047c5b433..8577d12ea 100755 --- a/run.sh +++ b/run.sh @@ -97,8 +97,8 @@ solana-faucet --keypair "$dataDir"/faucet-keypair.json & faucet=$! args=( - --identity-keypair "$dataDir"/leader-keypair.json - --voting-keypair "$dataDir"/leader-vote-account-keypair.json + --identity "$dataDir"/leader-keypair.json + --vote-account "$dataDir"/leader-vote-account-keypair.json --ledger "$ledgerDir" --gossip-port 8001 --rpc-port 8899 diff --git a/system-test/automation_utils.sh b/system-test/automation_utils.sh index 28cf00113..557d18cb6 100755 --- a/system-test/automation_utils.sh +++ b/system-test/automation_utils.sh @@ -67,7 +67,7 @@ function wait_for_bootstrap_validator_stake_drop { while true; do # shellcheck disable=SC2154 - bootstrap_validator_validator_info="$(ssh "${sshOptions[@]}" "${validatorIpList[0]}" '$HOME/.cargo/bin/solana validators | grep "$($HOME/.cargo/bin/solana-keygen pubkey ~/solana/config/bootstrap-validator/identity-keypair.json)"')" + bootstrap_validator_validator_info="$(ssh "${sshOptions[@]}" "${validatorIpList[0]}" '$HOME/.cargo/bin/solana validators | grep "$($HOME/.cargo/bin/solana-keygen pubkey ~/solana/config/bootstrap-validator/identity.json)"')" bootstrap_validator_stake_percentage="$(echo "$bootstrap_validator_validator_info" | awk '{gsub(/[\(,\),\%]/,""); print $9}')" if [[ $(echo "$bootstrap_validator_stake_percentage < $max_stake" | bc) -ne 0 ]]; then diff --git a/validator/src/main.rs b/validator/src/main.rs index d40612a56..4f99856ec 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -359,6 +359,7 @@ pub fn main() { Arg::with_name("blockstream_unix_socket") .long("blockstream") .takes_value(true) + .hidden(true) // Don't document this argument to discourage its use .value_name("UNIX DOMAIN SOCKET") .help("Stream entries to this unix domain socket path") ) @@ -368,21 +369,21 @@ pub fn main() { .help(SKIP_SEED_PHRASE_VALIDATION_ARG.help), ) .arg( - Arg::with_name("identity_keypair") + Arg::with_name("identity") .short("i") - .long("identity-keypair") + .long("identity") .value_name("PATH") .takes_value(true) .validator(is_keypair_or_ask_keyword) - .help("File containing the identity keypair for the validator"), + .help("Validator identity keypair"), ) .arg( - Arg::with_name("voting_keypair") - .long("voting-keypair") + Arg::with_name("authorized_voter") + .long("authorized-voter") .value_name("PATH") .takes_value(true) .validator(is_keypair_or_ask_keyword) - .help("File containing the authorized voting keypair. Default is an ephemeral keypair, which may disable voting without --vote-account."), + .help("Authorized voter keypair [default: value of --identity]"), ) .arg( Arg::with_name("vote_account") @@ -390,12 +391,13 @@ pub fn main() { .value_name("PUBKEY") .takes_value(true) .validator(is_pubkey_or_keypair) - .help("Public key of the vote account to vote with. Default is the public key of --voting-keypair"), + .help("Validator vote account public key. If unspecified voting will be disabled") ) .arg( Arg::with_name("storage_keypair") .long("storage-keypair") .value_name("PATH") + .hidden(true) // Don't document this argument to discourage its use .takes_value(true) .validator(is_keypair_or_ask_keyword) .help("File containing the storage account keypair. Default is an ephemeral keypair"), @@ -652,17 +654,15 @@ pub fn main() { ) .get_matches(); - let identity_keypair = - Arc::new(keypair_of(&matches, "identity_keypair").unwrap_or_else(Keypair::new)); + let identity_keypair = Arc::new(keypair_of(&matches, "identity").unwrap_or_else(Keypair::new)); - let (voting_keypair, ephemeral_voting_keypair) = keypair_of(&matches, "voting_keypair") - .map(|keypair| (keypair, false)) - .unwrap_or_else(|| (Keypair::new(), true)); + let authorized_voter = keypair_of(&matches, "authorized_voter") + .map(Arc::new) + .unwrap_or_else(|| identity_keypair.clone()); let storage_keypair = keypair_of(&matches, "storage_keypair").unwrap_or_else(Keypair::new); let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap()); - let entrypoint = matches.value_of("entrypoint"); let init_complete_file = matches.value_of("init_complete_file"); let skip_poh_verify = matches.is_present("skip_poh_verify"); let cuda = matches.is_present("cuda"); @@ -838,13 +838,9 @@ pub fn main() { info!("Starting validator with: {:#?}", std::env::args_os()); let vote_account = pubkey_of(&matches, "vote_account").unwrap_or_else(|| { - // Disable voting because normal (=not bootstrapping) validator rejects - // non-voting accounts (= ephemeral keypairs). - if ephemeral_voting_keypair && entrypoint.is_some() { - warn!("Disabled voting due to the use of ephemeral key for vote account"); - validator_config.voting_disabled = true; - }; - voting_keypair.pubkey() + warn!("--vote-account not specified, validator will not vote"); + validator_config.voting_disabled = true; + Keypair::new().pubkey() }); solana_metrics::set_host_id(identity_keypair.pubkey().to_string()); @@ -1014,7 +1010,7 @@ pub fn main() { check_vote_account( &rpc_client, &vote_account, - &voting_keypair.pubkey(), + &authorized_voter.pubkey(), &identity_keypair.pubkey(), ) } else { @@ -1057,7 +1053,7 @@ pub fn main() { &identity_keypair, &ledger_path, &vote_account, - &Arc::new(voting_keypair), + &authorized_voter, &Arc::new(storage_keypair), cluster_entrypoint.as_ref(), !skip_poh_verify,