Skip to content

Commit

Permalink
CAD-2907 stub compute: calibrate at startup, with configurable targets
Browse files Browse the repository at this point in the history
  • Loading branch information
deepfire committed May 4, 2021
1 parent 86beee4 commit e165a33
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cardano-node/src/Cardano/Node/Configuration/POM.hs
Expand Up @@ -220,10 +220,14 @@ instance FromJSON PartialNodeConfiguration where
(Just _, Just _) -> fail $ "Specify either ShelleyGenesisFile"
++ "or GenesisFile, but not both"
npcShelleyGenesisFileHash <- v .:? "ShelleyGenesisHash"
npcStubComputeDuration <- v .:? "StubComputeDuration"
npcStubComputePrecision <- v .:? "StubComputePrecision"

pure NodeShelleyProtocolConfiguration {
npcShelleyGenesisFile
, npcShelleyGenesisFileHash
, fromMaybe 0.1 npcStubComputeDuration
, fromMaybe 0.01 npcStubComputePrecision
}

parseHardForkProtocol v = do
Expand Down
9 changes: 8 additions & 1 deletion cardano-node/src/Cardano/Node/Protocol/Cardano.hs
Expand Up @@ -27,6 +27,7 @@ import qualified Ouroboros.Consensus.Cardano.CanHardFork as Consensus
import Ouroboros.Consensus.HardFork.Combinator.Condense ()

import Ouroboros.Consensus.Cardano.Condense ()
import Ouroboros.Consensus.Shelley.Ledger.Stub

import Cardano.Api.Orphans ()
import Cardano.Api.Protocol.Types
Expand Down Expand Up @@ -75,7 +76,9 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
}
NodeShelleyProtocolConfiguration {
npcShelleyGenesisFile,
npcShelleyGenesisFileHash
npcShelleyGenesisFileHash,
npcStubComputeDuration,
npcStubComputePrecision
}
NodeHardForkProtocolConfiguration {
npcTestShelleyHardForkAtEpoch,
Expand All @@ -86,6 +89,10 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
npcTestMaryHardForkAtVersion
}
files = do
calibrateStubComputationArgForTime
npcStubComputeDuration
npcStubComputePrecision

byronGenesis <-
firstExceptT CardanoProtocolInstantiationErrorByron $
Byron.readGenesis npcByronGenesisFile
Expand Down
2 changes: 2 additions & 0 deletions cardano-node/src/Cardano/Node/Types.hs
Expand Up @@ -268,6 +268,8 @@ data NodeShelleyProtocolConfiguration =
NodeShelleyProtocolConfiguration {
npcShelleyGenesisFile :: !GenesisFile
, npcShelleyGenesisFileHash :: !(Maybe GenesisHash)
, npcStubComputeDuration :: !Double
, npcStubComputePrecision :: !Double
}
deriving (Eq, Show)

Expand Down

0 comments on commit e165a33

Please sign in to comment.