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 c = Map (Credential 'Staking c) (Set (Reward c))
- data RewardAns c = RewardAns {
- accumRewardAns ∷ !(Map (Credential 'Staking c) (Reward c))
- recentRewardAns ∷ !(RewardEvent c)
- type Pulser c = RewardPulser c ShelleyBase (RewardAns c)
- data RewardUpdate c = RewardUpdate {}
- emptyRewardUpdate ∷ RewardUpdate c
- data RewardSnapShot c = RewardSnapShot {
- rewFees ∷ !Coin
- rewProtocolVersion ∷ !ProtVer
- rewNonMyopic ∷ !(NonMyopic c)
- rewDeltaR1 ∷ !Coin
- rewR ∷ !Coin
- rewDeltaT1 ∷ !Coin
- rewLikelihoods ∷ !(Map (KeyHash 'StakePool c) Likelihood)
- rewLeaders ∷ !(Map (Credential 'Staking c) (Set (Reward c)))
- data FreeVars c = FreeVars {
- fvDelegs ∷ !(VMap VB VB (Credential 'Staking c) (KeyHash 'StakePool c))
- fvAddrsRew ∷ !(Set (Credential 'Staking c))
- fvTotalStake ∷ !Coin
- fvProtVer ∷ !ProtVer
- fvPoolRewardInfo ∷ !(Map (KeyHash 'StakePool c) (PoolRewardInfo c))
- rewardStakePoolMember ∷ FreeVars c → RewardAns c → Credential 'Staking c → CompactForm Coin → RewardAns c
- data RewardPulser c (m ∷ Type → Type) ans where
- RSLP ∷ (ans ~ RewardAns c, m ~ ShelleyBase) ⇒ !Int → !(FreeVars c) → !(VMap VB VP (Credential 'Staking c) (CompactForm Coin)) → !ans → RewardPulser c m ans
- clearRecent ∷ RewardAns c → RewardAns c
- data PulsingRewUpdate c
- = Pulsing !(RewardSnapShot c) !(Pulser c)
- | Complete !(RewardUpdate c)
Documentation
type RewardEvent c = Map (Credential 'Staking c) (Set (Reward c)) 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
RewardAns | |
|
Instances
Generic (RewardAns c) Source # | |
Show (RewardAns c) Source # | |
Crypto c ⇒ DecCBOR (Pulser c) Source # | |
Crypto c ⇒ DecCBOR (RewardAns c) Source # | |
Crypto c ⇒ EncCBOR (Pulser c) Source # | |
Crypto c ⇒ EncCBOR (RewardAns c) Source # | |
NFData (Pulser c) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate | |
NFData (RewardAns c) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate | |
Eq (RewardAns c) Source # | |
Typeable c ⇒ NoThunks (Pulser c) Source # | |
NoThunks (RewardAns c) Source # | |
type Rep (RewardAns c) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate type Rep (RewardAns c) = D1 ('MetaData "RewardAns" "Cardano.Ledger.Shelley.RewardUpdate" "cardano-ledger-shelley-1.15.0.0-inplace" 'False) (C1 ('MetaCons "RewardAns" 'PrefixI 'True) (S1 ('MetaSel ('Just "accumRewardAns") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (Credential 'Staking c) (Reward c))) :*: S1 ('MetaSel ('Just "recentRewardAns") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (RewardEvent c)))) |
type Pulser c = RewardPulser c ShelleyBase (RewardAns c) Source #
The type of RewardPulser we pulse on.
data RewardUpdate c Source #
The ultimate goal of a reward update computation. Aggregating rewards for each staking credential.
Instances
data RewardSnapShot c Source #
To complete the reward update, we need a snap shot of the EpochState particular to this computation
RewardSnapShot | |
|
Instances
FreeVars | |
|
Instances
rewardStakePoolMember ∷ FreeVars c → RewardAns c → Credential 'Staking c → CompactForm Coin → RewardAns c Source #
The function to call on each reward update pulse. Called by the pulser.
data RewardPulser c (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 c, m ~ ShelleyBase) ⇒ !Int → !(FreeVars c) → !(VMap VB VP (Credential 'Staking c) (CompactForm Coin)) → !ans → RewardPulser c m ans |
Instances
Pulsable (RewardPulser c) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate done ∷ ∀ (m ∷ Type → Type) ans. RewardPulser c m ans → Bool Source # current ∷ ∀ (m ∷ Type → Type) ans. RewardPulser c m ans → ans Source # pulseM ∷ Monad m ⇒ RewardPulser c m ans → m (RewardPulser c m ans) Source # completeM ∷ Monad m ⇒ RewardPulser c m ans → m ans Source # | |
Crypto c ⇒ DecCBOR (Pulser c) Source # | |
Crypto c ⇒ EncCBOR (Pulser c) Source # | |
NFData (Pulser c) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate | |
Typeable c ⇒ NoThunks (Pulser c) Source # | |
Show ans ⇒ Show (RewardPulser c m ans) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate | |
Eq ans ⇒ Eq (RewardPulser c m ans) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate (==) ∷ RewardPulser c m ans → RewardPulser c m ans → Bool Source # (/=) ∷ RewardPulser c m ans → RewardPulser c m ans → Bool Source # |
clearRecent ∷ RewardAns c → RewardAns c Source #
data PulsingRewUpdate c Source #
The state used in the STS rules
Pulsing !(RewardSnapShot c) !(Pulser c) | |
Complete !(RewardUpdate c) |