@@ -19,8 +19,8 @@ module Testnet.Start.Cardano
19
19
20
20
, cardanoTestnet
21
21
, cardanoTestnetDefault
22
- , getDefaultAlonzoGenesis
23
- , getDefaultShelleyGenesis
22
+ , getDefaultAlonzoGenesis -- TODO, stop exporting me when Shutdown.hs is refactored to use cardanoTestnet
23
+ , getDefaultGenesisBatch
24
24
, retryOnAddressInUseError
25
25
) where
26
26
@@ -29,7 +29,6 @@ import Cardano.Api
29
29
import Cardano.Api.Ledger (StandardCrypto )
30
30
31
31
import Cardano.Ledger.Alonzo.Genesis (AlonzoGenesis )
32
- import Cardano.Ledger.Conway.Genesis (ConwayGenesis )
33
32
import Cardano.Node.Configuration.Topology
34
33
35
34
import Prelude hiding (lines )
@@ -88,6 +87,7 @@ startTimeOffsetSeconds = if OS.isWin32 then 90 else 15
88
87
-- | Like 'cardanoTestnet', but using 'GenesisOptions' to obtain
89
88
-- the genesis files, instead of passing them directly.
90
89
-- See 'cardanoTestnet' for additional documentation.
90
+ -- TODO delete me? @cardano-testnet@ plus @getDefaultGenesisBatch@ suffice now.
91
91
cardanoTestnetDefault
92
92
:: ()
93
93
=> HasCallStack
@@ -96,12 +96,8 @@ cardanoTestnetDefault
96
96
-> Conf
97
97
-> H. Integration TestnetRuntime
98
98
cardanoTestnetDefault testnetOptions shelleyOptions conf = do
99
- AnyShelleyBasedEra sbe <- pure cardanoNodeEra
100
- alonzoGenesis <- getDefaultAlonzoGenesis sbe
101
- shelleyGenesis <- getDefaultShelleyGenesis cardanoNodeEra cardanoMaxSupply shelleyOptions
102
- cardanoTestnet testnetOptions conf UserNodeConfigNotSubmitted shelleyGenesis alonzoGenesis Defaults. defaultConwayGenesis
103
- where
104
- CardanoTestnetOptions {cardanoNodeEra, cardanoMaxSupply} = testnetOptions
99
+ batch <- getDefaultGenesisBatch testnetOptions shelleyOptions
100
+ cardanoTestnet testnetOptions conf UserNodeConfigNotSubmitted batch
105
101
106
102
-- | An 'AlonzoGenesis' value that is fit to pass to 'cardanoTestnet'
107
103
getDefaultAlonzoGenesis :: ()
@@ -125,6 +121,23 @@ getDefaultShelleyGenesis asbe maxSupply opts = do
125
121
startTime <- H. noteShow $ DTC. addUTCTime startTimeOffsetSeconds currentTime
126
122
return $ Defaults. defaultShelleyGenesis asbe startTime maxSupply opts
127
123
124
+ -- | Get a 'GenesisBatch' that is fit to pass to 'cardanoTestnet'
125
+ getDefaultGenesisBatch
126
+ :: ()
127
+ => HasCallStack
128
+ => MonadIO m
129
+ => MonadTest m
130
+ => CardanoTestnetOptions
131
+ -> GenesisOptions
132
+ -> m GenesisBatch
133
+ getDefaultGenesisBatch testnetOptions shelleyOptions = do
134
+ AnyShelleyBasedEra sbe <- pure cardanoNodeEra
135
+ alonzoGenesis <- getDefaultAlonzoGenesis sbe
136
+ shelleyGenesis <- getDefaultShelleyGenesis cardanoNodeEra cardanoMaxSupply shelleyOptions
137
+ return (GenesisBatch (shelleyGenesis, alonzoGenesis, Defaults. defaultConwayGenesis, DefaultedOrigin ))
138
+ where
139
+ CardanoTestnetOptions {cardanoNodeEra, cardanoMaxSupply} = testnetOptions
140
+
128
141
-- | Setup a number of credentials and nodes (SPOs and relays), like this:
129
142
--
130
143
-- > ├── byron-gen-command
@@ -194,14 +207,15 @@ cardanoTestnet :: ()
194
207
=> CardanoTestnetOptions -- ^ The options to use
195
208
-> Conf
196
209
-> UserNodeConfig -- ^ The node configuration file to use. If omitted it's generated.
197
- -> ShelleyGenesis StandardCrypto -- ^ The shelley genesis to use, for example 'getDefaultShelleyGenesis' from this module.
198
- -- Some fields are overridden by the accompanying 'CardanoTestnetOptions'.
199
- -> AlonzoGenesis -- ^ The alonzo genesis to use, for example 'getDefaultAlonzoGenesis' from this module.
200
- -> ConwayGenesis StandardCrypto -- ^ The conway genesis to use, for example 'Defaults.defaultConwayGenesis'.
210
+ -> GenesisBatch
211
+ -- ^ The shelley genesis to use, for example 'getDefaultShelleyGenesis' from this module,
212
+ -- and whether they ar provided by the user or defaulted by 'cardano-testnet'.
213
+ -- Some fields are overridden by the accompanying 'CardanoTestnetOptions' (TODO: don't override
214
+ -- anything when the user provided the files)
201
215
-> H. Integration TestnetRuntime
202
216
cardanoTestnet
203
217
testnetOptions Conf {tempAbsPath= TmpAbsolutePath tmpAbsPath} mNodeConfigFile
204
- shelleyGenesis alonzoGenesis conwayGenesis = do
218
+ genesisBatch @ ( GenesisBatch ( shelleyGenesis, alonzoGenesis, conwayGenesis, _)) = do
205
219
let CardanoTestnetOptions
206
220
{ cardanoNodeEra= asbe
207
221
, cardanoMaxSupply= maxSupply
@@ -225,7 +239,7 @@ cardanoTestnet
225
239
writeGenesisSpecFile " alonzo" alonzoGenesis
226
240
writeGenesisSpecFile " conway" conwayGenesis
227
241
228
- _ <- createSPOGenesisAndFiles nPools nDReps maxSupply asbe shelleyGenesis alonzoGenesis conwayGenesis (TmpAbsolutePath tmpAbsPath)
242
+ _ <- createSPOGenesisAndFiles nPools nDReps maxSupply asbe genesisBatch (TmpAbsolutePath tmpAbsPath)
229
243
230
244
-- TODO: This should come from the configuration!
231
245
let makePathsAbsolute :: (Element a ~ FilePath , MonoFunctor a ) => a -> a
0 commit comments