scalus.cardano.ledger.epoch

Members list

Type members

Classlikes

case class AccountState(treasury: Coin, reserves: Coin)

The two pots of ADA outside the UTxO set and the accounts, the ledger's ChainAccountState: the treasury and the reserves, ledger-rules spec [DM-9].

The two pots of ADA outside the UTxO set and the accounts, the ledger's ChainAccountState: the treasury and the reserves, ledger-rules spec [DM-9].

The ledger reads the treasury of the last epoch boundary in LEDGER, so a tx's currentTreasuryValue must equal it; the Emulator keeps UtxoEnv.treasury equal to it, spec [DM-13]. The reserves fund the rewards of phase 4.

Value parameters

reserves

the reserves, casReserves

treasury

the treasury, casTreasury

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object AccountState

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class EnactState(committee: Option[Committee], constitution: Constitution, params: ProtocolParams, withdrawals: Map[Credential, Coin], roots: GovRoots)

What the enactment of the ratified actions gives, the ledger's EnactState (eras/conway/impl/src/Cardano/Ledger/Conway/Governance/Internal.hs:131-141) without the treasury and the previous pparams, ledger-rules spec [DM-12a], D86. The treasury is a variable of one RATIFY run only (RATIFY sets it to 0 when the run ends, conway Rules/Ratify.hs:360), and the ledger never reads ensPrevPParams.

What the enactment of the ratified actions gives, the ledger's EnactState (eras/conway/impl/src/Cardano/Ledger/Conway/Governance/Internal.hs:131-141) without the treasury and the previous pparams, ledger-rules spec [DM-12a], D86. The treasury is a variable of one RATIFY run only (RATIFY sets it to 0 when the run ends, conway Rules/Ratify.hs:360), and the ledger never reads ensPrevPParams.

Value parameters

committee

the committee, or None after a NoConfidence

params

the current pparams with the enacted ParameterChange and HardForkInitiation actions applied

roots

the last enacted action of each purpose

withdrawals

the enacted treasury withdrawals, summed per credential, spec [EN-6]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class EpochState

The node's EpochState (eras/shelley/impl/src/Cardano/Ledger/Shelley/LedgerState/Types.hs:66-75) with the parts of the node's ConwayGovState (eras/conway/impl/src/Cardano/Ledger/Conway/Governance.hs:245-252) that only epoch boundaries write, D122.

The node's EpochState (eras/shelley/impl/src/Cardano/Ledger/Shelley/LedgerState/Types.hs:66-75) with the parts of the node's ConwayGovState (eras/conway/impl/src/Cardano/Ledger/Conway/Governance.hs:245-252) that only epoch boundaries write, D122.

In the node, params, prevParams, futureParams and the ratify pulser live in the gov state of ledgerState. Here they sit beside it: the Scalus GovState holds only the part the tx rules read and write, D27, and the current pparams stay in the validation context, spec [DM-7].

Value parameters

accountState

the treasury and the reserves, esChainAccountState

futureParams

the pparams the next boundary adopts, cgsFuturePParams, D125

ledgerState

the ledger state of the tx rules, esLState

nonMyopic

the pool-ranking data, esNonMyopic; always NonMyopic.empty, D124

params

the current pparams, cgsCurPParams

pendingRatify

the ratify result the next boundary enacts, the result of cgsDRepPulsingState

prevParams

the pparams before the last boundary, cgsPrevPParams

snapshots

the stake snapshots and the fee snapshot, esSnapshots

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

The pparams the next epoch boundary adopts, the node's FuturePParams (libs/cardano-ledger-core/src/Cardano/Ledger/State/Governance.hs:90-101), D125.

The pparams the next epoch boundary adopts, the node's FuturePParams (libs/cardano-ledger-core/src/Cardano/Ledger/State/Governance.hs:90-101), D125.

The node has a third case, PotentialPParamsUpdate, for the time before the ratify pulser is done. The Emulator computes the ratify result whole at the boundary, D3, so the update is always known: it is never potential. Java reads the case with instanceof FuturePParams.DefinitePParamsUpdate and its params(), and builds one with the static forwarders FuturePParams.noPParamsUpdate() and definitePParamsUpdate(params), interop rule 9.

Attributes

Companion
object
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object FuturePParams

Attributes

Companion
enum
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class IndividualPoolStake

The stake of one pool, the node's IndividualPoolStake (libs/cardano-ledger-core/src/Cardano/Ledger/State/PoolDistr.hs:54-62).

The stake of one pool, the node's IndividualPoolStake (libs/cardano-ledger-core/src/Cardano/Ledger/State/PoolDistr.hs:54-62).

Value parameters

stakeShare

the pool's stake over the total active stake, in lowest terms, individualPoolStake

totalStake

the stake delegated to the pool, individualTotalPoolStake

vrfKeyHash

the VRF key of the pool params, individualPoolStakeVrf

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class NewEpochState

The whole ledger state of the Emulator in the shape of the node's NewEpochState (eras/shelley/impl/src/Cardano/Ledger/Shelley/LedgerState/Types.hs:308-333), ledger-rules spec D122. A read result: the Emulator builds it, a caller reads it; a new field later adds an accessor only. stashedAVVMAddresses is left out: it is empty after the Allegra era. Java reads the maps and the reward update through the getters of NewEpochStatePlatform, D128.

The whole ledger state of the Emulator in the shape of the node's NewEpochState (eras/shelley/impl/src/Cardano/Ledger/Shelley/LedgerState/Types.hs:308-333), ledger-rules spec D122. A read result: the Emulator builds it, a caller reads it; a new field later adds an accessor only. stashedAVVMAddresses is left out: it is empty after the Allegra era. Java reads the maps and the reward update through the getters of NewEpochStatePlatform, D128.

Value parameters

blocksMadeCur

the blocks each pool made since the last boundary, nesBcur

blocksMadePrev

the blocks each pool made in the epoch before the last boundary, nesBprev

epochState

the epoch state, nesEs

lastEpoch

the epoch of the last boundary the ledger ran, nesEL, D66

pendingRewards

the reward update the last boundary computed and the next one applies, nesRu; the Emulator computes it whole at the boundary, so it is never a pulser, D3

poolDistr

the stake distribution of the pools for this epoch, nesPd, D123

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait InteropApi
class Object
trait Matchable
class Any
Show all
object NonMyopic

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
NonMyopic.type
final case class NonMyopic

The pool-ranking data of the node, NonMyopic (eras/shelley/impl/src/Cardano/Ledger/Shelley/PoolRank.hs:231-235). Not part of the protocol: only the wallet ranking getNonMyopicMemberRewards reads it. The Emulator does not compute it, so it is always NonMyopic.empty, D124.

The pool-ranking data of the node, NonMyopic (eras/shelley/impl/src/Cardano/Ledger/Shelley/PoolRank.hs:231-235). Not part of the protocol: only the wallet ranking getNonMyopicMemberRewards reads it. The Emulator does not compute it, so it is always NonMyopic.empty, D124.

Value parameters

likelihoods

the log-weights of each pool's block counts, likelihoodsNM (a Likelihood is a sequence of Float log-weights, PoolRank.hs:88-101)

rewardPot

the reward pot of the last reward update, rewardPotNM

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait InteropApi
class Object
trait Matchable
class Any
Show all
final case class PoolDistr

The stake distribution of the pools, the node's PoolDistr (libs/cardano-ledger-core/src/Cardano/Ledger/State/PoolDistr.hs:98-106), D123.

The stake distribution of the pools, the node's PoolDistr (libs/cardano-ledger-core/src/Cardano/Ledger/State/PoolDistr.hs:98-106), D123.

Value parameters

pools

the stake of each pool with at least one delegator, unPoolDistr

totalActiveStake

the total active stake of the snapshot, at least 1 lovelace, pdTotalActiveStake

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait InteropApi
class Object
trait Matchable
class Any
Show all
object PoolDistr

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
PoolDistr.type
enum PoolPerformance extends Enum[PoolPerformance]

How the reward calculation rates the pools, ledger-rules spec [ES-1], [ES-1a].

How the reward calculation rates the pools, ledger-rules spec [ES-1], [ES-1a].

In the Instant preset each tx makes one block, at any slot, so the blocks made are far below the expected blocks and Measured rewards are close to 0. Ideal, the default, pays what a node where every pool is perfect pays.

Attributes

Companion
object
Supertypes
trait Enum
trait Product
trait Equals
class Enum[PoolPerformance]
trait Serializable
trait Comparable[PoolPerformance]
trait Constable
class Object
trait Matchable
class Any
Show all

Attributes

Companion
enum
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
case class PoolSnapshot(stake: Coin, selfDelegatedOwners: Set[AddrKeyHash], selfDelegatedOwnersStake: Coin, vrfKeyHash: VrfKeyHash, pledge: Coin, cost: Coin, margin: UnitInterval, numDelegators: Int, rewardAccount: Credential)

One pool in a StakeSnapshot, the ledger's StakePoolSnapShot without the derived spssStakeRatio (cardano-ledger-core State/SnapShots.hs:160-185), ledger-rules spec [DM-10b], [SN-8].

One pool in a StakeSnapshot, the ledger's StakePoolSnapShot without the derived spssStakeRatio (cardano-ledger-core State/SnapShots.hs:160-185), ledger-rules spec [DM-10b], [SN-8].

Value parameters

cost

the fixed cost of the pool params

margin

the margin of the pool params

numDelegators

the number of registered accounts that delegate to the pool, whatever their stake

pledge

the pledge of the pool params

rewardAccount

the credential of the reward account of the pool params

selfDelegatedOwners

the owners whose key credential is a registered account that delegates to the pool

selfDelegatedOwnersStake

the sum of the active stake of selfDelegatedOwners

stake

the sum of the active stake of the credentials that delegate to the pool

vrfKeyHash

the VRF key of the pool params

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class RatifyState(enactState: EnactState, enacted: Vector[GovActionId], expired: Set[GovActionId], delayed: Boolean)

The result of one RATIFY run, the ledger's RatifyState (eras/conway/impl/src/Cardano/Ledger/Conway/Governance/Internal.hs:257-275), ledger-rules spec [DM-12a].

The result of one RATIFY run, the ledger's RatifyState (eras/conway/impl/src/Cardano/Ledger/Conway/Governance/Internal.hs:257-275), ledger-rules spec [DM-12a].

Value parameters

delayed

whether an enacted delaying action stopped the run from enacting more, spec [RT-5c]

enactState

the enact state after the run

enacted

the ids of the enacted actions, in the order RATIFY enacted them

expired

the ids of the actions that expired unenacted, spec [RT-10]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class RewardUpdate(deltaT: Coin, deltaR: Coin, rewards: Map[Credential, Coin], deltaF: Coin)

The reward update one epoch boundary computes and the next applies, the ledger's RewardUpdate without nonMyopic (shelley RewardUpdate.hs:111-131), ledger-rules spec [DM-11a].

The reward update one epoch boundary computes and the next applies, the ledger's RewardUpdate without nonMyopic (shelley RewardUpdate.hs:111-131), ledger-rules spec [DM-11a].

The four parts sum to 0, spec [RW-9]: deltaT + deltaR + Σ rewards + deltaF = 0.

Value parameters

deltaF

the change to the fees, minus the fee snapshot

deltaR

the change to the reserves, with its sign: what was not paid out minus what was taken

deltaT

the change to the treasury, floor(tau · rPot)

rewards

the reward of each credential, the leader and member rewards of one credential summed, spec [RW-7]. A member reward of 0 is not an entry; the leader reward of every pool that earns is, also when it is 0, spec [RW-8a]

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case class SnapShots(mark: StakeSnapshot, set: StakeSnapshot, go: StakeSnapshot, fee: Coin)

The three stake snapshots and the fee snapshot of an epoch boundary, the ledger's SnapShots (cardano-ledger-core State/SnapShots.hs), ledger-rules spec [DM-9a].

The three stake snapshots and the fee snapshot of an epoch boundary, the ledger's SnapShots (cardano-ledger-core State/SnapShots.hs), ledger-rules spec [DM-9a].

SNAP makes a new mark at every boundary and moves the others down one: go := set, set := mark, spec [EB-6]. Rewards read go, the stake of two boundaries ago.

Value parameters

fee

the fees of the ledger at the last boundary, ssFee

go

the stake at the boundary before that, ssStakeGo

mark

the stake at the last boundary, ssStakeMark

set

the stake at the boundary before, ssStakeSet

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object SnapShots

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
SnapShots.type
case class StakeSnapshot(activeStake: Map[Credential, Coin], delegations: Map[Credential, PoolKeyHash], pools: Map[PoolKeyHash, PoolSnapshot])

The stake of one boundary, the ledger's SnapShot, ledger-rules spec [DM-10a].

The stake of one boundary, the ledger's SnapShot, ledger-rules spec [DM-10a].

Value parameters

activeStake

the stake of each registered credential that delegates to a pool and has stake above 0: the coin of its base-address outputs plus its reward balance, spec [SN-2] to [SN-5]

delegations

the pool each credential of activeStake delegates to, with the same keys

pools

one entry per registered pool at the boundary, also a pool with no stake, spec [SN-7]

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object StakeSnapshot

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type