@@ -22,9 +22,7 @@ import Hydra.Cardano.Api (
22
22
NetworkMagic (.. ),
23
23
SlotNo (.. ),
24
24
TxId (.. ),
25
- UsingRawBytesHex (.. ),
26
25
deserialiseFromRawBytes ,
27
- deserialiseFromRawBytesBase16 ,
28
26
deserialiseFromRawBytesHex ,
29
27
proxyToAsType ,
30
28
serialiseToRawBytesHexText ,
@@ -266,16 +264,16 @@ cardanoLedgerProtocolParametersParser =
266
264
)
267
265
268
266
data ChainConfig = DirectChainConfig
269
- { -- | Network identifer to which we expect to connect.
270
- networkId :: NetworkId
271
- , -- | Path to a domain socket used to connect to the server.
272
- nodeSocket :: FilePath
273
- , -- | Path to the cardano signing key of the internal wallet.
274
- cardanoSigningKey :: FilePath
275
- , -- | Paths to other node's verification keys.
276
- cardanoVerificationKeys :: [ FilePath ]
277
- , -- | Point at which to start following the chain.
278
- startChainFrom :: Maybe ChainPoint
267
+ { networkId :: NetworkId
268
+ -- ^ Network identifer to which we expect to connect.
269
+ , nodeSocket :: FilePath
270
+ -- ^ Path to a domain socket used to connect to the server.
271
+ , cardanoSigningKey :: FilePath
272
+ -- ^ Path to the cardano signing key of the internal wallet.
273
+ , cardanoVerificationKeys :: [ FilePath ]
274
+ -- ^ Paths to other node's verification keys.
275
+ , startChainFrom :: Maybe ChainPoint
276
+ -- ^ Point at which to start following the chain.
279
277
, contestationPeriod :: ContestationPeriod
280
278
}
281
279
deriving (Eq , Show , Generic , ToJSON , FromJSON )
@@ -525,11 +523,9 @@ startChainFromParser =
525
523
case T. splitOn " ." (toText chainPointStr) of
526
524
[slotNoTxt, headerHashTxt] -> do
527
525
slotNo <- SlotNo <$> readMaybe (toString slotNoTxt)
528
- UsingRawBytesHex headerHash <-
529
- either
530
- (const Nothing )
531
- Just
532
- (deserialiseFromRawBytesBase16 (encodeUtf8 headerHashTxt))
526
+ headerHash <-
527
+ either (const Nothing ) Just $
528
+ deserialiseFromRawBytesHex (proxyToAsType Proxy ) (encodeUtf8 headerHashTxt)
533
529
pure $ ChainPoint slotNo headerHash
534
530
_emptyOrSingularList ->
535
531
Nothing
@@ -630,7 +626,7 @@ validateRunOptions :: RunOptions -> Either InvalidOptions ()
630
626
validateRunOptions RunOptions {hydraVerificationKeys, chainConfig}
631
627
| numberOfOtherParties + 1 > maximumNumberOfParties = Left MaximumNumberOfPartiesExceeded
632
628
| length (cardanoVerificationKeys chainConfig) /= length hydraVerificationKeys =
633
- Left CardanoAndHydraKeysMissmatch
629
+ Left CardanoAndHydraKeysMissmatch
634
630
| otherwise = Right ()
635
631
where
636
632
-- let's take the higher number of loaded cardano/hydra keys
@@ -766,5 +762,5 @@ genChainPoint = ChainPoint <$> (SlotNo <$> arbitrary) <*> someHeaderHash
766
762
where
767
763
someHeaderHash = do
768
764
bytes <- vectorOf 32 arbitrary
769
- let hash = fromMaybe (error " invalid bytes" ) $ deserialiseFromRawBytes (proxyToAsType Proxy ) . BS. pack $ bytes
765
+ let hash = either (error " invalid bytes" ) id $ deserialiseFromRawBytes (proxyToAsType Proxy ) . BS. pack $ bytes
770
766
pure hash
0 commit comments