-
Notifications
You must be signed in to change notification settings - Fork 38.8k
test: p2p_feefilter improvements (logging, refactoring, speedup) #19564
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: p2p_feefilter improvements (logging, refactoring, speedup) #19564
Conversation
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
Edit: verified the test runs significantly more quickly with the noban arg.
bde6920 to
302388e
Compare
|
Thans a lot for reviewing jonatack! Force-pushed with your suggested changes. |
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.
LGTM, a couple more comments below.
test/functional/p2p_feefilter.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.
I wonder if we can eek some more perf by memoizing (untested):
| test_framework.wait_until(lambda: sorted(invs_expected) == sorted(self.txinvs), | |
| expected_txinvs = sorted(invs_expected) | |
| test_framework.wait_until(lambda: sorted(self.txinvs) == expected_txinvs), |
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.
Yes, that makes sense to do the sorting of the txinvs to test for only once. Did it with in-place sort of the passed list.
302388e to
2d43d84
Compare
|
Rebased on master and added suggested changes by jonatack (only sort expected invs once, use correct terminology regarding noban permission terminology). |
jonatack
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 2d43d84
Restarted the stalled s390x Travis job.
test/functional/p2p_feefilter.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.
c063dce9 nit: if you have to retouch, can remove "being" here and in line 87.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
2d43d84 to
ea74a3c
Compare
|
Rebased. |
|
re-ACK ea74a3c per |
maflcko
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.
Looks fine, some style nits
4fbda7da50d508481d9a94b00e4dc994dad9465d
additionally:
-> rename function with snake_case (s/allInvsMatch/wait_for_invs_to_match)
-> move it from global namespace to the class FeefilterConn
…lay) Most of the test time is spent in wait_for_invs() after sending to addresses, i.e. the bottleneck is in relaying transactions. By whitelisting the peers via -whitelist, the inventory is transmissioned immediately rather than on average every 5 seconds, speeding up the test significantly: before: $ time ./p2p_feefilter.py ... real 0m39.367s user 0m1.227s sys 0m0.571s with this commit: $ time ./p2p_feefilter.py ... real 0m9.386s user 0m1.120s sys 0m0.577s
ea74a3c to
9e78943
Compare
|
Thanks for reviewing Marco. Force-pushed with your suggestions and a small log-message change proposed by jonatack previously (#19564 (comment)). |
|
code review ACK 9e78943 |
|
re-ACK 9e78943 per |
…toring, speedup) 9e78943 test: speedup p2p_feefilter.py by whitelisting peers (immediate tx relay) (Sebastian Falbesoner) fe3f0cc test: use wait_until for invs matching in p2p_feefilter.py (Sebastian Falbesoner) 6d94192 test: add logging for p2p_feefilter.py (Sebastian Falbesoner) Pull request description: This PR gives some love to the functional test `p2p_feefilter.py` by introducing the following changes: * add missing log messages for the `test_feefilter` subtest (the main one) * deduplicate code by using the utility function `wait_until` (already using the [recently introduced version](bitcoin@12410b1)) instead of a manual condition checking loop with `time.sleep` * improve naming of the function `matchAllInvs` (more expressive name, snake_case) and moving it from global namespace to the connection class `FeefilterConn` * speeding up the test significantly by the good ol' method of activating immediate tx relay (as seen on e.g. bitcoin#17121, bitcoin#17124, bitcoin#17340, bitcoin#17362, ...): ``` master branch: $ time ./p2p_feefilter.py ... real 0m39.367s user 0m1.227s sys 0m0.571s PR branch: $ time ./p2p_feefilter.py ... real 0m9.386s user 0m1.120s sys 0m0.577s ``` ACKs for top commit: instagibbs: code review ACK bitcoin@9e78943 jonatack: re-ACK 9e78943 per `git range-diff 3ab2582 ea74a3c 9e78943` Tree-SHA512: fe21c1c5413df9165fea916b5d5f609d3ba33e7b5c3364b38eb824fcc55d9e6abddf27116cbc0b325913d451a73c44542040fb916aec9c46f805c6e12f6f10cf
Summary: > test: add logging for p2p_feefilter.py bitcoin/bitcoin@6d94192 > test: use wait_until for invs matching in p2p_feefilter.py > > additionally: > -> rename function with snake_case (s/allInvsMatch/wait_for_invs_to_match) > -> move it from global namespace to the class FeefilterConn bitcoin/bitcoin@fe3f0cc > test: speedup p2p_feefilter.py by whitelisting peers (immediate tx relay) > > Most of the test time is spent in wait_for_invs() after sending to addresses, > i.e. the bottleneck is in relaying transactions. By whitelisting the peers via > -whitelist, the inventory is transmissioned immediately rather than on average > every 5 seconds, speeding up the test significantly: bitcoin/bitcoin@9e78943 This is a backport of [[bitcoin/bitcoin#19564 | core#19564]] Test Plan: before: ``` TEST | STATUS | DURATION p2p_feefilter.py | ✓ Passed | 29 s ALL | ✓ Passed | 29 s (accumulated) Runtime: 21 s ``` after: ``` TEST | STATUS | DURATION p2p_feefilter.py | ✓ Passed | 4 s ALL | ✓ Passed | 4 s (accumulated) ``` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10111
This PR gives some love to the functional test
p2p_feefilter.pyby introducing the following changes:test_feefiltersubtest (the main one)wait_until(already using the recently introduced version) instead of a manual condition checking loop withtime.sleepmatchAllInvs(more expressive name, snake_case) and moving it from global namespace to the connection classFeefilterConn