Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
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
- prop_ignoresUnrelatedOnInitTx :: Property
- receiveMessage :: Message tx -> Input tx
- receiveMessageFrom :: Party -> Message tx -> Input tx
- chainEffect :: PostChainTx SimpleTx -> Effect SimpleTx
- observeTxAtSlot :: Natural -> OnChainTx SimpleTx -> Input SimpleTx
- observeTx :: OnChainTx SimpleTx -> Input SimpleTx
- connectivityChanged :: TTL -> Connectivity -> Input SimpleTx
- inIdleState :: HeadState SimpleTx
- inInitialState :: [Party] -> HeadState SimpleTx
- inOpenState :: [Party] -> 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 {}
- runHeadLogic :: Monad m => Environment -> Ledger tx -> HeadState tx -> StateT (StepState tx) m a -> m a
- getState :: MonadState (StepState tx) m => m (HeadState tx)
- step :: (MonadState (StepState tx) m, IsChainState tx) => Input tx -> m (Outcome tx)
- hasEffect :: (HasCallStack, IsChainState tx) => Outcome tx -> Effect tx -> IO ()
- assertWait :: (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 ()
- testSnapshot :: Monoid (UTxOType tx) => SnapshotNumber -> SnapshotVersion -> [tx] -> UTxOType tx -> Snapshot tx
Documentation
Properties
prop_ignoresUnrelatedOnInitTx :: Property Source #
Utilities
receiveMessage :: Message tx -> Input tx Source #
Create a network input about a received protocol message with defaultTTL
and alice
as the sender.
receiveMessageFrom :: Party -> Message tx -> Input tx Source #
Create a network input about a received protocol message with defaultTTL
from given sender.
chainEffect :: PostChainTx SimpleTx -> Effect SimpleTx Source #
Create a chain effect with fixed chain state and slot.
observeTxAtSlot :: Natural -> OnChainTx SimpleTx -> Input SimpleTx Source #
Create an observation chain input with chain state at given slot.
observeTx :: OnChainTx SimpleTx -> Input SimpleTx Source #
Create an observation chain input with fixed chain state and slot.
connectivityChanged :: TTL -> Connectivity -> Input SimpleTx Source #
inIdleState :: HeadState SimpleTx Source #
inInitialState :: [Party] -> HeadState SimpleTx Source #
inOpenState :: [Party] -> 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 #
runHeadLogic :: Monad m => Environment -> Ledger tx -> HeadState tx -> StateT (StepState tx) m a -> m a Source #
getState :: MonadState (StepState tx) m => m (HeadState tx) Source #
Retrieves the latest HeadState
from within runHeadLogic
.
step :: (MonadState (StepState tx) m, IsChainState tx) => Input tx -> m (Outcome tx) Source #
Calls update
and aggregate
to drive the runHeadLogic
monad forward.
hasEffect :: (HasCallStack, IsChainState tx) => Outcome tx -> Effect tx -> IO () Source #
assertWait :: (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 #
testSnapshot :: Monoid (UTxOType tx) => SnapshotNumber -> SnapshotVersion -> [tx] -> UTxOType tx -> Snapshot tx Source #