{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
module Cardano.Network.Diffusion.Configuration
( DefaultNumBootstrapPeers (..)
, NumberOfBigLedgerPeers (..)
, defaultNumBootstrapPeers
, defaultSyncTargets
, defaultNumberOfBigLedgerPeers
, defaultChainSyncIdleTimeout
, mkDefaultBlockFetchConfiguration
, mkDefaultMiniProtocolParameters
, TxSubmissionLogicVersion (..)
, defaultTxSubmissionLogicVersion
, defaultNodeTxSubmissionConfig
, srvPrefix
, ChainSyncIdleTimeout (..)
, BlockFetchConfiguration (..)
, MiniProtocolParameters (..)
, NodeTxSubmissionConfig (..)
, Salt
, mkSalt
, mkSaltIO
) where
import Cardano.Network.NodeToNode (MiniProtocolParameters (..),
NodeTxSubmissionConfig (..), mkDefaultMiniProtocolParameters)
import Cardano.Network.PeerSelection.Governor.PeerSelectionState
(NumberOfBigLedgerPeers (..))
import Ouroboros.Network.BlockFetch (BlockFetchConfiguration (..),
GenesisBlockFetchConfiguration (..))
import Ouroboros.Network.Hashable (Salt, mkSalt, mkSaltIO)
import Ouroboros.Network.PeerSelection.Governor.Types
(PeerSelectionTargets (..))
import Ouroboros.Network.PeerSelection.RelayAccessPoint (SRVPrefix)
import Ouroboros.Network.Protocol.ChainSync.Codec (ChainSyncIdleTimeout (..))
import Ouroboros.Network.TxSubmission.Inbound.V2.Policy qualified as V2
import Ouroboros.Network.TxSubmission.Inbound.V2.Types
(TxSubmissionLogicVersion (..))
newtype DefaultNumBootstrapPeers =
DefaultNumBootstrapPeers { DefaultNumBootstrapPeers -> Int
getDefaultNumBootstrapPeers :: Int }
deriving (DefaultNumBootstrapPeers -> DefaultNumBootstrapPeers -> Bool
(DefaultNumBootstrapPeers -> DefaultNumBootstrapPeers -> Bool)
-> (DefaultNumBootstrapPeers -> DefaultNumBootstrapPeers -> Bool)
-> Eq DefaultNumBootstrapPeers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DefaultNumBootstrapPeers -> DefaultNumBootstrapPeers -> Bool
== :: DefaultNumBootstrapPeers -> DefaultNumBootstrapPeers -> Bool
$c/= :: DefaultNumBootstrapPeers -> DefaultNumBootstrapPeers -> Bool
/= :: DefaultNumBootstrapPeers -> DefaultNumBootstrapPeers -> Bool
Eq, Int -> DefaultNumBootstrapPeers -> ShowS
[DefaultNumBootstrapPeers] -> ShowS
DefaultNumBootstrapPeers -> String
(Int -> DefaultNumBootstrapPeers -> ShowS)
-> (DefaultNumBootstrapPeers -> String)
-> ([DefaultNumBootstrapPeers] -> ShowS)
-> Show DefaultNumBootstrapPeers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DefaultNumBootstrapPeers -> ShowS
showsPrec :: Int -> DefaultNumBootstrapPeers -> ShowS
$cshow :: DefaultNumBootstrapPeers -> String
show :: DefaultNumBootstrapPeers -> String
$cshowList :: [DefaultNumBootstrapPeers] -> ShowS
showList :: [DefaultNumBootstrapPeers] -> ShowS
Show)
defaultNumBootstrapPeers :: DefaultNumBootstrapPeers
defaultNumBootstrapPeers :: DefaultNumBootstrapPeers
defaultNumBootstrapPeers = Int -> DefaultNumBootstrapPeers
DefaultNumBootstrapPeers Int
30
defaultSyncTargets :: PeerSelectionTargets
defaultSyncTargets :: PeerSelectionTargets
defaultSyncTargets =
PeerSelectionTargets {
targetNumberOfRootPeers :: Int
targetNumberOfRootPeers = Int
0,
targetNumberOfKnownPeers :: Int
targetNumberOfKnownPeers = Int
150,
targetNumberOfEstablishedPeers :: Int
targetNumberOfEstablishedPeers = Int
10,
targetNumberOfActivePeers :: Int
targetNumberOfActivePeers = Int
5,
targetNumberOfKnownBigLedgerPeers :: Int
targetNumberOfKnownBigLedgerPeers = Int
100,
targetNumberOfEstablishedBigLedgerPeers :: Int
targetNumberOfEstablishedBigLedgerPeers = Int
40,
targetNumberOfActiveBigLedgerPeers :: Int
targetNumberOfActiveBigLedgerPeers = Int
30 }
defaultNumberOfBigLedgerPeers :: NumberOfBigLedgerPeers
defaultNumberOfBigLedgerPeers :: NumberOfBigLedgerPeers
defaultNumberOfBigLedgerPeers = Int -> NumberOfBigLedgerPeers
NumberOfBigLedgerPeers Int
5
defaultChainSyncIdleTimeout :: ChainSyncIdleTimeout
defaultChainSyncIdleTimeout :: ChainSyncIdleTimeout
defaultChainSyncIdleTimeout = DiffTime -> ChainSyncIdleTimeout
ChainSyncIdleTimeout DiffTime
3373
srvPrefix :: SRVPrefix
srvPrefix :: SRVPrefix
srvPrefix = SRVPrefix
"_cardano._tcp"
mkDefaultBlockFetchConfiguration :: MiniProtocolParameters
-> Salt
-> BlockFetchConfiguration
mkDefaultBlockFetchConfiguration :: MiniProtocolParameters -> Salt -> BlockFetchConfiguration
mkDefaultBlockFetchConfiguration MiniProtocolParameters { Word16
blockFetchPipeliningMax :: MiniProtocolParameters -> Word16
blockFetchPipeliningMax :: Word16
blockFetchPipeliningMax }
Salt
bfcSalt =
BlockFetchConfiguration {
bfcMaxConcurrencyBulkSync :: Word
bfcMaxConcurrencyBulkSync = Word
1,
bfcMaxConcurrencyDeadline :: Word
bfcMaxConcurrencyDeadline = Word
1,
bfcMaxRequestsInflight :: Word
bfcMaxRequestsInflight = Word16 -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word16
blockFetchPipeliningMax,
bfcDecisionLoopIntervalGenesis :: DiffTime
bfcDecisionLoopIntervalGenesis = DiffTime
0.04,
bfcDecisionLoopIntervalPraos :: DiffTime
bfcDecisionLoopIntervalPraos = DiffTime
0.01,
bfcGenesisBFConfig :: GenesisBlockFetchConfiguration
bfcGenesisBFConfig = GenesisBlockFetchConfiguration
{ gbfcGracePeriod :: DiffTime
gbfcGracePeriod = DiffTime
10 },
Salt
bfcSalt :: Salt
bfcSalt :: Salt
bfcSalt }
defaultTxSubmissionLogicVersion :: TxSubmissionLogicVersion
defaultTxSubmissionLogicVersion :: TxSubmissionLogicVersion
defaultTxSubmissionLogicVersion = TxSubmissionLogicVersion
TxSubmissionLogicV1
defaultNodeTxSubmissionConfig :: NodeTxSubmissionConfig
defaultNodeTxSubmissionConfig :: NodeTxSubmissionConfig
defaultNodeTxSubmissionConfig =
NodeTxSubmissionConfig {
maxNumUnacknowledgedTxIds :: NumTxIdsToAck
maxNumUnacknowledgedTxIds =
TxSubmissionConfig -> NumTxIdsToAck
V2.maxNumUnacknowledgedTxIds TxSubmissionConfig
V2.defaultTxSubmissionConfigV2,
maxNumTxIdsToRequest :: NumTxIdsToReq
maxNumTxIdsToRequest =
TxSubmissionConfig -> NumTxIdsToReq
V2.maxNumTxIdsToRequest TxSubmissionConfig
V2.defaultTxSubmissionConfigV2
}