1
+ {-# LANGUAGE DerivingVia #-}
1
2
{-# LANGUAGE GADTs #-}
2
- {-# LANGUAGE NamedFieldPuns #-}
3
3
{-# LANGUAGE OverloadedStrings #-}
4
4
{-# LANGUAGE ScopedTypeVariables #-}
5
5
{-# LANGUAGE TypeApplications #-}
@@ -13,11 +13,6 @@ module Testnet.Components.Configuration
13
13
, getByronGenesisHash
14
14
, getShelleyGenesisHash
15
15
16
- , NumPools (.. )
17
- , numPools
18
- , NumDReps
19
- , numDReps
20
-
21
16
, anyEraToString
22
17
, eraToString
23
18
) where
@@ -61,7 +56,8 @@ import System.FilePath.Posix (takeDirectory, (</>))
61
56
import Testnet.Defaults
62
57
import Testnet.Filepath
63
58
import Testnet.Process.Run (execCli_ )
64
- import Testnet.Start.Types (CardanoTestnetOptions (.. ), anyEraToString , anyShelleyBasedEraToString , eraToString )
59
+ import Testnet.Start.Types (NumDReps (.. ), NumPools (.. ), anyEraToString ,
60
+ anyShelleyBasedEraToString , eraToString )
65
61
66
62
import Hedgehog
67
63
import qualified Hedgehog as H
@@ -118,16 +114,6 @@ getShelleyGenesisHash path key = do
118
114
numSeededUTxOKeys :: Int
119
115
numSeededUTxOKeys = 3
120
116
121
- newtype NumPools = NumPools Int
122
-
123
- numPools :: CardanoTestnetOptions -> NumPools
124
- numPools CardanoTestnetOptions { cardanoNodes } = NumPools $ length cardanoNodes
125
-
126
- newtype NumDReps = NumDReps Int
127
-
128
- numDReps :: CardanoTestnetOptions -> NumDReps
129
- numDReps CardanoTestnetOptions { cardanoNumDReps } = NumDReps cardanoNumDReps
130
-
131
117
createSPOGenesisAndFiles
132
118
:: (MonadTest m , MonadCatch m , MonadIO m , HasCallStack )
133
119
=> NumPools -- ^ The number of pools to make
@@ -139,7 +125,7 @@ createSPOGenesisAndFiles
139
125
-> ConwayGenesis StandardCrypto -- ^ The conway genesis to use, for example 'Defaults.defaultConwayGenesis'.
140
126
-> TmpAbsolutePath
141
127
-> m FilePath -- ^ Shelley genesis directory
142
- createSPOGenesisAndFiles ( NumPools numPoolNodes) ( NumDReps numDelReps) maxSupply sbe shelleyGenesis
128
+ createSPOGenesisAndFiles nPoolNodes nDelReps maxSupply sbe shelleyGenesis
143
129
alonzoGenesis conwayGenesis (TmpAbsolutePath tempAbsPath) = GHC. withFrozenCallStack $ do
144
130
let inputGenesisShelleyFp = tempAbsPath </> genesisInputFilepath ShelleyEra
145
131
inputGenesisAlonzoFp = tempAbsPath </> genesisInputFilepath AlonzoEra
@@ -158,7 +144,7 @@ createSPOGenesisAndFiles (NumPools numPoolNodes) (NumDReps numDelReps) maxSupply
158
144
let testnetMagic = sgNetworkMagic shelleyGenesis
159
145
-- At least there should be a delegator per DRep
160
146
-- otherwise some won't be representing anybody
161
- numStakeDelegators = max 3 numDelReps :: Int
147
+ numStakeDelegators = max 3 ( fromIntegral nDelReps) :: Int
162
148
startTime = sgSystemStart shelleyGenesis
163
149
164
150
-- TODO: Remove this rewrite.
@@ -171,8 +157,8 @@ createSPOGenesisAndFiles (NumPools numPoolNodes) (NumDReps numDelReps) maxSupply
171
157
-- TODO: create-testnet-data should have arguments for
172
158
-- Alonzo and Conway genesis that are optional and if not
173
159
-- supplised the users get a default
174
- H. note_ $ " Number of pools: " <> show numPoolNodes
175
- H. note_ $ " Number of stake delegators: " <> show numPoolNodes
160
+ H. note_ $ " Number of pools: " <> show nPoolNodes
161
+ H. note_ $ " Number of stake delegators: " <> show nPoolNodes
176
162
H. note_ $ " Number of seeded UTxO keys: " <> show numSeededUTxOKeys
177
163
178
164
execCli_
@@ -181,11 +167,11 @@ createSPOGenesisAndFiles (NumPools numPoolNodes) (NumDReps numDelReps) maxSupply
181
167
, " --spec-alonzo" , inputGenesisAlonzoFp
182
168
, " --spec-conway" , inputGenesisConwayFp
183
169
, " --testnet-magic" , show testnetMagic
184
- , " --pools" , show numPoolNodes
170
+ , " --pools" , show nPoolNodes
185
171
, " --total-supply" , show maxSupply -- Half of this will be delegated, see https://github.com/IntersectMBO/cardano-cli/pull/874
186
172
, " --stake-delegators" , show numStakeDelegators
187
173
, " --utxo-keys" , show numSeededUTxOKeys
188
- , " --drep-keys" , show numDelReps
174
+ , " --drep-keys" , show nDelReps
189
175
, " --start-time" , DTC. formatIso8601 startTime
190
176
, " --out-dir" , tempAbsPath
191
177
]
0 commit comments