Skip to content

Conversation

@instagibbs
Copy link
Member

@instagibbs instagibbs commented Mar 26, 2024

Bug causes an Assume() failure due to the expectation that the individual result should be invalid when done over submitpackage via rpc.

Bug introduced by #28950 , and I discovered it rebasing #28984 since it's easier to hit in that test scenario.

Tests in place were only checking AcceptSingleTransaction-level checks due to package evaluation only triggering when minfee is too high for the parent transaction.

Added test along with fix, moving the fill_mempool utility into a common area for re-use.

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 26, 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, theStack, ismaelsadeeq
Stale ACK murchandamus

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #29700 (kernel, refactor: return error status on all fatal errors by ryanofsky)
  • #28970 (p2p: opportunistically accept 1-parent-1-child packages by glozow)
  • #28531 (improve MallocUsage() accuracy by LarryRuane)

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.

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, verified that on master the test fails since the individual result wasn't populated and is "Valid"

@instagibbs instagibbs force-pushed the 2024-03-fix-multitx-maxfee branch from 5ae4dce to 4f8407c Compare March 27, 2024 12:55
@instagibbs
Copy link
Member Author

instagibbs commented Mar 27, 2024

Added some fuzz coverage which would have likely caught this

edit: yep, 3 minutes: LC1hZGRuCS0Ab2VtZHL1iQHY2NjY2Am//wAAAAD/AACAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAA//8AAABB44MP3NL5/4zzEoz/dpB2dg==

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.

Sorry for the nits, still need to run the fuzzer but otherwise lgtm

@instagibbs instagibbs force-pushed the 2024-03-fix-multitx-maxfee branch from b057d2b to 14c86ba Compare April 4, 2024 08:24
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 14c86ba721e1a208c88ada133ba9e90e24724ea4

Verified the fuzz test catches this problem, seems to run fine with the changes. Thanks for accepting the suggestions.

@glozow glozow mentioned this pull request Apr 4, 2024
57 tasks
Copy link
Contributor

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

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

ACK 14c86ba721e1a208c88ada133ba9e90e24724ea4 with nits.

Copy link
Contributor

Choose a reason for hiding this comment

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

In "Move fill_mempool to util function" (cc770e4b36e6f04cbd588ad3e7a19f122c21d38d):

Nit: If a commit is described as a move, I would expect no changes in the code beyond what’s necessary to update the callsites. While these changes are minor and obviously do not entail a functional change, I would have expected the updated commentary and refactor to be a separate commit—I’m wondering whether my understanding of the modus operandi is correct.

Copy link
Member Author

Choose a reason for hiding this comment

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

split out the moving and docstring changes, should be minimal now?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I don’t feel strongly about it, but the change that made me notice that there were code changes in the move originally was that COINBASE_MATURITY - 1 had gotten replaced with a 99 magic number.

Copy link
Member Author

Choose a reason for hiding this comment

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

bit of an annoying circular reference issue(blocktools requiring utils) so for now at least make it grep-able what the magic value should be(and more greppable)

@DrahtBot DrahtBot removed the CI failed label Apr 4, 2024
@instagibbs instagibbs force-pushed the 2024-03-fix-multitx-maxfee branch from 14c86ba to 1d79aab Compare April 5, 2024 06:20
@instagibbs instagibbs force-pushed the 2024-03-fix-multitx-maxfee branch from 1d79aab to 052c67d Compare April 6, 2024 09:53
Copy link
Contributor

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

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

ACK 052c67d4beb72d3fdf31fa5e584ea2fa12e6f69c

Please feel free to ignore nits

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I don’t feel strongly about it, but the change that made me notice that there were code changes in the move originally was that COINBASE_MATURITY - 1 had gotten replaced with a 99 magic number.

@DrahtBot DrahtBot requested a review from glozow April 8, 2024 12:23
Copy link
Member

@ismaelsadeeq ismaelsadeeq 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

I will run the new fuzz test with and without 72425bd699dd33d57794b3339f6266c4c9df443d

Copy link
Member

Choose a reason for hiding this comment

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

In a466686c6e97d47e3f4718eed0f781acb88da7fa "test: expand docstring to fill_mempool"

nit:

Suggested change
Allows for simpler testing of scenarios with floating minfee > minrelay
Allows for simpler testing of scenarios with floating mempoolminfee > minrelayfee

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Comment on lines 510 to 511
Copy link
Member

Choose a reason for hiding this comment

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

In c93f790cad1558dcf0b8fb5fd0cf3a276368d656 " Move fill_mempool to util function"

There should be a commit that will first pull out these two lines from this scope to

Moving fill_mempool to test_framework/util.py makes it clear that the comments do not belong to this scope.

Copy link
Member Author

Choose a reason for hiding this comment

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

done, I think

Comment on lines 505 to 507
Copy link
Member

Choose a reason for hiding this comment

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

Maybe assert for this at the beginning of the fill_mempool

     assert_equal(node.getnetworkinfo()['relayfee'], Decimal('0.00001000'))

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

looking at this again, what do you think about just restarting the node with the -datacarriersize=100000, -maxmempool=5, -minrelaytxfee=0.00001000 after filling the mempool we then restart the node with default node settings?
Are there any advantage of delegating setting this to the caller?
If not then this will reduce duplication of all callers of fill_mempool settings this values.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can't restart the node after filling the memopool without resetting the floating minfee.

I could pull in the initial restart if we knew people didn't want any other extra_args.

Alternatively I could assert that datacarrier and maxmempool is set in extra_args?

I think documentation is enough for now, leaving as is.

@instagibbs instagibbs force-pushed the 2024-03-fix-multitx-maxfee branch 2 times, most recently from 4aa47e7 to 4fe7d15 Compare April 8, 2024 13:16
Copy link
Member

@ismaelsadeeq ismaelsadeeq left a comment

Choose a reason for hiding this comment

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

ACK 4fe7d15

I've reviewed 73b68....4fe7d15


I've Ran the fuzz test without f28338b82be9820380ef217905ae9c167164f181

And verified the crash

Test unit written to ./crash-7fd49c80d3088f672b4bf03ab8a1d7f1aedff0aa
Base64: q6sAIqsA/6sACQCrAAAAANr/+zUBAQENASUABAB5aKqgnQAAAAAlKv8tATUBAQENASUABAB5aKqgnQAAAAAluQAAAMP3AAAAAasAAAAAAAAA2v/7Kv8tATYBAQENASUABAB0aKKgle/f/wAA

I ran functional tests and rpc_packages.py failed.


I then cherry-picked the patch f28338b82be9820380ef217905ae9c167164f181 and run the fuzz test again, it passed successfully.

INFO: seed corpus: files: 728 min: 1b max: 617355b total: 10276044b rss: 232Mb
#128    pulse  cov: 10579 ft: 39305 corp: 108/4319b exec/s: 64 rss: 260Mb
#512    pulse  cov: 11879 ft: 55511 corp: 356/67Kb exec/s: 36 rss: 283Mb
#925    INITED cov: 12041 ft: 66449 corp: 523/8522Kb exec/s: 20 rss: 550Mb
#925    DONE   cov: 12041 ft: 66449 corp: 523/8522Kb lim: 617355 exec/s: 20 rss: 550Mb
Done 925 runs in 46 second(s)

Functional tests are also passing

Copy link
Member

Choose a reason for hiding this comment

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

This should be in the extra args above to avoid writing mempool.dat.

Currently the test is fine, but this is because the new datacarriersize causes all the transactions to be rejected.

Copy link
Member Author

Choose a reason for hiding this comment

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

moved and added assertion of empty mempool after restart

@DrahtBot DrahtBot requested a review from glozow April 9, 2024 12:50
If we do not set the Failure for the workspace when
there is a client_maxfeerate related error, we hit
an Assume() to the contrary. Properly set it.
@instagibbs instagibbs force-pushed the 2024-03-fix-multitx-maxfee branch from 4fe7d15 to 4ba1d0b Compare April 9, 2024 12:54
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.

reACK 4ba1d0b

@DrahtBot DrahtBot requested a review from ismaelsadeeq April 9, 2024 15:20
Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

ACK 4ba1d0b

Copy link
Member

@ismaelsadeeq ismaelsadeeq left a comment

Choose a reason for hiding this comment

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

re-ACK 4ba1d0b via diff

@glozow glozow merged commit bdb33ec into bitcoin:master Apr 11, 2024
Pttn added a commit to RiecoinTeam/Riecoin that referenced this pull request Apr 13, 2024
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jul 17, 2024
Summary:
This is a partial backport of [[bitcoin/bitcoin#29735 | core#29735]], consisting of the first 3 commits.

The remaining parts of the PR fix a bug that has not been introduced (dependency not backported yet).

Test Plan:
  ./test/functional/test_runner.py mempool_limit

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK

Differential Revision: https://reviews.bitcoinabc.org/D16486
roqqit pushed a commit to doged-io/doged that referenced this pull request Aug 1, 2024
Summary:
This is a partial backport of [[bitcoin/bitcoin#29735 | core#29735]], consisting of the first 3 commits.

The remaining parts of the PR fix a bug that has not been introduced (dependency not backported yet).

Test Plan:
  ./test/functional/test_runner.py mempool_limit

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK

Differential Revision: https://reviews.bitcoinabc.org/D16486
@bitcoin bitcoin locked and limited conversation to collaborators Sep 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants