Skip to content

Commit

Permalink
Use Set of Party to signal ReadyToCommit
Browse files Browse the repository at this point in the history
Using a Set instead of a List makes it possible to expect a
deterministic order in the message, whatever the commits order may be.
  • Loading branch information
abailly-iohk committed Sep 10, 2021
1 parent ff7b2f4 commit 9f3c8c1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hydra-node/src/Hydra/HeadLogic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ update Environment{party, signingKey, otherParties} ledger st ev = case (st, ev)
(_, OnChainEvent OnInitTx{contestationPeriod, parties}) ->
NewState
(InitialState (HeadParameters{contestationPeriod, parties}) (Set.fromList parties) mempty)
[ClientEffect $ ReadyToCommit parties]
[ClientEffect $ ReadyToCommit $ fromList parties]
--
(InitialState _ remainingParties _, ClientEvent (Commit utxo))
| canCommit -> sameState [OnChainEffect (CommitTx party utxo)]
Expand Down
2 changes: 1 addition & 1 deletion hydra-node/src/Hydra/ServerOutput.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Hydra.Snapshot (Snapshot)
data ServerOutput tx
= PeerConnected {peer :: Host}
| PeerDisconnected {peer :: Host}
| ReadyToCommit {parties :: [Party]}
| ReadyToCommit {parties :: Set Party}
| Committed {party :: Party, utxo :: Utxo tx}
| HeadIsOpen {utxo :: Utxo tx}
| HeadIsClosed {contestationDeadline :: UTCTime, latestSnapshot :: Snapshot tx}
Expand Down
2 changes: 1 addition & 1 deletion local-cluster/bench/Bench/EndToEnd.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bench timeoutSeconds workDir dataset clusterSize =
let contestationPeriod = 100 :: Natural
send leader $ input "Init" ["contestationPeriod" .= contestationPeriod]
waitFor tracer 3 nodes $
output "ReadyToCommit" ["parties" .= map int [1 .. fromIntegral clusterSize]]
output "ReadyToCommit" ["parties" .= Set.fromList (map int [1 .. fromIntegral clusterSize])]

expectedUtxo <- commit nodes dataset

Expand Down

0 comments on commit 9f3c8c1

Please sign in to comment.