Skip to content
Permalink
Browse files

Remove requirement for pbft signature threshold

  • Loading branch information
Jimbo4350 committed Jan 14, 2020
1 parent 2e89769 commit 08f2a5850e84e2a06e451d9e6d9c51622378bd8f
@@ -133,18 +133,17 @@ fromProtocol
-- ^ Number of core nodes
-> GenesisFile
-> RequiresNetworkMagic
-> Maybe Double
-> Maybe DelegationCertFile
-> Maybe SigningKeyFile
-> Update
-> Protocol
-> ExceptT ProtocolInstantiationError IO SomeProtocol
fromProtocol _ _ _ _ _ _ _ _ _ ByronLegacy =
fromProtocol _ _ _ _ _ _ _ _ ByronLegacy =
left ByronLegacyProtocolNotImplemented
fromProtocol _ nId mNumCoreNodes _ _ _ _ _ _ BFT =
fromProtocol _ nId mNumCoreNodes _ _ _ _ _ BFT =
hoistEither $ mockSomeProtocol nId mNumCoreNodes $ \cid numCoreNodes ->
Consensus.ProtocolMockBFT numCoreNodes cid mockSecurityParam mockSlotLengths
fromProtocol _ nId mNumCoreNodes _ _ _ _ _ _ Praos =
fromProtocol _ nId mNumCoreNodes _ _ _ _ _ Praos =
hoistEither $ mockSomeProtocol nId mNumCoreNodes $ \cid numCoreNodes ->
Consensus.ProtocolMockPraos numCoreNodes cid PraosParams {
praosSecurityParam = mockSecurityParam
@@ -153,15 +152,15 @@ fromProtocol _ nId mNumCoreNodes _ _ _ _ _ _ Praos =
, praosLifetimeKES = 1000000
, praosSlotLength = slotLengthFromSec 2
}
fromProtocol _ nId mNumCoreNodes _ _ _ _ _ _ MockPBFT =
fromProtocol _ nId mNumCoreNodes _ _ _ _ _ MockPBFT =
hoistEither $ mockSomeProtocol nId mNumCoreNodes $ \cid numCoreNodes@(NumCoreNodes numNodes) ->
Consensus.ProtocolMockPBFT numCoreNodes cid
PBftParams { pbftSecurityParam = mockSecurityParam
, pbftNumNodes = fromIntegral numNodes
, pbftSignatureThreshold = (1.0 / fromIntegral numNodes) + 0.1
, pbftSlotLength = mockSlotLength
}
fromProtocol gHash _ _ genFile nMagic sigThresh delCertFp sKeyFp update RealPBFT = do
fromProtocol gHash _ _ genFile nMagic delCertFp sKeyFp update RealPBFT = do
let genHash = either panic identity $ decodeHash gHash

gc <- firstExceptT LedgerConfigError $ Genesis.mkConfigFromFile
@@ -174,7 +173,7 @@ fromProtocol gHash _ _ genFile nMagic sigThresh delCertFp sKeyFp update RealPBFT
delCertFp
sKeyFp

let p = protocolConfigRealPbft update sigThresh gc optionalLeaderCredentials
let p = protocolConfigRealPbft update Nothing gc optionalLeaderCredentials

case Consensus.runProtocol p of
Dict -> return $ SomeProtocol p
@@ -154,7 +154,6 @@ data NodeConfiguration =
, ncNodeId :: Maybe NodeId
, ncNumCoreNodes :: Maybe Int
, ncReqNetworkMagic :: RequiresNetworkMagic
, ncPbftSignatureThresh :: Maybe Double
, ncLoggingSwitch :: Bool
, ncLogMetrics :: Bool
, ncViewMode :: ViewMode
@@ -167,7 +166,6 @@ instance FromJSON NodeConfiguration where
ptcl <- v .: "Protocol"
numCoreNode <- v .:? "NumCoreNodes"
rNetworkMagic <- v .: "RequiresNetworkMagic"
pbftSignatureThresh <- v .:? "PBftSignatureThreshold"
loggingSwitch <- v .: "TurnOnLogging"
vMode <- v .: "ViewMode"
logMetrics <- v .: "TurnOnLogMetrics"
@@ -184,7 +182,6 @@ instance FromJSON NodeConfiguration where
nId
numCoreNode
rNetworkMagic
pbftSignatureThresh
loggingSwitch
logMetrics
vMode
@@ -49,7 +49,6 @@ main = do
(ncNumCoreNodes nc)
(caGenesisFile)
(ncReqNetworkMagic nc)
(ncPbftSignatureThresh nc)
(caDelegationCertFp)
(caSigningKeyFp)
(ncUpdate nc)
@@ -200,7 +200,6 @@ withRealPBFT
-> Maybe Int
-> GenesisFile
-> RequiresNetworkMagic
-> Maybe Double
-> Maybe DelegationCertFile
-> Maybe SigningKeyFile
-> Update
@@ -209,7 +208,7 @@ withRealPBFT
=> Consensus.Protocol ByronBlock
-> ExceptT RealPBFTError IO a)
-> ExceptT RealPBFTError IO a
withRealPBFT gHash nId mNumNodes genFile nMagic sigThresh delCertFp sKeyFp update ptcl action = do
withRealPBFT gHash nId mNumNodes genFile nMagic delCertFp sKeyFp update ptcl action = do
SomeProtocol p <- firstExceptT
FromProtocolError
$ fromProtocol
@@ -218,7 +217,6 @@ withRealPBFT gHash nId mNumNodes genFile nMagic sigThresh delCertFp sKeyFp updat
mNumNodes
genFile
nMagic
sigThresh
delCertFp
sKeyFp
update
@@ -219,7 +219,6 @@ runCommand
(coNumCoreNodes ccCore)
(GenesisFile $ coGenesisFile ccCore)
(coRequiresNetworkMagic ccCore)
(coPBftSigThd ccCore)
(DelegationCertFile <$> (coStaticKeyDlgCertFile ccCore))
(SigningKeyFile <$> (coStaticKeySigningKeyFile ccCore))
(SocketFile ccSocketDir)
@@ -240,7 +239,6 @@ runCommand
(coNumCoreNodes ccCore)
(GenesisFile $ coGenesisFile ccCore)
(coRequiresNetworkMagic ccCore)
(coPBftSigThd ccCore)
(DelegationCertFile <$> (coStaticKeyDlgCertFile ccCore))
(SigningKeyFile <$> (coStaticKeySigningKeyFile ccCore))
ccUpdate
@@ -263,7 +261,6 @@ runCommand
(coNumCoreNodes ccCore)
(GenesisFile $ coGenesisFile ccCore)
(coRequiresNetworkMagic ccCore)
(coPBftSigThd ccCore)
(DelegationCertFile <$> (coStaticKeyDlgCertFile ccCore))
(SigningKeyFile <$> (coStaticKeySigningKeyFile ccCore))
ccUpdate
@@ -291,7 +288,6 @@ runCommand
(coNumCoreNodes ccCore)
(GenesisFile $coGenesisFile ccCore)
(coRequiresNetworkMagic ccCore)
(coPBftSigThd ccCore)
(DelegationCertFile <$> coStaticKeyDlgCertFile ccCore)
(SigningKeyFile <$> coStaticKeySigningKeyFile ccCore)
ccUpdate
@@ -162,7 +162,6 @@ issueGenesisUTxOExpenditure
-- ^ Number of core nodes.
-> GenesisFile
-> RequiresNetworkMagic
-> Maybe Double
-> Maybe DelegationCertFile
-> Maybe SigningKeyFile
-> Update
@@ -177,13 +176,12 @@ issueGenesisUTxOExpenditure
mNumCoreNodes
genFile
nMagic
sigThresh
delCertFp
sKeyFp
update
ptcl
sk =
withRealPBFT gHash (Just nId) mNumCoreNodes genFile nMagic sigThresh delCertFp sKeyFp update ptcl
withRealPBFT gHash (Just nId) mNumCoreNodes genFile nMagic delCertFp sKeyFp update ptcl
$ \(Consensus.ProtocolRealPBFT gc _ _ _ _)-> do
case txSpendGenesisUTxOByronPBFT gc sk genRichAddr outs of
tx@(ByronTx txid _) -> do
@@ -223,7 +221,6 @@ issueUTxOExpenditure
-- ^ Number of core nodes.
-> GenesisFile
-> RequiresNetworkMagic
-> Maybe Double
-> Maybe DelegationCertFile
-> Maybe SigningKeyFile
-> Update
@@ -238,13 +235,12 @@ issueUTxOExpenditure
mNumCoreNodes
genFile
nMagic
sigThresh
delCertFp
sKeyFp
update
ptcl
key = do
withRealPBFT gHash (Just nId) mNumCoreNodes genFile nMagic sigThresh delCertFp sKeyFp update ptcl $
withRealPBFT gHash (Just nId) mNumCoreNodes genFile nMagic delCertFp sKeyFp update ptcl $
\(Consensus.ProtocolRealPBFT gc _ _ _ _)-> do
case txSpendUTxOByronPBFT gc key ins outs of
tx@(ByronTx txid _) -> do
@@ -265,7 +261,6 @@ nodeSubmitTx
-- ^ Number of core nodes
-> GenesisFile
-> RequiresNetworkMagic
-> Maybe Double
-> Maybe DelegationCertFile
-> Maybe SigningKeyFile
-> SocketFile
@@ -280,14 +275,13 @@ nodeSubmitTx
mNumCoreNodes
genFile
nMagic
sigThresh
delCertFp
sKeyFp
socketFp
update
ptcl
gentx =
withRealPBFT gHash (Just nId) mNumCoreNodes genFile nMagic sigThresh delCertFp sKeyFp update ptcl $
withRealPBFT gHash (Just nId) mNumCoreNodes genFile nMagic delCertFp sKeyFp update ptcl $
\p@Consensus.ProtocolRealPBFT{} -> do
_ <- case gentx of
ByronTx txid _ -> pure . putTextLn
@@ -100,7 +100,6 @@ runNode loggingLayer nc nCli = do
(ncNumCoreNodes nc)
(genesisFile $ mscFp nCli)
(ncReqNetworkMagic nc)
(ncPbftSignatureThresh nc)
(delegCertFile $ mscFp nCli)
(signKeyFile $ mscFp nCli)
(ncUpdate nc)
@@ -39,7 +39,6 @@ runClient (WalletCLI config delegCertFile gHash gFile sKeyFile socketFp) tracer
(ncNumCoreNodes nc)
gFile
(ncReqNetworkMagic nc)
(ncPbftSignatureThresh nc)
delegCertFile
sKeyFile
(ncUpdate nc)

0 comments on commit 08f2a58

Please sign in to comment.
You can’t perform that action at this time.