| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Ledger.Abstract
Description
Interface to the ledger layer
Synopsis
- class (IsLedger l, HeaderHash l ~ HeaderHash blk, HasHeader blk, HasHeader (Header blk)) => ApplyBlock l blk where
- applyLedgerBlock :: HasCallStack => LedgerCfg l -> blk -> Ticked l -> Except (LedgerErr l) l
- reapplyLedgerBlock :: HasCallStack => LedgerCfg l -> blk -> Ticked l -> l
- class ApplyBlock (LedgerState blk) blk => UpdateLedger blk
- tickThenApply :: ApplyBlock l blk => LedgerCfg l -> blk -> l -> Except (LedgerErr l) l
- tickThenReapply :: ApplyBlock l blk => LedgerCfg l -> blk -> l -> l
- foldLedger :: ApplyBlock l blk => LedgerCfg l -> [blk] -> l -> Except (LedgerErr l) l
- refoldLedger :: ApplyBlock l blk => LedgerCfg l -> [blk] -> l -> l
- ledgerTipHash :: forall blk. UpdateLedger blk => LedgerState blk -> ChainHash blk
- ledgerTipPoint :: UpdateLedger blk => Proxy blk -> LedgerState blk -> Point blk
- ledgerTipSlot :: forall blk. UpdateLedger blk => LedgerState blk -> WithOrigin SlotNo
- module Ouroboros.Consensus.Ledger.Basics
Apply block
class (IsLedger l, HeaderHash l ~ HeaderHash blk, HasHeader blk, HasHeader (Header blk)) => ApplyBlock l blk where Source #
Methods
applyLedgerBlock :: HasCallStack => LedgerCfg l -> blk -> Ticked l -> Except (LedgerErr l) l Source #
Apply a block to the ledger state.
This is passed the ledger state ticked with the slot of the given block,
so applyChainTick has already been called.
reapplyLedgerBlock :: HasCallStack => LedgerCfg l -> blk -> Ticked l -> l Source #
Re-apply a block to the very same ledger state it was applied in before.
Since a block can only be applied to a single, specific, ledger state, if we apply a previously applied block again it will be applied in the very same ledger state, and therefore can't possibly fail.
It is worth noting that since we already know that the block is valid in the provided ledger state, the ledger layer should not perform any validation checks.
Instances
class ApplyBlock (LedgerState blk) blk => UpdateLedger blk Source #
Interaction with the ledger layer
Instances
| CanHardFork xs => UpdateLedger (HardForkBlock xs) Source # | |
| Bridge m a => UpdateLedger (DualBlock m a) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
Derived
tickThenApply :: ApplyBlock l blk => LedgerCfg l -> blk -> l -> Except (LedgerErr l) l Source #
tickThenReapply :: ApplyBlock l blk => LedgerCfg l -> blk -> l -> l Source #
foldLedger :: ApplyBlock l blk => LedgerCfg l -> [blk] -> l -> Except (LedgerErr l) l Source #
refoldLedger :: ApplyBlock l blk => LedgerCfg l -> [blk] -> l -> l Source #
Short-hand
ledgerTipHash :: forall blk. UpdateLedger blk => LedgerState blk -> ChainHash blk Source #
ledgerTipPoint :: UpdateLedger blk => Proxy blk -> LedgerState blk -> Point blk Source #
Wrapper around ledgerTipPoint that uses a proxy to fix blk
This is occassionally useful to guide type inference
ledgerTipSlot :: forall blk. UpdateLedger blk => LedgerState blk -> WithOrigin SlotNo Source #