-
Notifications
You must be signed in to change notification settings - Fork 38.7k
MiniMiner changes for package linearization #28762
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
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
58ef23a to
a5b6481
Compare
|
last push changed new instances of uint256 to Txid |
|
ACK a5b6481b94580ef2cc2d9c45ac1c1959e79a82b2 |
kevkevinpal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK a5b6481b94580ef2cc2d9c45ac1c1959e79a82b2
added few small nits but feel free to ignore
sedited
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
lgtm, but can't really comment on the breadth of test cases.
…ncludes No behavior change. All we are doing is copying out these values before passing them into the ctor instead of within the ctor. This makes it possible to use the MiniMiner algorithms to analyze transactions that haven't been submitted to the mempool yet. It also iwyu's the mini_miner includes.
This is primarily intended for linearizing a package of transactions prior to submitting them to mempool. Note that, if this ctor is used, bump fees will not be calculated because we haven't instructed MiniMiner which outpoints for which we want bump fees to be calculated.
Add an option to keep building the template regardless of feerate. We can't just use target_feerate=0 because it's possible for transactions to have negative modified feerates. No behavior change for users that pass in a target_feerate.
Sometimes we are just interested in the order in which transactions would be included in a block (we want to "linearize" the transactions). Track and store this information. This doesn't change any of the bump fee calculations.
Name {low,med,high}_fee constants for reuse across file.
a5b6481 to
c83ab64
Compare
c83ab64 to
d9cc99d
Compare
|
ACK d9cc99d |
|
reACK d9cc99d |
|
re-ACK d9cc99d |
murchandamus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess now post-merge ACK d9cc99d
| explicit MiniMinerMempoolEntry(CAmount fee_self, | ||
| CAmount fee_ancestor, | ||
| int64_t vsize_self, | ||
| int64_t vsize_ancestor, | ||
| const CTransactionRef& tx_in): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible for these parameters to be in the same order as the assignments below?
| m_ready_to_calculate = false; | ||
| return; | ||
| } | ||
| std::vector<MockEntryMap::iterator> cached_descendants; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it important that these descendants are cached? Could they maybe just be descendants? The cached_descendants vs descendant_caches is a bit confusing.
| } | ||
| Assume(m_in_block.empty() || m_total_fees >= target_feerate.GetFee(m_total_vsize)); | ||
| if (!target_feerate.has_value()) { | ||
| Assume(m_in_block.size() == num_txns); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me until the commit [MiniMiner] track inclusion order and add Linearize() function until I understood what this PR was aiming to achieve. Perhaps you could add another sentence to the PR description about the goal of this PR.
| // (We cannot check bump fees in manually-constructed MiniMiners because it doesn't know what | ||
| // outpoints are requested). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we not know any outpoints or do we just not know whether the ancestor transactions of the submitted set are confirmed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just "I can't give an answer if I don't know what the question is." When using this constructor, the user is not specifying which outpoints they want bump fees for.
| CTxMemPool& pool = *Assert(m_node.mempool); | ||
| LOCK2(cs_main, pool.cs); | ||
| { | ||
| // 3 pairs of fee-bumping grandparent + parent, plus 1 low-feerate child. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn’t it the parent that is fee-bumping?
| // 3 pairs of fee-bumping grandparent + parent, plus 1 low-feerate child. | |
| // 3 pairs of grandparent + fee-bumping parent, plus 1 low-feerate child. |
theStack
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post-merge code-review ACK d9cc99d
| BOOST_CHECK_EQUAL(sequences.at(grandparent_double_low_feerate->GetHash()), 1); | ||
| BOOST_CHECK_EQUAL(sequences.at(parent_med_feerate->GetHash()), 1); | ||
|
|
||
| // CPFP low + med |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // CPFP low + med | |
| // CPFP low + double low |
|
Thanks for all the reviews :) |
ismaelsadeeq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strong ACK d9cc99d
The whole mempool transactions can also be used to create manual_entries and descendant_caches and use the new constructor to build a block template to get a fee rate histogram of the block template, with just a modification to BuildMockTemplate to enable getting the block template fee rate histogram.
it will be more desirable to modify this than BlockAssembler.
Due to the use of GatherClusters, which has a 500 transaction DOS limit, Mini Miner cannot be used to create a block template using the entire mempool with the initial constructor.
| MiniMiner(const CTxMemPool& mempool, const std::vector<COutPoint>& outpoints); | ||
|
|
||
| /** Constructor in which the MiniMinerMempoolEntry entries have been constructed manually, | ||
| * presumably because these transactions are not in the mempool (yet). It is assumed that all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just stating that this is a constructor where MiniMinerMempoolEntry are constructed manually is enough as this can be used with mempool transactions, but with the intent of building a block template to get a mempool fee rate histogram
| * presumably because these transactions are not in the mempool (yet). It is assumed that all | |
| * It is assumed that all |
…n followups b4b01d3 [refactor] updating miniminer comments to be more accurate (kevkevin) 83933ef [refactor] Miniminer var cached_descendants to descendants (kevkevin) 43423fd [refactor] Change MiniMinerMempoolEntry order (kevkevin) Pull request description: ### Motivation In bitcoin/bitcoin#28762 there were some post merge comments which are being addressed in this PR with the following commits ### [8d4c46f](kevkevinpal/bitcoin@8d4c46f) Reorganizing `MiniMinerMempoolEntry` to match the order we have elsewhere * bitcoin/bitcoin#28762 (comment) ### [7505ec2](kevkevinpal/bitcoin@7505ec2) Renaming `cached_descendants` to `descendants` for simpler variable naming * bitcoin/bitcoin#28762 (comment) ### [b21f2f2](kevkevinpal/bitcoin@b21f2f2) Code comment modifications to be more accurate to what is actually happening * bitcoin/bitcoin#28762 (comment) and * bitcoin/bitcoin#28762 (comment) and * bitcoin/bitcoin#28762 (comment) ACKs for top commit: murchandamus: reACK b4b01d3 theStack: LGTM ACK b4b01d3 Tree-SHA512: 54f044a578fb203d8a3c1aa0bcd1fc4bcdff0bc9b024351925a4caf0ccece7c7736b0694ad1168c3cbb447bdb58a91f4cac365f46114da29a889fbc8ea595b82
| // This class must be constructed while holding mempool.cs. After construction, the object's | ||
| // methods can be called without holding that lock. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think this docstring should now be removed, I don't think the constructor requires a mempool.cs lock anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 constructors, one requires mempool (and its lock) and the other one doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see this is not in the best place - perhaps this should be in the docstring for the with-mempool ctor.
This is part of #27463. It splits off the
MiniMiner-specific changes from #26711 for ease of review, as suggested in #26711 (comment).MiniMineron transactions that aren't in the mempool.target_feerateparam ofBuildMockTemplateoptional, meaning "don't stop building the template until all the transactions have been selected."target_feerate=0(validate package transactions with their in-package ancestor sets #26711 (comment))Reviewers can take a look at #26711 to see how these functions are used to linearize the
AncestorPackagethere.