mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 12:20:38 +00:00
test: speed up functional tests by removing avoidable waits #36440
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36440
Loading…
Reference in a new issue
No description provided.
Delete branch "speedup-p2p-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reduce functional test runtime:
Tested on my x86-64 machine:
Wall time (-j=18): 110.8s to 99.1s (-11%)
Accumulated: 1715s to 1411s (-17.5%)
Tests that were most affected:
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
removeprunedfundsand delete transaction delete code by davidgumberg)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.
Base:
f739c7876b81304bdc72e7eaa307702da269ac31Head:
8dc80cafa2ee5932c9ff499c02d6ab8e3cf2f5efNo verified findings are available from this review.
Review coverage was incomplete. concurrency: The framework implementation that consumes
noban_tx_relaywas not inspected, so its exact permission changes and their effect on the added wallet tests remain unresolved. design: The bodies of the six changed wallet tests (wallet_change_address.py, wallet_conflicts.py, wallet_exported_watchonly.py, wallet_importprunedfunds.py, wallet_orphanedreward.py, and wallet_signer.py) were not available to inspect. Checking whether any of them assert transaction-relay or timing behavior could change the assessment of enabling noban_tx_relay, which the framework says not to use for those tests.Full review report
Concept ACK
ACK
9d7c76d671tACK 9d7c76d
I ran the functional test suite locally on x86-64 machine w/ 16 cores and noted similar performance improvements:
Accumulated:
Runtime:
tACK
9d7c76d671I also tested this locally and confirmed the performance improvements. and some of the most affected tests, for example the wallet_conflicts.py:
Before:
wallet_conflicts.py | ✓ Passed | 44 s
After:
wallet_conflicts.py | ✓ Passed | 9 s
tACK
9d7c76d671Concept ACK
I think
wallet_change_address.pywould be a good addition too (goes from 9s to 1.9s on my machine).Thanks for the reviews!
True! Looking again, I found some others tests that can benefit from noban_tx_relay = True. There may be even more but checking for it is kinda nuanced and some tests don't benefit much.
Force-pushed
8dc80cafa2adding self.noban_tx_relay = True in wallet_exported_watchonly.py, wallet_signer.py and wallet_change_address.py.wallet_exported_watchonly.py 7.52s -> 2.68s
wallet_signer.py 7.98s -> 2.94s
wallet_change_address.py 11.30s -> 2.29s
lgtm, but I left a nit
lgtm, but there could be a risk that someone sets a larger explicit interval to ensure something is only checked so often and that for the time in between "nothing" happens.
I don't think there is such a case in the codebase for a lock, but it would be good to be able to make this reviewable with
git grep.Can you make all
check_intervalkwargs? Possibly alsotimeout:(edit: An alternative would be to only run this when the check_interval is the default, but up to you. This is just a nit)
Thanks! The only caller that can reach the Condition path is
P2PInterface.wait_until, which already takes check_interval as keyword-only, sogit grep check_interval=already covers it. MakingTestNode.wait_untilandBitcoinTestFramework.wait_untilkeyword-only seems like a good consistency change, but it's unrelated to this PR since those never pass a lock.Grepping check_interval=, the only tests setting an explicit interval are
p2p_ping_ibd.pyandinterface_http.py, both relying on it for stateful checks. They go throughBitcoinTestFramework.wait_until, so they aren't affected.Also, my take is that
wait_untiltakes a predicate, which should only describe a state, so evaluating it earlier on a notification should still be correct. Using stateful checks seems like a misuse ofwait_untilto me. So I'd prefer to leave this as is.It is used twice in:
but maybe they should be re-written to use
ensure_for.review ACK
8dc80cafa2🏏Show signature
Signature:
ACK
8dc80cafa2I also plan on reordering the tests in
test_runner.pyso running in parallel will have a smaller wall time after https://github.com/bitcoin/bitcoin/pull/36439 is merged too.