| -- | Test that collectCom cannot collect from an initial UTxO.
-
| -- | Test that every party has a chance to commit.
+
| -- | Every party should have commited and taken into account for the collectCom transaction to be valid
+
-- Here we increase the number of parties in input and output but keep the commits unchanged. This
+
-- simulate the situation where one participant would not have commited already or whose commit would
+
-- have been ignored by the collectCom transaction.
genCollectComMutation :: (Tx, UTxO) -> Gen SomeMutation
genCollectComMutation (tx, _utxo) =
-
[ SomeMutation Nothing MutateOpenUTxOHash . ChangeOutput 0 <$> mutateUTxOHash
-
, SomeMutation Nothing MutateHeadTransition <$> do
+
[ SomeMutation (Just "incorrect utxo hash") MutateOpenUTxOHash . ChangeOutput 0 <$> mutateUTxOHash
+
, -- TODO the following mutation is removed when merging with #717 so ignore
+
SomeMutation Nothing MutateHeadTransition <$> do
changeRedeemer <- ChangeHeadRedeemer <$> (Head.Close <$> arbitrary)
differencCurrencySymbol <- arbitrary `suchThat` (/= toPlutusCurrencySymbol testPolicyId)
<*> pure differencCurrencySymbol
pure $ Changes [changeRedeemer, changeDatum]
-
, SomeMutation Nothing MutateNumberOfParties <$> do
+
, SomeMutation (Just "changed parameters") MutateNumberOfParties <$> do
-- NOTE: This also mutates the contestation period becuase we could not
-- be bothered to decode/lookup the current one.
[ ChangeInputHeadDatum $ Head.Initial c moreParties (toPlutusCurrencySymbol testPolicyId)
, ChangeOutput 0 $ mutatedPartiesHeadTxOut moreParties headTxOut
-
, SomeMutation Nothing MutateHeadId <$> do
+
, SomeMutation (Just "ST not spent in transaction") MutateHeadId <$> do
illedHeadResolvedInput <-
<*> fmap headPolicyId (arbitrary `suchThat` (/= testSeedInput))
<*> pure (toUTxOContext $ mkTxOutDatum healthyCollectComInitialDatum)
return $ ChangeInput healthyHeadInput illedHeadResolvedInput (Just $ toScriptData Head.CollectCom)
-
, SomeMutation Nothing MutateRequiredSigner <$> do
+
, SomeMutation (Just "signer is not a participant") MutateRequiredSigner <$> do
newSigner <- verificationKeyHash <$> genVerificationKey
pure $ ChangeRequiredSigners [newSigner]
-
, SomeMutation Nothing MutateCommitToInitial <$> do
+
, SomeMutation (Just "datum not found") MutateCommitToInitial <$> do
+
-- we're satisfied with "datum not found" as the current version of the validator will consider
+
-- the initial input as if it were a commit input, hence fetching the datum which is expected
+
-- in a commit and complaining that it did not find it
(txIn, HealthyCommit{cardanoKey}) <- elements $ Map.toList healthyCommits
pure $ ChangeInput txIn (toUTxOContext $ mkInitialOutput testNetworkId testPolicyId cardanoKey) Nothing
, SomeMutation (Just "minting or burning is forbidden") MutateTokenMintingOrBurning