parent
369f37a0a4
commit
ae93d574c2
|
@ -467,7 +467,7 @@ FLAGS:
|
|||
OPTIONS:
|
||||
--authorized-voter <PUBKEY> Public key of the authorized voter (defaults to vote account)
|
||||
--authorized-withdrawer <PUBKEY> Public key of the authorized withdrawer (defaults to cli config pubkey)
|
||||
--commission <NUM> The commission taken on reward redemption (0-255), default: 0
|
||||
--commission <NUM> The commission taken on reward redemption (0-100), default: 0
|
||||
-C, --config <PATH> Configuration file to use [default:
|
||||
~/.config/solana/cli/config.yml]
|
||||
-u, --url <URL> JSON RPC URL for the solana cluster
|
||||
|
|
|
@ -713,7 +713,7 @@ The result field will be a JSON object of `current` and `delinquent` accounts, e
|
|||
* `nodePubkey` - Node public key, as base-58 encoded string
|
||||
* `activatedStake` - the stake, in lamports, delegated to this vote account and active in this epoch
|
||||
* `epochVoteAccount` - bool, whether the vote account is staked for this epoch
|
||||
* `commission`, an 8-bit integer used as a fraction \(commission/MAX\_U8\) for rewards payout
|
||||
* `commission`, percentage (0-100) of rewards payout owed to the vote account
|
||||
* `lastVote` - Most recent slot voted on by this vote account
|
||||
|
||||
#### Example:
|
||||
|
|
|
@ -616,7 +616,7 @@ pub fn process_show_validators(rpc_client: &RpcClient, use_lamports_unit: bool)
|
|||
}
|
||||
}
|
||||
println!(
|
||||
"{} {:<44} {:<44} {:>3} ({:>4.1}%) {:>10} {:>11} {:>11}",
|
||||
"{} {:<44} {:<44} {:>3}% {:>10} {:>11} {:>11}",
|
||||
if delinquent {
|
||||
WARNING.to_string()
|
||||
} else {
|
||||
|
@ -625,7 +625,6 @@ pub fn process_show_validators(rpc_client: &RpcClient, use_lamports_unit: bool)
|
|||
vote_account.node_pubkey,
|
||||
vote_account.vote_pubkey,
|
||||
vote_account.commission,
|
||||
f64::from(vote_account.commission) * 100.0 / f64::from(std::u8::MAX),
|
||||
non_zero_or_dash(vote_account.last_vote),
|
||||
non_zero_or_dash(vote_account.root_slot),
|
||||
if vote_account.activated_stake > 0 {
|
||||
|
|
|
@ -47,7 +47,7 @@ impl VoteSubCommands for App<'_, '_> {
|
|||
.long("commission")
|
||||
.value_name("NUM")
|
||||
.takes_value(true)
|
||||
.help("The commission taken on reward redemption (0-255), default: 0"),
|
||||
.help("The commission taken on reward redemption (0-100), default: 0"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("authorized_voter")
|
||||
|
@ -345,10 +345,7 @@ pub fn process_show_vote_account(
|
|||
vote_state.authorized_withdrawer
|
||||
);
|
||||
println!("credits: {}", vote_state.credits());
|
||||
println!(
|
||||
"commission: {}%",
|
||||
f64::from(vote_state.commission) / f64::from(std::u32::MAX)
|
||||
);
|
||||
println!("commission: {}%", vote_state.commission);
|
||||
println!(
|
||||
"root slot: {}",
|
||||
match vote_state.root_slot {
|
||||
|
|
|
@ -262,7 +262,7 @@ setup_validator_accounts() {
|
|||
fi
|
||||
|
||||
echo "Creating validator vote account"
|
||||
wallet create-vote-account "$voting_keypair_path" "$identity_keypair_path" --commission 127 || return $?
|
||||
wallet create-vote-account "$voting_keypair_path" "$identity_keypair_path" --commission 50 || return $?
|
||||
fi
|
||||
echo "Validator vote account configured"
|
||||
|
||||
|
|
|
@ -1902,9 +1902,9 @@ mod tests {
|
|||
None, // would be Some((0, 2 * 1 + 1 * 2, 3)),
|
||||
stake.calculate_rewards(1.0, &vote_state, None)
|
||||
);
|
||||
vote_state.commission = std::u8::MAX - 1;
|
||||
vote_state.commission = 99;
|
||||
assert_eq!(
|
||||
None, // would be pSome((0, 2 * 1 + 1 * 2, 3)),
|
||||
None, // would be Some((0, 2 * 1 + 1 * 2, 3)),
|
||||
stake.calculate_rewards(1.0, &vote_state, None)
|
||||
);
|
||||
}
|
||||
|
@ -1993,7 +1993,7 @@ mod tests {
|
|||
|
||||
let mut vote_state = VoteState::from(&vote_account).unwrap();
|
||||
// split credits 3:1 between staker and voter
|
||||
vote_state.commission = std::u8::MAX / 4;
|
||||
vote_state.commission = 25;
|
||||
// put in some credits in epoch 0 for which we should have a non-zero stake
|
||||
for _i in 0..100 {
|
||||
vote_state.increment_credits(1);
|
||||
|
@ -2033,7 +2033,7 @@ mod tests {
|
|||
assert!(voter_commission > 0);
|
||||
assert!(staker_rewards > 0);
|
||||
assert!(
|
||||
staker_rewards / 3 > voter_commission,
|
||||
staker_rewards / 3 >= voter_commission,
|
||||
"rewards should be split ~3:1"
|
||||
);
|
||||
// verify rewards are added to stake
|
||||
|
|
|
@ -125,7 +125,7 @@ fn test_stake_account_lifetime() {
|
|||
node_pubkey,
|
||||
authorized_voter: vote_pubkey,
|
||||
authorized_withdrawer: vote_pubkey,
|
||||
commission: std::u8::MAX / 2,
|
||||
commission: 50,
|
||||
},
|
||||
10,
|
||||
));
|
||||
|
|
|
@ -91,7 +91,7 @@ pub struct VoteState {
|
|||
pub authorized_voter: Pubkey,
|
||||
/// the signer for withdrawals
|
||||
pub authorized_withdrawer: Pubkey,
|
||||
/// fraction of std::u8::MAX that represents what part of a rewards
|
||||
/// percentage (0-100) that represents what part of a rewards
|
||||
/// payout should be given to this VoteAccount
|
||||
pub commission: u8,
|
||||
|
||||
|
@ -167,11 +167,11 @@ impl VoteState {
|
|||
/// if commission calculation is 100% one way or other,
|
||||
/// indicate with false for was_split
|
||||
pub fn commission_split(&self, on: f64) -> (f64, f64, bool) {
|
||||
match self.commission {
|
||||
match self.commission.min(100) {
|
||||
0 => (0.0, on, false),
|
||||
std::u8::MAX => (on, 0.0, false),
|
||||
100 => (on, 0.0, false),
|
||||
split => {
|
||||
let mine = on * f64::from(split) / f64::from(std::u8::MAX);
|
||||
let mine = on * f64::from(split) / f64::from(100);
|
||||
(mine, on - mine, true)
|
||||
}
|
||||
}
|
||||
|
@ -1066,7 +1066,7 @@ mod tests {
|
|||
vote_state.commission = std::u8::MAX;
|
||||
assert_eq!(vote_state.commission_split(1.0), (1.0, 0.0, false));
|
||||
|
||||
vote_state.commission = std::u8::MAX / 2;
|
||||
vote_state.commission = 50;
|
||||
let (voter_portion, staker_portion, was_split) = vote_state.commission_split(10.0);
|
||||
|
||||
assert_eq!(
|
||||
|
|
Loading…
Reference in New Issue