Remove RedeemVoteCredits (#7916)

* Move redeem_vote_credits into runtime

* Move redeem_vote_credits into runtime

* Remove RedeemVoteCredits

* chugga for less indentation

* resurrect NoCreditsToRedeem

* fixup
This commit is contained in:
Rob Walker
2020-01-22 16:53:42 -08:00
committed by GitHub
parent 964ff522be
commit 1e2b55c0d7
10 changed files with 38 additions and 532 deletions

View File

@@ -24,7 +24,7 @@ msc {
... ;
Validator abox Validator [label="\nmax\nlockout\n"];
|||;
StakerX => Cluster [label="StakeState::RedeemCredits()"];
StakerY => Cluster [label="StakeState::RedeemCredits()"] ;
Cluster box Cluster [label="credits redeemed (at epoch)"];
}

View File

@@ -231,11 +231,10 @@ SUBCOMMANDS:
nonce-account Show the contents of a nonce account
pay Send a payment
ping Submit transactions sequentially
redeem-vote-credits Redeem credits in the stake account
send-signature Send a signature to authorize a transfer
send-timestamp Send a timestamp to unlock a transfer
show-stake-account Show the contents of a stake account
slot Get current slot
stake-account Show the contents of a stake account
stake-authorize-staker Authorize a new stake signing keypair for the given stake account
stake-authorize-withdrawer Authorize a new withdraw signing keypair for the given stake account
stake-history Show the stake history
@@ -1182,34 +1181,6 @@ OPTIONS:
-t, --timeout <SECONDS> Wait up to timeout seconds for transaction confirmation [default: 15]
```
#### solana-redeem-vote-credits
```text
solana-redeem-vote-credits
Redeem credits in the stake account
USAGE:
solana redeem-vote-credits [FLAGS] [OPTIONS] <STAKE ACCOUNT> <VOTE ACCOUNT>
FLAGS:
-h, --help Prints help information
--skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39
official English word list
-V, --version Prints version information
-v, --verbose Show extra information header
OPTIONS:
--ask-seed-phrase <KEYPAIR NAME> Recover a keypair using a seed phrase and optional passphrase [possible
values: keypair]
-C, --config <PATH> Configuration file to use [default:
~/.config/solana/cli/config.yml]
-u, --url <URL> JSON RPC URL for the solana cluster
-k, --keypair <PATH> /path/to/id.json
ARGS:
<STAKE ACCOUNT> Address of the stake account in which to redeem credits
<VOTE ACCOUNT> The vote account to which the stake is currently delegated.
```
#### solana-send-signature
```text
solana-send-signature
@@ -1267,6 +1238,34 @@ ARGS:
<PROCESS ID> The process id of the transfer to unlock
```
#### solana-show-stake-account
```text
solana-show-stake-account
Show the contents of a stake account
USAGE:
solana show-stake-account [FLAGS] [OPTIONS] <STAKE ACCOUNT>
FLAGS:
-h, --help Prints help information
--lamports Display balance in lamports instead of SOL
--skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39
official English word list
-V, --version Prints version information
-v, --verbose Show extra information header
OPTIONS:
--ask-seed-phrase <KEYPAIR NAME> Recover a keypair using a seed phrase and optional passphrase [possible
values: keypair]
-C, --config <PATH> Configuration file to use [default:
~/.config/solana/cli/config.yml]
-u, --url <URL> JSON RPC URL for the solana cluster
-k, --keypair <PATH> /path/to/id.json
ARGS:
<STAKE ACCOUNT> Address of the stake account to display
```
#### solana-slot
```text
solana-slot
@@ -1292,34 +1291,6 @@ OPTIONS:
-k, --keypair <PATH> /path/to/id.json
```
#### solana-stake-account
```text
solana-stake-account
Show the contents of a stake account
USAGE:
solana stake-account [FLAGS] [OPTIONS] <STAKE ACCOUNT>
FLAGS:
-h, --help Prints help information
--lamports Display balance in lamports instead of SOL
--skip-seed-phrase-validation Skip validation of seed phrases. Use this if your phrase does not use the BIP39
official English word list
-V, --version Prints version information
-v, --verbose Show extra information header
OPTIONS:
--ask-seed-phrase <KEYPAIR NAME> Recover a keypair using a seed phrase and optional passphrase [possible
values: keypair]
-C, --config <PATH> Configuration file to use [default:
~/.config/solana/cli/config.yml]
-u, --url <URL> JSON RPC URL for the solana cluster
-k, --keypair <PATH> /path/to/id.json
ARGS:
<STAKE ACCOUNT> Address of the stake account to display
```
#### solana-stake-authorize-staker
```text
solana-stake-authorize-staker

View File

@@ -109,27 +109,6 @@ Updates the account with a new authorized staker or withdrawer, according to the
`StakeState::authorized_staker` or `authorized_withdrawer` is set to to `Pubkey`.
### StakeInstruction::RedeemVoteCredits
The staker or the owner of the Stake account sends a transaction with this instruction to claim rewards.
The Vote account and the Stake account pair maintain a lifetime counter of total rewards generated and claimed. Rewards are paid according to a point value supplied by the Bank from inflation. A `point` is one credit \* one staked lamport, rewards paid are proportional to the number of lamports staked.
* `account[0]` - RW - The StakeState::Stake instance that is redeeming rewards.
* `account[1]` - R - The VoteState instance, must be the same as `StakeState::voter_pubkey`
* `account[2]` - RW - The StakeState::RewardsPool instance that will fulfill the request \(picked at random\).
* `account[3]` - R - sysvar::rewards account from the Bank that carries point value.
* `account[4]` - R - sysvar::stake\_history account from the Bank that carries stake warmup/cooldown history
Reward is paid out for the difference between `VoteState::credits` to `StakeState::Stake::credits_observed`, multiplied by `sysvar::rewards::Rewards::validator_point_value`. `StakeState::Stake::credits_observed` is updated to`VoteState::credits`. The commission is deposited into the Vote account token balance, and the reward is deposited to the Stake account token balance and the stake account's `stake` is increased by the same amount \(re-invested\).
```text
let credits_to_claim = vote_state.credits - stake_state.credits_observed;
stake_state.credits_observed = vote_state.credits;
```
`credits_to_claim` is used to compute the reward and commission, and `StakeState::Stake::credits_observed` is updated to the latest `VoteState::credits` value.
### StakeInstruction::Deactivate
A staker may wish to withdraw from the network. To do so he must first deactivate his stake, and wait for cool down.

View File

@@ -54,11 +54,7 @@ solana delegate-stake ~/validator-stake-keypair.json ~/some-other-validator-vote
```
Assuming the node is voting, now you're up and running and generating validator
rewards. You'll want to periodically redeem/claim your rewards:
```bash
solana redeem-vote-credits ~/validator-stake-keypair.json ~/validator-vote-keypair.json
```
rewards. Rewards are paid automatically on epoch boundaries.
The rewards lamports earned are split between your stake account and the vote
account according to the commission rate set in the vote account. Rewards can
@@ -132,6 +128,3 @@ depending on active stake and the size of your stake.
Note that a stake account may only be used once, so after deactivation, use the
cli's `withdraw-stake` command to recover the previously staked lamports.
Be sure and redeem your credits before withdrawing all your lamports. Once the
account is fully withdrawn, the account is destroyed.