solana_stake_program/
points.rs

1//! Information about points calculation based on stake state.
2//! Used by `solana-runtime`.
3
4use {solana_pubkey::Pubkey, solana_stake_interface::state::Delegation};
5
6/// captures a rewards round as lamports to be awarded
7///  and the total points over which those lamports
8///  are to be distributed
9//  basically read as rewards/points, but in integers instead of as an f64
10#[derive(Clone, Debug, PartialEq, Eq)]
11pub struct PointValue {
12    pub rewards: u64, // lamports to split
13    pub points: u128, // over these points
14}
15
16#[derive(Debug)]
17pub enum InflationPointCalculationEvent {
18    CalculatedPoints(u64, u128, u128, u128),
19    SplitRewards(u64, u64, u64, PointValue),
20    EffectiveStakeAtRewardedEpoch(u64),
21    RentExemptReserve(u64),
22    Delegation(Delegation, Pubkey),
23    Commission(u8),
24    CreditsObserved(u64, Option<u64>),
25    Skipped(SkippedReason),
26}
27
28#[derive(Debug)]
29pub enum SkippedReason {
30    DisabledInflation,
31    JustActivated,
32    TooEarlyUnfairSplit,
33    ZeroPoints,
34    ZeroPointValue,
35    ZeroReward,
36    ZeroCreditsAndReturnZero,
37    ZeroCreditsAndReturnCurrent,
38    ZeroCreditsAndReturnRewinded,
39}
40
41impl From<SkippedReason> for InflationPointCalculationEvent {
42    fn from(reason: SkippedReason) -> Self {
43        InflationPointCalculationEvent::Skipped(reason)
44    }
45}