ouroboros-network:sim-tests-lib
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.BlockFetch.Examples

Synopsis

Documentation

blockFetchExample0 Source #

Run a single block fetch protocol until the chain is downloaded.

blockFetchExample1 Source #

Arguments

:: (MonadSTM m, MonadST m, MonadAsync m, MonadDelay m, MonadFork m, MonadTime m, MonadTimer m, MonadMask m, MonadThrow (STM m)) 
=> Tracer m [TraceLabelPeer Int (FetchDecision [Point BlockHeader])] 
-> Tracer m (TraceLabelPeer Int (TraceFetchClientState BlockHeader)) 
-> Tracer m (TraceLabelPeer Int (TraceSendRecv (BlockFetch Block (Point Block)))) 
-> Maybe DiffTime

client's channel delay

-> Maybe DiffTime

server's channel delay

-> ControlMessageSTM m 
-> AnchoredFragment Block

Fixed current chain

-> [AnchoredFragment Block]

Fixed candidate chains

-> m () 

End to end test of block fetching with fixed chain and candidates.

The setup is the block fetch logic thread and a bunch of peers each with a chain. The current chain and candidate chains are fixed and the peers never fail or go slowly.

Run the block fetch until all the chains are downloaded. So this assumes all the candidates do intersect the current chain, and are longer, so we will be interested in downloading them all.

mockBlockFetchServer1 :: forall block (m :: Type -> Type). (MonadSTM m, HasHeader block) => AnchoredFragment block -> BlockFetchServer block (Point block) m () Source #

A demo server for the block fetch protocol.

It serves up ranges on a single given AnchoredFragment. It does not simulate any delays, so is not suitable for timing-accurate simulations.

exampleFixedPeerGSVs :: PeerGSV Source #

Roughly 10ms ping time and 1MBit/s bandwidth, leads to ~2200 bytes in flight minimum.