Skip to content

Commit

Permalink
Add StateSpec tests for increment tx
Browse files Browse the repository at this point in the history
Currently failing because of missing script input so we need to
make sure to provide all needed UTxO when generating txs.
  • Loading branch information
v0d1ch committed Oct 25, 2024
1 parent 5c771c7 commit 4e7c993
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions hydra-node/test/Hydra/Chain/Direct/StateSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import Hydra.Chain.Direct.State (
genDepositTx,
genFanoutTx,
genHydraContext,
genIncrementTx,
genInitTx,
genRecoverTx,
genStInitial,
Expand Down Expand Up @@ -348,6 +349,10 @@ spec = parallel $ do
Nothing ->
False & counterexample ("observeRecoverTx ignored transaction: " <> renderTxWithUTxO utxo tx)

describe "increment" $ do
propBelowSizeLimit maxTxSize forAllIncrement
propIsValid forAllIncrement

describe "decrement" $ do
propBelowSizeLimit maxTxSize forAllDecrement
propIsValid forAllDecrement
Expand Down Expand Up @@ -655,6 +660,23 @@ forAllRecover ::
forAllRecover action = do
forAllShrink genRecoverTx shrink $ uncurry action

forAllIncrement ::
Testable property =>
(UTxO -> Tx -> property) ->
Property
forAllIncrement action = do
forAllIncrement' $ \_ utxo tx ->
action utxo tx

forAllIncrement' ::
Testable property =>
([TxOut CtxUTxO] -> UTxO -> Tx -> property) ->
Property
forAllIncrement' action = do
forAllShrink (genIncrementTx maximumNumberOfParties) shrink $ \(ctx, committed, st, incrementUTxO, tx) ->
let utxo = getKnownUTxO st <> getKnownUTxO ctx <> incrementUTxO
in action committed utxo tx

forAllDecrement ::
Testable property =>
(UTxO -> Tx -> property) ->
Expand Down

0 comments on commit 4e7c993

Please sign in to comment.