Safe Haskell | None |
---|---|
Language | Haskell2010 |
Diffusion simulation.
Synopsis
- diffusionSimulation :: (Alternative (STM m), MonadAsync m, MonadDelay m, MonadFix m, MonadFork m, MonadSay m, MonadST m, MonadEvaluate m, MonadLabelledSTM m, MonadTraceSTM m, MonadMask m, MonadTime m, MonadTimer m, MonadThrow (STM m), MonadMVar m, forall a. Semigroup a => Semigroup (m a)) => BearerInfo -> DiffusionScript -> Tracer m (WithTime (WithName NtNAddr DiffusionTestTrace)) -> m Void
- data DiffusionScript = DiffusionScript SimArgs DomainMapScript [(NodeArgs, [Command])]
- data SimArgs = SimArgs {}
- mainnetSimArgs :: Int -> SimArgs
- data NodeArgs = NodeArgs {
- naSeed :: Int
- naDiffusionMode :: DiffusionMode
- naMbTime :: Maybe DiffTime
- naPublicRoots :: Map RelayAccessPoint PeerAdvertise
- naConsensusMode :: ConsensusMode
- naBootstrapPeers :: Script UseBootstrapPeers
- naAddr :: NtNAddr
- naPeerSharing :: PeerSharing
- naLocalRootPeers :: [(HotValency, WarmValency, Map RelayAccessPoint LocalRootConfig)]
- naLedgerPeers :: Script LedgerPools
- naPeerTargets :: ConsensusModePeerTargets
- naDNSTimeoutScript :: Script DNSTimeout
- naDNSLookupDelayScript :: Script DNSLookupDelay
- naChainSyncExitOnBlockNo :: Maybe BlockNo
- naChainSyncEarlyExit :: Bool
- naFetchModeScript :: Script PraosFetchMode
- data ServiceDomainName
- data Command
- data HotDiffusionScript = HotDiffusionScript SimArgs DomainMapScript [(NodeArgs, [Command])]
- prop_diffusionScript_fixupCommands :: DiffusionScript -> Property
- prop_diffusionScript_commandScript_valid :: DiffusionScript -> Property
- data DiffusionSimulationTrace
- data DiffusionTestTrace
- = DiffusionLocalRootPeerTrace (TraceLocalRootPeers NtNAddr SomeException)
- | DiffusionPublicRootPeerTrace TracePublicRootPeers
- | DiffusionLedgerPeersTrace TraceLedgerPeers
- | DiffusionPeerSelectionTrace (TracePeerSelection NtNAddr)
- | DiffusionPeerSelectionActionsTrace (PeerSelectionActionsTrace NtNAddr NtNVersion)
- | DiffusionDebugPeerSelectionTrace (DebugPeerSelection NtNAddr)
- | DiffusionConnectionManagerTrace (Trace NtNAddr (ConnectionHandlerTrace NtNVersion NtNVersionData))
- | DiffusionDiffusionSimulationTrace DiffusionSimulationTrace
- | DiffusionConnectionManagerTransitionTrace (AbstractTransitionTrace ConnStateId)
- | DiffusionInboundGovernorTransitionTrace (RemoteTransitionTrace NtNAddr)
- | DiffusionInboundGovernorTrace (Trace NtNAddr)
- | DiffusionServerTrace (Trace NtNAddr)
- | DiffusionFetchTrace (TraceFetchClientState BlockHeader)
- | DiffusionDebugTrace String
- iosimTracer :: forall s a. (Show a, Typeable a) => Tracer (IOSim s) (WithTime (WithName NtNAddr a))
- newtype TestAddress addr = TestAddress {
- getTestAddress :: addr
- data RelayAccessPoint where
- newtype Script a = Script (NonEmpty a)
- data ConsensusModePeerTargets = ConsensusModePeerTargets {}
- data DebugPeerSelection peeraddr where
- TraceGovernorState :: forall peeraddr peerconn. Show peerconn => Time -> Maybe DiffTime -> PeerSelectionState peeraddr peerconn -> DebugPeerSelection peeraddr
- data PeerSelectionTargets = PeerSelectionTargets {}
- data TracePeerSelection peeraddr
- newtype DNSTimeout = DNSTimeout {}
- newtype DNSLookupDelay = DNSLookupDelay {}
Run diffusion simulation
:: (Alternative (STM m), MonadAsync m, MonadDelay m, MonadFix m, MonadFork m, MonadSay m, MonadST m, MonadEvaluate m, MonadLabelledSTM m, MonadTraceSTM m, MonadMask m, MonadTime m, MonadTimer m, MonadThrow (STM m), MonadMVar m, forall a. Semigroup a => Semigroup (m a)) | |
=> BearerInfo | |
-> DiffusionScript | |
-> Tracer m (WithTime (WithName NtNAddr DiffusionTestTrace)) | timed trace of nodes in the system |
-> m Void |
Run an arbitrary topology
data DiffusionScript Source #
Multinode Diffusion Simulator Script
SimArgs
with all the values needed for running the simulation, followed
by a list of NodeArgs
where each element represents one running node and
respective Command
s.
DiffusionScript SimArgs DomainMapScript [(NodeArgs, [Command])] |
Instances
Arbitrary DiffusionScript Source # | |
Defined in Test.Ouroboros.Network.Testnet.Internal arbitrary :: Gen DiffusionScript # shrink :: DiffusionScript -> [DiffusionScript] # | |
Show DiffusionScript Source # | |
Defined in Test.Ouroboros.Network.Testnet.Internal showsPrec :: Int -> DiffusionScript -> ShowS # show :: DiffusionScript -> String # showList :: [DiffusionScript] -> ShowS # |
Diffusion Simulator Arguments
Contains all necessary randomly generated values needed to run diffusion in simulation.
SimArgs | |
|
mainnetSimArgs :: Int -> SimArgs Source #
Simulation arguments.
Slot length needs to be greater than 0 else we get a livelock on the IOSim.
Quota values matches mainnet, so a slot length of 1s and 1 / 20 chance that someone gets to make a block.
Diffusion Simulator Node Arguments
Contains all necessary randomly generated values needed to run a node in simulation.
NodeArgs | |
|
data ServiceDomainName Source #
DomainName Domain | a well configured domain name |
Misconfigured Domain | a domain name which is advertised but its' IPs are wrong. |
NoDomainName |
Instances
Arbitrary ServiceDomainName Source # | |
Defined in Test.Ouroboros.Network.Testnet.Internal | |
Show ServiceDomainName Source # | |
Defined in Test.Ouroboros.Network.Testnet.Internal showsPrec :: Int -> ServiceDomainName -> ShowS # show :: ServiceDomainName -> String # showList :: [ServiceDomainName] -> ShowS # |
JoinNetwork DiffTime | |
Kill DiffTime | |
Reconfigure DiffTime [(HotValency, WarmValency, Map RelayAccessPoint LocalRootConfig)] |
data HotDiffusionScript Source #
Multinode Hot Diffusion Simulator Script
List of SimArgs
. Each element of the list represents one running node.
HotDiffusionScript SimArgs DomainMapScript [(NodeArgs, [Command])] |
Instances
Arbitrary HotDiffusionScript Source # | |
Defined in Test.Ouroboros.Network.Testnet.Internal | |
Show HotDiffusionScript Source # | |
Defined in Test.Ouroboros.Network.Testnet.Internal showsPrec :: Int -> HotDiffusionScript -> ShowS # show :: HotDiffusionScript -> String # showList :: [HotDiffusionScript] -> ShowS # |
QuickCheck properties
Tracing
data DiffusionSimulationTrace Source #
Diffusion Simulation Trace so we know what command is concurrently running
Instances
Show DiffusionSimulationTrace Source # | |
Defined in Test.Ouroboros.Network.Testnet.Internal showsPrec :: Int -> DiffusionSimulationTrace -> ShowS # show :: DiffusionSimulationTrace -> String # showList :: [DiffusionSimulationTrace] -> ShowS # |
data DiffusionTestTrace Source #
Instances
Show DiffusionTestTrace Source # | |
Defined in Test.Ouroboros.Network.Testnet.Internal showsPrec :: Int -> DiffusionTestTrace -> ShowS # show :: DiffusionTestTrace -> String # showList :: [DiffusionTestTrace] -> ShowS # |
iosimTracer :: forall s a. (Show a, Typeable a) => Tracer (IOSim s) (WithTime (WithName NtNAddr a)) Source #
A debug tracer which embeds events in DiffusionTestTrace.
Re-exports
newtype TestAddress addr #
TestAddress | |
|
Instances
data RelayAccessPoint #
A relay can have either an IP address and a port number or a domain with a port number
pattern RelayDomainAccessPoint :: DomainAccessPoint -> RelayAccessPoint |
|
Instances
Arbitrary RelayAccessPoint Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.Instances arbitrary :: Gen RelayAccessPoint # shrink :: RelayAccessPoint -> [RelayAccessPoint] # | |
FromJSON RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint parseJSON :: Value -> Parser RelayAccessPoint # parseJSONList :: Value -> Parser [RelayAccessPoint] # | |
ToJSON RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint toJSON :: RelayAccessPoint -> Value # toEncoding :: RelayAccessPoint -> Encoding # toJSONList :: [RelayAccessPoint] -> Value # toEncodingList :: [RelayAccessPoint] -> Encoding # omitField :: RelayAccessPoint -> Bool # | |
NFData RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint rnf :: RelayAccessPoint -> () # | |
Show RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint showsPrec :: Int -> RelayAccessPoint -> ShowS # show :: RelayAccessPoint -> String # showList :: [RelayAccessPoint] -> ShowS # | |
Eq RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint (==) :: RelayAccessPoint -> RelayAccessPoint -> Bool # (/=) :: RelayAccessPoint -> RelayAccessPoint -> Bool # | |
Ord RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint compare :: RelayAccessPoint -> RelayAccessPoint -> Ordering # (<) :: RelayAccessPoint -> RelayAccessPoint -> Bool # (<=) :: RelayAccessPoint -> RelayAccessPoint -> Bool # (>) :: RelayAccessPoint -> RelayAccessPoint -> Bool # (>=) :: RelayAccessPoint -> RelayAccessPoint -> Bool # max :: RelayAccessPoint -> RelayAccessPoint -> RelayAccessPoint # min :: RelayAccessPoint -> RelayAccessPoint -> RelayAccessPoint # |
Instances
Functor Script | |
Foldable Script | |
Defined in Ouroboros.Network.Testing.Data.Script fold :: Monoid m => Script m -> m # foldMap :: Monoid m => (a -> m) -> Script a -> m # foldMap' :: Monoid m => (a -> m) -> Script a -> m # foldr :: (a -> b -> b) -> b -> Script a -> b # foldr' :: (a -> b -> b) -> b -> Script a -> b # foldl :: (b -> a -> b) -> b -> Script a -> b # foldl' :: (b -> a -> b) -> b -> Script a -> b # foldr1 :: (a -> a -> a) -> Script a -> a # foldl1 :: (a -> a -> a) -> Script a -> a # elem :: Eq a => a -> Script a -> Bool # maximum :: Ord a => Script a -> a # minimum :: Ord a => Script a -> a # | |
Traversable Script | |
Arbitrary a => Arbitrary (Script a) | |
Show a => Show (Script a) | |
Eq a => Eq (Script a) | |
data ConsensusModePeerTargets #
Provides alternate peer selection targets for various syncing modes.
Instances
Arbitrary ConsensusModePeerTargets Source # | |
Show ConsensusModePeerTargets | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types showsPrec :: Int -> ConsensusModePeerTargets -> ShowS # show :: ConsensusModePeerTargets -> String # showList :: [ConsensusModePeerTargets] -> ShowS # | |
Eq ConsensusModePeerTargets | |
data DebugPeerSelection peeraddr where #
TraceGovernorState :: forall peeraddr peerconn. Show peerconn => Time -> Maybe DiffTime -> PeerSelectionState peeraddr peerconn -> DebugPeerSelection peeraddr |
Instances
(Ord peeraddr, Show peeraddr) => Show (DebugPeerSelection peeraddr) | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types showsPrec :: Int -> DebugPeerSelection peeraddr -> ShowS # show :: DebugPeerSelection peeraddr -> String # showList :: [DebugPeerSelection peeraddr] -> ShowS # |
data PeerSelectionTargets #
Adjustable targets for the peer selection mechanism.
These are used by the peer selection governor as targets. They are used by the peer churn governor loop as knobs to adjust, to influence the peer selection governor.
The known, established and active peer targets are targets both from below and from above: the governor will attempt to grow or shrink the sets to hit these targets.
Unlike the other targets, the root peer target is "one sided", it is only a target from below. The governor does not try to shrink the root set to hit it, it simply stops looking for more.
There is also an implicit target that enough local root peers are selected as active. This comes from the configuration for local roots, and is not an independently adjustable target.
PeerSelectionTargets | |
|
Instances
Arbitrary PeerSelectionTargets Source # | |
Show PeerSelectionTargets | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types showsPrec :: Int -> PeerSelectionTargets -> ShowS # show :: PeerSelectionTargets -> String # showList :: [PeerSelectionTargets] -> ShowS # | |
Eq PeerSelectionTargets | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types (==) :: PeerSelectionTargets -> PeerSelectionTargets -> Bool # (/=) :: PeerSelectionTargets -> PeerSelectionTargets -> Bool # |
data TracePeerSelection peeraddr #
Instances
(Ord peeraddr, Show peeraddr) => Show (TracePeerSelection peeraddr) | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types showsPrec :: Int -> TracePeerSelection peeraddr -> ShowS # show :: TracePeerSelection peeraddr -> String # showList :: [TracePeerSelection peeraddr] -> ShowS # |
newtype DNSTimeout Source #
Instances
Arbitrary DNSTimeout Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.RootPeersDNS arbitrary :: Gen DNSTimeout # shrink :: DNSTimeout -> [DNSTimeout] # | |
Show DNSTimeout Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.RootPeersDNS showsPrec :: Int -> DNSTimeout -> ShowS # show :: DNSTimeout -> String # showList :: [DNSTimeout] -> ShowS # |
newtype DNSLookupDelay Source #
Instances
Arbitrary DNSLookupDelay Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.RootPeersDNS arbitrary :: Gen DNSLookupDelay # shrink :: DNSLookupDelay -> [DNSLookupDelay] # | |
Show DNSLookupDelay Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.RootPeersDNS showsPrec :: Int -> DNSLookupDelay -> ShowS # show :: DNSLookupDelay -> String # showList :: [DNSLookupDelay] -> ShowS # |