Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data StakeHolder
- type AddrDist = Map Addr NodeId
- newtype StakeDist = StakeDist {}
- equalStakeDist ∷ AddrDist → StakeDist
- genesisStakeDist ∷ AddrDist → StakeDist
- relativeStakes ∷ Map StakeHolder Amount → StakeDist
- stakeWithDefault ∷ Rational → CoreNodeId → StakeDist → Rational
- totalStakes ∷ Map Addr NodeId → Utxo → Map StakeHolder Amount
- data family Ticked st
Stakeholders
data StakeHolder Source #
StakeCore CoreNodeId | Stake of a core node |
StakeEverybodyElse | Stake for everybody else (we don't need to distinguish) |
Instances
Show StakeHolder Source # | |
Defined in Ouroboros.Consensus.Mock.Ledger.Stake showsPrec ∷ Int → StakeHolder → ShowS # show ∷ StakeHolder → String # showList ∷ [StakeHolder] → ShowS # | |
Eq StakeHolder Source # | |
Defined in Ouroboros.Consensus.Mock.Ledger.Stake (==) ∷ StakeHolder → StakeHolder → Bool # (/=) ∷ StakeHolder → StakeHolder → Bool # | |
Ord StakeHolder Source # | |
Defined in Ouroboros.Consensus.Mock.Ledger.Stake compare ∷ StakeHolder → StakeHolder → Ordering # (<) ∷ StakeHolder → StakeHolder → Bool # (<=) ∷ StakeHolder → StakeHolder → Bool # (>) ∷ StakeHolder → StakeHolder → Bool # (>=) ∷ StakeHolder → StakeHolder → Bool # max ∷ StakeHolder → StakeHolder → StakeHolder # min ∷ StakeHolder → StakeHolder → StakeHolder # |
Address distribution
type AddrDist = Map Addr NodeId Source #
Mapping from addresses to node IDs
This is needed in order to assign stake to nodes.
Stake distribution
In the mock setup, only core nodes have stake
INVARIANT: The rationals should sum to 1.
equalStakeDist ∷ AddrDist → StakeDist Source #
Stake distribution where every address has equal state
genesisStakeDist ∷ AddrDist → StakeDist Source #
Genesis stake distribution
totalStakes ∷ Map Addr NodeId → Utxo → Map StakeHolder Amount Source #
Compute stakes of all nodes
The Nothing
value holds the total stake of all addresses that don't
get mapped to a NodeId.
Type family instances
data family Ticked st Source #
" Ticked " piece of state, either LedgerState
or ChainDepState
Ticking refers to the passage of time (the ticking of the clock). When a
piece of state is marked as ticked, it means that time-related changes have
been applied to the state. There are exactly two methods in the interface
that do that: tickChainDepState
and
applyChainTickLedgerResult
.
Also note that a successful forecast
must equal
forecastFor
(ledgerViewForecastAt
cfg st)
slot
. Thus a
protocolLedgerView
cfg
(applyChainTick
cfg slot st)LedgerView
can only be projected
from a Ticked
state, but cannot itself be ticked.
Some examples of time related changes:
- Scheduled delegations might have been applied in Byron
- New leader schedule computed for Shelley
- Transition from Byron to Shelley activated in the hard fork combinator.
- Nonces switched out at the start of a new epoch.