| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.ByronSpec.Ledger.Ledger
Synopsis
- newtype ByronSpecLedgerError = ByronSpecLedgerError {}
- initByronSpecLedgerState ∷ ∀ (mk ∷ MapKind). ByronSpecGenesis → LedgerState ByronSpecBlock mk
- data family LedgerState blk (mk ∷ MapKind)
- newtype LedgerTables blk (mk ∷ MapKind) = LedgerTables {
- getLedgerTables ∷ mk (TxIn blk) (TxOut blk)
- data family Ticked (st ∷ k) ∷ k
Documentation
newtype ByronSpecLedgerError Source #
Constructors
| ByronSpecLedgerError | |
Fields | |
Instances
| Eq ByronSpecLedgerError Source # | |
Defined in Ouroboros.Consensus.ByronSpec.Ledger.Ledger Methods | |
| Show ByronSpecLedgerError Source # | |
Defined in Ouroboros.Consensus.ByronSpec.Ledger.Ledger Methods showsPrec ∷ Int → ByronSpecLedgerError → ShowS # show ∷ ByronSpecLedgerError → String # showList ∷ [ByronSpecLedgerError] → ShowS # | |
| NoThunks ByronSpecLedgerError Source # | |
Defined in Ouroboros.Consensus.ByronSpec.Ledger.Ledger | |
initByronSpecLedgerState ∷ ∀ (mk ∷ MapKind). ByronSpecGenesis → LedgerState ByronSpecBlock mk Source #
Type family instances
data family LedgerState blk (mk ∷ MapKind) Source #
Ledger state associated with a block
This is the Consensus notion of a Ledger ledger state. Each block type is
associated with one of the Ledger types for the ledger state. Virtually
every concept in this codebase revolves around this type, or the referenced
blk. Whenever we use the type variable l we intend to signal that the
expected instantiation is either a LedgerState or some wrapper over it
(like the ExtLedgerState).
This type is parametrized over mk :: to express the
MapKindLedgerTables contained in such a LedgerState. See LedgerTables for a
more thorough description.
The main operations we can do with a LedgerState are ticking (defined in
IsLedger), and applying a block (defined in
ApplyBlock).
Instances
newtype LedgerTables blk (mk ∷ MapKind) Source #
The Ledger Tables represent the portion of the data on disk that has been pulled from disk and attached to the in-memory Ledger State or that will eventually be written to disk.
With UTxO-HD and the split of the Ledger ledger state into the in-memory
part and the on-disk part, this splitting was reflected in the new type
parameter added to the (Consensus)
LedgerState, to which we refer as "the
MapKind" or mk.
Every LedgerState (or LedgerState-like
type, such as the ExtLedgerState) is
associated with a LedgerTables and they both share the mk. They both are
of kind LedgerStateKind. LedgerTables is just a way to refer only to a
partial view of the on-disk data without having the rest of the in-memory
LedgerState in scope.
The mk can be instantiated to anything that is map-like, i.e. that expects
two type parameters, the key and the value.
Constructors
| LedgerTables | |
Fields
| |
Instances
| (∀ k v. LedgerTableConstraints' l k v ⇒ Monoid (mk k v), LedgerTableConstraints l) ⇒ Monoid (LedgerTables l mk) Source # | |||||
Defined in Ouroboros.Consensus.Ledger.Tables.Combinators Methods mempty ∷ LedgerTables l mk # mappend ∷ LedgerTables l mk → LedgerTables l mk → LedgerTables l mk # mconcat ∷ [LedgerTables l mk] → LedgerTables l mk # | |||||
| (∀ k v. LedgerTableConstraints' blk k v ⇒ Semigroup (mk k v), LedgerTableConstraints blk) ⇒ Semigroup (LedgerTables blk mk) Source # | |||||
Defined in Ouroboros.Consensus.Ledger.Tables.Combinators Methods (<>) ∷ LedgerTables blk mk → LedgerTables blk mk → LedgerTables blk mk # sconcat ∷ NonEmpty (LedgerTables blk mk) → LedgerTables blk mk # stimes ∷ Integral b ⇒ b → LedgerTables blk mk → LedgerTables blk mk # | |||||
| Eq (mk (TxIn blk) (TxOut blk)) ⇒ Eq (LedgerTables blk mk) Source # | |||||
Defined in Ouroboros.Consensus.Ledger.Tables.Basics Methods (==) ∷ LedgerTables blk mk → LedgerTables blk mk → Bool # (/=) ∷ LedgerTables blk mk → LedgerTables blk mk → Bool # | |||||
| Generic (LedgerTables blk mk) Source # | |||||
Defined in Ouroboros.Consensus.Ledger.Tables.Basics Associated Types
Methods from ∷ LedgerTables blk mk → Rep (LedgerTables blk mk) x # to ∷ Rep (LedgerTables blk mk) x → LedgerTables blk mk # | |||||
| Show (mk (TxIn blk) (TxOut blk)) ⇒ Show (LedgerTables blk mk) Source # | |||||
Defined in Ouroboros.Consensus.Ledger.Tables.Basics Methods showsPrec ∷ Int → LedgerTables blk mk → ShowS # show ∷ LedgerTables blk mk → String # showList ∷ [LedgerTables blk mk] → ShowS # | |||||
| NoThunks (mk (TxIn blk) (TxOut blk)) ⇒ NoThunks (LedgerTables blk mk) Source # | |||||
Defined in Ouroboros.Consensus.Ledger.Tables.Basics | |||||
| type Rep (LedgerTables blk mk) Source # | |||||
Defined in Ouroboros.Consensus.Ledger.Tables.Basics type Rep (LedgerTables blk mk) = D1 ('MetaData "LedgerTables" "Ouroboros.Consensus.Ledger.Tables.Basics" "ouroboros-consensus-4.0.0.0-inplace" 'True) (C1 ('MetaCons "LedgerTables" 'PrefixI 'True) (S1 ('MetaSel ('Just "getLedgerTables") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (mk (TxIn blk) (TxOut blk))))) | |||||
data family Ticked (st ∷ k) ∷ k 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.
Ticked is used mainly in two ways:
Ticked (Ext)LedgerStatewhere its kind gets concretized toStateKind -> StateKindTicked (HeaderState blk)where its kind gets concretized toType -> Type
Instances
| Show (Ticked ()) Source # | |
| ChainDepStateSupportsPeras (Ticked (ChainDepState (BlockProtocol blk))) ⇒ ChainDepStateSupportsPeras (Ticked (HeaderState blk)) Source # | |
Defined in Ouroboros.Consensus.HeaderValidation Methods getEpochNonce ∷ Ticked (HeaderState blk) → Nonce Source # | |
| ChainDepStateSupportsPeras (Ticked ()) Source # | |
Defined in Ouroboros.Consensus.Protocol.Abstract Methods getEpochNonce ∷ Ticked () → Nonce Source # | |
| HasLedgerTables (Ticked LedgerState) ByronSpecBlock Source # | |
Defined in Ouroboros.Consensus.ByronSpec.Ledger.Ledger Methods projectLedgerTables ∷ ∀ (mk ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked LedgerState ByronSpecBlock mk → LedgerTables ByronSpecBlock mk Source # withLedgerTables ∷ ∀ (mk ∷ MapKind) (any ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked LedgerState ByronSpecBlock any → LedgerTables ByronSpecBlock mk → Ticked LedgerState ByronSpecBlock mk Source # | |
| (NoThunks (TxIn blk), NoThunks (TxOut blk), HasLedgerTables (Ticked LedgerState) blk) ⇒ HasLedgerTables (Ticked ExtLedgerState) blk Source # | |
Defined in Ouroboros.Consensus.Ledger.Extended Methods projectLedgerTables ∷ ∀ (mk ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked ExtLedgerState blk mk → LedgerTables blk mk Source # withLedgerTables ∷ ∀ (mk ∷ MapKind) (any ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked ExtLedgerState blk any → LedgerTables blk mk → Ticked ExtLedgerState blk mk Source # | |
| LedgerTablesAreTrivial (Ticked LedgerState) ByronSpecBlock Source # | |
Defined in Ouroboros.Consensus.ByronSpec.Ledger.Ledger Methods convertMapKind ∷ ∀ (mk ∷ MapKind) (mk' ∷ MapKind). Ticked LedgerState ByronSpecBlock mk → Ticked LedgerState ByronSpecBlock mk' Source # | |
| (Bridge m a, HasLedgerTables (Ticked LedgerState) m) ⇒ HasLedgerTables (Ticked LedgerState) (DualBlock m a) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual Methods projectLedgerTables ∷ ∀ (mk ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked LedgerState (DualBlock m a) mk → LedgerTables (DualBlock m a) mk Source # withLedgerTables ∷ ∀ (mk ∷ MapKind) (any ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked LedgerState (DualBlock m a) any → LedgerTables (DualBlock m a) mk → Ticked LedgerState (DualBlock m a) mk Source # | |
| Bridge m a ⇒ GetTip (Ticked LedgerState (DualBlock m a)) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
| GetTip (Ticked LedgerState ByronSpecBlock) Source # | |
Defined in Ouroboros.Consensus.ByronSpec.Ledger.Ledger Methods getTip ∷ ∀ (mk ∷ MapKind). Ticked LedgerState ByronSpecBlock mk → Point (Ticked LedgerState ByronSpecBlock) Source # | |
| IsLedger LedgerState blk ⇒ GetTip (Ticked ExtLedgerState blk) Source # | |
Defined in Ouroboros.Consensus.Ledger.Extended Methods getTip ∷ ∀ (mk ∷ MapKind). Ticked ExtLedgerState blk mk → Point (Ticked ExtLedgerState blk) Source # | |
| LedgerStateSupportsPeras (Ticked LedgerState (DualBlock m a)) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual Methods getPoolDistr ∷ Ticked LedgerState (DualBlock m a) EmptyMK → PoolDistr Source # getPerasParams ∷ proxy blk → Ticked LedgerState (DualBlock m a) EmptyMK → PerasParams blk Source # | |
| Eq (Ticked LedgerState ByronSpecBlock mk) Source # | |
Defined in Ouroboros.Consensus.ByronSpec.Ledger.Ledger Methods (==) ∷ Ticked LedgerState ByronSpecBlock mk → Ticked LedgerState ByronSpecBlock mk → Bool # (/=) ∷ Ticked LedgerState ByronSpecBlock mk → Ticked LedgerState ByronSpecBlock mk → Bool # | |
| Show (Ticked LedgerState ByronSpecBlock mk) Source # | |
Defined in Ouroboros.Consensus.ByronSpec.Ledger.Ledger Methods showsPrec ∷ Int → Ticked LedgerState ByronSpecBlock mk → ShowS # show ∷ Ticked LedgerState ByronSpecBlock mk → String # showList ∷ [Ticked LedgerState ByronSpecBlock mk] → ShowS # | |
| NoThunks (Ticked LedgerState (DualBlock m a) mk) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
| NoThunks (Ticked LedgerState ByronSpecBlock mk) Source # | |
Defined in Ouroboros.Consensus.ByronSpec.Ledger.Ledger Methods noThunks ∷ Context → Ticked LedgerState ByronSpecBlock mk → IO (Maybe ThunkInfo) Source # wNoThunks ∷ Context → Ticked LedgerState ByronSpecBlock mk → IO (Maybe ThunkInfo) Source # showTypeOf ∷ Proxy (Ticked LedgerState ByronSpecBlock mk) → String Source # | |
| Show (Ticked (f a)) ⇒ Show (((Ticked ∷ Type → Type) :.: f) a) Source # | |
| NoThunks (Ticked (f a)) ⇒ NoThunks (((Ticked ∷ Type → Type) :.: f) a) Source # | |
| data Ticked () Source # | |
Defined in Ouroboros.Consensus.Ticked | |
| data Ticked (HardForkChainDepState xs ∷ Type) Source # | |
| data Ticked (HeaderState blk ∷ Type) Source # | |
Defined in Ouroboros.Consensus.HeaderValidation | |
| data Ticked (PBftState c ∷ Type) Source # | |
Defined in Ouroboros.Consensus.Protocol.PBFT | |
| newtype Ticked (WrapChainDepState blk ∷ Type) Source # | |
Defined in Ouroboros.Consensus.TypeFamilyWrappers | |
| type HeaderHash (Ticked l blk ∷ k2) Source # | |
Defined in Ouroboros.Consensus.Ticked | |
| data Ticked ExtLedgerState (blk ∷ Type) (mk ∷ MapKind) Source # | |
Defined in Ouroboros.Consensus.Ledger.Extended data Ticked ExtLedgerState (blk ∷ Type) (mk ∷ MapKind) = TickedExtLedgerState {
| |
| data Ticked LedgerState ByronSpecBlock (mk ∷ MapKind) Source # | |
| data Ticked LedgerState (HardForkBlock xs ∷ Type) (mk ∷ MapKind) Source # | |
| data Ticked LedgerState (DualBlock m a ∷ Type) (mk ∷ MapKind) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
Orphan instances
| GetBlockKeySets ByronSpecBlock Source # | |||||
Methods getBlockKeySets ∷ ByronSpecBlock → LedgerTables ByronSpecBlock KeysMK Source # | |||||
| UpdateLedger ByronSpecBlock Source # | |||||
| CommonProtocolParams ByronSpecBlock Source # | |||||
Methods maxHeaderSize ∷ ∀ (mk ∷ MapKind). LedgerState ByronSpecBlock mk → Word32 Source # maxTxSize ∷ ∀ (mk ∷ MapKind). LedgerState ByronSpecBlock mk → Word32 Source # | |||||
| ApplyBlock LedgerState ByronSpecBlock Source # | |||||
Methods applyBlockLedgerResultWithValidation ∷ ValidationPolicy → ComputeLedgerEvents → LedgerCfg LedgerState ByronSpecBlock → ByronSpecBlock → Ticked LedgerState ByronSpecBlock ValuesMK → Except (LedgerErr LedgerState ByronSpecBlock) (LedgerResult ByronSpecBlock (LedgerState ByronSpecBlock DiffMK)) Source # applyBlockLedgerResult ∷ ComputeLedgerEvents → LedgerCfg LedgerState ByronSpecBlock → ByronSpecBlock → Ticked LedgerState ByronSpecBlock ValuesMK → Except (LedgerErr LedgerState ByronSpecBlock) (LedgerResult ByronSpecBlock (LedgerState ByronSpecBlock DiffMK)) Source # reapplyBlockLedgerResult ∷ ComputeLedgerEvents → LedgerCfg LedgerState ByronSpecBlock → ByronSpecBlock → Ticked LedgerState ByronSpecBlock ValuesMK → LedgerResult ByronSpecBlock (LedgerState ByronSpecBlock DiffMK) Source # | |||||
| IsLedger LedgerState ByronSpecBlock Source # | |||||
Associated Types
| |||||
| HasLedgerTables LedgerState ByronSpecBlock Source # | |||||
Methods projectLedgerTables ∷ ∀ (mk ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ LedgerState ByronSpecBlock mk → LedgerTables ByronSpecBlock mk Source # withLedgerTables ∷ ∀ (mk ∷ MapKind) (any ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ LedgerState ByronSpecBlock any → LedgerTables ByronSpecBlock mk → LedgerState ByronSpecBlock mk Source # | |||||
| LedgerTablesAreTrivial LedgerState ByronSpecBlock Source # | |||||
Methods convertMapKind ∷ ∀ (mk ∷ MapKind) (mk' ∷ MapKind). LedgerState ByronSpecBlock mk → LedgerState ByronSpecBlock mk' Source # | |||||
| IndexedMemPack LedgerState ByronSpecBlock Void Source # | |||||
Methods indexedPackedByteCount ∷ LedgerState ByronSpecBlock EmptyMK → Void → Int Source # indexedPackM ∷ LedgerState ByronSpecBlock EmptyMK → Void → Pack s () Source # indexedUnpackM ∷ Buffer b ⇒ ∀ s. LedgerState ByronSpecBlock EmptyMK → Unpack s b Void Source # indexedTypeName ∷ Proxy Void → LedgerState ByronSpecBlock EmptyMK → String Source # | |||||
| GetTip (LedgerState ByronSpecBlock) Source # | |||||
Methods getTip ∷ ∀ (mk ∷ MapKind). LedgerState ByronSpecBlock mk → Point (LedgerState ByronSpecBlock) Source # | |||||
| Eq (LedgerState ByronSpecBlock mk) Source # | |||||
Methods (==) ∷ LedgerState ByronSpecBlock mk → LedgerState ByronSpecBlock mk → Bool # (/=) ∷ LedgerState ByronSpecBlock mk → LedgerState ByronSpecBlock mk → Bool # | |||||
| Generic (LedgerState ByronSpecBlock mk) Source # | |||||
Associated Types
Methods from ∷ LedgerState ByronSpecBlock mk → Rep (LedgerState ByronSpecBlock mk) x # to ∷ Rep (LedgerState ByronSpecBlock mk) x → LedgerState ByronSpecBlock mk # | |||||
| Show (LedgerState ByronSpecBlock mk) Source # | |||||
Methods showsPrec ∷ Int → LedgerState ByronSpecBlock mk → ShowS # show ∷ LedgerState ByronSpecBlock mk → String # showList ∷ [LedgerState ByronSpecBlock mk] → ShowS # | |||||
| NoThunks (LedgerState ByronSpecBlock mk) Source # | |||||
Methods noThunks ∷ Context → LedgerState ByronSpecBlock mk → IO (Maybe ThunkInfo) Source # wNoThunks ∷ Context → LedgerState ByronSpecBlock mk → IO (Maybe ThunkInfo) Source # showTypeOf ∷ Proxy (LedgerState ByronSpecBlock mk) → String Source # | |||||
| Serialise (LedgerState ByronSpecBlock mk) Source # | |||||
Methods encode ∷ LedgerState ByronSpecBlock mk → Encoding Source # decode ∷ Decoder s (LedgerState ByronSpecBlock mk) Source # encodeList ∷ [LedgerState ByronSpecBlock mk] → Encoding Source # decodeList ∷ Decoder s [LedgerState ByronSpecBlock mk] Source # | |||||
| HasLedgerTables (Ticked LedgerState) ByronSpecBlock Source # | |||||
Methods projectLedgerTables ∷ ∀ (mk ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked LedgerState ByronSpecBlock mk → LedgerTables ByronSpecBlock mk Source # withLedgerTables ∷ ∀ (mk ∷ MapKind) (any ∷ MapKind). (CanMapMK mk, CanMapKeysMK mk, ZeroableMK mk) ⇒ Ticked LedgerState ByronSpecBlock any → LedgerTables ByronSpecBlock mk → Ticked LedgerState ByronSpecBlock mk Source # | |||||
| LedgerTablesAreTrivial (Ticked LedgerState) ByronSpecBlock Source # | |||||
Methods convertMapKind ∷ ∀ (mk ∷ MapKind) (mk' ∷ MapKind). Ticked LedgerState ByronSpecBlock mk → Ticked LedgerState ByronSpecBlock mk' Source # | |||||
| GetTip (Ticked LedgerState ByronSpecBlock) Source # | |||||
Methods getTip ∷ ∀ (mk ∷ MapKind). Ticked LedgerState ByronSpecBlock mk → Point (Ticked LedgerState ByronSpecBlock) Source # | |||||
| Eq (Ticked LedgerState ByronSpecBlock mk) Source # | |||||
Methods (==) ∷ Ticked LedgerState ByronSpecBlock mk → Ticked LedgerState ByronSpecBlock mk → Bool # (/=) ∷ Ticked LedgerState ByronSpecBlock mk → Ticked LedgerState ByronSpecBlock mk → Bool # | |||||
| Show (Ticked LedgerState ByronSpecBlock mk) Source # | |||||
Methods showsPrec ∷ Int → Ticked LedgerState ByronSpecBlock mk → ShowS # show ∷ Ticked LedgerState ByronSpecBlock mk → String # showList ∷ [Ticked LedgerState ByronSpecBlock mk] → ShowS # | |||||
| NoThunks (Ticked LedgerState ByronSpecBlock mk) Source # | |||||
Methods noThunks ∷ Context → Ticked LedgerState ByronSpecBlock mk → IO (Maybe ThunkInfo) Source # wNoThunks ∷ Context → Ticked LedgerState ByronSpecBlock mk → IO (Maybe ThunkInfo) Source # showTypeOf ∷ Proxy (Ticked LedgerState ByronSpecBlock mk) → String Source # | |||||