Skip to content

Commit

Permalink
Do not change the deadline in the mutation
Browse files Browse the repository at this point in the history
- output of a contest tx already contains _pushed_ deadline so when
comparing they should not be equal and we should see _must not push
deadline_
  • Loading branch information
v0d1ch committed Feb 9, 2023
1 parent 875bda2 commit c440a93
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions hydra-node/test/Hydra/Chain/Direct/Contract/Contest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -272,24 +272,21 @@ genContestMutation
pure $ ChangeOutput 0 (headTxOut{txOutValue = newValue})
, SomeMutation (Just "must push deadline") MutatePushedContestationDeadlineOnOutputClosedState . ChangeOutput 0 <$> do
let deadline = posixFromUTCTime healthyContestationDeadline
-- Here we are replacing the contestationDeadline using the previous without pushing it
-- Here we are replacing the contestationDeadline using the previous so we are not _pushing it_ further
pure $ headTxOut & changeHeadOutputDatum (replaceContestationDeadline deadline)
, SomeMutation (Just "must not push deadline") MutatePushedContestationDeadlineOnOutputClosedState <$> do
let deadline = posixFromUTCTime healthyContestationDeadline
let partiesVKeys = genForParty genVerificationKey <$> healthyParties
let contesters = toPlutusKeyHash . verificationKeyHash <$> partiesVKeys
-- Here we are replacing :
-- - contestationDeadline using the previous without pushing it
-- - alter the contesters in input so that everybody contested
-- - alter the contesters in output so that there is one party left to contest
-- Here we are :
-- - altering the contesters in input so that everybody contested
-- - altering the contesters in output so that there is one party left to contest

-- NOTE: we don't need change contestationPeriod since off-chain tx is
-- already pushing it further thus input and output should contain
-- different deadlines
pure $
Changes
[ ChangeOutput
0
( headTxOut & do
void $ changeHeadOutputDatum (replaceContestationDeadline deadline)
changeHeadOutputDatum (replaceContesters contesters)
)
[ ChangeOutput 0 (headTxOut & changeHeadOutputDatum (replaceContesters contesters))
, ChangeInputHeadDatum
-- use tail here to remove one contestant
(healthyClosedState & replaceContesters (List.tail contesters))
Expand Down

0 comments on commit c440a93

Please sign in to comment.