@@ -38,6 +38,7 @@ import qualified Ouroboros.Consensus.Node as Consensus (NetworkP2PMode (..))
38
38
import Ouroboros.Consensus.Storage.LedgerDB.DiskPolicy (NumOfDiskSnapshots (.. ),
39
39
SnapshotInterval (.. ))
40
40
import Ouroboros.Network.Diffusion.Configuration as Configuration
41
+ import Ouroboros.Network.TxSubmission.Inbound.Server (EnableNewTxSubmissionProtocol (.. ))
41
42
42
43
import Control.Monad (when )
43
44
import Data.Aeson
@@ -148,6 +149,13 @@ data NodeConfiguration
148
149
-- | Node AcceptedConnectionsLimit
149
150
, ncAcceptedConnectionsLimit :: ! AcceptedConnectionsLimit
150
151
152
+ -- Used to determine which set of peer targets to use
153
+ -- by the diffusion layer when syncing
154
+ , ncConsensusMode :: ! ConsensusMode
155
+ -- Minimum number of active big ledger peers we must be connected to
156
+ -- in Genesis mode
157
+ , ncMinBigLedgerPeersForTrustedState :: MinBigLedgerPeersForTrustedState
158
+
151
159
-- P2P governor targets
152
160
, ncDeadlineTargetOfRootPeers :: ! Int
153
161
, ncDeadlineTargetOfKnownPeers :: ! Int
@@ -160,17 +168,15 @@ data NodeConfiguration
160
168
, ncSyncTargetOfKnownBigLedgerPeers :: ! Int
161
169
, ncSyncTargetOfEstablishedBigLedgerPeers :: ! Int
162
170
, ncSyncTargetOfActiveBigLedgerPeers :: ! Int
163
- , ncSyncMinTrusted :: ! MinBigLedgerPeersForTrustedState
164
-
165
- -- Used to determine which set of peer targets to use
166
- -- by the diffusion layer when syncing
167
- , ncConsensusMode :: ! ConsensusMode
168
171
169
172
-- Enable experimental P2P mode
170
173
, ncEnableP2P :: SomeNetworkP2PMode
171
174
172
175
-- Enable Peer Sharing
173
176
, ncPeerSharing :: PeerSharing
177
+
178
+ -- Enable new TX Submission Protocol
179
+ , ncEnableNewTxSubmissionProtocol :: EnableNewTxSubmissionProtocol
174
180
} deriving (Eq , Show )
175
181
176
182
@@ -220,6 +226,12 @@ data PartialNodeConfiguration
220
226
-- AcceptedConnectionsLimit
221
227
, pncAcceptedConnectionsLimit :: ! (Last AcceptedConnectionsLimit )
222
228
229
+ -- Consensus mode for diffusion layer
230
+ , pncConsensusMode :: ! (Last ConsensusMode )
231
+ -- Minimum number of active big ledger peers we must be connected to
232
+ -- in Genesis mode, otherwise syncing is halted temporarily
233
+ , pncMinBigLedgerPeersForTrustedState :: ! (Last MinBigLedgerPeersForTrustedState )
234
+
223
235
-- P2P governor targets
224
236
, pncDeadlineTargetOfRootPeers :: ! (Last Int )
225
237
, pncDeadlineTargetOfKnownPeers :: ! (Last Int )
@@ -232,16 +244,15 @@ data PartialNodeConfiguration
232
244
, pncSyncTargetOfKnownBigLedgerPeers :: ! (Last Int )
233
245
, pncSyncTargetOfEstablishedBigLedgerPeers :: ! (Last Int )
234
246
, pncSyncTargetOfActiveBigLedgerPeers :: ! (Last Int )
235
- , pncSyncMinTrusted :: ! (Last MinBigLedgerPeersForTrustedState )
236
-
237
- -- Consensus mode for diffusion layer
238
- , pncConsensusMode :: ! (Last ConsensusMode )
239
247
240
248
-- Enable experimental P2P mode
241
249
, pncEnableP2P :: ! (Last NetworkP2PMode )
242
250
243
251
-- Peer Sharing
244
252
, pncPeerSharing :: ! (Last PeerSharing )
253
+
254
+ -- Enable new TX Submission Protocol
255
+ , pncEnableNewTxSubmissionProtocol :: ! (Last EnableNewTxSubmissionProtocol )
245
256
} deriving (Eq , Generic , Show )
246
257
247
258
instance AdjustFilePaths PartialNodeConfiguration where
@@ -316,6 +327,8 @@ instance FromJSON PartialNodeConfiguration where
316
327
pncAcceptedConnectionsLimit
317
328
<- Last <$> v .:? " AcceptedConnectionsLimit"
318
329
330
+ pncConsensusMode <- Last <$> v .:? " ConsensusMode"
331
+
319
332
-- P2P Governor parameters, with conservative defaults.
320
333
pncDeadlineTargetOfRootPeers <- Last <$> v .:? " TargetNumberOfRootPeers"
321
334
pncDeadlineTargetOfKnownPeers <- Last <$> v .:? " TargetNumberOfKnownPeers"
@@ -328,9 +341,7 @@ instance FromJSON PartialNodeConfiguration where
328
341
pncSyncTargetOfKnownBigLedgerPeers <- Last <$> v .:? " SyncTargetNumberOfKnownBigLedgerPeers"
329
342
pncSyncTargetOfEstablishedBigLedgerPeers <- Last <$> v .:? " SyncTargetNumberOfEstablishedBigLedgerPeers"
330
343
pncSyncTargetOfActiveBigLedgerPeers <- Last <$> v .:? " SyncTargetNumberOfActiveBigLedgerPeers"
331
- pncSyncMinTrusted <- Last <$> v .:? " SyncMinNumberOfBigLedgerPeersForTrustedState"
332
-
333
- pncConsensusMode <- Last <$> v .:? " ConsensusMode"
344
+ pncMinBigLedgerPeersForTrustedState <- Last <$> v .:? " MinBigLedgerPeersForTrustedState"
334
345
335
346
pncChainSyncIdleTimeout <- Last <$> v .:? " ChainSyncIdleTimeout"
336
347
@@ -346,6 +357,14 @@ instance FromJSON PartialNodeConfiguration where
346
357
-- DISABLED BY DEFAULT
347
358
pncPeerSharing <- Last <$> v .:? " PeerSharing" .!= Just Configuration. PeerSharingDisabled
348
359
360
+ -- Enable new TX Submission Protocol
361
+ newTxSubmissionProtocol <- v .:? " EnableNewTxSubmissionProtocol"
362
+ let pncEnableNewTxSubmissionProtocol =
363
+ case newTxSubmissionProtocol of
364
+ Nothing -> Last $ Just EnableNewTxSubmissionProtocol -- defaultEnableNewTxSubmissionProtocol
365
+ Just False -> Last $ Just DisableNewTxSubmissionProtocol
366
+ Just True -> Last $ Just EnableNewTxSubmissionProtocol
367
+
349
368
pure PartialNodeConfiguration {
350
369
pncProtocolConfig
351
370
, pncSocketConfig = Last . Just $ SocketConfig mempty mempty mempty pncSocketPath
@@ -382,10 +401,11 @@ instance FromJSON PartialNodeConfiguration where
382
401
, pncSyncTargetOfKnownBigLedgerPeers
383
402
, pncSyncTargetOfEstablishedBigLedgerPeers
384
403
, pncSyncTargetOfActiveBigLedgerPeers
385
- , pncSyncMinTrusted
404
+ , pncMinBigLedgerPeersForTrustedState
386
405
, pncConsensusMode
387
406
, pncEnableP2P
388
407
, pncPeerSharing
408
+ , pncEnableNewTxSubmissionProtocol
389
409
}
390
410
where
391
411
parseMempoolCapacityBytesOverride v = parseNoOverride <|> parseOverride
@@ -564,10 +584,11 @@ defaultPartialNodeConfiguration =
564
584
, pncSyncTargetOfKnownBigLedgerPeers = Last (Just syncBigKnown)
565
585
, pncSyncTargetOfEstablishedBigLedgerPeers = Last (Just syncBigEst)
566
586
, pncSyncTargetOfActiveBigLedgerPeers = Last (Just syncBigAct)
567
- , pncSyncMinTrusted = Last (Just defaultMinBigLedgerPeersForTrustedState)
587
+ , pncMinBigLedgerPeersForTrustedState = Last (Just defaultMinBigLedgerPeersForTrustedState)
568
588
, pncConsensusMode = mempty
569
589
, pncEnableP2P = Last (Just EnabledP2PMode )
570
590
, pncPeerSharing = Last (Just Configuration. PeerSharingDisabled )
591
+ , pncEnableNewTxSubmissionProtocol = Last (Just EnableNewTxSubmissionProtocol ) -- defaultEnableNewTxSubmissionProtocol)
571
592
}
572
593
where
573
594
Configuration. PeerSelectionTargets {
@@ -637,9 +658,9 @@ makeNodeConfiguration pnc = do
637
658
ncSyncTargetOfActiveBigLedgerPeers <-
638
659
lastToEither " Missing SyncTargetNumberOfActiveBigLedgerPeers"
639
660
$ pncSyncTargetOfActiveBigLedgerPeers pnc
640
- ncSyncMinTrusted <-
641
- lastToEither " Missing SyncMinNumberOfBigLedgerPeersForTrustedState "
642
- $ pncSyncMinTrusted pnc
661
+ ncMinBigLedgerPeersForTrustedState <-
662
+ lastToEither " Missing MinBigLedgerPeersForTrustedState "
663
+ $ pncMinBigLedgerPeersForTrustedState pnc
643
664
ncConsensusMode <-
644
665
lastToEither " Missing ConsensusMode"
645
666
$ pncConsensusMode pnc
@@ -665,6 +686,10 @@ makeNodeConfiguration pnc = do
665
686
lastToEither " Missing PeerSharing"
666
687
$ pncPeerSharing pnc
667
688
689
+ ncEnableNewTxSubmissionProtocol <-
690
+ lastToEither " Missing EnableNewTxSubmissionProtocol"
691
+ $ pncEnableNewTxSubmissionProtocol pnc
692
+
668
693
-- TODO: This is not mandatory
669
694
experimentalProtocols <-
670
695
lastToEither " Missing ExperimentalProtocolsEnabled" $
@@ -712,12 +737,13 @@ makeNodeConfiguration pnc = do
712
737
, ncSyncTargetOfKnownBigLedgerPeers
713
738
, ncSyncTargetOfEstablishedBigLedgerPeers
714
739
, ncSyncTargetOfActiveBigLedgerPeers
715
- , ncSyncMinTrusted
740
+ , ncMinBigLedgerPeersForTrustedState
716
741
, ncEnableP2P = case enableP2P of
717
742
EnabledP2PMode -> SomeNetworkP2PMode Consensus. EnabledP2PMode
718
743
DisabledP2PMode -> SomeNetworkP2PMode Consensus. DisabledP2PMode
719
744
, ncPeerSharing
720
745
, ncConsensusMode
746
+ , ncEnableNewTxSubmissionProtocol
721
747
}
722
748
723
749
ncProtocol :: NodeConfiguration -> Protocol
0 commit comments