| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Chain.Direct.StateSpec
Contents
Synopsis
- spec :: Spec
- genInitTxMutation :: TxIn -> Tx -> Gen (Mutation, String, NotAnInitReason)
- prop_observeAnyTx :: Property
- prop_splitUTxO :: UTxO -> Property
- prop_incrementObservesCorrectUTxO :: Property
- prop_incrementRequiresFirstDepositOutput :: Property
- prop_recoverRequiresFirstDepositOutput :: Property
- propBelowSizeLimit :: Natural -> ((UTxO -> Tx -> Property) -> Property) -> SpecWith ()
- propIsValid :: ((UTxO -> Tx -> Property) -> Property) -> SpecWith ()
- propRemainingAccumulatorRebuilds :: ChainContext -> UTxO -> TxIn -> Int -> UTxO -> UTxO -> SlotNo -> Property
- fanoutProgressCommitment :: Tx -> Maybe BuiltinBLS12_381_G1_Element
- onCrossPairedSelection :: Testable property => UTxO -> (UTxO -> property) -> Property
- forAllInit :: Testable property => (UTxO -> Tx -> property) -> Property
- forAllDeposit :: Testable property => (UTxO -> Tx -> property) -> Property
- forAllRecover :: Testable property => (UTxO -> Tx -> property) -> Property
- genMixedDeposit :: Gen UTxO
- forAllIncrement :: Testable property => (UTxO -> Tx -> property) -> Property
- forAllIncrement' :: Testable property => (UTxO -> Tx -> property) -> Property
- forAllDecrement :: Testable property => (UTxO -> Tx -> property) -> Property
- forAllDecrement' :: Testable property => (UTxO -> UTxO -> Tx -> property) -> Property
- forAllClose :: Testable property => (UTxO -> Tx -> property) -> Property
- forAllContest :: Testable property => (UTxO -> Tx -> property) -> Property
- forAllFanout :: Testable property => (UTxO -> Tx -> property) -> Property
- forAllPartialFanout :: Testable property => (UTxO -> Tx -> property) -> Property
- forAllFinalPartialFanout :: Testable property => (UTxO -> Tx -> property) -> Property
Documentation
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_incrementObservesCorrectUTxO :: Property Source #
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 #
propRemainingAccumulatorRebuilds Source #
Arguments
| :: ChainContext | |
| -> UTxO | |
| -> TxIn | |
| -> Int | |
| -> UTxO | UTxO the on-chain accumulator commits to |
| -> UTxO | UTxO to distribute from |
| -> SlotNo | |
| -> Property |
The commitment a partial fanout puts in the continuing head output must be one over everything the step leaves behind: what it did not distribute.
The on-chain check is A = P_K * A' against the A in the head datum, so
the two ways of arriving at A' - removing the distributed outputs from the
verified A, or building afresh over the rest - have to agree. This pins
them at the call site; AccumulatorSpec only pins the underlying
accumulator operations in isolation.
fanoutProgressCommitment :: Tx -> Maybe BuiltinBLS12_381_G1_Element Source #
The accumulator commitment in the continuing head output of a partial fanout transaction. Output 0 is the head output; the chunk follows.
onCrossPairedSelection :: Testable property => UTxO -> (UTxO -> property) -> Property Source #
Run the action on a selection naming the first two outputs of the given set
under each other's TxIn. The head still holds both outputs, so HeadLogic
accepts this as a selection, but no TxIn in it resolves to the output it
carries.
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'.