Skip to content

Commit

Permalink
CheckPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
v0d1ch committed Jul 5, 2023
1 parent c5ba106 commit 298fbf9
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion hydra-node/test/Hydra/Network/AuthenticateSpec.hs
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ spec = parallel $ do

receivedMsgs `shouldBe` ["1"]

it "drop unauthenticated messages" $ do
it "drop message coming from unknown party" $ do
let receivedMsgs = runSimOrThrow $ do
receivedMessages <- newTVarIO ([] :: [ByteString])

@@ -62,6 +62,24 @@ spec = parallel $ do

receivedMsgs `shouldBe` ["1"]

it "drop message comming from party with wrong signature" $
let receivedMsgs = runSimOrThrow $ do
receivedMessages <- newTVarIO ([] :: [ByteString])

withAuthentication
aliceSk
[bob, carol]
( \incoming _ -> do
incoming (Authenticated "1" (sign carolSk "1") bob)
)
(captureIncoming receivedMessages)
$ \_ ->
threadDelay 1

readTVarIO receivedMessages

receivedMsgs `shouldBe` ["1"]

it "authenticate the message to broadcast" $ do
signingKey <- generate arbitrary
let someMessage = "1"
@@ -81,6 +99,7 @@ spec = parallel $ do
prop "can roundtrip CBOR encoding/decoding of Authenticated Hydra Message" $
prop_canRoundtripCBOREncoding @(Authenticated Msg)


newtype Msg = Msg ByteString
deriving newtype (Eq, Show, ToCBOR, FromCBOR, SignableRepresentation)

0 comments on commit 298fbf9

Please sign in to comment.