Skip to content

Commit

Permalink
Rework validator vote account defaults to half voting fees
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Mar 14, 2020
1 parent 5c2cf04 commit 29fb793
Show file tree
Hide file tree
Showing 20 changed files with 140 additions and 134 deletions.
2 changes: 1 addition & 1 deletion archiver/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ci/localnet-sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
2 changes: 1 addition & 1 deletion cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions cli/src/vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ 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")
.long("authorized-withdrawer")
.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")
Expand Down Expand Up @@ -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<RemoteWalletManager>>,
Expand Down Expand Up @@ -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,
};

Expand Down
19 changes: 9 additions & 10 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl Validator {
keypair: &Arc<Keypair>,
ledger_path: &Path,
vote_account: &Pubkey,
voting_keypair: &Arc<Keypair>,
authorized_voter: &Arc<Keypair>,
storage_keypair: &Arc<Keypair>,
entrypoint_info_option: Option<&ContactInfo>,
poh_verify: bool,
Expand All @@ -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);
Expand Down Expand Up @@ -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(),
Expand All @@ -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,
Expand Down
18 changes: 9 additions & 9 deletions docs/src/paper-wallet/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <PATH>` you can pass
Rather than specifying a path with `--identity <PATH>` 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:
Expand Down
8 changes: 4 additions & 4 deletions docs/src/running-validator/validator-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,24 +137,24 @@ 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

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
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```
Expand Down
5 changes: 3 additions & 2 deletions genesis/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,9 @@ fn main() -> Result<(), Box<dyn error::Error>> {
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),
Expand Down
22 changes: 11 additions & 11 deletions multinode-demo/archiver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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"

Expand Down
8 changes: 4 additions & 4 deletions multinode-demo/bootstrap-validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]] || {
Expand All @@ -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
Expand Down
22 changes: 11 additions & 11 deletions multinode-demo/delegate-stake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,30 +80,30 @@ 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

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"
6 changes: 3 additions & 3 deletions multinode-demo/faucet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ 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
}

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 "$@"
20 changes: 10 additions & 10 deletions multinode-demo/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 29fb793

Please sign in to comment.