Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 33e4d04

Browse files
deepfireksaric
authored andcommitted
Core: + coPBftSigThd; optionalise coStaticKeySigningKeyFile & coStaticKey (#234)
* Core: + coPBftSigThd; optionalise coStaticKeySigningKeyFile & coStaticKeyDlgCertFile * Fix formatting and use existing functions for the CLI.
1 parent 455c006 commit 33e4d04

File tree

5 files changed

+25
-17
lines changed

5 files changed

+25
-17
lines changed

src/Cardano/Shell/Configuration/Lib.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ finaliseCardanoConfiguration PartialCardanoConfiguration{..} = do
9898
coRequiresNetworkMagic <- lastToEither "Unspecified coRequiresNetworkMagic" pcoRequiresNetworkMagic
9999
coDBSerializeVersion <- lastToEither "Unspecified coDBSerializeVersion" pcoDBSerializeVersion
100100

101+
coPBftSigThd <- lastToEither "Unspecified coPBftSigThd" pcoPBftSigThd
102+
101103
pure Core{..}
102104

103105

@@ -241,7 +243,6 @@ finaliseCardanoConfiguration PartialCardanoConfiguration{..} = do
241243

242244
pure Wallet {..}
243245

244-
245246
-- | Generate 'TopologyConfig' with given 'Cluster'
246247
mkTopology :: Cluster -> IO TopologyConfig
247248
mkTopology cluster = input auto topologyPath

src/Cardano/Shell/Constants/CLI.hs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,26 @@ configCoreCLIParser = PartialCore
116116
<> metavar "GENESIS-HASH"
117117
<> help "The genesis hash value."
118118
)
119-
<*> lastStrOption
119+
<*> (Just <<$>> lastStrOption
120120
( long "signing-key"
121121
<> metavar "FILEPATH"
122122
<> help "Path to the signing key."
123123
)
124-
<*> lastStrOption
124+
)
125+
<*> (Just <<$>> lastStrOption
125126
( long "delegation-certificate"
126127
<> metavar "FILEPATH"
127128
<> help "Path to the delegation certificate."
128129
)
130+
)
129131
<*> lastOption configNetworkMagicCLIParser
130132
<*> lastOption configDBVersionCLIParser
133+
<*> (Just <<$>> lastDoubleOption
134+
( long "pbft-signature-threshold"
135+
<> metavar "DOUBLE"
136+
<> help "The PBFT signature threshold."
137+
)
138+
)
131139
where
132140
-- | Parser for the network magic options.
133141
configNetworkMagicCLIParser :: Parser RequireNetworkMagic

src/Cardano/Shell/Constants/PartialTypes.hs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,12 @@ data PartialCardanoConfiguration = PartialCardanoConfiguration
4949
-- | Partial @Core@ configuration.
5050
data PartialCore = PartialCore
5151
{ pcoGenesisFile :: !(Last FilePath)
52-
-- ^ Genesis source file JSON.
5352
, pcoGenesisHash :: !(Last Text)
54-
-- ^ Genesis previous block hash.
55-
, pcoStaticKeySigningKeyFile :: !(Last FilePath)
56-
-- ^ Static key signing file.
57-
, pcoStaticKeyDlgCertFile :: !(Last FilePath)
58-
-- ^ Static key delegation certificate.
53+
, pcoStaticKeySigningKeyFile :: !(Last (Maybe FilePath))
54+
, pcoStaticKeyDlgCertFile :: !(Last (Maybe FilePath))
5955
, pcoRequiresNetworkMagic :: !(Last RequireNetworkMagic)
60-
-- ^ Do we require the network byte indicator for mainnet, testnet or staging?
6156
, pcoDBSerializeVersion :: !(Last Integer)
62-
-- ^ Versioning for values in node's DB.
57+
, pcoPBftSigThd :: !(Last (Maybe Double))
6358
} deriving (Eq, Show, Generic)
6459
deriving Semigroup via GenericSemigroup PartialCore
6560
deriving Monoid via GenericMonoid PartialCore

src/Cardano/Shell/Constants/Types.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,16 @@ data Core = Core
8282
-- ^ Genesis source file JSON.
8383
, coGenesisHash :: !Text
8484
-- ^ Genesis previous block hash.
85-
, coStaticKeySigningKeyFile :: !FilePath
85+
, coStaticKeySigningKeyFile :: !(Maybe FilePath)
8686
-- ^ Static key signing file.
87-
, coStaticKeyDlgCertFile :: !FilePath
87+
, coStaticKeyDlgCertFile :: !(Maybe FilePath)
8888
-- ^ Static key delegation certificate.
8989
, coRequiresNetworkMagic :: !RequireNetworkMagic
9090
-- ^ Do we require the network byte indicator for mainnet, testnet or staging?
9191
, coDBSerializeVersion :: !Integer
9292
-- ^ Versioning for values in node's DB.
93+
, coPBftSigThd :: !(Maybe Double)
94+
-- ^ PBFT signature threshold system parameters
9395
} deriving (Eq, Show, Generic)
9496

9597
data Spec = Spec

src/Cardano/Shell/Presets.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ mainnetConfiguration =
3434
PartialCore
3535
{ pcoGenesisFile = pure "mainnet-genesis.json"
3636
, pcoGenesisHash = pure "89d9b5a5b8ddc8d7e5a6795e9774d97faf1efea59b2caf7eaf9f8c5b32059df4"
37-
, pcoStaticKeySigningKeyFile = pure "TEST"
38-
, pcoStaticKeyDlgCertFile = pure "TEST"
37+
, pcoStaticKeySigningKeyFile = pure Nothing
38+
, pcoStaticKeyDlgCertFile = pure Nothing
3939
, pcoRequiresNetworkMagic = pure RequireNetworkMagic
4040
, pcoDBSerializeVersion = pure 0
41+
, pcoPBftSigThd = pure Nothing
4142
}
4243
, pccNTP =
4344
PartialNTP
@@ -151,10 +152,11 @@ devConfiguration =
151152
PartialCore
152153
{ pcoGenesisFile = pure "testnet-genesis.json"
153154
, pcoGenesisHash = pure "7f141ea26e189c9cb09e2473f6499561011d5d3c90dd642fde859ce02282a3ae"
154-
, pcoStaticKeySigningKeyFile = mempty
155-
, pcoStaticKeyDlgCertFile = mempty
155+
, pcoStaticKeySigningKeyFile = pure Nothing
156+
, pcoStaticKeyDlgCertFile = pure Nothing
156157
, pcoRequiresNetworkMagic = pure RequireNetworkMagic
157158
, pcoDBSerializeVersion = pure 0
159+
, pcoPBftSigThd = pure Nothing
158160
}
159161
, pccNTP =
160162
PartialNTP

0 commit comments

Comments
 (0)