Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module implements the operation rules for treating UTxO transactions (Tx
)
as state transformations on a ledger state (LedgerState
),
as specified in A Simplified Formal Specification of a UTxO Ledger.
Synopsis
- data AccountState = AccountState {
- asTreasury ∷ !Coin
- asReserves ∷ !Coin
- data CertState era = CertState {
- certVState ∷ !(VState era)
- certPState ∷ !(PState era)
- certDState ∷ !(DState era)
- data DState era = DState {}
- data VState era = VState {
- vsDReps ∷ !(Map (Credential 'DRepRole) DRepState)
- vsCommitteeState ∷ !(CommitteeState era)
- vsNumDormantEpochs ∷ !EpochNo
- rewards ∷ DState era → UView (Credential 'Staking) RDPair
- delegations ∷ DState era → UView (Credential 'Staking) (KeyHash 'StakePool)
- ptrsMap ∷ DState era → Map Ptr (Credential 'Staking)
- data EpochState era = EpochState {
- esAccountState ∷ !AccountState
- esLState ∷ !(LedgerState era)
- esSnapshots ∷ !SnapShots
- esNonMyopic ∷ !NonMyopic
- data PulsingRewUpdate
- data FutureGenDeleg = FutureGenDeleg {}
- data InstantaneousRewards = InstantaneousRewards {
- iRReserves ∷ !(Map (Credential 'Staking) Coin)
- iRTreasury ∷ !(Map (Credential 'Staking) Coin)
- deltaReserves ∷ !DeltaCoin
- deltaTreasury ∷ !DeltaCoin
- data LedgerState era = LedgerState {
- lsUTxOState ∷ !(UTxOState era)
- lsCertState ∷ !(CertState era)
- data PState era = PState {
- psStakePoolParams ∷ !(Map (KeyHash 'StakePool) PoolParams)
- psFutureStakePoolParams ∷ !(Map (KeyHash 'StakePool) PoolParams)
- psRetiring ∷ !(Map (KeyHash 'StakePool) EpochNo)
- psDeposits ∷ !(Map (KeyHash 'StakePool) Coin)
- type RewardAccounts = Map (Credential 'Staking) Coin
- data RewardUpdate = 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 UTxOState era = UTxOState {
- utxosUtxo ∷ !(UTxO era)
- utxosDeposited ∷ Coin
- utxosFees ∷ !Coin
- utxosGovState ∷ !(GovState era)
- utxosStakeDistr ∷ !IncrementalStake
- utxosDonation ∷ !Coin
- smartUTxOState ∷ EraTxOut era ⇒ PParams era → UTxO era → Coin → Coin → GovState era → Coin → UTxOState era
- data IncrementalStake = IStake {
- credMap ∷ !(Map (Credential 'Staking) (CompactForm Coin))
- ptrMap ∷ !(Map Ptr (CompactForm Coin))
- genesisState ∷ ∀ era. EraGov era ⇒ Map (KeyHash 'Genesis) GenDelegPair → UTxO era → LedgerState era
- consumed ∷ EraUTxO era ⇒ PParams era → CertState era → UTxO era → TxBody era → Value era
- produced ∷ EraUTxO era ⇒ PParams era → CertState era → TxBody era → Value era
- payPoolDeposit ∷ EraPParams era ⇒ KeyHash 'StakePool → PParams era → PState era → PState era
- refundPoolDeposit ∷ KeyHash 'StakePool → PState era → (Coin, PState era)
- totalObligation ∷ EraGov era ⇒ CertState era → GovState era → Coin
- allObligations ∷ EraGov era ⇒ CertState era → GovState era → Obligations
- incrementalStakeDistr ∷ ∀ era. EraPParams era ⇒ PParams era → IncrementalStake → DState era → PState era → SnapShot
- updateStakeDistribution ∷ EraTxOut era ⇒ PParams era → IncrementalStake → UTxO era → UTxO era → IncrementalStake
- applyRUpd ∷ EraGov era ⇒ RewardUpdate → EpochState era → EpochState era
- applyRUpdFiltered ∷ EraGov era ⇒ RewardUpdate → EpochState era → (EpochState era, FilteredRewards era)
- filterAllRewards ∷ EraGov era ⇒ Map (Credential 'Staking) (Set Reward) → EpochState era → FilteredRewards era
- data FilteredRewards era = FilteredRewards {
- frRegistered ∷ !(Map (Credential 'Staking) (Set Reward))
- frShelleyIgnored ∷ Map (Credential 'Staking) (Set Reward)
- frUnregistered ∷ Set (Credential 'Staking)
- frTotalUnregistered ∷ Coin
- createRUpd ∷ ∀ era. EraGov era ⇒ EpochSize → BlocksMade → EpochState era → Coin → ActiveSlotCoeff → Word64 → ShelleyBase RewardUpdate
- completeRupd ∷ PulsingRewUpdate → ShelleyBase (RewardUpdate, RewardEvent)
- startStep ∷ ∀ era. EraGov era ⇒ EpochSize → BlocksMade → EpochState era → Coin → ActiveSlotCoeff → Word64 → PulsingRewUpdate
- pulseStep ∷ PulsingRewUpdate → ShelleyBase (PulsingRewUpdate, RewardEvent)
- completeStep ∷ PulsingRewUpdate → ShelleyBase (PulsingRewUpdate, RewardEvent)
- data NewEpochState era = NewEpochState !EpochNo !BlocksMade !BlocksMade !(EpochState era) !(StrictMaybe PulsingRewUpdate) !PoolDistr !(StashedAVVMAddresses era)
- type family StashedAVVMAddresses era where ...
- stashedAVVMAddresses ∷ NewEpochState era → StashedAVVMAddresses era
- getGKeys ∷ NewEpochState era → Set (KeyHash 'Genesis)
- updateNES ∷ EraGov era ⇒ NewEpochState era → BlocksMade → LedgerState era → NewEpochState era
- circulation ∷ EpochState era → Coin → Coin
- decayFactor ∷ Float
- returnRedeemAddrsToReserves ∷ ∀ era. EraTxOut era ⇒ EpochState era → EpochState era
- updateNonMyopic ∷ NonMyopic → Coin → Map (KeyHash 'StakePool) Likelihood → NonMyopic
- emptyRewardUpdate ∷ RewardUpdate
- pvCanFollow ∷ ProtVer → ProtVer → Bool
- availableAfterMIR ∷ MIRPot → AccountState → InstantaneousRewards → Coin
- data ShelleyGovState era = ShelleyGovState {
- sgsCurProposals ∷ !(ProposedPPUpdates era)
- sgsFutureProposals ∷ !(ProposedPPUpdates era)
- sgsCurPParams ∷ !(PParams era)
- sgsPrevPParams ∷ !(PParams era)
- sgsFuturePParams ∷ !(FuturePParams era)
- nesPdL ∷ Lens' (NewEpochState era) PoolDistr
- nesEsL ∷ Lens' (NewEpochState era) (EpochState era)
- unifiedL ∷ Lens' (NewEpochState era) UMap
- nesELL ∷ Lens' (NewEpochState era) EpochNo
- nesBprevL ∷ Lens' (NewEpochState era) (Map (KeyHash 'StakePool) Natural)
- nesBcurL ∷ Lens' (NewEpochState era) (Map (KeyHash 'StakePool) Natural)
- nesRuL ∷ Lens' (NewEpochState era) (StrictMaybe PulsingRewUpdate)
- nesStashedAVVMAddressesL ∷ Lens' (NewEpochState era) (StashedAVVMAddresses era)
- nesEpochStateL ∷ Lens' (NewEpochState era) (EpochState era)
- esAccountStateL ∷ Lens' (EpochState era) AccountState
- esSnapshotsL ∷ Lens' (EpochState era) SnapShots
- esLStateL ∷ Lens' (EpochState era) (LedgerState era)
- esNonMyopicL ∷ Lens' (EpochState era) NonMyopic
- curPParamsEpochStateL ∷ EraGov era ⇒ Lens' (EpochState era) (PParams era)
- prevPParamsEpochStateL ∷ EraGov era ⇒ Lens' (EpochState era) (PParams era)
- futurePParamsEpochStateL ∷ EraGov era ⇒ Lens' (EpochState era) (FuturePParams era)
- asTreasuryL ∷ Lens' AccountState Coin
- asReservesL ∷ Lens' AccountState Coin
- lsUTxOStateL ∷ Lens' (LedgerState era) (UTxOState era)
- lsCertStateL ∷ Lens' (LedgerState era) (CertState era)
- utxosUtxoL ∷ Lens' (UTxOState era) (UTxO era)
- utxosDepositedL ∷ Lens' (UTxOState era) Coin
- utxosFeesL ∷ Lens' (UTxOState era) Coin
- utxosGovStateL ∷ Lens' (UTxOState era) (GovState era)
- utxosStakeDistrL ∷ Lens' (UTxOState era) IncrementalStake
- utxosDonationL ∷ Lens' (UTxOState era) Coin
- epochStateGovStateL ∷ Lens' (EpochState era) (GovState era)
- epochStateStakeDistrL ∷ Lens' (EpochState era) (VMap VB VP (Credential 'Staking) (CompactForm Coin))
- epochStateUMapL ∷ Lens' (EpochState era) UMap
- epochStatePoolParamsL ∷ Lens' (EpochState era) (Map (KeyHash 'StakePool) PoolParams)
- epochStateRegDrepL ∷ Lens' (EpochState era) (Map (Credential 'DRepRole) DRepState)
- epochStateIncrStakeDistrL ∷ Lens' (EpochState era) (Map (Credential 'Staking) (CompactForm Coin))
- epochStateDonationL ∷ Lens' (EpochState era) Coin
- newEpochStateGovStateL ∷ Lens' (NewEpochState era) (GovState era)
- epochStateTreasuryL ∷ Lens' (EpochState era) Coin
- certDStateL ∷ Lens' (CertState era) (DState era)
- certPStateL ∷ Lens' (CertState era) (PState era)
- certVStateL ∷ Lens' (CertState era) (VState era)
- dsUnifiedL ∷ Lens' (DState era) UMap
- dsGenDelegsL ∷ Lens' (DState era) GenDelegs
- dsIRewardsL ∷ Lens' (DState era) InstantaneousRewards
- dsFutureGenDelegsL ∷ Lens' (DState era) (Map FutureGenDeleg GenDelegPair)
- psStakePoolParamsL ∷ Lens' (PState era) (Map (KeyHash 'StakePool) PoolParams)
- psFutureStakePoolParamsL ∷ Lens' (PState era) (Map (KeyHash 'StakePool) PoolParams)
- psRetiringL ∷ Lens' (PState era) (Map (KeyHash 'StakePool) EpochNo)
- psDepositsL ∷ Lens' (PState era) (Map (KeyHash 'StakePool) Coin)
- vsDRepsL ∷ Lens' (VState era) (Map (Credential 'DRepRole) DRepState)
- vsCommitteeStateL ∷ Lens' (VState era) (CommitteeState era)
- credMapL ∷ Lens' IncrementalStake (Map (Credential 'Staking) (CompactForm Coin))
- ptrMapL ∷ Lens' IncrementalStake (Map Ptr (CompactForm Coin))
- ssStakeMarkL ∷ Lens' SnapShots SnapShot
- ssStakeMarkPoolDistrL ∷ Lens' SnapShots PoolDistr
- ssStakeSetL ∷ Lens' SnapShots SnapShot
- ssStakeGoL ∷ Lens' SnapShots SnapShot
- ssFeeL ∷ Lens' SnapShots Coin
- ssStakeL ∷ Lens' SnapShot Stake
- ssStakeDistrL ∷ Lens' SnapShot (VMap VB VP (Credential 'Staking) (CompactForm Coin))
- ssDelegationsL ∷ Lens' SnapShot (VMap VB VB (Credential 'Staking) (KeyHash 'StakePool))
- ssPoolParamsL ∷ Lens' SnapShot (VMap VB VB (KeyHash 'StakePool) PoolParams)
Documentation
data AccountState Source #
AccountState | |
|
Instances
The state associated with the DELPL rule, which combines the DELEG rule and the POOL rule.
CertState | |
|
Instances
ToJSON (CertState era) | |
Generic (CertState era) | |
Show (CertState era) | |
Era era ⇒ DecShareCBOR (CertState era) | |
Era era ⇒ EncCBOR (CertState era) | |
Default (CertState era) | |
Defined in Cardano.Ledger.CertState | |
NFData (CertState era) | |
Defined in Cardano.Ledger.CertState | |
Eq (CertState era) | |
NoThunks (CertState era) | |
type Rep (CertState era) | |
Defined in Cardano.Ledger.CertState type Rep (CertState era) = D1 ('MetaData "CertState" "Cardano.Ledger.CertState" "cardano-ledger-core-1.17.0.0-inplace" 'False) (C1 ('MetaCons "CertState" 'PrefixI 'True) (S1 ('MetaSel ('Just "certVState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VState era)) :*: (S1 ('MetaSel ('Just "certPState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PState era)) :*: S1 ('MetaSel ('Just "certDState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (DState era))))) | |
type Share (CertState era) | |
The state used by the DELEG rule, which roughly tracks stake delegation and some governance features.
DState | |
|
Instances
ToJSON (DState era) | |
Generic (DState era) | |
Show (DState era) | |
DecShareCBOR (DState era) | |
Era era ⇒ EncCBOR (DState era) | |
Default (DState era) | |
Defined in Cardano.Ledger.CertState | |
NFData (DState era) | |
Defined in Cardano.Ledger.CertState | |
Eq (DState era) | |
NoThunks (DState era) | |
type Rep (DState era) | |
Defined in Cardano.Ledger.CertState type Rep (DState era) = D1 ('MetaData "DState" "Cardano.Ledger.CertState" "cardano-ledger-core-1.17.0.0-inplace" 'False) (C1 ('MetaCons "DState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "dsUnified") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UMap) :*: S1 ('MetaSel ('Just "dsFutureGenDelegs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map FutureGenDeleg GenDelegPair))) :*: (S1 ('MetaSel ('Just "dsGenDelegs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 GenDelegs) :*: S1 ('MetaSel ('Just "dsIRewards") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 InstantaneousRewards)))) | |
type Share (DState era) | |
The state that tracks the voting entities (DReps and Constitutional Committee
members). In the formal ledger specification this type is called GState
VState | |
|
Instances
Generic (VState era) | |
Show (VState era) | |
Era era ⇒ DecCBOR (VState era) | |
Era era ⇒ DecShareCBOR (VState era) | |
Era era ⇒ EncCBOR (VState era) | |
Default (VState era) | |
Defined in Cardano.Ledger.CertState | |
NFData (VState era) | |
Defined in Cardano.Ledger.CertState | |
Eq (VState era) | |
NoThunks (VState era) | |
type Rep (VState era) | |
Defined in Cardano.Ledger.CertState type Rep (VState era) = D1 ('MetaData "VState" "Cardano.Ledger.CertState" "cardano-ledger-core-1.17.0.0-inplace" 'False) (C1 ('MetaCons "VState" 'PrefixI 'True) (S1 ('MetaSel ('Just "vsDReps") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (Credential 'DRepRole) DRepState)) :*: (S1 ('MetaSel ('Just "vsCommitteeState") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (CommitteeState era)) :*: S1 ('MetaSel ('Just "vsNumDormantEpochs") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 EpochNo)))) | |
type Share (VState era) | |
delegations ∷ DState era → UView (Credential 'Staking) (KeyHash 'StakePool) Source #
ptrsMap ∷ DState era → Map Ptr (Credential 'Staking) Source #
get the actual ptrs map, we don't need a view
data EpochState era Source #
EpochState | |
|
Instances
data PulsingRewUpdate Source #
The state used in the STS rules
Instances
data FutureGenDeleg Source #
Instances
data InstantaneousRewards Source #
InstantaneousRewards captures the pending changes to the ledger state caused by MIR certificates. It consists of two mappings, the rewards which will be paid out from the reserves and the rewards which will be paid out from the treasury. It also consists of two coin values which represent the transfer of coins from one pot to the other pot. NOTE that the following property should always hold: deltaReserves + deltaTreasury = 0
InstantaneousRewards | |
|
Instances
data LedgerState era Source #
The state associated with a Ledger
.
LedgerState | |
|
Instances
The state used by the POOL rule, which tracks stake pool information.
PState | |
|
Instances
type RewardAccounts = Map (Credential 'Staking) Coin Source #
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
There is a serious invariant that we must maintain in the UTxOState. Given (UTxOState utxo _ _ _ istake) it must be the case that istake == (updateStakeDistribution (UTxO Map.empty) (UTxO Map.empty) utxo) Of course computing the RHS of the above equality can be very expensive, so we only use this route in the testing function smartUTxO. But we are very careful, wherever we update the UTxO, we carefully make INCREMENTAL changes to istake to maintain this invariant. This happens in the UTxO rule.
UTxOState | |
|
Instances
smartUTxOState ∷ EraTxOut era ⇒ PParams era → UTxO era → Coin → Coin → GovState era → Coin → UTxOState era Source #
A valid (or self-consistent) UTxOState{utxosUtxo, utxosDeposited , utxosFees , utxosPpups , utxosStakeDistr} maintains an invariant between the utxosUtxo and utxosStakeDistr fields. the utxosStakeDistr field is the aggregation of Coin over the StakeReferences in the UTxO. It can be computed by a pure function from the _utxo field. In some situations, mostly unit or example tests, or when initializing a small UTxO, we want to create a UTxOState that computes the utxosStakeDistr from the utxosUtxo. This is aways safe to do, but if the utxosUtxo field is big, this can be very expensive, which defeats the purpose of memoizing the utxosStakeDistr field. So use of this function should be restricted to tests and initializations, where the invariant should be maintained.
TO IncrementalStake
data IncrementalStake Source #
Incremental Stake, Stake along with possible missed coins from danging Ptrs.
Transactions can use Ptrs to refer to a stake credential in a TxOut. The Ptr
does not have to point to anything until the epoch boundary, when we compute
rewards and aggregate staking information for ranking. This is unusual but legal.
In a non incremental system, we use whatever legal
Ptrs exist at the epoch
boundary. Here we are computing things incrementally, so we need to remember Ptrs
that might point to something by the time the epoch boundary is reached. When
the epoch boundary is reached we resolve
these pointers, to see if any have
become non-dangling since the time they were first used in the incremental computation.
IStake | |
|
Instances
Genesis State
genesisState ∷ ∀ era. EraGov era ⇒ Map (KeyHash 'Genesis) GenDelegPair → UTxO era → LedgerState era Source #
Creates the ledger state for an empty ledger which contains the specified transaction outputs.
Validation
consumed ∷ EraUTxO era ⇒ PParams era → CertState era → UTxO era → TxBody era → Value era Source #
For eras before Conway, VState is expected to have an empty Map for vsDReps, and so deposit summed up is zero.
produced ∷ EraUTxO era ⇒ PParams era → CertState era → TxBody era → Value era Source #
Compute the lovelace which are created by the transaction For eras before Conway, VState is expected to have an empty Map for vsDReps, and so deposit summed up is zero.
DelegationState
payPoolDeposit ∷ EraPParams era ⇒ KeyHash 'StakePool → PParams era → PState era → PState era Source #
One only pays a deposit on the initial pool registration. So return the the Deposits unchanged if the keyhash already exists. There are legal situations where a pool may be registered multiple times.
allObligations ∷ EraGov era ⇒ CertState era → GovState era → Obligations Source #
Epoch boundary
incrementalStakeDistr ∷ ∀ era. EraPParams era ⇒ PParams era → IncrementalStake → DState era → PState era → SnapShot Source #
This computes a Snapshot using IncrementalStake (which is an aggregate of the current UTxO) and UMap (which tracks Coin, SPoolUView, and Ptrs simultaneously). Note that logically: 1) IncrementalStake = (credStake, ptrStake) 2) UMap = (rewards, activeDelegs, ptrmap :: Map ptr cred)
Using this scheme the logic can do 3 things in one go, without touching the UTxO. 1) Resolve Pointers 2) Throw away things not actively delegated 3) Add up the coin
The Stake distribution function (Map cred coin) (the first component of a SnapShot) is defined by this SetAlgebra expression: (dom activeDelegs) ◁ (aggregate+ (credStake ∪ ptrStake ∪ rewards))
We can apply meaning preserving operations to get equivalent expressions
(dom activeDelegs) ◁ (aggregate+ (credStake ∪ ptrStake ∪ rewards)) aggregate+ (dom activeDelegs ◁ (credStake ∪ ptrStake ∪ rewards)) aggregate+ ((dom activeDelegs ◁ credStake) ∪ (dom activeDelegs ◁ ptrStake) ∪ (dom activeDelegs ◁ rewards))
We will compute this in several steps
step1 = (dom activeDelegs ◁ credStake) ∪ (dom activeDelegs ◁ ptrStake)
step2 = aggregate (dom activeDelegs ◁ rewards) step1
This function has a non-incremental analog, stakeDistr
, mosty used in tests, which does use the UTxO.
updateStakeDistribution ∷ EraTxOut era ⇒ PParams era → IncrementalStake → UTxO era → UTxO era → IncrementalStake Source #
Incrementally add the inserts utxoAdd
and the deletes utxoDel
to the IncrementalStake.
applyRUpd ∷ EraGov era ⇒ RewardUpdate → EpochState era → EpochState era Source #
Apply a RewardUpdate to the EpochState. Does several things 1) Adds reward coins to Rewards component of the UMap field of the DState, for actively delegated Stake 2) Adds to the Treasury of the AccountState for non-actively delegated stake 3) Adds fees to the UTxOState
applyRUpdFiltered ∷ EraGov era ⇒ RewardUpdate → EpochState era → (EpochState era, FilteredRewards era) Source #
filterAllRewards ∷ EraGov era ⇒ Map (Credential 'Staking) (Set Reward) → EpochState era → FilteredRewards era Source #
data FilteredRewards era Source #
FilteredRewards | |
|
Instances
NFData (FilteredRewards era) Source # | |
Defined in Cardano.Ledger.Shelley.LedgerState.IncrementalStake rnf ∷ FilteredRewards era → () Source # |
createRUpd ∷ ∀ era. EraGov era ⇒ EpochSize → BlocksMade → EpochState era → Coin → ActiveSlotCoeff → Word64 → ShelleyBase RewardUpdate Source #
To create a reward update, run all 3 phases This function is not used in the rules, so it ignores RewardEvents
completeRupd ∷ PulsingRewUpdate → ShelleyBase (RewardUpdate, RewardEvent) Source #
Phase 3 of reward update has several parts a) completeM the pulser (in case there are still computions to run) b) Combine the pulser provenance with the RewardProvenance c) Construct the final RewardUpdate d) Add the leader rewards to both the events and the computed Rewards
startStep ∷ ∀ era. EraGov era ⇒ EpochSize → BlocksMade → EpochState era → Coin → ActiveSlotCoeff → Word64 → PulsingRewUpdate Source #
pulseStep ∷ PulsingRewUpdate → ShelleyBase (PulsingRewUpdate, RewardEvent) Source #
Run the pulser for a bit. If is has nothing left to do, complete it.
data NewEpochState era Source #
New Epoch state and environment
NewEpochState !EpochNo !BlocksMade !BlocksMade !(EpochState era) !(StrictMaybe PulsingRewUpdate) !PoolDistr !(StashedAVVMAddresses era) |
Instances
type family StashedAVVMAddresses era where ... Source #
stashedAVVMAddresses ∷ NewEpochState era → StashedAVVMAddresses era Source #
AVVM addresses to be removed at the end of the Shelley era. Note that the existence of this field is a hack, related to the transition of UTxO to disk. We remove AVVM addresses from the UTxO on the Shelley/Allegra boundary. However, by this point the UTxO will be moved to disk, and hence doing a scan of the UTxO for AVVM addresses will be expensive. Our solution to this is to do a scan of the UTxO on the Byron/Shelley boundary (since Byron UTxO are still on disk), stash the results here, and then remove them at the Shelley/Allegra boundary.
This is very much an awkward implementation hack, and hence we hide it from as many places as possible.
updateNES ∷ EraGov era ⇒ NewEpochState era → BlocksMade → LedgerState era → NewEpochState era Source #
Update new epoch state
circulation ∷ EpochState era → Coin → Coin Source #
Calculate the current circulation
This is used in the rewards calculation, and for API endpoints for pool ranking.
Decay
Remove Bootstrap Redeem Addresses
returnRedeemAddrsToReserves ∷ ∀ era. EraTxOut era ⇒ EpochState era → EpochState era Source #
updateNonMyopic ∷ NonMyopic → Coin → Map (KeyHash 'StakePool) Likelihood → NonMyopic Source #
Check whether the new protocol version is a legitimate version bump with respect to the previous one.
availableAfterMIR ∷ MIRPot → AccountState → InstantaneousRewards → Coin Source #
This function returns the coin balance of a given pot, either the reserves or the treasury, after the instantaneous rewards and pot transfers are accounted for.
data ShelleyGovState era Source #
ShelleyGovState | |
|
Instances
Lenses from Types
nesEsL ∷ Lens' (NewEpochState era) (EpochState era) Source #
nesRuL ∷ Lens' (NewEpochState era) (StrictMaybe PulsingRewUpdate) Source #
nesStashedAVVMAddressesL ∷ Lens' (NewEpochState era) (StashedAVVMAddresses era) Source #
nesEpochStateL ∷ Lens' (NewEpochState era) (EpochState era) Source #
esAccountStateL ∷ Lens' (EpochState era) AccountState Source #
esSnapshotsL ∷ Lens' (EpochState era) SnapShots Source #
esLStateL ∷ Lens' (EpochState era) (LedgerState era) Source #
esNonMyopicL ∷ Lens' (EpochState era) NonMyopic Source #
curPParamsEpochStateL ∷ EraGov era ⇒ Lens' (EpochState era) (PParams era) Source #
prevPParamsEpochStateL ∷ EraGov era ⇒ Lens' (EpochState era) (PParams era) Source #
futurePParamsEpochStateL ∷ EraGov era ⇒ Lens' (EpochState era) (FuturePParams era) Source #
lsUTxOStateL ∷ Lens' (LedgerState era) (UTxOState era) Source #
lsCertStateL ∷ Lens' (LedgerState era) (CertState era) Source #
epochStateGovStateL ∷ Lens' (EpochState era) (GovState era) Source #
epochStateStakeDistrL ∷ Lens' (EpochState era) (VMap VB VP (Credential 'Staking) (CompactForm Coin)) Source #
epochStateUMapL ∷ Lens' (EpochState era) UMap Source #
epochStatePoolParamsL ∷ Lens' (EpochState era) (Map (KeyHash 'StakePool) PoolParams) Source #
epochStateRegDrepL ∷ Lens' (EpochState era) (Map (Credential 'DRepRole) DRepState) Source #
epochStateIncrStakeDistrL ∷ Lens' (EpochState era) (Map (Credential 'Staking) (CompactForm Coin)) Source #
epochStateDonationL ∷ Lens' (EpochState era) Coin Source #
newEpochStateGovStateL ∷ Lens' (NewEpochState era) (GovState era) Source #
epochStateTreasuryL ∷ Lens' (EpochState era) Coin Source #
Lenses from CertState
dsIRewardsL ∷ Lens' (DState era) InstantaneousRewards Source #
dsFutureGenDelegsL ∷ Lens' (DState era) (Map FutureGenDeleg GenDelegPair) Source #
psStakePoolParamsL ∷ Lens' (PState era) (Map (KeyHash 'StakePool) PoolParams) Source #
psFutureStakePoolParamsL ∷ Lens' (PState era) (Map (KeyHash 'StakePool) PoolParams) Source #
vsCommitteeStateL ∷ Lens' (VState era) (CommitteeState era) Source #
credMapL ∷ Lens' IncrementalStake (Map (Credential 'Staking) (CompactForm Coin)) Source #
ptrMapL ∷ Lens' IncrementalStake (Map Ptr (CompactForm Coin)) Source #
Lenses from SnapShot(s)
ssStakeDistrL ∷ Lens' SnapShot (VMap VB VP (Credential 'Staking) (CompactForm Coin)) Source #