-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Remove MemPoolAccept::m_limits to avoid mutating it in package evaluation #28472
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
Remove MemPoolAccept::m_limits to avoid mutating it in package evaluation #28472
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
src/validation.cpp
Outdated
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.
This prevents PackageMempoolChecks and SubmitPackage from seeing the bumped limits. Maybe have const m_base_limits and m_current_limits and have PreChecks() reset m_current_limits=m_base_limits before bumping it?
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 there aren't any situations in which we'd have RBFing and PackageMempoolChecks/SubmitPackage right now? This has been mentioned in the comment which was added to maybe_rbf_limits. We'll just need to think about this again when we try to add package RBF.
glozow
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.
After #26711, are there scenarios where it would make sense to give these carveouts to transactions in SubmitPackage? At that point we only use those functions for transactions that need to be bumped. They won't be allowed to do package RBF (so no RBF carveout), and CPFP carveout will never work (it'd be given to the parent which exceeds limits, but parent+child will bust 26). Also see 9b576f0.
Also, I just realized we could maybe delete MemPoolAccept::m_limits now that we can just query pool.m_limits. Unless we need to remember the limit amendments for SubmitPackage, I think these amendments should probably just have a local scope.
|
Could you add a test? |
275687f to
275579d
Compare
|
@glozow good idea, I think removing it entirely makes a lot of sense if your assumptions are correct, and they sound correct to me. @dergoegge Example on |
|
Pushed a test that fails on master |
6782a61 to
7959451
Compare
7959451 to
cddf03e
Compare
cddf03e to
1b7f54b
Compare
ariard
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.
After #26711, are there scenarios where it would make > sense to give these carveouts to transactions in SubmitPackage? At that point we only use > those functions for transactions that need to be bumped.
I can’t see a scenario, at least for LN-chain of transactions, where these carveouts would make sense (maybe if you have 24 commitment txn bumped by one CPFP, though this is not safe for other reasons).
test/functional/mempool_limit.py
Outdated
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.
should say” spend B”.
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.
tried pushing an update, it doesn't seem to be showing yet... tried to fix this up anyways!
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.
Shows up at ee589d4
1b7f54b to
ee589d4
Compare
|
ACK ee589d4 |
glozow
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 ee589d4, nits can be ignored
src/validation.cpp
Outdated
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 there aren't any situations in which we'd have RBFing and PackageMempoolChecks/SubmitPackage right now? This has been mentioned in the comment which was added to maybe_rbf_limits. We'll just need to think about this again when we try to add package RBF.
| rbf_utxo = self.wallet.send_self_transfer( | ||
| from_node=node, | ||
| confirmed_only=True | ||
| )["new_utxo"] | ||
| self.generate(node, 1) |
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 ee589d4: just use get_utxo
| rbf_utxo = self.wallet.send_self_transfer( | |
| from_node=node, | |
| confirmed_only=True | |
| )["new_utxo"] | |
| self.generate(node, 1) | |
| rbf_utxo = self.wallet.get_utxo(confirmed_only=True) |
| fee=(mempoolmin_feerate / 1000) * (A_weight // 4) + Decimal('0.000001'), | ||
| target_weight=A_weight, | ||
| utxo_to_spend=rbf_utxo, | ||
| confirmed_only=True |
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 ee589d4: this arg doesn't do anything as you've already specified which utxo to spend. Doesn't hurt but you can omit it.
ariard
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.
Code Review ACK ee589d4
| ws.m_iters_conflicting = m_pool.GetIterSet(ws.m_conflicts); | ||
|
|
||
| // Note that these modifications are only applicable to single transaction scenarios; | ||
| // carve-outs and package RBF are disabled for multi-transaction evaluations. |
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: the two types of carve-out (RBF and CPFP) are disabled, could be commented here.
… it in package evaluation
Without remoing it, if we ever call
PreChecks()multiple times for any reason during any oneMempoolAccept, subsequent invocations may have incorrect limits, allowing longer/larger chains than should be allowed.Currently this is only an issue with
submitpackage, so this is not exposed on mainnet.