Skip to content
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

Merged
merged 1 commit into from May 20, 2024

Conversation

instagibbs
Copy link
Member

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.

@DrahtBot
Copy link
Contributor

DrahtBot commented May 8, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK glozow, rkrux
Concept ACK sdaftuar

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@DrahtBot DrahtBot added the Tests label May 8, 2024
@instagibbs
Copy link
Member Author

cc @glozow

Copy link
Member

@glozow glozow left a 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': []})
Copy link
Member

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)

Copy link
Member Author

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

Copy link

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?

Copy link
Member Author

@instagibbs instagibbs May 9, 2024

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

Copy link

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'

Copy link

@rkrux rkrux May 12, 2024

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!

Copy link

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.

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

test/functional/rpc_packages.py Show resolved Hide resolved
Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fba1565

Copy link

@rkrux rkrux left a 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': []})
Copy link

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?

test/functional/rpc_packages.py Outdated Show resolved Hide resolved
Copy link

@rkrux rkrux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK fba1565

Copy link
Member

@sdaftuar sdaftuar left a 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': []})
Copy link
Member

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.
@sdaftuar
Copy link
Member

re-utACK

@glozow
Copy link
Member

glozow commented May 15, 2024

reACK 9365baa

@DrahtBot DrahtBot requested review from sdaftuar and rkrux May 15, 2024 12:51
@glozow glozow mentioned this pull request May 15, 2024
56 tasks
Copy link

@rkrux rkrux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reACK 9365baa

@DrahtBot DrahtBot requested a review from sdaftuar May 17, 2024 13:48
@glozow glozow merged commit 063bb2f into bitcoin:master May 20, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants