Skip to content

Commit

Permalink
Merge pull request #6008 from IntersectMBO/smelc/testnet-honor-nodes-…
Browse files Browse the repository at this point in the history
…custom-params

cardano-testnet: QoL changes
  • Loading branch information
smelc authored Oct 17, 2024
2 parents 959eb8e + 31cd564 commit 5f73911
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 30 deletions.
28 changes: 3 additions & 25 deletions cardano-testnet/src/Parsers/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ module Parsers.Cardano
( cmdCardano
) where

import Cardano.Api (AnyShelleyBasedEra (AnyShelleyBasedEra), EraInEon (..), File (..),
bounded)
import Cardano.Api (AnyShelleyBasedEra (AnyShelleyBasedEra), EraInEon (..), bounded)

import Cardano.CLI.Environment
import Cardano.CLI.EraBased.Options.Common hiding (pNetworkId)
Expand Down Expand Up @@ -65,6 +64,8 @@ pCardanoTestnetCliOptions envCli = CardanoTestnetOptions

pNumSpoNodes :: Parser [TestnetNodeOptions]
pNumSpoNodes =
-- We don't support passing custom node configurations files on the CLI.
-- So we use a default node configuration for all nodes.
(`L.replicate` defaultSpoOptions) <$>
OA.option auto
( OA.long "num-pool-nodes"
Expand All @@ -75,29 +76,6 @@ pNumSpoNodes =
where
defaultSpoOptions = SpoNodeOptions Nothing []

_pSpo :: Parser TestnetNodeOptions
_pSpo =
SpoNodeOptions -- TODO add parser for node roles
. Just <$> parseNodeConfigFile
<*> pure [] -- TODO: Consider adding support for extra args

parseNodeConfigFile :: Parser NodeConfigurationYaml
parseNodeConfigFile = File <$>
strOption
(mconcat
[ long "configuration-file"
, metavar "NODE-CONFIGURATION"
, help helpText
, completer (bashCompleter "file")
]
)
where
helpText = unwords
[ "Configuration file for the cardano-node(s)."
, "Specify a configuration file per node you want to have in the cluster."
, "Or use num-pool-nodes to use cardano-testnet's default configuration."
]

pGenesisOptions :: Parser GenesisOptions
pGenesisOptions =
GenesisOptions
Expand Down
3 changes: 2 additions & 1 deletion cardano-testnet/src/Testnet/Runtime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ startNode
-> Int
-- ^ Testnet magic
-> [String]
-- ^ The command --socket-path will be added automatically.
-- ^ The command to execute to start the node.
-- @--socket-path@, @--port@, and @--host-addr@ gets added automatically.
-> ExceptT NodeStartFailure m TestnetNode
startNode tp node ipv4 port testnetMagic nodeCmd = GHC.withFrozenCallStack $ do
let tempBaseAbsPath = makeTmpBaseAbsPath tp
Expand Down
5 changes: 1 addition & 4 deletions cardano-testnet/src/Testnet/Start/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ getDefaultShelleyGenesis asbe maxSupply opts = do
-- > │   └── README.md
-- > ├── drep-keys
-- > │   ├── drep{1,2,3}
-- > │   │   └── drep.{skey,drep.vkey}
-- > │   │   └── drep.{skey,vkey}
-- > │   └── README.md
-- > ├── genesis-keys
-- > │   ├── genesis{1,2,3}
Expand Down Expand Up @@ -234,9 +234,6 @@ cardanoTestnet
H.lbsWriteFile (tmpAbsPath </> "byron.genesis.spec.json")
. encode $ Defaults.defaultByronProtocolParamsJsonValue

-- Because in Conway the overlay schedule and decentralization parameter
-- are deprecated, we must use the "create-staked" cli command to create
-- SPOs in the ShelleyGenesis
Byron.createByronGenesis
testnetMagic
startTime
Expand Down

0 comments on commit 5f73911

Please sign in to comment.