AppV2: Impairment test
Add tests that verify that V2 is robust even if peers are late or omit TXs in replies.
Add tests that verify that V2 is robust even if peers are late or omit TXs in replies.
When peers have conflicting advertisement orders for TXs it is possible for them to form a dependancy loop. For example peer A has tx id 1 but requires tx id 0 to submit, peer B has txid 2 but requires tx id 1 to submit, peer C has txid 0 but requires txid 2 before it can submit. We break this loop by introducing a inflightTimeout. When a peer has spent that much time unable to get the TX into the mempool it will bump the new currentMaxInflightMultiplicity limit. This will allow another peer to issue a new request for the TX.
This reverts commit fcc5801a153bcedb9f12e14421e5bbecf727a5c3.
When peers have conflicting advertisement orders for TXs it is possible for them to form a dependancy loop. For example peer A has tx id 1 but requires tx id 0 to submit, peer B has txid 2 but requires tx id 1 to submit, peer C has txid 0 but requires txid 2 before it can submit. We break this loop by introducing a inflightTimeout. When a peer has spent that much time unable to get the TX into the mempool it will bump the new currentMaxInflightMultiplicity limit. This will allow another peer to issue a new request for the TX.
XXX: Breaks backwards compat. Bump maxUnacknowledgedTxIds to 20 Bump maxNumTxIdsToRequest to 12 Lower maxOutstandingTxBatchesPerPeer to 2
Move cleanup of expired retained TXs and orphaned TXs to the counter thread.
Since peer score is now only a peer local thing move it into PeerTxLocalState and update it outside of atomic.
Inline some hot path functions. The old NOINLINE pragmas where a leftover from V1, and not applicable to V2 since we don't run unsafeNoThunks between states.
Use nothunks to assert that there are no thunks after some property based tests.
Not only idle peers but all peers should be notified when something changes for one of their TX.s
We don't track peers that don't have an ongoing attempt any longer so TxNoAttempt isn't needed.
The provided Eq/Ord instance for txid allocates memory. HasRawTxId lets the network layer convert to a type without that problems for our interal data structures. XXX Waiting on feedback from consensus.
The retained functions in Types.hs are just small wrappes around IntPSQ functions.
Merge prop_handleReceivedTxs_buffersAndDropsOmitted, prop_handleReceivedTxs_dropsLateBodies, prop_handleReceivedTxs_penalizesOmittedAfterPrune into prop_handleReceivedTxs. Improve tests to use arbitrary shared state, local state and a list of TXs.
The common case is that no TX has been downloaded.
The common case is that not TXs has expired. If so exit quickly.
Test the peer score functionality. Use arbitrary TxDecisionPolicy instead of the defaultTxDecisionPolicy.
If there is at least one TX outstanding don't ack the final txid in the window
Improve comment around deletion of retaind txs.