ouroboros-network
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.TxSubmission.Inbound.V2.Policy

Contents

Synopsis

Documentation

data TxDecisionPolicy Source #

Policy for making decisions

Constructors

TxDecisionPolicy 

Fields

  • txsSizeInflightPerPeer :: !SizeInBytes

    a limit of tx size in-flight from a single peer. It can be exceed by max tx size.

  • txsSizePerBatch :: !SizeInBytes

    Hard limit on the total advertised transaction size in one body request batch, except for the first tx in a batch, which is requested even if it is larger. Hence a batch is at most `max txsSizePerBatch max_TX_SIZE`. The default reserves space for reply framing and for the const_MAX_TX_SIZE_DISCREPANCY tolerance of each tx. It MUST be positive, and the reply to the largest batch MUST fit within the StTxs size limit (see saneTxDecisionPolicy). It can be smaller than max_TX_SIZE: a larger tx is requested in a batch on its own.

  • maxOutstandingTxBatchesPerPeer :: !Int

    a limit of outstanding tx-body request batches from a single peer.

  • txInflightMultiplicity :: !Int

    from how many peers download the txid simultaneously

  • bufferedTxsMinLifetime :: !DiffTime

    how long TXs that have been added to the mempool will be kept in the bufferedTxs cache.

  • scoreRate :: !Double

    rate at which "rejected" TXs drain. Unit: TX/seconds.

  • scoreMax :: !Double

    Maximum number of "rejections". Unit: seconds

  • scoreAcceptDecrement :: !Double

    amount subtracted from the peer's score for each tx body the peer delivered that the mempool accepted.

  • interTxSpace :: !DiffTime

    space between actual requests for the same TX. This the time a peer has soul ownership of their TX lease. When it expires other peers may issue additional requests.

  • inflightTimeout :: !DiffTime

    Maximum time a peer's attempt may sit between claim and entering submission before the per-entry inflight-multiplicity cap is bumped, allowing another peer to attempt in parallel.

  • maxPeerClaimDelay :: !DiffTime

    Maximum delay penalty for poor performing peers.

  • disablePipelinedTxIdRequests :: !Bool

    When True, the txid picker never issues pipelined MsgRequestTxIds messages; only blocking requests fire (and only when the unack window has been fully drained). Used by some benchmarks.

mkTxDecisionPolicy :: TxSubmissionConfig -> Either TxConfigurationError TxDecisionPolicy Source #

The default policy for the given config. Returns a TxConfigurationError if it isn't sane (see saneTxDecisionPolicy); the node should then report it and halt.

saneTxDecisionPolicy :: TxDecisionPolicy -> TxSubmissionConfig -> Either TxConfigurationError () Source #

Sanity check for a TxDecisionPolicy: Right when every field lies in the range the decision logic assumes, otherwise the first violated bound as a TxConfigurationError.

All window and size limits must be positive (otherwise the peer can make no progress), the rate, score and delay parameters must be non-negative, and inflightTimeout must be at least interTxSpace (their difference is used as a non-negative delay when bumping a stuck entry's inflight-multiplicity cap). mkTxDecisionPolicy satisfies it. The reply to the largest batch MUST fit within the StTxs size limit. A batch can exceed txsSizePerBatch by being a single tx (of at most max_TX_SIZE), so its advertised size is at most `max txsSizePerBatch max_TX_SIZE`. It holds at most maxNumUnacknowledgedTxIds txs, and each received tx can be larger than advertised by up to const_MAX_TX_SIZE_DISCREPANCY. A MsgRequestTxs with maxNumUnacknowledgedTxIds txids of size max_TXID_SIZE MUST fit within the StIdle size limit. `max_TX_SIZE * maxNumTxIdsToRequest` MUST fit in SizeInBytes.

data TxConfigurationError Source #

Why a TxDecisionPolicy with a TxSubmissionConfig isn't sane, see saneTxDecisionPolicy. Each constructor carries the offending values.

Constructors

NumUnacknowledgedTxIdsTooSmall NumTxIdsToAck

maxNumUnacknowledgedTxIds must be positive

NumUnacknowledgedTxIdsTooLarge NumTxIdsToAck

a MsgRequestTxs with maxNumUnacknowledgedTxIds txids of size max_TXID_SIZE doesn't fit within the StIdle size limit

MaxNumTxIdsToRequestTooSmall NumTxIdsToReq

maxNumTxIdsToRequest must be positive

MaxNumTxIdsToRequestTooLarge NumTxIdsToReq

max_TX_SIZE * maxNumTxIdsToRequest doesn't fit in SizeInBytes

TxsSizeInflightPerPeerTooSmall SizeInBytes

txsSizeInflightPerPeer must be positive

TxsSizePerBatchTooSmall SizeInBytes

txsSizePerBatch must be positive

TxsSizePerBatchTooLarge SizeInBytes NumTxIdsToAck

the reply to the largest batch, with maxNumUnacknowledgedTxIds txs each up to const_MAX_TX_SIZE_DISCREPANCY larger than advertised, doesn't fit within the StTxs size limit

MaxOutstandingTxBatchesPerPeerTooSmall Int

maxOutstandingTxBatchesPerPeer must be positive

TxInflightMultiplicityTooSmall Int

txInflightMultiplicity must be positive

BufferedTxsMinLifetimeTooSmall DiffTime

bufferedTxsMinLifetime must be non-negative

ScoreRateTooSmall Double

scoreRate must be non-negative

ScoreMaxTooSmall Double

scoreMax must be non-negative

ScoreAcceptDecrementTooSmall Double

scoreAcceptDecrement must be non-negative

InterTxSpaceTooSmall DiffTime

interTxSpace must be non-negative

InflightTimeoutTooSmall DiffTime DiffTime

inflightTimeout (the first field) must be at least interTxSpace (the second field)

MaxPeerClaimDelayTooSmall DiffTime

maxPeerClaimDelay must be non-negative

data TxSubmissionConfig Source #

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.

max_TX_SIZE :: SizeInBytes Source #

Maximal tx size.

It bounds the advertised tx size on every node-to-node version: the V2 inbound disconnects from a peer which advertises a larger tx (ProtocolErrorTxSizeTooLarge). The bound is far above the ledger's maximal tx size, and every version was already limited by it through the ingress queue of the mini-protocol (see below). Increasing it requires a new node-to-node version, since nodes running older versions disconnect from peers which advertise larger txs.

Affects:

max_TXID_SIZE :: SizeInBytes Source #

Upper bound on the size of an encoded txid, the same as used by txSubmissionProtocolLimits.

It bounds maxNumUnacknowledgedTxIds: a MsgRequestTxs can carry up to maxNumUnacknowledgedTxIds txids and must fit within the StIdle size limit, see saneTxDecisionPolicy.

Re-exports

newtype NumTxIdsToReq #

Constructors

NumTxIdsToReq 

Instances

Instances details
NFData NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Methods

rnf :: NumTxIdsToReq -> () #

Monoid NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Semigroup NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Bounded NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Enum NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Generic NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Associated Types

type Rep NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

type Rep NumTxIdsToReq = D1 ('MetaData "NumTxIdsToReq" "Ouroboros.Network.Protocol.TxSubmission2.Type" "ouroboros-network-2.0.0.0-inplace-protocols" 'True) (C1 ('MetaCons "NumTxIdsToReq" 'PrefixI 'True) (S1 ('MetaSel ('Just "getNumTxIdsToReq") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)))
Num NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Integral NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Real NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Show NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Eq NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

Ord NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

NoThunks NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

type Rep NumTxIdsToReq 
Instance details

Defined in Ouroboros.Network.Protocol.TxSubmission2.Type

type Rep NumTxIdsToReq = D1 ('MetaData "NumTxIdsToReq" "Ouroboros.Network.Protocol.TxSubmission2.Type" "ouroboros-network-2.0.0.0-inplace-protocols" 'True) (C1 ('MetaCons "NumTxIdsToReq" 'PrefixI 'True) (S1 ('MetaSel ('Just "getNumTxIdsToReq") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)))