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
test: add conflicting topology test case #30066
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. |
cc @glozow |
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, 1 suggestion
# ... and without the in-mempool ancestor tx1 included in the call | ||
submitres = node.submitpackage([tx2["hex"], tx_child["hex"]]) | ||
|
||
assert_equal(submitres, {'package_msg': 'package-not-child-with-unconfirmed-parents', 'tx-results': {}, 'replaced-transactions': []}) |
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.e. if we relaxed the package-not-child-with-unconfirmed-parents rule, we should still fail because
- package parent is conflicting with ancestor of child (what the rule would be)
- the child spends 2 conflicting transactions, which makes no sense (what's actually wrong)
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.
and specifically, the conflict is happening between a transaction in the mempool already, and a transaction in the package
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.
that even if topologies
that are acceptable are relaxed, like
removing package-not-child-with-unconfirmed-parents,
Where exactly here is this topology relaxed?
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 hasn't been, but has been discussed (having trouble finding the discussion on github sorry).
specifically: If we drop package-not-child-with-unconfirmed-parents
, then we would allow in-mempool ancestors for packages we submit
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 see, the part I'm a little confused about is that how can we test for something that's not done yet. Is the intention to have this test written before the topology is relaxed so that we have more robustness in the tests?
Also, am I correct to assume that this error message would need to be updated when the topology is relaxed later? 'package_msg': 'package-not-child-with-unconfirmed-parents'
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, it makes sense to me now. I'll take this as an opportunity to go through test/functional/p2p_opportunistic_1p1c.py
as well!
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.
However, I do feel that the description can be updated to let others know that this topology will be relaxed in the future and not now.
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 may be just a matter of personal preference, so feel free to take it or leave it -- but if I were writing this I'd drop this line which tests the reason for failure, and also drop line 269 which tests that RBF doesn't work, in favor of just having the assertion at line 270 below that the child doesn't make it in. That way, someone changing the behavior in the future is less likely to rip the whole test out (eg if "not child with unconfirmed parents" stops being a rejection reason, or if we were to process a subpackage for validation) and overlook the fact that tx_child should never make it into the mempool, no matter what our policies for processing packages are.
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'm a little conflicted since without the string checking it's a little harder to tell what the two cases being checked are there? I do agree that dropping the check for the parent RBF is better.
I pushed a small update to make it a bit harder to have the whole case ripped out by someone reading the test, let me know what you think.
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.
Looks good, thanks!
d612e8c
to
fba1565
Compare
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 fba1565
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'm still reviewing the PR and gaining some context. For now, make is successful and all the functional tests pass on commit fba1565.
# ... and without the in-mempool ancestor tx1 included in the call | ||
submitres = node.submitpackage([tx2["hex"], tx_child["hex"]]) | ||
|
||
assert_equal(submitres, {'package_msg': 'package-not-child-with-unconfirmed-parents', 'tx-results': {}, 'replaced-transactions': []}) |
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.
that even if topologies
that are acceptable are relaxed, like
removing package-not-child-with-unconfirmed-parents,
Where exactly here is this topology relaxed?
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.
tACK fba1565
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.
utACK, one style preference/nit for you to consider
# ... and without the in-mempool ancestor tx1 included in the call | ||
submitres = node.submitpackage([tx2["hex"], tx_child["hex"]]) | ||
|
||
assert_equal(submitres, {'package_msg': 'package-not-child-with-unconfirmed-parents', 'tx-results': {}, 'replaced-transactions': []}) |
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 may be just a matter of personal preference, so feel free to take it or leave it -- but if I were writing this I'd drop this line which tests the reason for failure, and also drop line 269 which tests that RBF doesn't work, in favor of just having the assertion at line 270 below that the child doesn't make it in. That way, someone changing the behavior in the future is less likely to rip the whole test out (eg if "not child with unconfirmed parents" stops being a rejection reason, or if we were to process a subpackage for validation) and overlook the fact that tx_child should never make it into the mempool, no matter what our policies for processing packages are.
We want to ensure that even if topologies that are acceptable are relaxed, like removing package-not-child-with-unconfirmed-parents, that we don't end up accepting packages we shouldn't.
fba1565
to
9365baa
Compare
re-utACK |
reACK 9365baa |
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.
reACK 9365baa
We want to ensure that even if topologies
that are acceptable are relaxed, like
removing package-not-child-with-unconfirmed-parents, that we don't end up accepting packages we shouldn't.