Skip to content

Commit

Permalink
Fix record construction and add missing field
Browse files Browse the repository at this point in the history
  • Loading branch information
v0d1ch committed Feb 20, 2024
1 parent 700b2c4 commit 3072482
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
8 changes: 4 additions & 4 deletions hydra-cluster/test/Test/DirectChainSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@ spec = around (showLogsOnFailure "DirectChainSpec") $ do

-- Alice close with the initial snapshot U0
postTx $ CloseTx headId headParameters InitialSnapshot{headId, initialUTxO = someUTxO}
waitMatch aliceChain $ \case
Observation{observedTx = OnCloseTx{snapshotNumber}}
| snapshotNumber == 0 -> Just ()
deadline <- waitMatch aliceChain $ \case
Observation{observedTx = OnCloseTx{snapshotNumber, contestationDeadline}}
| snapshotNumber == 0 -> Just contestationDeadline
_ -> Nothing

-- Alice contests with some snapshot U1 -> successful
Expand All @@ -413,7 +413,7 @@ spec = around (showLogsOnFailure "DirectChainSpec") $ do
{ snapshot = snapshot1
, signatures = aggregate [sign aliceSk snapshot1]
}
aliceChain `observesInTime` OnContestTx{headId, snapshotNumber = 1}
aliceChain `observesInTime` OnContestTx{headId, snapshotNumber = 1, contestationDeadline = deadline}

-- Alice contests with some snapshot U2 -> expect fail
let snapshot2 =
Expand Down
14 changes: 14 additions & 0 deletions hydra-node/json-schemas/logs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,20 @@ definitions:
$ref: "api.yaml#/components/schemas/ChainState"
contestationDeadline:
$ref: "api.yaml#/components/schemas/UTCTime"
- title: "HeadContested"
additionalProperties: false
required:
- tag
- chainState
- contestationDeadline
properties:
tag:
type: string
enum: ["HeadContested"]
chainState:
$ref: "api.yaml#/components/schemas/ChainState"
contestationDeadline:
$ref: "api.yaml#/components/schemas/UTCTime"
- title: "HeadIsReadyToFanout"
additionalProperties: false
required:
Expand Down
12 changes: 11 additions & 1 deletion hydra-node/src/Hydra/HeadLogic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,17 @@ aggregate st = \case
_otherState -> st
HeadContested{chainState, contestationDeadline} ->
case st of
Closed c -> Closed c{chainState, contestationDeadline}
Closed ClosedState { parameters , confirmedSnapshot , readyToFanoutSent, headId , headSeed } ->
Closed
ClosedState
{ parameters
, confirmedSnapshot
, contestationDeadline
, readyToFanoutSent
, chainState
, headId
, headSeed
}
_otherState -> st
HeadFannedOut{chainState} ->
case st of
Expand Down

0 comments on commit 3072482

Please sign in to comment.