Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
How to compute the reward update compuation. Also, how to spread the compuation over many blocks, once the chain reaches a stability point.
Synopsis
- type RewardEvent = Map (Credential 'Staking) (Set Reward)
- data RewardAns = RewardAns {}
- type Pulser = RewardPulser ShelleyBase RewardAns
- data RewardUpdate = RewardUpdate {}
- emptyRewardUpdate ∷ RewardUpdate
- data RewardSnapShot = RewardSnapShot {
- rewFees ∷ !Coin
- rewProtocolVersion ∷ !ProtVer
- rewNonMyopic ∷ !NonMyopic
- rewDeltaR1 ∷ !Coin
- rewR ∷ !Coin
- rewDeltaT1 ∷ !Coin
- rewLikelihoods ∷ !(Map (KeyHash 'StakePool) Likelihood)
- rewLeaders ∷ !(Map (Credential 'Staking) (Set Reward))
- data FreeVars = FreeVars {
- fvDelegs ∷ !(VMap VB VB (Credential 'Staking) (KeyHash 'StakePool))
- fvAddrsRew ∷ !(Set (Credential 'Staking))
- fvTotalStake ∷ !Coin
- fvProtVer ∷ !ProtVer
- fvPoolRewardInfo ∷ !(Map (KeyHash 'StakePool) PoolRewardInfo)
- rewardStakePoolMember ∷ FreeVars → RewardAns → Credential 'Staking → CompactForm Coin → RewardAns
- data RewardPulser (m ∷ Type → Type) ans where
- RSLP ∷ (ans ~ RewardAns, m ~ ShelleyBase) ⇒ !Int → !FreeVars → !(VMap VB VP (Credential 'Staking) (CompactForm Coin)) → !ans → RewardPulser m ans
- clearRecent ∷ RewardAns → RewardAns
- data PulsingRewUpdate
Documentation
type RewardEvent = Map (Credential 'Staking) (Set Reward) Source #
The result of reward calculation is a pair of aggregate Maps. One for the accumulated answer, and one for the answer since the last pulse
Instances
Generic RewardAns Source # | |
Show RewardAns Source # | |
DecCBOR Pulser Source # | |
DecCBOR RewardAns Source # | |
EncCBOR Pulser Source # | |
EncCBOR RewardAns Source # | |
NFData Pulser Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate | |
NFData RewardAns Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate | |
Eq RewardAns Source # | |
NoThunks Pulser Source # | |
NoThunks RewardAns Source # | |
type Rep RewardAns Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate type Rep RewardAns = D1 ('MetaData "RewardAns" "Cardano.Ledger.Shelley.RewardUpdate" "cardano-ledger-shelley-1.16.0.0-inplace" 'False) (C1 ('MetaCons "RewardAns" 'PrefixI 'True) (S1 ('MetaSel ('Just "accumRewardAns") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (Credential 'Staking) Reward)) :*: S1 ('MetaSel ('Just "recentRewardAns") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RewardEvent))) |
type Pulser = RewardPulser ShelleyBase RewardAns Source #
The type of RewardPulser we pulse on.
data RewardUpdate Source #
The ultimate goal of a reward update computation. Aggregating rewards for each staking credential.
Instances
data RewardSnapShot Source #
To complete the reward update, we need a snap shot of the EpochState particular to this computation
RewardSnapShot | |
|
Instances
FreeVars | |
|
Instances
rewardStakePoolMember ∷ FreeVars → RewardAns → Credential 'Staking → CompactForm Coin → RewardAns Source #
The function to call on each reward update pulse. Called by the pulser.
data RewardPulser (m ∷ Type → Type) ans where Source #
The type of a Pulser which uses rewardStakePoolMember
as its underlying function.
rewardStakePool
will be partially applied to the component of type
(FreeVars c) when pulsing. Note that we use two type equality (~) constraints
to fix both the monad m
and the ans
type, to the context where we will use
the type as a Pulser. The type must have m
and ans
as its last two
parameters so we can make a Pulsable instance.
RSLP = Reward Serializable Listbased Pulser
RSLP ∷ (ans ~ RewardAns, m ~ ShelleyBase) ⇒ !Int → !FreeVars → !(VMap VB VP (Credential 'Staking) (CompactForm Coin)) → !ans → RewardPulser m ans |
Instances
Pulsable RewardPulser Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate done ∷ ∀ (m ∷ Type → Type) ans. RewardPulser m ans → Bool Source # current ∷ ∀ (m ∷ Type → Type) ans. RewardPulser m ans → ans Source # pulseM ∷ Monad m ⇒ RewardPulser m ans → m (RewardPulser m ans) Source # completeM ∷ Monad m ⇒ RewardPulser m ans → m ans Source # | |
DecCBOR Pulser Source # | |
EncCBOR Pulser Source # | |
NFData Pulser Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate | |
NoThunks Pulser Source # | |
Show ans ⇒ Show (RewardPulser m ans) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate | |
Eq ans ⇒ Eq (RewardPulser m ans) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate (==) ∷ RewardPulser m ans → RewardPulser m ans → Bool Source # (/=) ∷ RewardPulser m ans → RewardPulser m ans → Bool Source # |
data PulsingRewUpdate Source #
The state used in the STS rules