-
Notifications
You must be signed in to change notification settings - Fork 748
Open
Labels
Description
Problem
CardanoTestnetOptions is a single record used by both createTestnetEnv (step 1: environment creation) and cardanoTestnet (step 2: runtime). However, many fields are only used by one phase:
- Step 1 only:
cardanoNodeEra,cardanoMaxSupply,cardanoNumDReps - Step 2 only:
cardanoEnableNewEpochStateLogging,cardanoEnableTxGenerator - Shared:
cardanoNodes - Unused by either function:
cardanoNodeLoggingFormat,cardanoOutputDir(used only in the parser layer)
This means create-env silently accepts and ignores runtime-only flags like --enable-new-epoch-state-logging, and step-2 code has access to step-1-only fields it should never read.
Proposed fix
Split CardanoTestnetOptions into two records:
data EnvCreationOptions = EnvCreationOptions
{ envNodes :: NonEmpty NodeOption
, envNodeEra :: AnyShelleyBasedEra
, envMaxSupply :: Word64
, envNumDReps :: NumDReps
}
data RuntimeOptions = RuntimeOptions
{ rtNodes :: NonEmpty NodeOption
, rtEnableNewEpochStateLogging :: Bool
, rtEnableTxGenerator :: TxGeneratorSupport
}Update createTestnetEnv to take EnvCreationOptions and cardanoTestnet to take RuntimeOptions. The compiler will enforce that each phase can only access its own fields.
Depends on
- cardano-testnet: Add
--params-fileand--params-mainnetflags to the directcardanopath #6457 (so--params-*lands in the right record from the start)
Type: Refactoring
Effort: Medium (~80 lines across Types.hs, Cardano.hs, Parsers/Cardano.hs, Parsers/Run.hs)
Risk: Low-medium (mechanical — compiler guides every call site update)
Reactions are currently unavailable