Conversation
f434785 to
91304d1
Compare
da7ff95 to
97ca973
Compare
8504d49 to
9e6e0f4
Compare
Allow monadic action when trying to pipeline more messages, while collecting responses.
* `prop_makeDecisions_receivedTxIds` mix up `makeDecisions` and `receivedTxIds` * `prop_makeDecisions_collectTxIds` mix up `makeDecisions` and `collectTxIds`
Export everything from the `Ouroboros.Network.TxSubmission.Inbound` module.
992a7de to
228aa28
Compare
- Factors out common type definitions and their generators and properties to a Common.hs file. - Adds a TxSubmissionV2 file with the boilerplate to run the new, more accurate submission that uses the V2 version of TxSubmission protocol
Refactored SimResult name to not clash with IOSim's
- Updated txSubmissionV2 test - Fixed TODO about passing an STM action inside receivedTxIds - Fixed usage of partial function `(!)` - Fixed wrong usage of MVars in decisionLogicThread that lead to deadlock.
There was a race condition between the `decisionLogicThread` producing
the right policy and inbound server picking up the most up to date
policy. This would lead to the inbound side issuing a blocking request
when the client was awaiting for a non-blocking request. This blocking
request isn't wrong considering the policy it was used, it is a legit
decision that's made which leads to the inbound server issuing a
blocking request but because we have received a txid in the meantime and
didn't manage to read it soon enough we didn't create a more important
decision. The fix involved being aware of how many requests for txs we
have in flight and not generate "low priority" policies.
`hasTxIdsToAcknowledge` is not used anywhere in the code so it is
removed.
`filterActivePeers` is improved by making its decision logic more closed
to `pickTxsToDownload`.
`filterActivePeers` test is fixed, since it doesn't hold under the new
logic:
`filterActivePeers` will not compute a decision for peers which have
`requestedTxIdsInflight` and `makeDecisions` computes non-empty decisions
for peers with no `requestedTxIdsInflight`. So:
1. "The set of active peers is a superset of peers for which a decision
was made" this is not true since it is possible that a non active
peer has a legitimate decision, but due to our race-condition
protection condition we just don't generate it.
2. "The set of active peer which can acknowledge txids is a subset of
peers for which a decision was made" this is removed since
hasTxIdsToAcknowledge function is removed
3. "Decisions made from the results of `filterActivePeers` is the same
as from the original set" this isn't true because of what I said
above
So I refactored the test to check that the number of filtered decisions
is a subset of the total number of decisions, which I believe to be a
more accurate test for the current logic
- Adds tx submission diffusion testnet test This test checks that even in the presence of a node that keeps disconnecting, but eventually stays online, we manage to learn about all its transactions.
Module structure needs to be reorganised to have just one debug tracer.
Use `IOSim` API. `evaluateTrace` from `Test.Ouroboros.Network.LedgerPeers` has the annoying property that once the trace was evaluated in won't show the trace again, which makes it hard to work with `cabal repl`. Refactored `checkMempools` to improve readablity. Should be squashed onto `c9d45673ca New txSubmissionV2 simulation`
9e6e0f4 to
99097c7
Compare
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/TxSubmission/TxSubmissionV2.hs
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/TxSubmission/TxSubmissionV2.hs
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/TxSubmission/TxSubmissionV2.hs
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/TxSubmission/TxSubmissionV2.hs
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/TxSubmission/TxSubmissionV2.hs
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/TxSubmission/Inbound/Registry.hs
Show resolved
Hide resolved
| defaultTxDecisionPolicy :: TxDecisionPolicy | ||
| defaultTxDecisionPolicy = | ||
| TxDecisionPolicy { | ||
| maxNumTxIdsToRequest = 1, | ||
| maxUnacknowledgedTxIds = 2, | ||
| txsSizeInflightPerPeer = 2, | ||
| maxTxsSizeInflight = maxBound, | ||
| txInflightMultiplicity = 2 | ||
| } |
There was a problem hiding this comment.
These numbers are far from production configuration.
| defaultTxDecisionPolicy :: TxDecisionPolicy | |
| defaultTxDecisionPolicy = | |
| TxDecisionPolicy { | |
| maxNumTxIdsToRequest = 1, | |
| maxUnacknowledgedTxIds = 2, | |
| txsSizeInflightPerPeer = 2, | |
| maxTxsSizeInflight = maxBound, | |
| txInflightMultiplicity = 2 | |
| } | |
| defaultTxDecisionPolicy :: TxDecisionPolicy | |
| defaultTxDecisionPolicy = | |
| TxDecisionPolicy { | |
| maxNumTxIdsToRequest = 3, | |
| maxUnacknowledgedTxIds = 10, | |
| txsSizeInflightPerPeer = error "TODO", -- currently we download at most 2 tx-s in `MsgReplytTxs`. | |
| maxTxsSizeInflight = error "TODO", -- ? | |
| txInflightMultiplicity = 1 | |
| } |
There was a problem hiding this comment.
| ( 0 | ||
| , 0 | ||
| , [] | ||
| , RefCountDiff Map.empty | ||
| , ps | ||
| ) | ||
| where |
There was a problem hiding this comment.
| ( 0 | |
| , 0 | |
| , [] | |
| , RefCountDiff Map.empty | |
| , ps | |
| ) | |
| where | |
| emptyAck | |
| where | |
| emptyAck = (0, 0, [], RefCoundDiff Map.empty, ps) | |
| Left err -> counterexample (ppTrace trace) | ||
| $ counterexample (show err) | ||
| $ property False |
There was a problem hiding this comment.
indentation
| Left err -> counterexample (ppTrace trace) | |
| $ counterexample (show err) | |
| $ property False | |
| Left err -> counterexample (ppTrace trace) | |
| $ counterexample (show err) | |
| $ property False |
| ) | ||
| Map.empty | ||
| inmp | ||
| in resultRepeatedValidTxs === maxRepeatedValidTxs |
There was a problem hiding this comment.
I think this only works because there's no attenuation. The logic here counts how many times a tx is downloaded over the whole simulation rather than from how many peers it is being downloaded from at the same time. The latter could be done using tx-submission message traces, e.g. MsgRequestTxs and MsgReplyTxs. Each tx is in flight for some time between sending MsgRequestTxs and getting MsgReplyTxs back. Having a list of (startTime, endTime) for each tx's we'd need to check that we never have more than the configured number of them at each time. So we'd need a function:
maxOverlapped :: [(Time, Time)] -> Intwhich counts the maximal number of overlapping intervals.
There was a problem hiding this comment.
Yes, that's true, in Diffusion Sim we have the same test but with attenuation.
76c0d13 to
11d833b
Compare
|
closed due to it being merged into #4887 |
No description provided.