Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- spec :: Spec
- prop_traces :: Property
- prop_runActions :: Actions Model -> Property
- data Model = Model {}
- data State
- data Actor
- allActors :: [Actor]
- snapshotUTxO :: SnapshotNumber -> UTxO
- correctlySignedSnapshot :: SnapshotNumber -> ConfirmedSnapshot Tx
- openHeadUTxO :: UTxO
- newCloseTx :: HasCallStack => Actor -> ConfirmedSnapshot Tx -> IO Tx
- newContestTx :: HasCallStack => UTxO -> Actor -> ConfirmedSnapshot Tx -> IO Tx
- actorChainContext :: Actor -> ChainContext
- testScriptRegistry :: ScriptRegistry
- validateTx :: (HasCallStack, MonadThrow m) => UTxO -> Tx -> m ()
- observeTxMatching :: (HasCallStack, MonadThrow m) => UTxO -> Tx -> (HeadObservation -> Maybe a) -> m a
Documentation
prop_traces :: Property Source #
prop_runActions :: Actions Model -> Property Source #
Model
Instances
Show Model Source # | |
StateModel Model Source # | |
Defined in Hydra.Chain.Direct.TxTraceSpec data Action Model a actionName :: Action Model a -> String arbitraryAction :: VarContext -> Model -> Gen (Any (Action Model)) shrinkAction :: Typeable a => VarContext -> Model -> Action Model a -> [Any (Action Model)] nextState :: Typeable a => Model -> Action Model a -> Var a -> Model failureNextState :: Typeable a => Model -> Action Model a -> Model precondition :: Model -> Action Model a -> Bool validFailingAction :: Model -> Action Model a -> Bool | |
HasVariables Model Source # | |
Defined in Hydra.Chain.Direct.TxTraceSpec getAllVariables :: Model -> Set (Any Var) | |
RunModel Model IO Source # | |
Defined in Hydra.Chain.Direct.TxTraceSpec perform :: Typeable a => Model -> Action Model a -> LookUp IO -> IO (Realized IO a) postcondition :: (Model, Model) -> Action Model a -> LookUp IO -> Realized IO a -> PostconditionM IO Bool postconditionOnFailure :: (Model, Model) -> Action Model a -> LookUp IO -> Realized IO a -> PostconditionM IO Bool monitoring :: (Model, Model) -> Action Model a -> LookUp IO -> Realized IO a -> Property -> Property | |
Show (Action Model a) Source # | |
Eq (Action Model a) Source # | |
HasVariables (Action Model a) Source # | |
Defined in Hydra.Chain.Direct.TxTraceSpec getAllVariables :: Action Model a -> Set (Any Var) | |
data Action Model a Source # | |
Fixtures and glue code
snapshotUTxO :: SnapshotNumber -> UTxO Source #
A "random" UTxO distribution for a given snapshot number. This always contains one UTxO for alice, bob, and carol.
correctlySignedSnapshot :: SnapshotNumber -> ConfirmedSnapshot Tx Source #
A model of a correctly signed snapshot. Given a snapshot number a snapshot signed by all participants (alice, bob and carol) with some UTxO contained is produced.
openHeadUTxO :: UTxO Source #
UTxO of the open head on-chain. NOTE: This uses fixtures for headId, parties, and cperiod.
newCloseTx :: HasCallStack => Actor -> ConfirmedSnapshot Tx -> IO Tx Source #
Creates a transaction that closes openHeadUTxO
with given the snapshot.
NOTE: This uses fixtures for headId, parties (alice, bob, carol),
contestation period and also claims to close at time 0 resulting in a
contestation deadline of 0 + cperiod.
newContestTx :: HasCallStack => UTxO -> Actor -> ConfirmedSnapshot Tx -> IO Tx Source #
Creates a contest transaction using given utxo and contesting with given snapshot. NOTE: This uses fixtures for headId, contestation period and also claims to contest at time 0.
actorChainContext :: Actor -> ChainContext Source #
Fixture for the chain context of a model Actor
on testNetworkId
. Uses a generated ScriptRegistry
.
testScriptRegistry :: ScriptRegistry Source #
Helpers
validateTx :: (HasCallStack, MonadThrow m) => UTxO -> Tx -> m () Source #
Thin wrapper around evaluateTx
that fails with failure
if any of the
scripts/redeemers fail to evaluate.
observeTxMatching :: (HasCallStack, MonadThrow m) => UTxO -> Tx -> (HeadObservation -> Maybe a) -> m a Source #
Expect to observe a transaction matching given predicate. This fails with
failure
if the predicate yields Nothing
.