Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Hydra.HeadLogicSpec
Description
Unit tests of the the protocol logic in HeadLogic
. These are very fine
grained and specific to individual steps in the protocol. More high-level of
the protocol logic, especially between multiple parties can be found in
BehaviorSpec
.
Synopsis
- spec :: Spec
- runEvents :: Monad m => Environment -> Ledger tx -> HeadState tx -> StateT (StepState tx) m a -> m a
- chainEffect :: PostChainTx SimpleTx -> Effect SimpleTx
- observeEventAtSlot :: Natural -> OnChainTx SimpleTx -> Event SimpleTx
- observationEvent :: OnChainTx SimpleTx -> Event SimpleTx
- inInitialState :: [Party] -> HeadState SimpleTx
- inOpenState :: [Party] -> Ledger SimpleTx -> HeadState SimpleTx
- inOpenState' :: [Party] -> CoordinatedHeadState SimpleTx -> HeadState SimpleTx
- inClosedState :: [Party] -> HeadState SimpleTx
- inClosedState' :: [Party] -> ConfirmedSnapshot SimpleTx -> HeadState SimpleTx
- getConfirmedSnapshot :: HeadState tx -> Maybe (Snapshot tx)
- data StepState tx = StepState {}
- getState :: MonadState (StepState tx) m => m (HeadState tx)
- step :: (MonadState (StepState tx) m, IsChainState tx) => Event tx -> m (Outcome tx)
- assertEffects :: (HasCallStack, IsChainState tx) => Outcome tx -> IO ()
- hasEffect :: (HasCallStack, IsChainState tx) => Outcome tx -> Effect tx -> IO ()
- hasWait :: (HasCallStack, IsChainState tx) => Outcome tx -> WaitReason tx -> IO ()
- hasEffectSatisfying :: (HasCallStack, IsChainState tx) => Outcome tx -> (Effect tx -> Bool) -> IO ()
- hasNoEffectSatisfying :: (HasCallStack, IsChainState tx) => Outcome tx -> (Effect tx -> Bool) -> IO ()
- testHeadId :: HeadId
Documentation
runEvents :: Monad m => Environment -> Ledger tx -> HeadState tx -> StateT (StepState tx) m a -> m a Source #
chainEffect :: PostChainTx SimpleTx -> Effect SimpleTx Source #
Create a chain effect with fixed chain state and slot.
observeEventAtSlot :: Natural -> OnChainTx SimpleTx -> Event SimpleTx Source #
observationEvent :: OnChainTx SimpleTx -> Event SimpleTx Source #
Create an observation event with fixed chain state and slot.
inInitialState :: [Party] -> HeadState SimpleTx Source #
inOpenState :: [Party] -> Ledger SimpleTx -> HeadState SimpleTx Source #
inOpenState' :: [Party] -> CoordinatedHeadState SimpleTx -> HeadState SimpleTx Source #
inClosedState :: [Party] -> HeadState SimpleTx Source #
inClosedState' :: [Party] -> ConfirmedSnapshot SimpleTx -> HeadState SimpleTx Source #
getConfirmedSnapshot :: HeadState tx -> Maybe (Snapshot tx) Source #
getState :: MonadState (StepState tx) m => m (HeadState tx) Source #
Retrieves the latest HeadState
from within runEvents
.
step :: (MonadState (StepState tx) m, IsChainState tx) => Event tx -> m (Outcome tx) Source #
Calls update
and aggregate
to drive the runEvents
monad forward.
assertEffects :: (HasCallStack, IsChainState tx) => Outcome tx -> IO () Source #
hasEffect :: (HasCallStack, IsChainState tx) => Outcome tx -> Effect tx -> IO () Source #
hasWait :: (HasCallStack, IsChainState tx) => Outcome tx -> WaitReason tx -> IO () Source #
hasEffectSatisfying :: (HasCallStack, IsChainState tx) => Outcome tx -> (Effect tx -> Bool) -> IO () Source #
hasNoEffectSatisfying :: (HasCallStack, IsChainState tx) => Outcome tx -> (Effect tx -> Bool) -> IO () Source #
testHeadId :: HeadId Source #