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

Ouroboros.Consensus.Storage.ChainDB.API.Types.InvalidBlockPunishment

Description

How to punish the sender of a invalid block

Synopsis

opaque

data InvalidBlockPunishment m Source #

How to handle a discovered Invalidity

This type is opaque because the soundness of the punishment is subtle because of where it is invoked during the chain selection. As a result, arbitrary monadic actions would be foot guns. Instead, this module defines a small DSL for punishment that we judge to be sound.

Instances

Instances details
NoThunks (InvalidBlockPunishment m) Source # 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.API.Types.InvalidBlockPunishment

Methods

noThunks ∷ Context → InvalidBlockPunishment m → IO (Maybe ThunkInfo) #

wNoThunks ∷ Context → InvalidBlockPunishment m → IO (Maybe ThunkInfo) #

showTypeOfProxy (InvalidBlockPunishment m) → String #

combinators

data Invalidity Source #

Is the added block itself invalid, or is its prefix invalid?

Constructors

BlockItself 
BlockPrefix 

mkPunishThisThreadIOLike m ⇒ m (InvalidBlockPunishment m) Source #

Create a punishment that kills this thread

mkUnlessImproved ∷ ∀ proxy m blk. (IOLike m, NoThunks (SelectView (BlockProtocol blk)), Ord (SelectView (BlockProtocol blk))) ⇒ proxy blk → STM m (SelectView (BlockProtocol blk) → InvalidBlockPunishment m → InvalidBlockPunishment m) Source #

Allocate a stateful punishment that performs the given punishment unless the given header is better than the previous invocation