Skip to content

Commit

Permalink
Use lenses for config
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Jan 6, 2024
1 parent 1147cab commit 85ca504
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
1 change: 0 additions & 1 deletion cardano-testnet/cardano-testnet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ library
, time
, transformers
, transformers-except
, unordered-containers
, vector

hs-source-dirs: src
Expand Down
28 changes: 14 additions & 14 deletions cardano-testnet/src/Testnet/Components/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import Control.Monad.IO.Class (MonadIO)
import Data.Aeson
import qualified Data.Aeson as Aeson
import qualified Data.ByteString.Lazy as LBS
import qualified Data.HashMap.Lazy as HM
import qualified Data.List as List
import Data.String
import Data.Time
Expand All @@ -34,7 +33,6 @@ import System.FilePath.Posix ((</>))

import Hedgehog
import qualified Hedgehog as H
import qualified Hedgehog.Extras.Stock.Aeson as J
import qualified Hedgehog.Extras.Stock.Time as DTC
import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.File as H
Expand Down Expand Up @@ -104,18 +102,20 @@ createSPOGenesisAndFiles testnetOptions startTime (TmpAbsolutePath tempAbsPath')
-- TODO: Remove this rewrite.
-- 50 second epochs
-- Epoch length should be "10 * k / f" where "k = securityParam, f = activeSlotsCoeff"
H.rewriteJsonFile createStakedInitialGenesisFile $ J.rewriteObject
( HM.insert "securityParam" (toJSON @Int 5) -- TODO: USE config p arameter
. HM.adjust
(J.rewriteObject
$ HM.adjust
(J.rewriteObject (HM.insert "major" (toJSON @Int 8)))
"protocolVersion"
) "protocolParams"
. HM.insert "rho" (toJSON @Double 0.1)
. HM.insert "tau" (toJSON @Double 0.1)
. HM.insert "updateQuorum" (toJSON @Int 2)
)
H.rewriteJsonFile createStakedInitialGenesisFile $ \o ->
o
-- J.rewriteObject
-- ( HM.insert "securityParam" (toJSON @Int 5) -- TODO: USE config p arameter
-- . HM.adjust
-- (J.rewriteObject
-- $ HM.adjust
-- (J.rewriteObject (HM.insert "major" (toJSON @Int 8)))
-- "protocolVersion"
-- ) "protocolParams"
-- . HM.insert "rho" (toJSON @Double 0.1)
-- . HM.insert "tau" (toJSON @Double 0.1)
-- . HM.insert "updateQuorum" (toJSON @Int 2)
-- )

execCli_
[ "genesis", "create-staked"
Expand Down

0 comments on commit 85ca504

Please sign in to comment.