{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Cardano.Node.Protocol.Byron (
mkSomeConsensusProtocolByron
, ByronProtocolInstantiationError (..)
, readGenesis
, readLeaderCredentials
) where
import Cardano.Api.Any
import Cardano.Api.KeysByron
import qualified Cardano.Api.Protocol.Types as Protocol
import qualified Cardano.Chain.Genesis as Genesis
import qualified Cardano.Chain.Update as Update
import qualified Cardano.Chain.UTxO as UTxO
import qualified Cardano.Crypto.Hash as Crypto
import qualified Cardano.Crypto.Hashing as Byron.Crypto
import Cardano.Crypto.ProtocolMagic (RequiresNetworkMagic)
import Cardano.Node.Protocol.Types
import Cardano.Node.Types
import Cardano.Prelude
import Control.Monad.Trans.Except.Extra (bimapExceptT, firstExceptT,
hoistEither, hoistMaybe, left)
import qualified Data.ByteString.Lazy as LB
import Data.Text as Text (unpack)
import Ouroboros.Consensus.Cardano
import qualified Ouroboros.Consensus.Cardano as Consensus
import Prelude hiding (show, (.))
mkSomeConsensusProtocolByron ::
NodeByronProtocolConfiguration
-> Maybe ProtocolFilepaths
-> ExceptT ByronProtocolInstantiationError IO SomeConsensusProtocol
mkSomeConsensusProtocolByron :: NodeByronProtocolConfiguration
-> Maybe ProtocolFilepaths
-> ExceptT ByronProtocolInstantiationError IO SomeConsensusProtocol
mkSomeConsensusProtocolByron NodeByronProtocolConfiguration {
GenesisFile
npcByronGenesisFile :: GenesisFile
npcByronGenesisFile :: NodeByronProtocolConfiguration -> GenesisFile
npcByronGenesisFile,
Maybe GenesisHash
npcByronGenesisFileHash :: Maybe GenesisHash
npcByronGenesisFileHash :: NodeByronProtocolConfiguration -> Maybe GenesisHash
npcByronGenesisFileHash,
RequiresNetworkMagic
npcByronReqNetworkMagic :: RequiresNetworkMagic
npcByronReqNetworkMagic :: NodeByronProtocolConfiguration -> RequiresNetworkMagic
npcByronReqNetworkMagic,
Maybe Double
npcByronPbftSignatureThresh :: Maybe Double
npcByronPbftSignatureThresh :: NodeByronProtocolConfiguration -> Maybe Double
npcByronPbftSignatureThresh,
ApplicationName
npcByronApplicationName :: ApplicationName
npcByronApplicationName :: NodeByronProtocolConfiguration -> ApplicationName
npcByronApplicationName,
NumSoftwareVersion
npcByronApplicationVersion :: NumSoftwareVersion
npcByronApplicationVersion :: NodeByronProtocolConfiguration -> NumSoftwareVersion
npcByronApplicationVersion,
Word16
npcByronSupportedProtocolVersionMajor :: Word16
npcByronSupportedProtocolVersionMajor :: NodeByronProtocolConfiguration -> Word16
npcByronSupportedProtocolVersionMajor,
Word16
npcByronSupportedProtocolVersionMinor :: Word16
npcByronSupportedProtocolVersionMinor :: NodeByronProtocolConfiguration -> Word16
npcByronSupportedProtocolVersionMinor,
Word8
npcByronSupportedProtocolVersionAlt :: Word8
npcByronSupportedProtocolVersionAlt :: NodeByronProtocolConfiguration -> Word8
npcByronSupportedProtocolVersionAlt
}
Maybe ProtocolFilepaths
files = do
Config
genesisConfig <- GenesisFile
-> Maybe GenesisHash
-> RequiresNetworkMagic
-> ExceptT ByronProtocolInstantiationError IO Config
readGenesis GenesisFile
npcByronGenesisFile
Maybe GenesisHash
npcByronGenesisFileHash
RequiresNetworkMagic
npcByronReqNetworkMagic
Maybe ByronLeaderCredentials
optionalLeaderCredentials <- Config
-> Maybe ProtocolFilepaths
-> ExceptT
ByronProtocolInstantiationError IO (Maybe ByronLeaderCredentials)
readLeaderCredentials Config
genesisConfig Maybe ProtocolFilepaths
files
SomeConsensusProtocol
-> ExceptT ByronProtocolInstantiationError IO SomeConsensusProtocol
forall a. a -> ExceptT ByronProtocolInstantiationError IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (SomeConsensusProtocol
-> ExceptT
ByronProtocolInstantiationError IO SomeConsensusProtocol)
-> SomeConsensusProtocol
-> ExceptT ByronProtocolInstantiationError IO SomeConsensusProtocol
forall a b. (a -> b) -> a -> b
$ BlockType (HardForkBlock '[ByronBlock])
-> ProtocolInfoArgs IO (HardForkBlock '[ByronBlock])
-> SomeConsensusProtocol
forall blk.
Protocol IO blk =>
BlockType blk -> ProtocolInfoArgs IO blk -> SomeConsensusProtocol
SomeConsensusProtocol BlockType (HardForkBlock '[ByronBlock])
Protocol.ByronBlockType (ProtocolInfoArgs IO (HardForkBlock '[ByronBlock])
-> SomeConsensusProtocol)
-> ProtocolInfoArgs IO (HardForkBlock '[ByronBlock])
-> SomeConsensusProtocol
forall a b. (a -> b) -> a -> b
$ ProtocolParamsByron
-> ProtocolInfoArgs IO (HardForkBlock '[ByronBlock])
forall (m :: * -> *).
ProtocolParamsByron
-> ProtocolInfoArgs m (HardForkBlock '[ByronBlock])
Protocol.ProtocolInfoArgsByron (ProtocolParamsByron
-> ProtocolInfoArgs IO (HardForkBlock '[ByronBlock]))
-> ProtocolParamsByron
-> ProtocolInfoArgs IO (HardForkBlock '[ByronBlock])
forall a b. (a -> b) -> a -> b
$ Consensus.ProtocolParamsByron {
$sel:byronGenesis:ProtocolParamsByron :: Config
byronGenesis = Config
genesisConfig,
$sel:byronPbftSignatureThreshold:ProtocolParamsByron :: Maybe PBftSignatureThreshold
byronPbftSignatureThreshold =
Double -> PBftSignatureThreshold
PBftSignatureThreshold (Double -> PBftSignatureThreshold)
-> Maybe Double -> Maybe PBftSignatureThreshold
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Double
npcByronPbftSignatureThresh,
$sel:byronProtocolVersion:ProtocolParamsByron :: ProtocolVersion
byronProtocolVersion =
Word16 -> Word16 -> Word8 -> ProtocolVersion
Update.ProtocolVersion
Word16
npcByronSupportedProtocolVersionMajor
Word16
npcByronSupportedProtocolVersionMinor
Word8
npcByronSupportedProtocolVersionAlt,
$sel:byronSoftwareVersion:ProtocolParamsByron :: SoftwareVersion
byronSoftwareVersion =
ApplicationName -> NumSoftwareVersion -> SoftwareVersion
Update.SoftwareVersion
ApplicationName
npcByronApplicationName
NumSoftwareVersion
npcByronApplicationVersion,
$sel:byronLeaderCredentials:ProtocolParamsByron :: Maybe ByronLeaderCredentials
byronLeaderCredentials = Maybe ByronLeaderCredentials
optionalLeaderCredentials
}
readGenesis :: GenesisFile
-> Maybe GenesisHash
-> RequiresNetworkMagic
-> ExceptT ByronProtocolInstantiationError IO
Genesis.Config
readGenesis :: GenesisFile
-> Maybe GenesisHash
-> RequiresNetworkMagic
-> ExceptT ByronProtocolInstantiationError IO Config
readGenesis (GenesisFile FilePath
file) Maybe GenesisHash
mbExpectedGenesisHash RequiresNetworkMagic
ncReqNetworkMagic = do
(GenesisData
genesisData, GenesisHash
genesisHash) <- (GenesisDataError -> ByronProtocolInstantiationError)
-> ExceptT GenesisDataError IO (GenesisData, GenesisHash)
-> ExceptT
ByronProtocolInstantiationError IO (GenesisData, GenesisHash)
forall (m :: * -> *) x y a.
Functor m =>
(x -> y) -> ExceptT x m a -> ExceptT y m a
firstExceptT (FilePath -> GenesisDataError -> ByronProtocolInstantiationError
GenesisReadError FilePath
file) (ExceptT GenesisDataError IO (GenesisData, GenesisHash)
-> ExceptT
ByronProtocolInstantiationError IO (GenesisData, GenesisHash))
-> ExceptT GenesisDataError IO (GenesisData, GenesisHash)
-> ExceptT
ByronProtocolInstantiationError IO (GenesisData, GenesisHash)
forall a b. (a -> b) -> a -> b
$
FilePath -> ExceptT GenesisDataError IO (GenesisData, GenesisHash)
forall (m :: * -> *).
(MonadError GenesisDataError m, MonadIO m) =>
FilePath -> m (GenesisData, GenesisHash)
Genesis.readGenesisData FilePath
file
GenesisHash -> ExceptT ByronProtocolInstantiationError IO ()
checkExpectedGenesisHash GenesisHash
genesisHash
Config -> ExceptT ByronProtocolInstantiationError IO Config
forall a. a -> ExceptT ByronProtocolInstantiationError IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Genesis.Config {
configGenesisData :: GenesisData
Genesis.configGenesisData = GenesisData
genesisData,
configGenesisHash :: GenesisHash
Genesis.configGenesisHash = GenesisHash
genesisHash,
configReqNetMagic :: RequiresNetworkMagic
Genesis.configReqNetMagic = RequiresNetworkMagic
ncReqNetworkMagic,
configUTxOConfiguration :: UTxOConfiguration
Genesis.configUTxOConfiguration = UTxOConfiguration
UTxO.defaultUTxOConfiguration
}
where
checkExpectedGenesisHash :: Genesis.GenesisHash
-> ExceptT ByronProtocolInstantiationError IO ()
checkExpectedGenesisHash :: GenesisHash -> ExceptT ByronProtocolInstantiationError IO ()
checkExpectedGenesisHash GenesisHash
actual' =
case Maybe GenesisHash
mbExpectedGenesisHash of
Just GenesisHash
expected | GenesisHash
actual GenesisHash -> GenesisHash -> Bool
forall a. Eq a => a -> a -> Bool
/= GenesisHash
expected ->
ByronProtocolInstantiationError
-> ExceptT ByronProtocolInstantiationError IO ()
forall a.
ByronProtocolInstantiationError
-> ExceptT ByronProtocolInstantiationError IO a
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (GenesisHash -> GenesisHash -> ByronProtocolInstantiationError
GenesisHashMismatch GenesisHash
actual GenesisHash
expected)
where
actual :: GenesisHash
actual = GenesisHash -> GenesisHash
fromByronGenesisHash GenesisHash
actual'
Maybe GenesisHash
_ -> () -> ExceptT ByronProtocolInstantiationError IO ()
forall a. a -> ExceptT ByronProtocolInstantiationError IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
fromByronGenesisHash :: Genesis.GenesisHash -> GenesisHash
fromByronGenesisHash :: GenesisHash -> GenesisHash
fromByronGenesisHash (Genesis.GenesisHash Hash Raw
h) =
Hash Blake2b_256 ByteString -> GenesisHash
GenesisHash
(Hash Blake2b_256 ByteString -> GenesisHash)
-> (Hash Raw -> Hash Blake2b_256 ByteString)
-> Hash Raw
-> GenesisHash
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Hash Blake2b_256 ByteString
-> Maybe (Hash Blake2b_256 ByteString)
-> Hash Blake2b_256 ByteString
forall a. a -> Maybe a -> a
fromMaybe Hash Blake2b_256 ByteString
forall {a}. a
impossible
(Maybe (Hash Blake2b_256 ByteString)
-> Hash Blake2b_256 ByteString)
-> (Hash Raw -> Maybe (Hash Blake2b_256 ByteString))
-> Hash Raw
-> Hash Blake2b_256 ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ByteString -> Maybe (Hash Blake2b_256 ByteString)
forall h a. HashAlgorithm h => ByteString -> Maybe (Hash h a)
Crypto.hashFromBytes
(ByteString -> Maybe (Hash Blake2b_256 ByteString))
-> (Hash Raw -> ByteString)
-> Hash Raw
-> Maybe (Hash Blake2b_256 ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Hash Raw -> ByteString
forall algo a. AbstractHash algo a -> ByteString
Byron.Crypto.hashToBytes
(Hash Raw -> GenesisHash) -> Hash Raw -> GenesisHash
forall a b. (a -> b) -> a -> b
$ Hash Raw
h
where
impossible :: a
impossible =
Text -> a
forall a. HasCallStack => Text -> a
panic Text
"fromByronGenesisHash: old and new crypto libs disagree on hash size"
readLeaderCredentials :: Genesis.Config
-> Maybe ProtocolFilepaths
-> ExceptT ByronProtocolInstantiationError IO
(Maybe ByronLeaderCredentials)
readLeaderCredentials :: Config
-> Maybe ProtocolFilepaths
-> ExceptT
ByronProtocolInstantiationError IO (Maybe ByronLeaderCredentials)
readLeaderCredentials Config
_ Maybe ProtocolFilepaths
Nothing = Maybe ByronLeaderCredentials
-> ExceptT
ByronProtocolInstantiationError IO (Maybe ByronLeaderCredentials)
forall a. a -> ExceptT ByronProtocolInstantiationError IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ByronLeaderCredentials
forall a. Maybe a
Nothing
readLeaderCredentials Config
genesisConfig
(Just ProtocolFilepaths {
Maybe FilePath
byronCertFile :: Maybe FilePath
byronCertFile :: ProtocolFilepaths -> Maybe FilePath
byronCertFile,
Maybe FilePath
byronKeyFile :: Maybe FilePath
byronKeyFile :: ProtocolFilepaths -> Maybe FilePath
byronKeyFile
}) =
case (Maybe FilePath
byronCertFile, Maybe FilePath
byronKeyFile) of
(Maybe FilePath
Nothing, Maybe FilePath
Nothing) -> Maybe ByronLeaderCredentials
-> ExceptT
ByronProtocolInstantiationError IO (Maybe ByronLeaderCredentials)
forall a. a -> ExceptT ByronProtocolInstantiationError IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe ByronLeaderCredentials
forall a. Maybe a
Nothing
(Just FilePath
_, Maybe FilePath
Nothing) -> ByronProtocolInstantiationError
-> ExceptT
ByronProtocolInstantiationError IO (Maybe ByronLeaderCredentials)
forall (m :: * -> *) x a. Monad m => x -> ExceptT x m a
left ByronProtocolInstantiationError
SigningKeyFilepathNotSpecified
(Maybe FilePath
Nothing, Just FilePath
_) -> ByronProtocolInstantiationError
-> ExceptT
ByronProtocolInstantiationError IO (Maybe ByronLeaderCredentials)
forall (m :: * -> *) x a. Monad m => x -> ExceptT x m a
left ByronProtocolInstantiationError
DelegationCertificateFilepathNotSpecified
(Just FilePath
delegCertFile, Just FilePath
signingKeyFile) -> do
ByteString
signingKeyFileBytes <- IO ByteString
-> ExceptT ByronProtocolInstantiationError IO ByteString
forall a. IO a -> ExceptT ByronProtocolInstantiationError IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString
-> ExceptT ByronProtocolInstantiationError IO ByteString)
-> IO ByteString
-> ExceptT ByronProtocolInstantiationError IO ByteString
forall a b. (a -> b) -> a -> b
$ FilePath -> IO ByteString
LB.readFile FilePath
signingKeyFile
ByteString
delegCertFileBytes <- IO ByteString
-> ExceptT ByronProtocolInstantiationError IO ByteString
forall a. IO a -> ExceptT ByronProtocolInstantiationError IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ByteString
-> ExceptT ByronProtocolInstantiationError IO ByteString)
-> IO ByteString
-> ExceptT ByronProtocolInstantiationError IO ByteString
forall a b. (a -> b) -> a -> b
$ FilePath -> IO ByteString
LB.readFile FilePath
delegCertFile
ByronSigningKey SigningKey
signingKey <- ByronProtocolInstantiationError
-> Maybe (SigningKey ByronKey)
-> ExceptT ByronProtocolInstantiationError IO (SigningKey ByronKey)
forall (m :: * -> *) x a. Monad m => x -> Maybe a -> ExceptT x m a
hoistMaybe (FilePath -> ByronProtocolInstantiationError
SigningKeyDeserialiseFailure FilePath
signingKeyFile)
(Maybe (SigningKey ByronKey)
-> ExceptT
ByronProtocolInstantiationError IO (SigningKey ByronKey))
-> Maybe (SigningKey ByronKey)
-> ExceptT ByronProtocolInstantiationError IO (SigningKey ByronKey)
forall a b. (a -> b) -> a -> b
$ AsType (SigningKey ByronKey)
-> ByteString -> Maybe (SigningKey ByronKey)
forall a.
SerialiseAsRawBytes a =>
AsType a -> ByteString -> Maybe a
deserialiseFromRawBytes (AsType ByronKey -> AsType (SigningKey ByronKey)
forall a. AsType a -> AsType (SigningKey a)
AsSigningKey AsType ByronKey
AsByronKey) (ByteString -> Maybe (SigningKey ByronKey))
-> ByteString -> Maybe (SigningKey ByronKey)
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
LB.toStrict ByteString
signingKeyFileBytes
Certificate
delegCert <- (Text -> ByronProtocolInstantiationError)
-> ExceptT Text IO Certificate
-> ExceptT ByronProtocolInstantiationError IO Certificate
forall (m :: * -> *) x y a.
Functor m =>
(x -> y) -> ExceptT x m a -> ExceptT y m a
firstExceptT (FilePath -> Text -> ByronProtocolInstantiationError
CanonicalDecodeFailure FilePath
delegCertFile)
(ExceptT Text IO Certificate
-> ExceptT ByronProtocolInstantiationError IO Certificate)
-> (Either Text Certificate -> ExceptT Text IO Certificate)
-> Either Text Certificate
-> ExceptT ByronProtocolInstantiationError IO Certificate
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Either Text Certificate -> ExceptT Text IO Certificate
forall (m :: * -> *) x a. Monad m => Either x a -> ExceptT x m a
hoistEither
(Either Text Certificate
-> ExceptT ByronProtocolInstantiationError IO Certificate)
-> Either Text Certificate
-> ExceptT ByronProtocolInstantiationError IO Certificate
forall a b. (a -> b) -> a -> b
$ ByteString -> Either Text Certificate
forall a.
FromJSON (Either SchemaError) a =>
ByteString -> Either Text a
canonicalDecodePretty ByteString
delegCertFileBytes
(ByronLeaderCredentialsError -> ByronProtocolInstantiationError)
-> (ByronLeaderCredentials -> Maybe ByronLeaderCredentials)
-> ExceptT ByronLeaderCredentialsError IO ByronLeaderCredentials
-> ExceptT
ByronProtocolInstantiationError IO (Maybe ByronLeaderCredentials)
forall (m :: * -> *) x y a b.
Functor m =>
(x -> y) -> (a -> b) -> ExceptT x m a -> ExceptT y m b
bimapExceptT ByronLeaderCredentialsError -> ByronProtocolInstantiationError
CredentialsError ByronLeaderCredentials -> Maybe ByronLeaderCredentials
forall a. a -> Maybe a
Just
(ExceptT ByronLeaderCredentialsError IO ByronLeaderCredentials
-> ExceptT
ByronProtocolInstantiationError IO (Maybe ByronLeaderCredentials))
-> (Either ByronLeaderCredentialsError ByronLeaderCredentials
-> ExceptT ByronLeaderCredentialsError IO ByronLeaderCredentials)
-> Either ByronLeaderCredentialsError ByronLeaderCredentials
-> ExceptT
ByronProtocolInstantiationError IO (Maybe ByronLeaderCredentials)
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Either ByronLeaderCredentialsError ByronLeaderCredentials
-> ExceptT ByronLeaderCredentialsError IO ByronLeaderCredentials
forall (m :: * -> *) x a. Monad m => Either x a -> ExceptT x m a
hoistEither
(Either ByronLeaderCredentialsError ByronLeaderCredentials
-> ExceptT
ByronProtocolInstantiationError IO (Maybe ByronLeaderCredentials))
-> Either ByronLeaderCredentialsError ByronLeaderCredentials
-> ExceptT
ByronProtocolInstantiationError IO (Maybe ByronLeaderCredentials)
forall a b. (a -> b) -> a -> b
$ Config
-> SigningKey
-> Certificate
-> Text
-> Either ByronLeaderCredentialsError ByronLeaderCredentials
mkByronLeaderCredentials Config
genesisConfig SigningKey
signingKey Certificate
delegCert Text
"Byron"
data ByronProtocolInstantiationError =
CanonicalDecodeFailure !FilePath !Text
| GenesisHashMismatch !GenesisHash !GenesisHash
| DelegationCertificateFilepathNotSpecified
| GenesisConfigurationError !FilePath !Genesis.ConfigurationError
| GenesisReadError !FilePath !Genesis.GenesisDataError
| CredentialsError !ByronLeaderCredentialsError
| SigningKeyDeserialiseFailure !FilePath
| SigningKeyFilepathNotSpecified
deriving Int -> ByronProtocolInstantiationError -> ShowS
[ByronProtocolInstantiationError] -> ShowS
ByronProtocolInstantiationError -> FilePath
(Int -> ByronProtocolInstantiationError -> ShowS)
-> (ByronProtocolInstantiationError -> FilePath)
-> ([ByronProtocolInstantiationError] -> ShowS)
-> Show ByronProtocolInstantiationError
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ByronProtocolInstantiationError -> ShowS
showsPrec :: Int -> ByronProtocolInstantiationError -> ShowS
$cshow :: ByronProtocolInstantiationError -> FilePath
show :: ByronProtocolInstantiationError -> FilePath
$cshowList :: [ByronProtocolInstantiationError] -> ShowS
showList :: [ByronProtocolInstantiationError] -> ShowS
Show
instance Error ByronProtocolInstantiationError where
displayError :: ByronProtocolInstantiationError -> FilePath
displayError (CanonicalDecodeFailure FilePath
fp Text
failure) =
FilePath
"Canonical decode failure in " FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> FilePath
fp
FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> FilePath
" Canonical failure: " FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> Text -> FilePath
Text.unpack Text
failure
displayError (GenesisHashMismatch GenesisHash
actual GenesisHash
expected) =
FilePath
"Wrong Byron genesis file: the actual hash is " FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> GenesisHash -> FilePath
forall a b. (Show a, ConvertText FilePath b) => a -> b
show GenesisHash
actual
FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> FilePath
", but the expected Byron genesis hash given in the node configuration "
FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> FilePath
"file is " FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> GenesisHash -> FilePath
forall a b. (Show a, ConvertText FilePath b) => a -> b
show GenesisHash
expected
displayError ByronProtocolInstantiationError
DelegationCertificateFilepathNotSpecified =
FilePath
"Delegation certificate filepath not specified"
displayError (GenesisConfigurationError FilePath
fp ConfigurationError
genesisConfigError) =
FilePath
"Genesis configuration error in: " FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> ShowS
forall a b. ConvertText a b => a -> b
toS FilePath
fp
FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> FilePath
" Error: " FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> ConfigurationError -> FilePath
forall a b. (Show a, ConvertText FilePath b) => a -> b
show ConfigurationError
genesisConfigError
displayError (GenesisReadError FilePath
fp GenesisDataError
err) =
FilePath
"There was an error parsing the genesis file: " FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> ShowS
forall a b. ConvertText a b => a -> b
toS FilePath
fp
FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> FilePath
" Error: " FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> GenesisDataError -> FilePath
forall a b. (Show a, ConvertText FilePath b) => a -> b
show GenesisDataError
err
displayError (CredentialsError ByronLeaderCredentialsError
byronLeaderCredentialsError) =
FilePath
"Byron leader credentials error: " FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> ByronLeaderCredentialsError -> FilePath
forall a b. (Show a, ConvertText FilePath b) => a -> b
show ByronLeaderCredentialsError
byronLeaderCredentialsError
displayError (SigningKeyDeserialiseFailure FilePath
fp) =
FilePath
"Signing key deserialisation error in: " FilePath -> ShowS
forall a. Semigroup a => a -> a -> a
<> ShowS
forall a b. ConvertText a b => a -> b
toS FilePath
fp
displayError ByronProtocolInstantiationError
SigningKeyFilepathNotSpecified =
FilePath
"Signing key filepath not specified"