8
8
{-# OPTIONS_GHC -Wno-unused-local-binds -Wno-unused-matches #-}
9
9
10
10
module Testnet.Babbage
11
- ( BabbageTestnetOptions (.. )
12
- , defaultTestnetOptions
13
- , TestnetRuntime (.. )
11
+ ( TestnetRuntime (.. )
14
12
, PaymentKeyPair (.. )
15
13
16
14
, babbageTestnet
17
15
) where
18
16
19
- import Control.Monad
20
- import Data.Aeson (encode , object , toJSON , (.=) )
21
- import Hedgehog.Extras.Stock.Time (showUTCTimeSeconds )
22
17
import Prelude
23
- import System.FilePath.Posix ((</>) )
24
18
19
+ import Control.Monad
20
+ import Data.Aeson (encode , object , toJSON , (.=) )
25
21
import qualified Data.HashMap.Lazy as HM
26
22
import qualified Data.List as L
27
23
import qualified Data.Time.Clock as DTC
28
24
import qualified Hedgehog.Extras.Stock.Aeson as J
29
25
import qualified Hedgehog.Extras.Stock.OS as OS
30
26
import qualified Hedgehog.Extras.Test.Base as H
31
27
import qualified Hedgehog.Extras.Test.File as H
28
+ import System.FilePath.Posix ((</>) )
32
29
import qualified System.Info as OS
33
30
34
31
import Testnet.Commands.Genesis
35
32
import qualified Testnet.Conf as H
33
+ import Testnet.Options
36
34
import qualified Testnet.Util.Assert as H
37
35
import Testnet.Util.Process (execCli_ )
38
36
import Testnet.Util.Runtime (Delegator (.. ), NodeLoggingFormat (.. ), PaymentKeyPair (.. ),
@@ -42,23 +40,6 @@ import Testnet.Util.Runtime (Delegator (..), NodeLoggingFormat (..), P
42
40
43
41
{- HLINT ignore "Redundant flip" -}
44
42
45
- data BabbageTestnetOptions = BabbageTestnetOptions
46
- { babbageNumSpoNodes :: Int
47
- , babbageSlotDuration :: Int
48
- , babbageSecurityParam :: Int
49
- , babbageTotalBalance :: Int
50
- , babbageNodeLoggingFormat :: NodeLoggingFormat
51
- } deriving (Eq , Show )
52
-
53
- defaultTestnetOptions :: BabbageTestnetOptions
54
- defaultTestnetOptions = BabbageTestnetOptions
55
- { babbageNumSpoNodes = 3
56
- , babbageSlotDuration = 200
57
- , babbageSecurityParam = 10
58
- , babbageTotalBalance = 10020000000
59
- , babbageNodeLoggingFormat = NodeLoggingFormatAsJson
60
- }
61
-
62
43
-- | For an unknown reason, CLI commands are a lot slower on Windows than on Linux and
63
44
-- MacOS. We need to allow a lot more time to set up a testnet.
64
45
startTimeOffsetSeconds :: DTC. NominalDiffTime
@@ -75,20 +56,13 @@ babbageTestnet testnetOptions H.Conf {..} = do
75
56
currentTime <- H. noteShowIO DTC. getCurrentTime
76
57
startTime <- H. noteShow $ DTC. addUTCTime startTimeOffsetSeconds currentTime
77
58
78
- execCli_
79
- [ " byron" , " genesis" , " genesis"
80
- , " --protocol-magic" , show @ Int testnetMagic
81
- , " --start-time" , showUTCTimeSeconds startTime
82
- , " --k" , show @ Int (babbageSecurityParam testnetOptions)
83
- , " --n-poor-addresses" , " 0"
84
- , " --n-delegate-addresses" , show @ Int (babbageNumSpoNodes testnetOptions)
85
- , " --total-balance" , show @ Int (babbageTotalBalance testnetOptions)
86
- , " --delegate-share" , " 1"
87
- , " --avvm-entry-count" , " 0"
88
- , " --avvm-entry-balance" , " 0"
89
- , " --protocol-parameters-file" , tempAbsPath </> " byron.genesis.spec.json"
90
- , " --genesis-output-dir" , tempAbsPath </> " byron-gen-command"
91
- ]
59
+ createByronGenesis
60
+ testnetMagic
61
+ startTime
62
+ testnetOptions
63
+ (tempAbsPath </> " byron.genesis.spec.json" )
64
+ (tempAbsPath </> " byron-gen-command" )
65
+
92
66
93
67
-- Because in Babbage the overlay schedule and decentralization parameter
94
68
-- are deprecated, we must use the "create-staked" cli command to create
0 commit comments