Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data DRepPulsingState era
- = DRPulsing !(DRepPulser era Identity (RatifyState era))
- | DRComplete !(PulsingSnapshot era) !(RatifyState era)
- data DRepPulser era (m ∷ Type → Type) ans where
- DRepPulser ∷ ∀ era ans m. (ans ~ RatifyState era, m ~ Identity, RunConwayRatify era) ⇒ {..} → DRepPulser era m ans
- pulseDRepPulsingState ∷ DRepPulsingState era → DRepPulsingState era
- completeDRepPulsingState ∷ DRepPulsingState era → DRepPulsingState era
- extractDRepPulsingState ∷ DRepPulsingState era → RatifyState era
- finishDRepPulser ∷ ∀ era. DRepPulsingState era → (PulsingSnapshot era, RatifyState era)
- computeDRepDistr ∷ Map (Credential 'Staking) (CompactForm Coin) → Map (Credential 'DRepRole) DRepState → Map (Credential 'Staking) (CompactForm Coin) → PoolDistr → Map DRep (CompactForm Coin) → Map (Credential 'Staking) UMElem → (Map DRep (CompactForm Coin), PoolDistr)
- psDRepDistrG ∷ SimpleGetter (DRepPulsingState era) (Map DRep (CompactForm Coin))
- data PulsingSnapshot era = PulsingSnapshot {
- psProposals ∷ !(StrictSeq (GovActionState era))
- psDRepDistr ∷ !(Map DRep (CompactForm Coin))
- psDRepState ∷ !(Map (Credential 'DRepRole) DRepState)
- psPoolDistr ∷ Map (KeyHash 'StakePool) (CompactForm Coin)
- psProposalsL ∷ Lens' (PulsingSnapshot era) (StrictSeq (GovActionState era))
- psDRepDistrL ∷ Lens' (PulsingSnapshot era) (Map DRep (CompactForm Coin))
- psDRepStateL ∷ Lens' (PulsingSnapshot era) (Map (Credential 'DRepRole) DRepState)
- psPoolDistrL ∷ Lens' (PulsingSnapshot era) (Map (KeyHash 'StakePool) (CompactForm Coin))
- class (STS (ConwayRATIFY era), Signal (ConwayRATIFY era) ~ RatifySignal era, BaseM (ConwayRATIFY era) ~ Reader Globals, Environment (ConwayRATIFY era) ~ RatifyEnv era, State (ConwayRATIFY era) ~ RatifyState era, PredicateFailure (ConwayRATIFY era) ~ Void) ⇒ RunConwayRatify era where
- runConwayRatify ∷ Globals → RatifyEnv era → RatifyState era → RatifySignal era → RatifyState era
Documentation
data DRepPulsingState era Source #
DRPulsing !(DRepPulser era Identity (RatifyState era)) | |
DRComplete !(PulsingSnapshot era) !(RatifyState era) |
Instances
data DRepPulser era (m ∷ Type → Type) ans where Source #
The type of a Pulser which uses computeDRepDistr
as its underlying
function. 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 DRepPulser must have m
and ans
as its last
two parameters so we can make a Pulsable instance. We will always use this
instantiation (DRepPulser era Identity (RatifyState era))
DRepPulser | |
|
Instances
pulseDRepPulsingState ∷ DRepPulsingState era → DRepPulsingState era Source #
completeDRepPulsingState ∷ DRepPulsingState era → DRepPulsingState era Source #
extractDRepPulsingState ∷ DRepPulsingState era → RatifyState era Source #
finishDRepPulser ∷ ∀ era. DRepPulsingState era → (PulsingSnapshot era, RatifyState era) Source #
computeDRepDistr ∷ Map (Credential 'Staking) (CompactForm Coin) → Map (Credential 'DRepRole) DRepState → Map (Credential 'Staking) (CompactForm Coin) → PoolDistr → Map DRep (CompactForm Coin) → Map (Credential 'Staking) UMElem → (Map DRep (CompactForm Coin), PoolDistr) Source #
We iterate over a pulse-sized chunk of the UMap.
For each staking credential in the chunk that has delegated to a DRep, add the stake distribution, rewards, and proposal deposits for that credential to the DRep distribution, if the DRep is a DRepCredential (also, AlwaysAbstain or AlwaysNoConfidence) and a member of the registered DReps. If the DRepCredential is not a member of the registered DReps, ignore and skip that DRep.
For each staking credential in the chunk that has delegated to an SPO, add only the proposal deposits for that credential to the stake pool distribution, since the rewards and stake are already added to it by the SNAP rule.
Give or take, this operation has roughly
O (a * (log(b) + log(c) + log(d) + log(e) + log(f)))
complexity, where,
(a) is the size of the chunk of the UMap, which is the pulse-size, iterate over
(b) is the size of the StakeDistr, lookup
(c) is the size of the DRepDistr, insertWith
(d) is the size of the dpProposalDeposits, lookup
(e) is the size of the registered DReps, lookup
(f) is the size of the PoolDistr, insert
psDRepDistrG ∷ SimpleGetter (DRepPulsingState era) (Map DRep (CompactForm Coin)) Source #
This is potentially an expensive getter. Make sure not to use it in the first 80% of the epoch.
data PulsingSnapshot era Source #
A snapshot of information from the previous epoch stored inside the Pulser.
After the pulser completes, but before the epoch turns, this information
is store in the DRComplete
constructor of the DRepPulsingState
These are the values at the start of the current epoch. This allows the API
To access these "previous" values, both during and after pulsing.
PulsingSnapshot | |
|
Instances
psProposalsL ∷ Lens' (PulsingSnapshot era) (StrictSeq (GovActionState era)) Source #
psDRepDistrL ∷ Lens' (PulsingSnapshot era) (Map DRep (CompactForm Coin)) Source #
psDRepStateL ∷ Lens' (PulsingSnapshot era) (Map (Credential 'DRepRole) DRepState) Source #
psPoolDistrL ∷ Lens' (PulsingSnapshot era) (Map (KeyHash 'StakePool) (CompactForm Coin)) Source #
class (STS (ConwayRATIFY era), Signal (ConwayRATIFY era) ~ RatifySignal era, BaseM (ConwayRATIFY era) ~ Reader Globals, Environment (ConwayRATIFY era) ~ RatifyEnv era, State (ConwayRATIFY era) ~ RatifyState era, PredicateFailure (ConwayRATIFY era) ~ Void) ⇒ RunConwayRatify era where Source #
Nothing
runConwayRatify ∷ Globals → RatifyEnv era → RatifyState era → RatifySignal era → RatifyState era Source #