tests
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Chain.Direct.TxTraceSpec

Synopsis

Documentation

spec :: Spec Source #

prop_traces :: Property Source #

prop_runActions :: Actions Model -> Property Source #

Model

data Model Source #

Constructors

Model 

Fields

Instances

Instances details
Show Model Source # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

StateModel Model Source # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

Associated Types

data Action Model a

Methods

actionName :: Action Model a -> String

arbitraryAction :: VarContext -> Model -> Gen (Any (Action Model))

shrinkAction :: Typeable a => VarContext -> Model -> Action Model a -> [Any (Action Model)]

initialState :: 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 # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

Methods

getAllVariables :: Model -> Set (Any Var)

RunModel Model IO Source # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

Methods

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 # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

Methods

showsPrec :: Int -> Action Model a -> ShowS Source #

show :: Action Model a -> String Source #

showList :: [Action Model a] -> ShowS Source #

Eq (Action Model a) Source # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

Methods

(==) :: Action Model a -> Action Model a -> Bool Source #

(/=) :: Action Model a -> Action Model a -> Bool Source #

HasVariables (Action Model a) Source # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

Methods

getAllVariables :: Action Model a -> Set (Any Var)

data Action Model a Source # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

data Action Model a where

data State Source #

Constructors

Open 
Closed 
Final 

Instances

Instances details
Show State Source # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

Eq State Source # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

Methods

(==) :: State -> State -> Bool Source #

(/=) :: State -> State -> Bool Source #

data Actor Source #

Constructors

Alice 
Bob 
Carol 

Instances

Instances details
Show Actor Source # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

Eq Actor Source # 
Instance details

Defined in Hydra.Chain.Direct.TxTraceSpec

Methods

(==) :: Actor -> Actor -> Bool Source #

(/=) :: Actor -> Actor -> Bool Source #

Fixtures and glue code

allActors :: [Actor] Source #

List of all model actors corresponding to the fixtures used.

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.