Skip to content

Commit

Permalink
Merge pull request #6118 from IntersectMBO/smelc/remove-unused-cardan…
Browse files Browse the repository at this point in the history
…o-testnet-feature

cardano-testnet: remove possibility to programmatically pass a custom node configuration file (it was unused)
  • Loading branch information
smelc authored Feb 20, 2025
2 parents 97cd975 + d510758 commit 757f338
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 29 deletions.
2 changes: 1 addition & 1 deletion cardano-testnet/src/Parsers/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pNumSpoNodes =
<> OA.showDefault
<> OA.value 1)
where
defaultSpoOptions = SpoNodeOptions Nothing []
defaultSpoOptions = SpoNodeOptions []

pGenesisOptions :: Parser GenesisOptions
pGenesisOptions =
Expand Down
8 changes: 0 additions & 8 deletions cardano-testnet/src/Testnet/Start/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import Data.Bifunctor (first)
import qualified Data.ByteString.Lazy as LBS
import Data.Either
import Data.Functor
import Data.Maybe
import Data.MonoTraversable (Element, MonoFunctor, omap)
import qualified Data.Text as Text
import Data.Time (diffUTCTime)
Expand Down Expand Up @@ -219,13 +218,6 @@ cardanoTestnet

H.note_ OS.os

when (all (isJust . testnetNodeCfgFile) cardanoNodes) $
-- TODO: We need a very simple non-obscure way of generating the files necessary
-- to run a testnet. "create-staked" is not a good way to do this especially because it
-- makes assumptions about where things should go and where genesis template files should be.
-- See all of the ad hoc file creation/renaming/dir creation etc below.
H.failMessage GHC.callStack "Specifying node configuration files per node not supported yet."

-- Write specification files. Those are the same as the genesis files
-- used for launching the nodes, but omitting the content regarding stake, utxos, etc.
-- They are used by benchmarking: as templates to CLI commands,
Expand Down
20 changes: 7 additions & 13 deletions cardano-testnet/src/Testnet/Start/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module Testnet.Start.Types
, eraToString

, TestnetNodeOptions(..)
, testnetNodeCfgFile
, testnetNodeExtraCliArgs
, isSpoNodeOptions
, isRelayNodeOptions
Expand Down Expand Up @@ -128,8 +127,8 @@ instance Default GenesisOptions where

-- | Specify a SPO (Shelley era onwards only) or a Relay node
data TestnetNodeOptions
= SpoNodeOptions (Maybe NodeConfigurationYaml) [String]
| RelayNodeOptions (Maybe NodeConfigurationYaml) [String]
= SpoNodeOptions [String]
| RelayNodeOptions [String]
-- ^ These arguments will be appended to the default set of CLI options when
-- starting the node.
deriving (Eq, Show)
Expand All @@ -142,13 +141,8 @@ data UserNodeConfig =

-- | Get extra CLI arguments passed to the node executable
testnetNodeExtraCliArgs :: TestnetNodeOptions -> [String]
testnetNodeExtraCliArgs (SpoNodeOptions _ args) = args
testnetNodeExtraCliArgs (RelayNodeOptions _ args) = args

-- | Get node-specific configuration file path
testnetNodeCfgFile :: TestnetNodeOptions -> Maybe NodeConfigurationYaml
testnetNodeCfgFile (SpoNodeOptions mFp _) = mFp
testnetNodeCfgFile (RelayNodeOptions mFp _) = mFp
testnetNodeExtraCliArgs (SpoNodeOptions args) = args
testnetNodeExtraCliArgs (RelayNodeOptions args) = args

isSpoNodeOptions :: TestnetNodeOptions -> Bool
isSpoNodeOptions SpoNodeOptions{} = True
Expand All @@ -160,9 +154,9 @@ isRelayNodeOptions RelayNodeOptions{} = True

cardanoDefaultTestnetNodeOptions :: [TestnetNodeOptions]
cardanoDefaultTestnetNodeOptions =
[ SpoNodeOptions Nothing []
, RelayNodeOptions Nothing []
, RelayNodeOptions Nothing []
[ SpoNodeOptions []
, RelayNodeOptions []
, RelayNodeOptions []
]

data NodeLoggingFormat = NodeLoggingFormatAsJson | NodeLoggingFormatAsText deriving (Eq, Show)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \
cTestnetOptions = def
{ cardanoNodeEra = asbe
, cardanoNodes =
[ SpoNodeOptions Nothing []
, SpoNodeOptions Nothing []
, SpoNodeOptions Nothing []
[ SpoNodeOptions []
, SpoNodeOptions []
, SpoNodeOptions []
]
}
eraString = eraToString sbe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ hprop_ledger_events_propose_new_constitution_spo = integrationWorkspace "propose
fastTestnetOptions = def
{ cardanoNodeEra = AnyShelleyBasedEra sbe
, cardanoNodes =
[ SpoNodeOptions Nothing []
, SpoNodeOptions Nothing []
, SpoNodeOptions Nothing []
[ SpoNodeOptions []
, SpoNodeOptions []
, SpoNodeOptions []
]
}
shelleyOptions = def { genesisEpochLength = 100 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ hprop_shutdownOnSlotSynced = integrationRetryWorkspace 2 "shutdown-on-slot-synce
slotLen = 0.01
let fastTestnetOptions = def
{ cardanoNodes =
[ SpoNodeOptions Nothing ["--shutdown-on-slot-synced", show maxSlot]
[ SpoNodeOptions ["--shutdown-on-slot-synced", show maxSlot]
]
}
shelleyOptions = def
Expand Down

0 comments on commit 757f338

Please sign in to comment.