Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
pbft signing threshold config from CLI
Browse files Browse the repository at this point in the history
use the --pbft-threshold parameter
  • Loading branch information
avieth committed Aug 13, 2019
1 parent 60be954 commit d0ef4a2
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/exec/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ import Ouroboros.Consensus.Ledger.Byron (ByronGiven)
import Ouroboros.Consensus.Ledger.Byron.Config (ByronConfig)
import Ouroboros.Consensus.Protocol.Abstract (SecurityParam (..))
import Ouroboros.Consensus.Node.ProtocolInfo.Abstract (ProtocolInfo (..))
import Ouroboros.Consensus.Node.ProtocolInfo.Byron (protocolInfoByron)
import Ouroboros.Consensus.Node.ProtocolInfo.Byron (PBftSignatureThreshold (..),
protocolInfoByron)
import Ouroboros.Network.NodeToNode (withServer)
import Ouroboros.Consensus.Util.ThreadRegistry (ThreadRegistry, withThreadRegistry)
import Ouroboros.Network.Block (SlotNo (..), Point (..))
Expand All @@ -105,6 +106,9 @@ data ByronProxyOptions = ByronProxyOptions
, bpoCardanoConfigurationOptions :: !CSL.ConfigurationOptions
, bpoShelleyOptions :: !ShelleyOptions
, bpoByronOptions :: !(Maybe ByronOptions)
, bpoPBftSignatureThreshold :: !PBftSignatureThreshold
-- ^ PBFT signature threshold parameter. It's not present in, and cannot
-- be derived from, the cardano-sl configuration.
}

-- | Host and port on which to run the Shelley server.
Expand Down Expand Up @@ -190,6 +194,7 @@ cliParser = ByronProxyOptions
<*> cliCardanoConfigurationOptions
<*> cliShelleyOptions
<*> cliByronOptions
<*> cliPBftSignatureThreshold

where

Expand Down Expand Up @@ -222,6 +227,16 @@ cliParser = ByronProxyOptions
Opt.metavar "[HOSTNAME]:SERVIVCENAME" <>
Opt.help help

-- Uses the Read instance for Double.
cliPBftSignatureThreshold :: Opt.Parser PBftSignatureThreshold
cliPBftSignatureThreshold = Opt.option (PBftSignatureThreshold <$> Opt.auto) $
Opt.long "pbft-threshold" <>
Opt.metavar "DOUBLE" <>
-- FIXME ouroboros-consensus should export defaultPBftSignatureThreshold
-- That'd be better than putting this magic number here.
Opt.value (PBftSignatureThreshold 0.22) <>
Opt.help "PBft signature threshold"

cliByronOptions :: Opt.Parser (Maybe ByronOptions)
cliByronOptions = Opt.optional $
ByronOptions <$> cliNetworkConfig
Expand Down Expand Up @@ -507,7 +522,7 @@ main = do
(Cardano.ApplicationName (fromString "cardano-byron-proxy")) 2
protocolInfo = protocolInfoByron
newGenesisConfig
Nothing -- Default signature threshold.
(Just (bpoPBftSignatureThreshold bpo))
protocolVersion
softwareVersion
Nothing
Expand Down

0 comments on commit d0ef4a2

Please sign in to comment.