hydra-node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Chain.Direct.StateSpec

Synopsis

Documentation

spec :: Spec Source #

genInitTxMutation :: TxIn -> Tx -> Gen (Mutation, String, NotAnInitReason) Source #

Properties

prop_observeAnyTx :: Property Source #

Given any Head protocol state and the transaction corresponding a protocol transition we should be able to observe this transition correctly even in presence of other valid Hydra Head protocol states in the used lookup utxo.

prop_splitUTxO :: UTxO -> Property Source #

Given a UTxO with more than one entry, we can split it into two non-empty UTxO.

prop_incrementRequiresFirstDepositOutput :: Property Source #

checkIncrement requires the claimed deposit to be its transaction's first output, so increment resolves exactly that output rather than any output of the deposit transaction. Matching by transaction id alone would build a transaction that cannot validate.

prop_recoverRequiresFirstDepositOutput :: Property Source #

recoverTx spends TxIn depositTxId (TxIx 0), so recover resolves exactly that output. Matching by transaction id alone would read one output's datum and then build a transaction spending a different one.

propBelowSizeLimit :: Natural -> ((UTxO -> Tx -> Property) -> Property) -> SpecWith () Source #

propIsValid :: ((UTxO -> Tx -> Property) -> Property) -> SpecWith () Source #

Generators

forAllInit :: Testable property => (UTxO -> Tx -> property) -> Property Source #

forAllDeposit :: Testable property => (UTxO -> Tx -> property) -> Property Source #

forAllRecover :: Testable property => (UTxO -> Tx -> property) -> Property Source #

genMixedDeposit :: Gen UTxO Source #

Deposits ranging from trivially fitting (a few ada-only outputs) to clearly oversized (>100 distinct-policy tokens whose merged value exceeds mainnet's 5000 byte maxValSize), so rejectOversizedDeposit exercises both verdicts.

forAllIncrement :: Testable property => (UTxO -> Tx -> property) -> Property Source #

forAllIncrement' :: Testable property => (UTxO -> Tx -> property) -> Property Source #

forAllDecrement :: Testable property => (UTxO -> Tx -> property) -> Property Source #

forAllDecrement' :: Testable property => (UTxO -> UTxO -> Tx -> property) -> Property Source #

forAllClose :: Testable property => (UTxO -> Tx -> property) -> Property Source #

forAllContest :: Testable property => (UTxO -> Tx -> property) -> Property Source #

forAllFanout :: Testable property => (UTxO -> Tx -> property) -> Property Source #

forAllPartialFanout :: Testable property => (UTxO -> Tx -> property) -> Property Source #

Use spendableUTxO (not 'getKnownUTxO stClosed'): the generator adds the full UTxO value to the head output so partialFanoutTx can subtract distributed values without going negative. The evaluation UTxO must match.

forAllFinalPartialFanout :: Testable property => (UTxO -> Tx -> property) -> Property Source #

The spendable UTxO for the final partial fanout is the FanoutProgress head output produced by the preceding partial fanout step, so we use the 3rd element from the generator rather than 'getKnownUTxO stClosed'.