Safe Haskell | None |
---|---|
Language | Haskell2010 |
Test.Ouroboros.Network.Diffusion.Testnet.Cardano.Simulation
Contents
Synopsis
- 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 PeerTrustable))]
- naLedgerPeers :: Script LedgerPools
- naPeerTargets :: (PeerSelectionTargets, PeerSelectionTargets)
- naDNSTimeoutScript :: Script DNSTimeout
- naDNSLookupDelayScript :: Script DNSLookupDelay
- naChainSyncExitOnBlockNo :: Maybe BlockNo
- naChainSyncEarlyExit :: Bool
- naFetchModeScript :: Script PraosFetchMode
- data ServiceDomainName
- data DiffusionScript = DiffusionScript SimArgs DomainMapScript [(NodeArgs, [Command])]
- data HotDiffusionScript = HotDiffusionScript SimArgs DomainMapScript [(NodeArgs, [Command])]
- data DiffusionSimulationTrace
- prop_diffusionScript_fixupCommands :: DiffusionScript -> Property
- prop_diffusionScript_commandScript_valid :: DiffusionScript -> Property
- fixupCommands :: [Command] -> [Command]
- 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 Command
- data DiffusionTestTrace
- = DiffusionLocalRootPeerTrace (TraceLocalRootPeers PeerTrustable NtNAddr SomeException)
- | DiffusionPublicRootPeerTrace TracePublicRootPeers
- | DiffusionLedgerPeersTrace TraceLedgerPeers
- | DiffusionPeerSelectionTrace (TracePeerSelection ExtraState PeerTrustable (ExtraPeers NtNAddr) NtNAddr)
- | DiffusionPeerSelectionActionsTrace (PeerSelectionActionsTrace NtNAddr NtNVersion)
- | DiffusionDebugPeerSelectionTrace (DebugPeerSelection ExtraState PeerTrustable (ExtraPeers NtNAddr) 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 DebugPeerSelection extraState extraFlags extraPeers peeraddr where
- TraceGovernorState :: forall extraState extraFlags extraPeers peeraddr peerconn. Show peerconn => Time -> Maybe DiffTime -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> DebugPeerSelection extraState extraFlags extraPeers peeraddr
- data PeerSelectionTargets = PeerSelectionTargets {}
- data TracePeerSelection extraDebugState extraFlags extraPeers peeraddr
- newtype DNSLookupDelay = DNSLookupDelay {}
- newtype DNSTimeout = DNSTimeout {}
- mockDNSActions :: forall exception (m :: Type -> Type). (MonadDelay m, MonadTimer m) => StrictTVar m (Map Domain [(IP, TTL)]) -> StrictTVar m (Script DNSTimeout) -> StrictTVar m (Script DNSLookupDelay) -> DNSActions () exception m
Documentation
Diffusion Simulator Arguments
Contains all necessary randomly generated values needed to run diffusion in simulation.
Constructors
SimArgs | |
Fields
|
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.
Constructors
NodeArgs | |
Fields
|
data ServiceDomainName Source #
Constructors
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 # | |
Show ServiceDomainName Source # | |
Defined in Test.Ouroboros.Network.Diffusion.Testnet.Cardano.Simulation Methods showsPrec :: Int -> ServiceDomainName -> ShowS # show :: ServiceDomainName -> String # showList :: [ServiceDomainName] -> ShowS # |
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.
Constructors
DiffusionScript SimArgs DomainMapScript [(NodeArgs, [Command])] |
Instances
Arbitrary DiffusionScript Source # | |
Show DiffusionScript Source # | |
Defined in Test.Ouroboros.Network.Diffusion.Testnet.Cardano.Simulation Methods showsPrec :: Int -> DiffusionScript -> ShowS # show :: DiffusionScript -> String # showList :: [DiffusionScript] -> ShowS # |
data HotDiffusionScript Source #
Multinode Hot Diffusion Simulator Script
List of SimArgs
. Each element of the list represents one running node.
Constructors
HotDiffusionScript SimArgs DomainMapScript [(NodeArgs, [Command])] |
Instances
Arbitrary HotDiffusionScript Source # | |
Show HotDiffusionScript Source # | |
Defined in Test.Ouroboros.Network.Diffusion.Testnet.Cardano.Simulation Methods showsPrec :: Int -> HotDiffusionScript -> ShowS # show :: HotDiffusionScript -> String # showList :: [HotDiffusionScript] -> ShowS # |
data DiffusionSimulationTrace Source #
Diffusion Simulation Trace so we know what command is concurrently running
Constructors
TrJoiningNetwork | |
TrKillingNode | |
TrReconfiguringNode | |
TrUpdatingDNS | |
TrRunning | |
TrErrored SomeException |
Instances
Show DiffusionSimulationTrace Source # | |
Defined in Test.Ouroboros.Network.Diffusion.Testnet.Cardano.Simulation Methods showsPrec :: Int -> DiffusionSimulationTrace -> ShowS # show :: DiffusionSimulationTrace -> String # showList :: [DiffusionSimulationTrace] -> ShowS # |
fixupCommands :: [Command] -> [Command] Source #
Arguments
:: (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
Constructors
JoinNetwork DiffTime | |
Kill DiffTime | |
Reconfigure DiffTime [(HotValency, WarmValency, Map RelayAccessPoint (LocalRootConfig PeerTrustable))] |
Tracing
data DiffusionTestTrace Source #
Constructors
Instances
Show DiffusionTestTrace Source # | |
Defined in Test.Ouroboros.Network.Diffusion.Testnet.Cardano.Simulation Methods 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 #
Constructors
TestAddress | |
Fields
|
Instances
data RelayAccessPoint #
A relay can have either an IP address and a port number or a domain with a port number
Constructors
RelayAccessDomain !Domain !PortNumber | |
RelayAccessAddress !IP !PortNumber |
Bundled Patterns
pattern RelayDomainAccessPoint :: DomainAccessPoint -> RelayAccessPoint |
|
Instances
Arbitrary RelayAccessPoint Source # | |
FromJSON RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods parseJSON :: Value -> Parser RelayAccessPoint # parseJSONList :: Value -> Parser [RelayAccessPoint] # | |
ToJSON RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods toJSON :: RelayAccessPoint -> Value # toEncoding :: RelayAccessPoint -> Encoding # toJSONList :: [RelayAccessPoint] -> Value # toEncodingList :: [RelayAccessPoint] -> Encoding # omitField :: RelayAccessPoint -> Bool # | |
NFData RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods rnf :: RelayAccessPoint -> () # | |
Show RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods showsPrec :: Int -> RelayAccessPoint -> ShowS # show :: RelayAccessPoint -> String # showList :: [RelayAccessPoint] -> ShowS # | |
Eq RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods (==) :: RelayAccessPoint -> RelayAccessPoint -> Bool # (/=) :: RelayAccessPoint -> RelayAccessPoint -> Bool # | |
Ord RelayAccessPoint | |
Defined in Ouroboros.Network.PeerSelection.RelayAccessPoint Methods 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 Test.Ouroboros.Network.Data.Script Methods 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 DebugPeerSelection extraState extraFlags extraPeers peeraddr where #
Constructors
TraceGovernorState :: forall extraState extraFlags extraPeers peeraddr peerconn. Show peerconn => Time -> Maybe DiffTime -> PeerSelectionState extraState extraFlags extraPeers peeraddr peerconn -> DebugPeerSelection extraState extraFlags extraPeers peeraddr |
Instances
(Show extraState, Show extraFlags, Show extraPeers, Ord peeraddr, Show peeraddr) => Show (DebugPeerSelection extraState extraFlags extraPeers peeraddr) | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods showsPrec :: Int -> DebugPeerSelection extraState extraFlags extraPeers peeraddr -> ShowS # show :: DebugPeerSelection extraState extraFlags extraPeers peeraddr -> String # showList :: [DebugPeerSelection extraState extraFlags extraPeers 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.
Constructors
PeerSelectionTargets | |
Fields
|
Instances
Arbitrary PeerSelectionTargets Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.Instances Methods | |
Show PeerSelectionTargets | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods showsPrec :: Int -> PeerSelectionTargets -> ShowS # show :: PeerSelectionTargets -> String # showList :: [PeerSelectionTargets] -> ShowS # | |
Eq PeerSelectionTargets | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods (==) :: PeerSelectionTargets -> PeerSelectionTargets -> Bool # (/=) :: PeerSelectionTargets -> PeerSelectionTargets -> Bool # |
data TracePeerSelection extraDebugState extraFlags extraPeers peeraddr #
Instances
(Ord peeraddr, Show extraFlags, Show extraPeers, Show peeraddr, Show extraDebugState) => Show (TracePeerSelection extraDebugState extraFlags extraPeers peeraddr) | |
Defined in Ouroboros.Network.PeerSelection.Governor.Types Methods showsPrec :: Int -> TracePeerSelection extraDebugState extraFlags extraPeers peeraddr -> ShowS # show :: TracePeerSelection extraDebugState extraFlags extraPeers peeraddr -> String # showList :: [TracePeerSelection extraDebugState extraFlags extraPeers peeraddr] -> ShowS # |
newtype DNSLookupDelay Source #
Constructors
DNSLookupDelay | |
Fields |
Instances
Arbitrary DNSLookupDelay Source # | |
Show DNSLookupDelay Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.RootPeersDNS Methods showsPrec :: Int -> DNSLookupDelay -> ShowS # show :: DNSLookupDelay -> String # showList :: [DNSLookupDelay] -> ShowS # |
newtype DNSTimeout Source #
Constructors
DNSTimeout | |
Fields |
Instances
Arbitrary DNSTimeout Source # | |
Show DNSTimeout Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.RootPeersDNS Methods showsPrec :: Int -> DNSTimeout -> ShowS # show :: DNSTimeout -> String # showList :: [DNSTimeout] -> ShowS # |
mockDNSActions :: forall exception (m :: Type -> Type). (MonadDelay m, MonadTimer m) => StrictTVar m (Map Domain [(IP, TTL)]) -> StrictTVar m (Script DNSTimeout) -> StrictTVar m (Script DNSLookupDelay) -> DNSActions () exception m Source #
Mock DNSActions data structure for testing purposes. Adds DNS Lookup function for IOSim with different timeout and lookup delays for every attempt.