ouroboros-consensus-0.1.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Ledger.Abstract

Description

Interface to the ledger layer

Synopsis

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

Instances details
LedgerSupportsProtocol blk => ApplyBlock (ExtLedgerState blk) blk Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Extended

CanHardFork xs => ApplyBlock (LedgerState (HardForkBlock xs)) (HardForkBlock xs) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

Bridge m a => ApplyBlock (LedgerState (DualBlock m a)) (DualBlock m a) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

ApplyBlock l blk => ApplyBlock (LedgerDB l (RealPoint blk)) blk Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.InMemory

class ApplyBlock (LedgerState blk) blk => UpdateLedger blk Source #

Interaction with the ledger layer

Instances

Instances details
CanHardFork xs => UpdateLedger (HardForkBlock xs) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger

Bridge m a => UpdateLedger (DualBlock m a) Source # 
Instance details

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

Re-exports