-
Notifications
You must be signed in to change notification settings - Fork 37.8k
test: a test to check descendant limits #22582
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: a test to check descendant limits #22582
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
68b3c7a
to
c18188e
Compare
Concept ACK |
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 to more testing.
The commit message for c18188e seems to contain some squash comments? Would be better to describe exactly what edge case you're testing / coverage you're adding.
c18188e
to
0dab0ac
Compare
Will review again after rebase - note that the mempool tests have been moved to mempool_package_limits.py |
0dab0ac
to
fc42d4f
Compare
fc42d4f
to
2bc8b5a
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.
Thanks for rebasing, the test is well-written and does what the comment says it does.
Suggestion: label your commit message with [test] and add a short description about why this test is an improvement.
Another suggestion (probably for a different PR): This doesn't matter that much, but we have quite a few of the same lines repeated in this test. Given how many OP_TRUE spends there are, I think it'd be good to either add a OP_TRUE variation of |
2bc8b5a
to
4fd7979
Compare
c03c6d3
to
5a7050c
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.
utACK 5a7050c
PR description needs to be updated |
I still don't understand what logic this is testing that isn't already covered by the |
It is testing if the second generation in Package transactions are considered while checking Descendant count limits. It is analogous to the 'test_anc_count_limits_2()' subtest for Ancestor count limits. |
5a7050c
to
e0f92f3
Compare
@glozow has pointed out that this scenario is for a transaction to fail its descendant limit count due to a combination of mempool descendants, package direct descendants, and package indirect descendants, which seems like a reasonable thing to test. I think the transaction P3 is unnecessary, since the package would fail with just P2. It's good for a test to fail at the edge case (i.e. the package would be accepted if you removed just one transaction). I'd also recommend you remove the image from the PR description and replace it with an ascii drawing. The PR description is included in the merge commit, so it's best if it's plain text without attachments. |
97cf2d3
to
2ef27b5
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.
Code review ACK e0f92f3. Seems like a useful and straightforward test case, assuming it doesn't duplicate existing coverage.
2ef27b5
to
fa7db1c
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.
Code review ACK fa7db1c. Only were suggested changes since last review: simplifying test and dropping P3 transaction as John suggested, and adding assert_equal I suggested
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 fa7db1c
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 fa7db1c
I've left a couple of comments inline, but they can be picked up in #22901.
If you have to touch this again, I'd suggest changing the commit log:
-[test] checks descendants limtis for second generation Package descendants
+[test] check descendant limits for second generation package descendants
value = parent_value | ||
txid = parent_txid | ||
for i in range(23): # M2...M24 | ||
(tx, txhex, value, spk) = make_chain(node, self.address, self.privkeys, txid, value, 0, spk) |
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.
(tx, txhex, value, spk) = make_chain(node, self.address, self.privkeys, txid, value, 0, spk) | |
tx, txhex, value, spk = make_chain(node, self.address, self.privkeys, txid, value, 0, spk) |
first_coin_a = self.coins.pop() | ||
parent_value = (first_coin_a["amount"] - DEFAULT_FEE) / 2 # Deduct reasonable fee and make 2 outputs | ||
inputs = [{"txid": first_coin_a["txid"], "vout": 0}] | ||
outputs = [{self.address : parent_value}, {ADDRESS_BCRT1_P2WSH_OP_TRUE : parent_value}] |
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.
fa7db1c [test] checks descendants limtis for second generation Package descendants (ritickgoenka) Pull request description: This PR adds a new functional test to test the new descendant limits for packages that were proposed in bitcoin#21800. ``` +----------------------+ | | | M1 | | ^ ^ | | M2 ^ | | . ^ | | . ^ | | . ^ | | . ^ | | M24 ^ | | ^ | | P1 | | ^ | | P2 | | | +----------------------+ ``` This test is for checking a transaction to fail its descendant count limits because of a combination of mempool descendants, package direct descendants, and package indirect descendants. In this test, P1 has M1 as a mempool ancestor, P2 has no in-mempool ancestors, but when combined P2 has M1 as an ancestor and M1 exceeds descendant_limits (23 in-mempool descendants + 2 in-package descendants, a total of 26 including itself) ACKs for top commit: ryanofsky: Code review ACK fa7db1c. Only were suggested changes since last review: simplifying test and dropping P3 transaction as John suggested, and adding assert_equal I suggested glozow: ACK fa7db1c jnewbery: ACK fa7db1c Tree-SHA512: d1eb993550ac8ce31cbe42e17c6522a213ede66970d5d9391f31a116477ab5889fefa6ff2df6ceadd63a28c1be1ad893b0e8e449247e9ade2ca61dc636508d68
Summary: ``` This test is for checking a transaction to fail its descendant count limits because of a combination of mempool descendants, package direct descendants, and package indirect descendants. ``` Backport of [[bitcoin/bitcoin#22582 | core#22582]]. Also remove a debug print leftover from D12162. Test Plan: ./test/functional/test_runner.py mempool_package_limits Reviewers: #bitcoin_abc, sdulfari Reviewed By: #bitcoin_abc, sdulfari Subscribers: sdulfari Differential Revision: https://reviews.bitcoinabc.org/D12365
This PR adds a new functional test to test the new descendant limits for packages that were proposed in #21800.
This test is for checking a transaction to fail its descendant count limits because of a combination of mempool descendants, package direct descendants, and package indirect descendants.
In this test, P1 has M1 as a mempool ancestor, P2 has no in-mempool ancestors, but when combined P2 has M1 as an ancestor and M1 exceeds descendant_limits (23 in-mempool descendants + 2 in-package descendants, a total of 26 including itself)