hydra-node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Chain.Direct.HandlersSpec

Synopsis

Documentation

genTimeHandleWithSlotInsideHorizon :: Gen (TimeHandle, SlotNo) Source #

genTimeHandleWithSlotPastHorizon :: Gen (TimeHandle, SlotNo) Source #

spec :: Spec Source #

sizeLimit :: Tx -> Gen Int Source #

Generate a byte-count limit that straddles the real serialised size of tx, giving roughly equal probability of the size check passing or failing.

genFailingReport :: Gen EvaluationReport Source #

Generate an EvaluationReport that contains at least one script failure at an arbitrary witness index, optionally mixed with passing entries.

recordEventsHandler :: ChainContext -> ChainStateAt -> (SlotNo -> 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] 

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 deposits, which is already sufficient to observe at least one state transition and different levels of rollback.