Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Ledger.Shelley.RewardUpdate
Description
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 KeyHashPoolProvenance c = Map ( KeyHash ' StakePool c) ( RewardProvenancePool c)
- type Pulser c = RewardPulser c ShelleyBase ( RewardAns c)
- data RewardUpdate crypto = RewardUpdate { }
- emptyRewardUpdate :: RewardUpdate crypto
-
data
RewardSnapShot
crypto =
RewardSnapShot
{
- rewFees :: ! Coin
- rewprotocolVersion :: ! ProtVer
- rewNonMyopic :: !( NonMyopic crypto)
- rewDeltaR1 :: ! Coin
- rewR :: ! Coin
- rewDeltaT1 :: ! Coin
- rewLikelihoods :: !( Map ( KeyHash ' StakePool crypto) Likelihood )
- rewLeaders :: !( Map ( Credential ' Staking crypto) ( Set ( Reward crypto)))
-
data
FreeVars
crypto =
FreeVars
{
- delegs :: !( VMap VB VB ( Credential ' Staking crypto) ( KeyHash ' StakePool crypto))
- addrsRew :: !( Set ( Credential ' Staking crypto))
- totalStake :: ! Integer
- pp_pv :: ! ProtVer
- poolRewardInfo :: !( Map ( KeyHash ' StakePool crypto) ( PoolRewardInfo crypto))
- 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
crypto
- = Pulsing !( RewardSnapShot crypto) !( Pulser crypto)
- | Complete !( RewardUpdate crypto)
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
Constructors
RewardAns | |
Fields
|
Instances
type KeyHashPoolProvenance c = Map ( KeyHash ' StakePool c) ( RewardProvenancePool c) Source #
The provenance we collect
type Pulser c = RewardPulser c ShelleyBase ( RewardAns c) Source #
The type of RewardPulser we pulse on.
data RewardUpdate crypto Source #
The ultiate goal of a reward update computation. Aggregating rewards for each staking credential.
Constructors
RewardUpdate | |
Instances
emptyRewardUpdate :: RewardUpdate crypto Source #
data RewardSnapShot crypto Source #
To complete the reward update, we need a snap shot of the EpochState particular to this computation
Constructors
RewardSnapShot | |
Fields
|
Instances
Constructors
FreeVars | |
Fields
|
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.
RSPL = Reward Serializable Listbased Pulser
Constructors
RSLP :: (ans ~ RewardAns c, m ~ ShelleyBase ) => ! Int -> !( FreeVars c) -> !( VMap VB VP ( Credential ' Staking c) ( CompactForm Coin )) -> !ans -> RewardPulser c m ans |
Instances
NFData ( Pulser c) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate |
|
Crypto c => ToCBOR ( Pulser c) Source # | |
Crypto c => FromCBOR ( Pulser c) Source # | |
Pulsable ( RewardPulser crypto) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate Methods done :: forall (m :: Type -> Type ) ans. RewardPulser crypto m ans -> Bool Source # current :: forall (m :: Type -> Type ) ans. RewardPulser crypto m ans -> ans Source # pulseM :: Monad m => RewardPulser crypto m ans -> m ( RewardPulser crypto m ans) Source # completeM :: Monad m => RewardPulser crypto m ans -> m ans Source # |
|
Typeable c => NoThunks ( Pulser c) Source # | |
Eq ans => Eq ( RewardPulser c m ans) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate Methods (==) :: RewardPulser c m ans -> RewardPulser c m ans -> Bool Source # (/=) :: RewardPulser c m ans -> RewardPulser c m ans -> Bool Source # |
|
Show ans => Show ( RewardPulser c m ans) Source # | |
Defined in Cardano.Ledger.Shelley.RewardUpdate |
clearRecent :: RewardAns c -> RewardAns c Source #
data PulsingRewUpdate crypto Source #
The state used in the STS rules
Constructors
Pulsing !( RewardSnapShot crypto) !( Pulser crypto) | |
Complete !( RewardUpdate crypto) |