Karknu/tx undecision#5352
Draft
karknu wants to merge 80 commits into
Draft
Conversation
Attempt to create a buildable version of whats released in cardano-node 10.7.0.
e3189b8 to
47f2ed7
Compare
b747b36 to
441a997
Compare
In case of duplicate txids, a second invalid tx could be counted as valid because it was tracked by txid alongside the valid duplicate, conflating the two.
Add a test for ensuring that a peer can download all valid TXs when faced with two peers with conflicting tx order.
Replace the central decsision thread by having server threads coordinate between them by blocking on STM actions.
Use sharedGeneration to track if the sharedState really changed and only write to the tvar if it changed. This makes common operations like receiving and acking a txid that is already retained something that only affects the peer local state.
Remove shared states that where only written to.
Have the peer update its score during phase change. This makes State's idle calculation quicker since peers will drain back to 0. Mark pacIdlePeerScores as lazy to avoid doing the calculations when it isn't needed.
Add benchmarks for V2
Instead of traversing all peers only touch the peers that need to wake up.
Avoid copying the map when encountering an existing advertiser.
We don't need to track the ack state, it can be derived by the time we decide to ack a TX. So txAdvertisers can just be a Set member check.
Remove the tracking of advertisers in TxEntry. This change also changing how scoring is used to rank peers. A peers score affects how long time after the TX owners lease expire they can wake up and attempt to claim it. This means that acknowledgement/downloading requires minimal coordination between peers.
The first peer that advertised a new txid always got a lease on it. This is a problem since the peer may be at capacity and unable to request the TX. Update the behaviour so that anyone peer that advertise a txid can gain the first claim.
Replace the local state tvar with V1's Stateful types.
Improve comment around deletion of retaind txs.
The retained functions in Types.hs are just small wrappes around IntPSQ functions.
Use nothunks to assert that there are no thunks after some property based tests.
If there is at least one TX outstanding don't ack the final txid in the window
We don't track peers that don't have an ongoing attempt any longer so TxNoAttempt isn't needed.
Convert the direct server benchmark into one that can run multiple peers with async.
Avoid Double conversions, similar to muxs diffTimeToMicroseconds.
Use IntSet for faster lookups for retained keys. IntPSQ is still needed for quick removal of expeired entries.
Reduce STM contention in V2 TxSubmission inbound by splitting per-peer in-flight bookkeeping out of SharedTxState into a small per-peer PeerTxInFlight TVar. SharedTxState is now only written when the shared state updates. The common case of a new peer advertising an existing txid is just a read operation for the shared state and a write operation into the peer local TVar.
Break out mempoolGetSnapshot into its own atomic transaction.
Add the conter thread to the test cases. Add meta tests for AppV2 generators/shrinkers
Add basic counter test. Add property that check for leaks in shared state.
add scoreAcceptDecrement which rewards peers that deliver TXs that gets accepted. Reduce scoreRate to a slow trickle Ensure that the delay penalty stings by mapping it to between 10ms and interTxSpace for any peer with a positive score.
d6bf451 to
f952b66
Compare
Trace TraceTxInboundCanRequestMoreTxs and TraceTxInboundCannotRequestMoreTxs just as V1 does.
90a3350 to
fdbd89b
Compare
50ms was too low in my mainnet relay. Most tx requests took longer than that. 125ms should be long enough for 90% of all requests.
421c6ca to
77c974c
Compare
Reasoning: interTxSpace = 250 ms p90 target (Asia) inflightTimeout = 600 ms 2x interTxSpace + ~100 ms headroom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Txsubmission V2, but without a central decision thread.
WIP. WIP. WIP.
Checklist
Quality
Maintenance
ouroboros-networkproject.