-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Cluster mempool implementation #28676
base: master
Are you sure you want to change the base?
Commits on Jun 9, 2024
-
This adds a bitset module that implements a BitSet<N> class, a variant of std::bitset with a few additional features that cannot be implemented in a wrapper without performance loss (specifically, finding first and last bit set, or iterating over all set bits).
Configuration menu - View commit details
-
Copy full SHA for ab98ce5 - Browse repository at this point
Copy the full SHA ab98ce5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 14ad38f - Browse repository at this point
Copy the full SHA 14ad38fView commit details -
clusterlin: introduce cluster_linearize.h with Cluster and DepGraph t…
…ypes This primarily adds the DepGraph class, which encapsulated precomputed ancestor/descendant information for a given transaction cluster, with a number of a utility features (inspectors for set feerates, computing reduced parents/children, adding transactions, adding dependencies), which will become needed in future commits.
Configuration menu - View commit details
-
Copy full SHA for ddd5514 - Browse repository at this point
Copy the full SHA ddd5514View commit details -
tests: Fuzzing framework for DepGraph class
This introduces a bespoke fuzzing-focused serialization format for DepGraphs, and then tests that this format can represent any graph, roundtrips, and then uses that to test the correctness of DepGraph itself. This forms the basis for future fuzz tests that need to work with interesting graph.
Configuration menu - View commit details
-
Copy full SHA for 648856f - Browse repository at this point
Copy the full SHA 648856fView commit details
Commits on Jun 10, 2024
-
clusterlin: add AncestorCandidateFinder class
This is a class that encapsulated precomputes ancestor set feerates, and presents an interface for getting the best remaining ancestor set.
Configuration menu - View commit details
-
Copy full SHA for 4bf08c0 - Browse repository at this point
Copy the full SHA 4bf08c0View commit details -
clusterlin: add SearchCandidateFinder class
Similar to AncestorCandidateFinder, this encapsulates the state needed for finding good candidate sets using a search algorithm.
Configuration menu - View commit details
-
Copy full SHA for 5f747f3 - Browse repository at this point
Copy the full SHA 5f747f3View commit details -
clusterlin: add Linearize function
This adds a first version of the overall linearization interface, which given a DepGraph constructs a good linearization, by incrementally including good candidate sets (found using AncestorCandidateFinder and SearchCandidateFinder).
Configuration menu - View commit details
-
Copy full SHA for 2af60f8 - Browse repository at this point
Copy the full SHA 2af60f8View commit details -
bench: Candidate finding and linearization benchmarks
Add benchmarks for known bad graphs for the purpose of search (as an upper bound on work per search iterations) and ancestor sorting (as an upper bound on linearization work with no search iterations).
Configuration menu - View commit details
-
Copy full SHA for 02d4284 - Browse repository at this point
Copy the full SHA 02d4284View commit details -
clusterlin: add algorithms for connectedness/connected components
Add utility functions to DepGraph for finding connected components.
Configuration menu - View commit details
-
Copy full SHA for 0229297 - Browse repository at this point
Copy the full SHA 0229297View commit details -
clusterlin: separate initial search entries per component (optimization)
Before this commit, the worst case for linearization involves clusters which break apart in several smaller components after the first candidate is included in the output linearization. Address this by never considering work items that span multiple components of what remains of the cluster.
Configuration menu - View commit details
-
Copy full SHA for db13f8e - Browse repository at this point
Copy the full SHA db13f8eView commit details -
clusterlin: use bounded BFS exploration (optimization)
Switch to BFS exploration of the search tree in SearchCandidateFinder instead of DFS exploration. This appears to behave better for real world clusters. As BFS has the downside of needing far larger search queues, switch back to DFS temporarily when the queue grows too large.
Configuration menu - View commit details
-
Copy full SHA for 1618822 - Browse repository at this point
Copy the full SHA 1618822View commit details -
clusterlin: randomize the SearchCandidateFinder search order
To make search non-deterministic, change the BFS logic from always picking the first queue item, randomly picking the first or second queue item.
Configuration menu - View commit details
-
Copy full SHA for e0e7a67 - Browse repository at this point
Copy the full SHA e0e7a67View commit details -
clusterlin: permit passing in existing linearization to Linearize
This implements the LIMO algorithm for linearizing by improving an existing linearization. See https://delvingbitcoin.org/t/limo-combining-the-best-parts-of-linearization-search-and-merging for details.
Configuration menu - View commit details
-
Copy full SHA for f25eef9 - Browse repository at this point
Copy the full SHA f25eef9View commit details -
clusterlin: use feerate-sorted depgraph in SearchCandidateFinder
This is a requirement for a future commit, which will rely on quickly iterating over transaction sets in decreasing individual feerate order.
Configuration menu - View commit details
-
Copy full SHA for 4ee9156 - Browse repository at this point
Copy the full SHA 4ee9156View commit details -
clusterlin: track upper bound potential set for work items (optimizat…
…ion) In each work item, keep track of a conservative overestimate of the best possible feerate that can be reached from it, and then use these to avoid exploring hopeless work items.
Configuration menu - View commit details
-
Copy full SHA for 02c3bd9 - Browse repository at this point
Copy the full SHA 02c3bd9View commit details -
clusterlin: reduce computation of unnecessary pot sets (optimization)
Keep track of which transactions in the graph have an individual feerate that is better than the best included set so far. Others do not need to be added to the pot set, as they cannot possibly help beating best.
Configuration menu - View commit details
-
Copy full SHA for 829355d - Browse repository at this point
Copy the full SHA 829355dView commit details -
clusterlin: include topological pot subsets automatically (optimization)
Automatically add topologically-valid subsets of the potential set pot to inc. It can be proven that these must be part of the best reachable topologically-valid set from that work item.
Configuration menu - View commit details
-
Copy full SHA for c411a7a - Browse repository at this point
Copy the full SHA c411a7aView commit details -
clusterlin: improve heuristic to decide split transaction (optimization)
Emperically, this approach seems to be more efficient in common real-life clusters, and does not change the worst case.
Configuration menu - View commit details
-
Copy full SHA for f74ba48 - Browse repository at this point
Copy the full SHA f74ba48View commit details -
clusterlin: avoid recomputing potential set on every split (optimizat…
…ion) Cache the potential set inside work items, and use it to skip part of the computation of split-off work items from it.
Configuration menu - View commit details
-
Copy full SHA for cd84a26 - Browse repository at this point
Copy the full SHA cd84a26View commit details -
Configuration menu - View commit details
-
Copy full SHA for 694a103 - Browse repository at this point
Copy the full SHA 694a103View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0676101 - Browse repository at this point
Copy the full SHA 0676101View commit details -
Configuration menu - View commit details
-
Copy full SHA for a7829ba - Browse repository at this point
Copy the full SHA a7829baView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3bffb34 - Browse repository at this point
Copy the full SHA 3bffb34View commit details -
Configuration menu - View commit details
-
Copy full SHA for 91c0b68 - Browse repository at this point
Copy the full SHA 91c0b68View commit details -
Configuration menu - View commit details
-
Copy full SHA for 071d131 - Browse repository at this point
Copy the full SHA 071d131View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1896afb - Browse repository at this point
Copy the full SHA 1896afbView commit details -
Limit mempool size based on chunk feerate
Rather than evicting the transactions with the lowest descendant feerate, instead evict transactions that have the lowest chunk feerate. Once mining is implemented based on choosing transactions with highest chunk feerate (see next commit), mining and eviction will be opposites, so that we will evict the transactions that would be mined last.
Configuration menu - View commit details
-
Copy full SHA for 2e07a66 - Browse repository at this point
Copy the full SHA 2e07a66View commit details -
Configuration menu - View commit details
-
Copy full SHA for a74a05f - Browse repository at this point
Copy the full SHA a74a05fView commit details -
Configuration menu - View commit details
-
Copy full SHA for a56472a - Browse repository at this point
Copy the full SHA a56472aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 195fa4b - Browse repository at this point
Copy the full SHA 195fa4bView commit details -
policy: Remove CPFP carveout rule
The addition of a cluster size limit makes the CPFP carveout rule useless, because carveout cannot be used to bypass the cluster size limit. Remove this policy rule and update tests to no longer rely on the behavior.
Configuration menu - View commit details
-
Copy full SHA for a862b0b - Browse repository at this point
Copy the full SHA a862b0bView commit details -
Implement new RBF logic for cluster mempool
With a total ordering on mempool transactions, we are now able to calculate a transaction's mining score at all times. Use this to improve the RBF logic: - we no longer enforce a "no new unconfirmed parents" rule - we now require that the mempool's feerate diagram must improve in order to accept a replacement TODO: update functional test feature_rbf.py to cover all our new scenarios.
Configuration menu - View commit details
-
Copy full SHA for 9e0938c - Browse repository at this point
Copy the full SHA 9e0938cView commit details -
Configuration menu - View commit details
-
Copy full SHA for a20f38a - Browse repository at this point
Copy the full SHA a20f38aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0811c9a - Browse repository at this point
Copy the full SHA 0811c9aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6e8058a - Browse repository at this point
Copy the full SHA 6e8058aView commit details -
Use cluster linearization for transaction relay sort order
Previously, transaction batches were first sorted by ancestor count and then feerate, to ensure transactions are announced in a topologically valid order, while prioritizing higher feerate transactions. Ancestor count is a crude topological sort criteria, so replace this with linearization order so that the highest feerate transactions (as would be observed by the mining algorithm) are relayed before lower feerate ones, in a topologically valid way. This also fixes a test that only worked due to the ancestor-count-based sort order.
Configuration menu - View commit details
-
Copy full SHA for 15ec906 - Browse repository at this point
Copy the full SHA 15ec906View commit details -
Remove CTxMemPool::GetSortedDepthAndScore
The mempool clusters and linearization permit sorting the mempool topologically without making use of ancestor counts.
Configuration menu - View commit details
-
Copy full SHA for 8e047b1 - Browse repository at this point
Copy the full SHA 8e047b1View commit details -
Reimplement GetTransactionAncestry() to not rely on cached data
In preparation for removing ancestor data from CTxMemPoolEntry, recalculate the ancestor statistics on demand wherever needed.
Configuration menu - View commit details
-
Copy full SHA for 82af314 - Browse repository at this point
Copy the full SHA 82af314View commit details -
Configuration menu - View commit details
-
Copy full SHA for 986406b - Browse repository at this point
Copy the full SHA 986406bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 657534f - Browse repository at this point
Copy the full SHA 657534fView commit details -
Stop enforcing ancestor size/count limits
The cluster limits should be sufficient.
Configuration menu - View commit details
-
Copy full SHA for 513dc9b - Browse repository at this point
Copy the full SHA 513dc9bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c9120d - Browse repository at this point
Copy the full SHA 0c9120dView commit details -
Use mempool/txgraph to determine if a tx has descendants
Remove a reference to GetCountWithDescendants() in preparation for removing this function and the associated cached state from the mempool.
Configuration menu - View commit details
-
Copy full SHA for aae45f4 - Browse repository at this point
Copy the full SHA aae45f4View commit details -
Calculate descendant information for mempool RPC output on-the-fly
This is in preparation for removing the cached descendant state from the mempool.
Configuration menu - View commit details
-
Copy full SHA for 21bfbb0 - Browse repository at this point
Copy the full SHA 21bfbb0View commit details -
test: fix rbf carveout test in mempool_limit.py
Minimal fix to the test that the RBF carveout doesn't apply in certain package validation cases. Now that RBF carveout doesn't exist, we can just test that the cluster count limit is respected (in preparation for removing the descendant limit altogether).
Configuration menu - View commit details
-
Copy full SHA for 308dec4 - Browse repository at this point
Copy the full SHA 308dec4View commit details -
Stop enforcing descendant size/count limits
Cluster size limits should be enough.
Configuration menu - View commit details
-
Copy full SHA for 67586ce - Browse repository at this point
Copy the full SHA 67586ceView commit details -
wallet: Replace max descendantsize with clustersize
With the descendant size limits removed, replace the concept of "max number of descendants of any ancestor of a given tx" with the cluster count of the cluster that the transaction belongs to.
Configuration menu - View commit details
-
Copy full SHA for e311049 - Browse repository at this point
Copy the full SHA e311049View commit details -
Configuration menu - View commit details
-
Copy full SHA for 751c373 - Browse repository at this point
Copy the full SHA 751c373View commit details -
Eliminate RBF workaround for CPFP carveout transactions
The new cluster mempool RBF rules take into account clusters sizes exactly, so with the removal of descendant count enforcement this idea is obsolete.
Configuration menu - View commit details
-
Copy full SHA for e6c76d2 - Browse repository at this point
Copy the full SHA e6c76d2View commit details -
Configuration menu - View commit details
-
Copy full SHA for be678ac - Browse repository at this point
Copy the full SHA be678acView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3d4ce41 - Browse repository at this point
Copy the full SHA 3d4ce41View commit details -
Configuration menu - View commit details
-
Copy full SHA for 98e9b89 - Browse repository at this point
Copy the full SHA 98e9b89View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9e2ea2f - Browse repository at this point
Copy the full SHA 9e2ea2fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 93c7d01 - Browse repository at this point
Copy the full SHA 93c7d01View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7a1249f - Browse repository at this point
Copy the full SHA 7a1249fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 26bc551 - Browse repository at this point
Copy the full SHA 26bc551View commit details -
Configuration menu - View commit details
-
Copy full SHA for eb72abd - Browse repository at this point
Copy the full SHA eb72abdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1525d0d - Browse repository at this point
Copy the full SHA 1525d0dView commit details -
Rework removeForBlock so that clusters are only touched once
Also remove extra linearization that was happening and some logging Update interface_zmq.py for new block connection behavior
Configuration menu - View commit details
-
Copy full SHA for 5c68be9 - Browse repository at this point
Copy the full SHA 5c68be9View commit details -
Simplify ancestor calculation functions
Now that ancestor calculation never fails (due to ancestor/descendant limits being eliminated), we can eliminate the error handling from CalculateMemPoolAncestors. interface_zmq test is broken
Configuration menu - View commit details
-
Copy full SHA for 9eda1ea - Browse repository at this point
Copy the full SHA 9eda1eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for d743d9c - Browse repository at this point
Copy the full SHA d743d9cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2472b4d - Browse repository at this point
Copy the full SHA 2472b4dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 96e3cc0 - Browse repository at this point
Copy the full SHA 96e3cc0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9a99439 - Browse repository at this point
Copy the full SHA 9a99439View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a4c468 - Browse repository at this point
Copy the full SHA 2a4c468View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9aea970 - Browse repository at this point
Copy the full SHA 9aea970View commit details -
Configuration menu - View commit details
-
Copy full SHA for 42a46bc - Browse repository at this point
Copy the full SHA 42a46bcView commit details -
Configuration menu - View commit details
-
Copy full SHA for afe8f8f - Browse repository at this point
Copy the full SHA afe8f8fView commit details -
Switch to using the faster CalculateDescendants
The only place we still use the older interface is in policy/rbf.cpp, where it's helpful to incrementally calculate descendants to avoid calculating too many at once (or cluttering the CalculateDescendants interface with a calculation limit).
Configuration menu - View commit details
-
Copy full SHA for 91d0758 - Browse repository at this point
Copy the full SHA 91d0758View commit details -
Configuration menu - View commit details
-
Copy full SHA for df2a8b8 - Browse repository at this point
Copy the full SHA df2a8b8View commit details -
Configuration menu - View commit details
-
Copy full SHA for f2fdd37 - Browse repository at this point
Copy the full SHA f2fdd37View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a443bb - Browse repository at this point
Copy the full SHA 2a443bbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6a430b7 - Browse repository at this point
Copy the full SHA 6a430b7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 57c69b3 - Browse repository at this point
Copy the full SHA 57c69b3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b23cc8 - Browse repository at this point
Copy the full SHA 9b23cc8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3daeb9c - Browse repository at this point
Copy the full SHA 3daeb9cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 76e4b33 - Browse repository at this point
Copy the full SHA 76e4b33View commit details -
Configuration menu - View commit details
-
Copy full SHA for a8619b4 - Browse repository at this point
Copy the full SHA a8619b4View commit details -
Eliminate need for ancestors in PackageV3Checks
TO DO: Rewrite unit tests for PV3C to not lie about mempool parents, so that we can push down the parent calculation into v3_policy from validation.
Configuration menu - View commit details
-
Copy full SHA for cc463e9 - Browse repository at this point
Copy the full SHA cc463e9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6cb8d4a - Browse repository at this point
Copy the full SHA 6cb8d4aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1e9f23c - Browse repository at this point
Copy the full SHA 1e9f23cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 654ae93 - Browse repository at this point
Copy the full SHA 654ae93View commit details -
bench: add more mempool benchmarks
Add benchmarks for: - mempool update time when blocks are found - adding a transaction - performing the mempool's RBF calculation - calculating mempool ancestors/descendants
Configuration menu - View commit details
-
Copy full SHA for 0edc5f4 - Browse repository at this point
Copy the full SHA 0edc5f4View commit details -
fuzz: try to add more code coverage for mempool fuzzing
Including test coverage for mempool eviction and expiry
Configuration menu - View commit details
-
Copy full SHA for 610945c - Browse repository at this point
Copy the full SHA 610945cView commit details -
Configuration menu - View commit details
-
Copy full SHA for bebcd5c - Browse repository at this point
Copy the full SHA bebcd5cView commit details -
Configuration menu - View commit details
-
Copy full SHA for f258137 - Browse repository at this point
Copy the full SHA f258137View commit details -
Configuration menu - View commit details
-
Copy full SHA for de4b948 - Browse repository at this point
Copy the full SHA de4b948View commit details -
Configuration menu - View commit details
-
Copy full SHA for 435e2ec - Browse repository at this point
Copy the full SHA 435e2ecView commit details -
fuzz: remove comparison between mini_miner block construction and miner
This is in preparation for eliminating the block template building happening in mini_miner, in favor of directly using the linearizations done in the mempool.
Configuration menu - View commit details
-
Copy full SHA for 5de8783 - Browse repository at this point
Copy the full SHA 5de8783View commit details
Commits on Jun 11, 2024
-
Configuration menu - View commit details
-
Copy full SHA for be7fb2a - Browse repository at this point
Copy the full SHA be7fb2aView commit details