tests
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Chain.Direct.HandlersSpec

Synopsis

Documentation

genTimeHandleWithSlotInsideHorizon :: Gen (TimeHandle, SlotNo) Source #

genTimeHandleWithSlotPastHorizon :: Gen (TimeHandle, SlotNo) Source #

spec :: Spec Source #

recordEventsHandler :: ChainContext -> ChainStateAt -> GetTimeHandle IO -> IO (ChainSyncHandler IO, IO [ChainEvent Tx]) Source #

Create a chain sync handler which records events as they are called back.

data TestBlock Source #

A block used for testing. This is a simpler version of the cardano-api Block and can be de-/constructed easily.

Constructors

TestBlock BlockHeader [Tx] 

withCounterExample :: [TestBlock] -> TVar IO ChainStateAt -> IO a -> PropertyM IO a Source #

genBlockAt :: SlotNo -> [Tx] -> Gen TestBlock Source #

Thin wrapper which generates a TestBlock at some specific slot.

genRollbackPoint :: [TestBlock] -> Gen ChainPoint Source #

Pick a block point in a list of blocks.

genRollbackBlocks :: [TestBlock] -> Gen (ChainPoint, [TestBlock]) Source #

Pick a rollback point from a list of blocks and also yield the tail of blocks to be replayed.

genSequenceOfObservableBlocks :: Gen (ChainContext, ChainStateAt, [TestBlock]) Source #

Generate a non-sparse sequence of blocks each containing an observable transaction, starting from the returned on-chain head state.

Note that this does not generate the entire spectrum of observable transactions in Hydra, but only init and commits, which is already sufficient to observe at least one state transition and different levels of rollback.

showRollbackInfo :: (Word, ChainPoint) -> String Source #