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

Test.Ouroboros.Network.TxSubmission.Types

Synopsis

Documentation

data Tx txid Source #

Constructors

Tx 

Fields

  • getTxId :: !txid
     
  • getTxSize :: !SizeInBytes
     
  • getTxAdvSize :: !SizeInBytes
     
  • getTxValid :: !Bool

    If false this means that when this tx will be submitted to a remote mempool it will not be valid. The outbound mempool might contain invalid tx's in this sense.

  • getTxParent :: !(Maybe txid)

    Optional parent dependency: this tx may only be accepted into a mempool once its parent is already present (either from an earlier batch or earlier in the same batch). Nothing means no dependency. Used by chain-aware tests to model transaction chains.

Instances

Instances details
ShowProxy txid => ShowProxy (Tx txid :: Type) Source # 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.Types

Methods

showProxy :: Proxy (Tx txid) -> String

Arbitrary txid => Arbitrary (Tx txid) Source # 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.Types

Methods

arbitrary :: Gen (Tx txid) #

shrink :: Tx txid -> [Tx txid] #

NFData txid => NFData (Tx txid) Source # 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.Types

Methods

rnf :: Tx txid -> () #

Generic (Tx txid) Source # 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.Types

Associated Types

type Rep (Tx txid) 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.Types

type Rep (Tx txid) = D1 ('MetaData "Tx" "Test.Ouroboros.Network.TxSubmission.Types" "ouroboros-network-2.0.0.0-inplace-ouroboros-network-tests-lib" 'False) (C1 ('MetaCons "Tx" 'PrefixI 'True) ((S1 ('MetaSel ('Just "getTxId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 txid) :*: S1 ('MetaSel ('Just "getTxSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SizeInBytes)) :*: (S1 ('MetaSel ('Just "getTxAdvSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SizeInBytes) :*: (S1 ('MetaSel ('Just "getTxValid") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "getTxParent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe txid))))))

Methods

from :: Tx txid -> Rep (Tx txid) x #

to :: Rep (Tx txid) x -> Tx txid #

Show txid => Show (Tx txid) Source # 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.Types

Methods

showsPrec :: Int -> Tx txid -> ShowS #

show :: Tx txid -> String #

showList :: [Tx txid] -> ShowS #

Eq txid => Eq (Tx txid) Source # 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.Types

Methods

(==) :: Tx txid -> Tx txid -> Bool #

(/=) :: Tx txid -> Tx txid -> Bool #

Ord txid => Ord (Tx txid) Source # 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.Types

Methods

compare :: Tx txid -> Tx txid -> Ordering #

(<) :: Tx txid -> Tx txid -> Bool #

(<=) :: Tx txid -> Tx txid -> Bool #

(>) :: Tx txid -> Tx txid -> Bool #

(>=) :: Tx txid -> Tx txid -> Bool #

max :: Tx txid -> Tx txid -> Tx txid #

min :: Tx txid -> Tx txid -> Tx txid #

NoThunks txid => NoThunks (Tx txid) Source # 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.Types

Methods

noThunks :: Context -> Tx txid -> IO (Maybe ThunkInfo) #

wNoThunks :: Context -> Tx txid -> IO (Maybe ThunkInfo) #

showTypeOf :: Proxy (Tx txid) -> String #

type Rep (Tx txid) Source # 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.Types

type Rep (Tx txid) = D1 ('MetaData "Tx" "Test.Ouroboros.Network.TxSubmission.Types" "ouroboros-network-2.0.0.0-inplace-ouroboros-network-tests-lib" 'False) (C1 ('MetaCons "Tx" 'PrefixI 'True) ((S1 ('MetaSel ('Just "getTxId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 txid) :*: S1 ('MetaSel ('Just "getTxSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SizeInBytes)) :*: (S1 ('MetaSel ('Just "getTxAdvSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SizeInBytes) :*: (S1 ('MetaSel ('Just "getTxValid") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "getTxParent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe txid))))))

type TxId = Int Source #

data Mempool (m :: Type -> Type) txid tx #

A simple in-memory mempool implementation.

emptyMempool :: MonadSTM m => m (Mempool m txid (Tx txid)) Source #

newMempool :: (MonadSTM m, Ord txid) => [Tx txid] -> m (Mempool m txid (Tx txid)) Source #

readMempool :: MonadSTM m => Mempool m txid (Tx txid) -> m [Tx txid] Source #

getMempoolReader :: forall txid (m :: Type -> Type). (MonadSTM m, Ord txid, Show txid) => Mempool m txid (Tx txid) -> TxSubmissionMempoolReader txid (Tx txid) Integer m Source #

getMempoolWriter :: forall txid (m :: Type -> Type). (MonadSTM m, MonadTime m, MonadThrow m, Ord txid, Eq txid, Typeable txid, Show txid) => TVar m [txid] -> Mempool m txid (Tx txid) -> TxSubmissionMempoolWriter txid (Tx txid) Integer m InvalidTx Source #

data WithThreadAndTime (m :: Type -> Type) a #

Constructors

WithThreadAndTime 

Instances

Instances details
(Show (ThreadId m), Show a) => Show (WithThreadAndTime m a) 
Instance details

Defined in Test.Ouroboros.Network.Utils

txSubmissionCodec2 :: forall (m :: Type -> Type). MonadST m => Codec (TxSubmission2 Int (Tx Int)) DeserialiseFailure m ByteString Source #

verboseTracer :: forall a (m :: Type -> Type). (MonadFork m, MonadDelay m, MonadSay m, MonadMonotonicTime m, Show a) => Tracer m a Source #

data TxSubmissionConfig #

Shared options between the inbound and outbound side.

Constructors

TxSubmissionConfig 

Fields

  • maxNumUnacknowledgedTxIds :: !NumTxIdsToAck

    maximum number of unacknowledged txids; it MUST be positive, and small enough for a MsgRequestTxs with that many txids to fit within the StIdle size limit (see max_TXID_SIZE). Before NodeToNodeV_16 it is a protocol parameter and must not be changed; since NodeToNodeV_16 it is a local setting.

  • maxNumTxIdsToRequest :: !NumTxIdsToReq

    maximum number of txids an inbound client can request at a time.

data ArbTxSubmissionConfigs Source #

A TxOutboundVersion and two configs, e.g. the inbound's and the outbound's, or two nodes'. Under TxOutboundV_1 the window is a protocol parameter, so both share the config. Under TxOutboundV_2 the second has its own window, mostly not larger than the first's, so that the second clamps the first's requests.

Constructors

ArbTxSubmissionConfigs 

Fields

data RequestTxIdsEvent Source #

How the outbound handles a MsgRequestTxIds, given its own window.

Constructors

NotClamped

the requested txids fit within the window

Clamped

the request is clamped to the room left in the window

ClampedToZero

the window is full: the request is clamped to no txids

data OutboundRequest Source #

A request received by the outbound, traced by traceOutboundRequests.

Constructors

RequestTxIds Bool NumTxIdsToAck NumTxIdsToReq RequestTxIdsEvent Int

a MsgRequestTxIds: whether it is blocking, the acknowledged and requested numbers, how the outbound handles it given its window, and the number of txids in the reply

RequestTxs Int

a MsgRequestTxs, with the number of txs in the reply

traceOutboundRequests Source #

Arguments

:: forall txid tx (m :: Type -> Type) a. Monad m 
=> Tracer m OutboundRequest 
-> NumTxIdsToAck

the outbound's window

-> TxSubmissionClient txid tx m a 
-> TxSubmissionClient txid tx m a 

Wrap an outbound, tracing every request it receives. The number of unacknowledged txids is tracked from the acknowledged and requested numbers and the lengths of the replies, as the outbound does.

Orphan instances

HasRawTxId Int Source # 
Instance details

Associated Types

type RawTxId Int 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.Types

type RawTxId Int = Int

Methods

getRawTxId :: Int -> RawTxId Int