{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
module Cardano.Network.Diffusion.Configuration
( DefaultNumBootstrapPeers (..)
, NumberOfBigLedgerPeers (..)
, defaultNumBootstrapPeers
, defaultSyncTargets
, defaultNumberOfBigLedgerPeers
, defaultChainSyncIdleTimeout
, defaultBlockFetchConfiguration
, defaultMiniProtocolParameters
, TxSubmissionLogicVersion (..)
, defaultTxSubmissionLogicVersion
, srvPrefix
, ChainSyncIdleTimeout (..)
, BlockFetchConfiguration (..)
, MiniProtocolParameters (..)
, Salt
, mkSalt
, mkSaltIO
) where
import Cardano.Network.NodeToNode (MiniProtocolParameters (..),
defaultMiniProtocolParameters)
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.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"
defaultBlockFetchConfiguration :: Salt -> BlockFetchConfiguration
defaultBlockFetchConfiguration :: Salt -> BlockFetchConfiguration
defaultBlockFetchConfiguration 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 -> Word) -> Word16 -> Word
forall a b. (a -> b) -> a -> b
$ MiniProtocolParameters -> Word16
blockFetchPipeliningMax MiniProtocolParameters
defaultMiniProtocolParameters,
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