Skip to content

Commit

Permalink
ADD explicit error expectations for Contest
Browse files Browse the repository at this point in the history
  • Loading branch information
ffakenz committed Feb 20, 2023
1 parent e66beaf commit 2a1128c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions hydra-node/test/Hydra/Chain/Direct/Contract/Contest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ genContestMutation
, _utxo
) =
oneof
[ SomeMutation Nothing MutateSignatureButNotSnapshotNumber . ChangeHeadRedeemer <$> do
[ SomeMutation (Just "signature verification failed") MutateSignatureButNotSnapshotNumber . ChangeHeadRedeemer <$> do
mutatedSignature <- arbitrary :: Gen (MultiSignature (Snapshot Tx))
pure $
Head.Contest
{ signature = toPlutusSignatures mutatedSignature
}
, SomeMutation Nothing MutateToNonNewerSnapshot <$> do
, SomeMutation (Just "signature verification failed") MutateToNonNewerSnapshot <$> do
mutatedSnapshotNumber <- choose (0, toInteger healthyClosedSnapshotNumber)
pure $
Changes
Expand All @@ -231,24 +231,25 @@ genContestMutation
healthySignature (fromInteger mutatedSnapshotNumber)
}
]
, SomeMutation Nothing MutateRequiredSigner <$> do
, SomeMutation (Just "signer is not a participant") MutateRequiredSigner <$> do
newSigner <- verificationKeyHash <$> genVerificationKey
pure $ ChangeRequiredSigners [newSigner]
, SomeMutation Nothing MutateContestUTxOHash . ChangeOutput 0 <$> do
, SomeMutation (Just "too old snapshot") MutateContestUTxOHash . ChangeOutput 0 <$> do
mutatedUTxOHash <- genHash `suchThat` ((/= healthyContestUTxOHash) . toBuiltin)
pure $
changeHeadOutputDatum
(const $ healthyClosedState & replaceUtxoHash (toBuiltin mutatedUTxOHash))
headTxOut
, SomeMutation Nothing MutateParties . ChangeInputHeadDatum <$> do
, SomeMutation (Just "signature verification failed") MutateParties . ChangeInputHeadDatum <$> do
mutatedParties <- arbitrary `suchThat` (/= healthyOnChainParties)
pure $
healthyClosedState & replaceParties mutatedParties
, SomeMutation Nothing MutateValidityPastDeadline . ChangeValidityInterval <$> do
, SomeMutation (Just "upper bound beyond contestation deadline") MutateValidityPastDeadline . ChangeValidityInterval <$> do
lb <- arbitrary
ub <- TxValidityUpperBound <$> arbitrary `suchThat` slotOverContestationDeadline
pure (lb, ub)
, SomeMutation Nothing MutateHeadId <$> do
, -- REVIEW: There is no trace for this error. Fails due to `verifyEd25519Signature`
SomeMutation Nothing MutateHeadId <$> do
otherHeadId <- fmap headPolicyId (arbitrary `suchThat` (/= healthyClosedHeadTxIn))
pure $
Changes
Expand Down

0 comments on commit 2a1128c

Please sign in to comment.