Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fanout after contest #1313

Merged
merged 12 commits into from
Feb 21, 2024
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ changes.

- Provide more details about why a command failed. Added the state of the head logic at the point of failure.

- Fix a bug where the `hydra-node` would not correctly observe a contest transaction and fail to fanout a head [#1260](https://github.com/input-output-hk/hydra/issues/1260).

- Add `contestationDeadline` to the `HeadIsContested` output on the `hydra-node` API.

- Add `--sanchonet` option to `hydra-cluster` binary.

## [0.15.0] - 2024-01-18
Expand Down
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
8 changes: 6 additions & 2 deletions hydra-cluster/test/Test/EndToEndSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import Control.Concurrent.STM.TVar (modifyTVar')
import Control.Lens ((^..), (^?))
import Data.Aeson (Result (..), Value (Null, Object, String), fromJSON, object, (.=))
import Data.Aeson qualified as Aeson
import Data.Aeson.Lens (key, values, _Double, _JSON)
import Data.Aeson.Lens (AsJSON (_JSON), key, values, _Double, _JSON)
import Data.ByteString qualified as BS
import Data.List qualified as List
import Data.Map qualified as Map
Expand Down Expand Up @@ -398,10 +398,14 @@ spec = around (showLogsOnFailure "EndToEndSpec") $ do
guard $ v ^? key "headId" == Just (toJSON headId)
snapshotNumber <- v ^? key "snapshotNumber"
guard $ snapshotNumber == toJSON (0 :: Word)

waitMatch 10 n1 isHeadClosedWith0
waitMatch 10 n2 isHeadClosedWith0

waitFor hydraTracer 10 [n1, n2] $ output "HeadIsContested" ["snapshotNumber" .= (1 :: Word), "headId" .= headId]
forM_ [n1, n2] $ \n ->
waitMatch 10 n $ \v -> do
guard $ v ^? key "tag" == Just "HeadIsContested"
guard $ v ^? key "headId" == Just (toJSON headId)

describe "two hydra heads scenario" $ do
it "two heads on the same network do not conflict" $ \tracer ->
Expand Down
21,592 changes: 10,909 additions & 10,683 deletions hydra-node/golden/ReasonablySized (ServerOutput (Tx BabbageEra)).json

Large diffs are not rendered by default.

Loading