Skip to content

Commit ca78f37

Browse files
authored
Merge pull request #4341 from input-output-hk/ludvikgalois/testenableadvertiseprotver
Rename TestEnableDevelopmentHardForkEras and TestEnableDevelopmentNetworkProtocols
2 parents be1dd96 + d2cd5c4 commit ca78f37

File tree

17 files changed

+97
-71
lines changed

17 files changed

+97
-71
lines changed

cardano-api/ChangeLog.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
### Features
66

7+
- Rename `TestEnableDevelopmentHardForkEras` to `ExperimentalHardForksEnabled` and
8+
`TestEnableDevelopmentNetworkProtocols` to `ExperimentalProtocolsEnabled`
9+
([PR 4341](https://github.com/input-output-hk/cardano-node/pull/4341))
10+
711
- Append, not prepend change output when balancing a transaction ([PR 4343](https://github.com/input-output-hk/cardano-node/pull/4343))
812

913
- Expose convenience functions `executeQueryCardanoMode`, `determineEra`, `constructBalancedTx` and `queryStateForBalancedTx` ([PR 4446](https://github.com/input-output-hk/cardano-node/pull/4446))

cardano-node/src/Cardano/Node/Configuration/POM.hs

+46-28
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ module Cardano.Node.Configuration.POM
2121
)
2222
where
2323

24+
import Control.Monad (when)
2425
import Data.Aeson
2526
import qualified Data.Aeson.Types as Aeson
2627
import Data.Bifunctor (Bifunctor (..))
28+
import Data.Maybe (isJust)
2729
import Data.Monoid (Last (..))
2830
import Data.Text (Text)
2931
import qualified Data.Text as Text
@@ -50,6 +52,16 @@ import qualified Ouroboros.Consensus.Node as Consensus (NetworkP2PMode (..))
5052
import Ouroboros.Consensus.Storage.LedgerDB.DiskPolicy (SnapshotInterval (..))
5153
import Ouroboros.Network.NodeToNode (AcceptedConnectionsLimit (..), DiffusionMode (..))
5254

55+
-- | Parse field that have been removed from the configuration file and
56+
-- fail if they are present.
57+
--
58+
-- This is used to notify users that a field has been removed from the
59+
-- configuration file.
60+
failOnRemovedField :: Aeson.Object -> Key -> String -> Aeson.Parser ()
61+
failOnRemovedField obj removedField errorMessage = do
62+
mVal :: Maybe Aeson.Value <- obj .:? removedField
63+
when (isJust mVal) $ fail errorMessage
64+
5365
data NetworkP2PMode = EnabledP2PMode | DisabledP2PMode
5466
deriving (Eq, Show, Generic)
5567

@@ -104,7 +116,7 @@ data NodeConfiguration
104116
--
105117
-- This flag should be set to 'True' when testing the new protocol
106118
-- versions.
107-
, ncTestEnableDevelopmentNetworkProtocols :: !Bool
119+
, ncExperimentalProtocolsEnabled :: !Bool
108120

109121
-- BlockFetch configuration
110122
, ncMaxConcurrencyBulkSync :: !(Maybe MaxConcurrencyBulkSync)
@@ -160,7 +172,7 @@ data PartialNodeConfiguration
160172
-- Node parameters, not protocol-specific:
161173
, pncDiffusionMode :: !(Last DiffusionMode)
162174
, pncSnapshotInterval :: !(Last SnapshotInterval)
163-
, pncTestEnableDevelopmentNetworkProtocols :: !(Last Bool)
175+
, pncExperimentalProtocolsEnabled :: !(Last Bool)
164176

165177
-- BlockFetch configuration
166178
, pncMaxConcurrencyBulkSync :: !(Last MaxConcurrencyBulkSync)
@@ -211,8 +223,11 @@ instance FromJSON PartialNodeConfiguration where
211223
<- Last . fmap getDiffusionMode <$> v .:? "DiffusionMode"
212224
pncSnapshotInterval
213225
<- Last . fmap RequestedSnapshotInterval <$> v .:? "SnapshotInterval"
214-
pncTestEnableDevelopmentNetworkProtocols
215-
<- Last <$> v .:? "TestEnableDevelopmentNetworkProtocols"
226+
pncExperimentalProtocolsEnabled <- fmap Last $ do
227+
failOnRemovedField v "TestEnableDevelopmentNetworkProtocols"
228+
"TestEnableDevelopmentNetworkProtocols has been renamed to ExperimentalProtocolsEnabled"
229+
230+
v .:? "ExperimentalProtocolsEnabled"
216231

217232
-- Blockfetch parameters
218233
pncMaxConcurrencyBulkSync <- Last <$> v .:? "MaxConcurrencyBulkSync"
@@ -276,7 +291,7 @@ instance FromJSON PartialNodeConfiguration where
276291
, pncSocketConfig = Last . Just $ SocketConfig mempty mempty mempty pncSocketPath
277292
, pncDiffusionMode
278293
, pncSnapshotInterval
279-
, pncTestEnableDevelopmentNetworkProtocols
294+
, pncExperimentalProtocolsEnabled
280295
, pncMaxConcurrencyBulkSync
281296
, pncMaxConcurrencyDeadline
282297
, pncLoggingSwitch = Last $ Just pncLoggingSwitch'
@@ -383,9 +398,12 @@ instance FromJSON PartialNodeConfiguration where
383398
}
384399

385400
parseHardForkProtocol v = do
386-
npcTestEnableDevelopmentHardForkEras
387-
<- v .:? "TestEnableDevelopmentHardForkEras"
388-
.!= False
401+
402+
npcExperimentalHardForksEnabled <- do
403+
failOnRemovedField v "TestEnableDevelopmentHardForkEras"
404+
"TestEnableDevelopmentHardForkEras has been renamed to ExperimentalHardForksEnabled"
405+
406+
v .:? "ExperimentalHardForksEnabled" .!= False
389407

390408
npcTestShelleyHardForkAtEpoch <- v .:? "TestShelleyHardForkAtEpoch"
391409
npcTestShelleyHardForkAtVersion <- v .:? "TestShelleyHardForkAtVersion"
@@ -405,27 +423,27 @@ instance FromJSON PartialNodeConfiguration where
405423
npcTestConwayHardForkAtEpoch <- v .:? "TestConwayHardForkAtEpoch"
406424
npcTestConwayHardForkAtVersion <- v .:? "TestConwayHardForkAtVersion"
407425

408-
pure NodeHardForkProtocolConfiguration {
409-
npcTestEnableDevelopmentHardForkEras,
426+
pure NodeHardForkProtocolConfiguration
427+
{ npcExperimentalHardForksEnabled
410428

411-
npcTestShelleyHardForkAtEpoch,
412-
npcTestShelleyHardForkAtVersion,
429+
, npcTestShelleyHardForkAtEpoch
430+
, npcTestShelleyHardForkAtVersion
413431

414-
npcTestAllegraHardForkAtEpoch,
415-
npcTestAllegraHardForkAtVersion,
432+
, npcTestAllegraHardForkAtEpoch
433+
, npcTestAllegraHardForkAtVersion
416434

417-
npcTestMaryHardForkAtEpoch,
418-
npcTestMaryHardForkAtVersion,
435+
, npcTestMaryHardForkAtEpoch
436+
, npcTestMaryHardForkAtVersion
419437

420-
npcTestAlonzoHardForkAtEpoch,
421-
npcTestAlonzoHardForkAtVersion,
438+
, npcTestAlonzoHardForkAtEpoch
439+
, npcTestAlonzoHardForkAtVersion
422440

423-
npcTestBabbageHardForkAtEpoch,
424-
npcTestBabbageHardForkAtVersion,
441+
, npcTestBabbageHardForkAtEpoch
442+
, npcTestBabbageHardForkAtVersion
425443

426-
npcTestConwayHardForkAtEpoch,
427-
npcTestConwayHardForkAtVersion
428-
}
444+
, npcTestConwayHardForkAtEpoch
445+
, npcTestConwayHardForkAtVersion
446+
}
429447

430448
-- | Default configuration is mainnet
431449
defaultPartialNodeConfiguration :: PartialNodeConfiguration
@@ -437,7 +455,7 @@ defaultPartialNodeConfiguration =
437455
, pncSocketConfig = Last . Just $ SocketConfig mempty mempty mempty mempty
438456
, pncDiffusionMode = Last $ Just InitiatorAndResponderDiffusionMode
439457
, pncSnapshotInterval = Last $ Just DefaultSnapshotInterval
440-
, pncTestEnableDevelopmentNetworkProtocols = Last $ Just False
458+
, pncExperimentalProtocolsEnabled = Last $ Just False
441459
, pncTopologyFile = Last . Just $ TopologyFile "configuration/cardano/mainnet-topology.json"
442460
, pncProtocolFiles = mempty
443461
, pncValidateDB = mempty
@@ -510,9 +528,9 @@ makeNodeConfiguration pnc = do
510528
$ pncEnableP2P pnc
511529

512530
-- TODO: This is not mandatory
513-
testEnableDevelopmentNetworkProtocols <-
514-
lastToEither "Missing TestEnableDevelopmentNetworkProtocols" $
515-
pncTestEnableDevelopmentNetworkProtocols pnc
531+
experimentalProtocols <-
532+
lastToEither "Missing ExperimentalProtocolsEnabled" $
533+
pncExperimentalProtocolsEnabled pnc
516534
return $ NodeConfiguration
517535
{ ncConfigFile = configFile
518536
, ncTopologyFile = topologyFile
@@ -530,7 +548,7 @@ makeNodeConfiguration pnc = do
530548
, ncSocketConfig = socketConfig
531549
, ncDiffusionMode = diffusionMode
532550
, ncSnapshotInterval = snapshotInterval
533-
, ncTestEnableDevelopmentNetworkProtocols = testEnableDevelopmentNetworkProtocols
551+
, ncExperimentalProtocolsEnabled = experimentalProtocols
534552
, ncMaxConcurrencyBulkSync = getLast $ pncMaxConcurrencyBulkSync pnc
535553
, ncMaxConcurrencyDeadline = getLast $ pncMaxConcurrencyDeadline pnc
536554
, ncLoggingSwitch = loggingSwitch

cardano-node/src/Cardano/Node/Parsers.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ nodeRunParser = do
8888
, pncDatabaseFile = DbFile <$> dbFp
8989
, pncDiffusionMode = mempty
9090
, pncSnapshotInterval = snapshotInterval
91-
, pncTestEnableDevelopmentNetworkProtocols = mempty
91+
, pncExperimentalProtocolsEnabled = mempty
9292
, pncProtocolFiles = Last $ Just ProtocolFilepaths
9393
{ byronCertFile
9494
, byronKeyFile

cardano-node/src/Cardano/Node/Protocol/Cardano.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
9090
npcConwayGenesisFileHash
9191
}
9292
NodeHardForkProtocolConfiguration {
93-
npcTestEnableDevelopmentHardForkEras,
93+
npcExperimentalHardForksEnabled,
9494
-- During testing of the Alonzo era, we conditionally declared that we
9595
-- knew about the Alonzo era. We do so only when a config option for
9696
-- testing development/unstable eras is used. This lets us include
@@ -234,7 +234,7 @@ mkSomeConsensusProtocolCardano NodeByronProtocolConfiguration {
234234
-- is in the Babbage era. Since Babbage is currently the last known
235235
-- protocol version then this is also the Babbage protocol version.
236236
Praos.conwayProtVer =
237-
if npcTestEnableDevelopmentHardForkEras
237+
if npcExperimentalHardForksEnabled
238238
then ProtVer 9 0
239239
else ProtVer 8 0,
240240
Praos.conwayMaxTxCapacityOverrides =

cardano-node/src/Cardano/Node/Run.hs

+21-17
Original file line numberDiff line numberDiff line change
@@ -429,22 +429,26 @@ handleSimpleNode runP p2pMode tracers nc onKernel = do
429429
Nothing
430430
#endif
431431
void $
432+
let diffusionArgumentsExtra =
433+
mkP2PArguments nc
434+
(readTVar localRootsVar)
435+
(readTVar publicRootsVar)
436+
(readTVar useLedgerVar)
437+
in
432438
Node.run
433439
nodeArgs
434440
StdRunNodeArgs
435-
{ srnBfcMaxConcurrencyBulkSync = unMaxConcurrencyBulkSync <$> ncMaxConcurrencyBulkSync nc
436-
, srnBfcMaxConcurrencyDeadline = unMaxConcurrencyDeadline <$> ncMaxConcurrencyDeadline nc
437-
, srnChainDbValidateOverride = ncValidateDB nc
438-
, srnSnapshotInterval = ncSnapshotInterval nc
439-
, srnDatabasePath = dbPath
440-
, srnDiffusionArguments = diffusionArguments
441-
, srnDiffusionArgumentsExtra = mkP2PArguments nc (readTVar localRootsVar)
442-
(readTVar publicRootsVar)
443-
(readTVar useLedgerVar)
444-
, srnDiffusionTracers = diffusionTracers tracers
445-
, srnDiffusionTracersExtra = diffusionTracersExtra tracers
446-
, srnEnableInDevelopmentVersions = ncTestEnableDevelopmentNetworkProtocols nc
447-
, srnTraceChainDB = chainDBTracer tracers
441+
{ srnBfcMaxConcurrencyBulkSync = unMaxConcurrencyBulkSync <$> ncMaxConcurrencyBulkSync nc
442+
, srnBfcMaxConcurrencyDeadline = unMaxConcurrencyDeadline <$> ncMaxConcurrencyDeadline nc
443+
, srnChainDbValidateOverride = ncValidateDB nc
444+
, srnSnapshotInterval = ncSnapshotInterval nc
445+
, srnDatabasePath = dbPath
446+
, srnDiffusionArguments = diffusionArguments
447+
, srnDiffusionArgumentsExtra = diffusionArgumentsExtra
448+
, srnDiffusionTracers = diffusionTracers tracers
449+
, srnDiffusionTracersExtra = diffusionTracersExtra tracers
450+
, srnEnableInDevelopmentVersions = ncExperimentalProtocolsEnabled nc
451+
, srnTraceChainDB = chainDBTracer tracers
448452
, srnMaybeMempoolCapacityOverride = ncMaybeMempoolCapacityOverride nc
449453
}
450454
DisabledP2PMode -> do
@@ -483,7 +487,7 @@ handleSimpleNode runP p2pMode tracers nc onKernel = do
483487
, srnDiffusionArgumentsExtra = mkNonP2PArguments ipProducers dnsProducers
484488
, srnDiffusionTracers = diffusionTracers tracers
485489
, srnDiffusionTracersExtra = diffusionTracersExtra tracers
486-
, srnEnableInDevelopmentVersions = ncTestEnableDevelopmentNetworkProtocols nc
490+
, srnEnableInDevelopmentVersions = ncExperimentalProtocolsEnabled nc
487491
, srnTraceChainDB = chainDBTracer tracers
488492
, srnMaybeMempoolCapacityOverride = ncMaybeMempoolCapacityOverride nc
489493
}
@@ -509,13 +513,13 @@ handleSimpleNode runP p2pMode tracers nc onKernel = do
509513
$ supportedNodeToClientVersions (Proxy @blk)
510514
(_, Nothing) -> Map.keys
511515
$ supportedNodeToClientVersions (Proxy @blk)
512-
when ( ncTestEnableDevelopmentNetworkProtocols nc
516+
when ( ncExperimentalProtocolsEnabled nc
513517
&& not (null developmentNtnVersions))
514518
$ traceWith (startupTracer tracers)
515519
(WarningDevelopmentNodeToNodeVersions
516520
developmentNtnVersions)
517521

518-
when ( ncTestEnableDevelopmentNetworkProtocols nc
522+
when ( ncExperimentalProtocolsEnabled nc
519523
&& not (null developmentNtcVersions))
520524
$ traceWith (startupTracer tracers)
521525
(WarningDevelopmentNodeToClientVersions
@@ -552,7 +556,7 @@ handleSimpleNode runP p2pMode tracers nc onKernel = do
552556
-> Map k v
553557
-> Map k v
554558
limitToLatestReleasedVersion prj =
555-
if ncTestEnableDevelopmentNetworkProtocols nc then id
559+
if ncExperimentalProtocolsEnabled nc then id
556560
else
557561
case prj $ latestReleasedNodeVersion (Proxy @blk) of
558562
Nothing -> id

cardano-node/src/Cardano/Node/Startup.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ data StartupTrace blk =
103103
-- | Warn when 'EnableP2P' is set.
104104
| P2PWarning
105105

106-
-- | Warn when 'TestEnableDevelopmentNetworkProtocols' is set and affects
106+
-- | Warn when 'ExperimentalProtocolsEnabled' is set and affects
107107
-- node-to-node protocol.
108108
--
109109
| WarningDevelopmentNodeToNodeVersions [NodeToNodeVersion]
110110

111-
-- | Warn when 'TestEnableDevelopmentNetworkProtocols' is set and affects
111+
-- | Warn when 'ExperimentalProtocolsEnabled' is set and affects
112112
-- node-to-client protocol.
113113
--
114114
| WarningDevelopmentNodeToClientVersions [NodeToClientVersion]

cardano-node/src/Cardano/Node/Types.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ data NodeHardForkProtocolConfiguration =
198198
-- This flag should be set to true for nodes taking part in testnets for
199199
-- testing the new era.
200200
--
201-
npcTestEnableDevelopmentHardForkEras :: Bool
201+
npcExperimentalHardForksEnabled :: Bool
202202

203203
-- | For testing purposes we support specifying that the hard fork
204204
-- happens at an exact epoch number (ie the first epoch of the new era).

cardano-node/test/Test/Cardano/Node/POM.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ testPartialYamlConfig =
5656
, pncShutdownConfig = Last Nothing
5757
, pncDiffusionMode = Last Nothing
5858
, pncSnapshotInterval = mempty
59-
, pncTestEnableDevelopmentNetworkProtocols = Last Nothing
59+
, pncExperimentalProtocolsEnabled = Last Nothing
6060
, pncMaxConcurrencyBulkSync = Last Nothing
6161
, pncMaxConcurrencyDeadline = Last Nothing
6262
, pncLoggingSwitch = Last $ Just True
@@ -91,7 +91,7 @@ testPartialCliConfig =
9191
, pncDatabaseFile = mempty
9292
, pncDiffusionMode = mempty
9393
, pncSnapshotInterval = Last . Just . RequestedSnapshotInterval $ secondsToDiffTime 100
94-
, pncTestEnableDevelopmentNetworkProtocols = Last $ Just True
94+
, pncExperimentalProtocolsEnabled = Last $ Just True
9595
, pncProtocolFiles = Last . Just $ ProtocolFilepaths Nothing Nothing Nothing Nothing Nothing Nothing
9696
, pncValidateDB = Last $ Just True
9797
, pncProtocolConfig = mempty
@@ -130,7 +130,7 @@ eExpectedConfig = do
130130
(GenesisFile "dummmy-genesis-file") Nothing
131131
, ncDiffusionMode = InitiatorAndResponderDiffusionMode
132132
, ncSnapshotInterval = RequestedSnapshotInterval $ secondsToDiffTime 100
133-
, ncTestEnableDevelopmentNetworkProtocols = True
133+
, ncExperimentalProtocolsEnabled = True
134134
, ncMaxConcurrencyBulkSync = Nothing
135135
, ncMaxConcurrencyDeadline = Nothing
136136
, ncLoggingSwitch = True

cardano-testnet/src/Testnet/Babbage.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ babbageTestnet testnetOptions H.Conf {..} = do
9797
. HM.insert "TestMaryHardForkAtEpoch" (toJSON @Int 0)
9898
. HM.insert "TestAlonzoHardForkAtEpoch" (toJSON @Int 0)
9999
. HM.insert "TestBabbageHardForkAtEpoch" (toJSON @Int 0)
100-
. HM.insert "TestEnableDevelopmentHardForkEras" (toJSON True)
100+
. HM.insert "ExperimentalHardForksEnabled" (toJSON True)
101101
. flip HM.alter "setupScribes"
102102
( fmap
103103
. J.rewriteArrayElements

cardano-testnet/src/Testnet/Cardano.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ cardanoTestnet testnetOptions H.Conf {..} = do
256256
. HM.insert "LastKnownBlockVersion-Minor" (J.toJSON @Int 0)
257257
. HM.insert "TraceBlockchainTime" (J.toJSON True)
258258
. HM.delete "GenesisFile"
259-
. HM.insert "TestEnableDevelopmentHardForkEras" (J.toJSON @Bool True)
259+
. HM.insert "ExperimentalHardForksEnabled" (J.toJSON @Bool True)
260260
. HM.insert "EnableP2P" (J.toJSON @Bool (cardanoEnableP2P testnetOptions))
261261
. flip HM.alter "setupScribes"
262262
( fmap

configuration/chairman/byron-shelley/configuration.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ ApplicationVersion: 1
5252

5353
##### Enable P2P Mode #####
5454
EnableP2P: False
55-
TestEnableDevelopmentNetworkProtocols: True
55+
ExperimentalProtocolsEnabled: True
5656

5757
##### Logging configuration #####
5858

nix/nixos/cardano-node-service.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let
2424
TargetNumberOfKnownPeers = cfg.targetNumberOfKnownPeers;
2525
TargetNumberOfEstablishedPeers = cfg.targetNumberOfEstablishedPeers;
2626
TargetNumberOfActivePeers = cfg.targetNumberOfActivePeers;
27-
TestEnableDevelopmentNetworkProtocols = true;
27+
ExperimentalProtocolsEnabled = true;
2828
MaxConcurrencyBulkSync = 2;
2929
})) cfg.extraNodeConfig;
3030
baseInstanceConfig =

nix/workbench/backend/nixops.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ let
6868
minSeverity = "Debug";
6969
TurnOnLogMetrics = true;
7070

71-
TestEnableDevelopmentHardForkEras = true;
72-
TestEnableDevelopmentNetworkProtocols = true;
71+
ExperimentalHardForksEnabled = true;
72+
ExperimentalProtocolsEnabled = true;
7373

7474
inherit TraceBlockFetchProtocol;
7575

nix/workbench/backend/nixops/role-explorer.nix

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ in {
8787
# "LastKnownBlockVersion-Major"
8888
# "LastKnownBlockVersion-Minor"
8989
# "LastKnownBlockVersion-Alt"
90-
# "TestEnableDevelopmentHardForkEras"
91-
# "TestEnableDevelopmentNetworkProtocols"
90+
# "ExperimentalHardForksEnabled"
91+
# "ExperimentalProtocolsEnabled"
9292
# "TestShelleyHardForkAtEpoch"
9393
# "TestAllegraHardForkAtEpoch"
9494
# "TestMaryHardForkAtEpoch"
@@ -147,8 +147,8 @@ in {
147147
# minSeverity = "Debug";
148148
# TracingVerbosity = "NormalVerbosity";
149149

150-
# TestEnableDevelopmentHardForkEras = true;
151-
# TestEnableDevelopmentNetworkProtocols = true;
150+
# ExperimentalHardForksEnabled = true;
151+
# ExperimentalProtocolsEnabled = true;
152152

153153
# TraceAcceptPolicy = false;
154154
# TraceBlockFetchClient = true;

0 commit comments

Comments
 (0)