-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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: Fix intermittent failure in feature_dbcrash #19022
test: Fix intermittent failure in feature_dbcrash #19022
Conversation
This was presumably introduced in aab8172 |
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 fa2ca0c
Perhaps a longer-term solution would be to change the generate()
method in TestNode
:
- set an hd seed on the node instead of a private key in
import_deterministic_coinbase_privkeys()
- use
generatetodescriptor
to generate to a key in the hd tree - keep a static variable in
generate()
to ensure a new keypath is used for each call.
Could be a good first issue?
You mean a member variable? (Different nodes shouldn't influence each other) |
You're right. Should be a member variable. |
I can work on this! |
Nice! I see that this method is lacking a comment to explain its motivation. The background the tests need deterministic keys is:
Just make sure to preserve those use-cases. Let me know if you need any other pointers. |
fa2ca0c test: Fix intermittent failure in feature_dbcrash (MarcoFalke) Pull request description: Example backtrace https://cirrus-ci.com/task/6005716207009792?command=functional_test#L817 ACKs for top commit: jnewbery: utACK fa2ca0c Tree-SHA512: 978b3ac222f4764c887719240cfd1b29f72cdd273a456345b631e622db0a38e345c25a70d0bae8d4063c1ff6c1af892a7ee37d0d66f47284c2524b663c3afe55
Thank you so much @MarcoFalke and @jnewbery ! 1.You mentioned that 2.I did a little research, but I'm not sure if I'm getting what you meant by 3.Additionally, I would like to make sure I understand the context & goal of this task: Background: feature_dbcrash test experienced intermittent failures due to the fact that Goal: we want to rewrite the generate() function to this logic:
|
If you call
And all of this happens in the same second, then the two generated blocks will be completely identical in all fields of their struct. Thus, the second call to |
Yes, I'd say so. It allows to simply cache the blockchain once instead of MAX_NODES datadirs (including the wallet dirs) And about your other questions: In general, the more deterministic a test is, the easier it is to reproduce failures. |
thank you for your answers!! I have some follow up questions 😂 In your answer, there seems to be an emphasis of using The feature_crash.py test is using In the case that wallet is enabled & that we want to generate blocks deterministically, is it okay if we reuse the block data in rpc_getblockstats.json? In the case that wallet is not enable, do you have any preference as to whether we should use Thank you again 🙏 |
Don't worry too much about mocktime. This is just another dimension to achieve more determinism. It should be orthogonal to your changes. Sometimes mocktime is used to "speed up" tests by telling them how much time has passed. In other cases, it is used to deterministically generate blocks. (The time ends up in the block header, see https://btcinformation.org/en/developer-reference#block-headers)
Currently the test does require a wallet. However, it might be possible to remove that requirement.
|
I feel like maybe I am spinning my wheel for a bit... If you got sometime to take a look and let me know if I am heading in the right direction, I would really appreciate it! #19297 |
Summary: test: Fix intermittent failure in feature_dbcrash (MarcoFalke) Pull request description: Example backtrace https://cirrus-ci.com/task/6005716207009792?command=functional_test#L817 --- Backport of Core [[bitcoin/bitcoin#19022 | PR19022]] Test Plan: ninja test_runner.py feature_dbcrash Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D7406
fa2ca0c test: Fix intermittent failure in feature_dbcrash (MarcoFalke) Pull request description: Example backtrace https://cirrus-ci.com/task/6005716207009792?command=functional_test#L817 ACKs for top commit: jnewbery: utACK fa2ca0c Tree-SHA512: 978b3ac222f4764c887719240cfd1b29f72cdd273a456345b631e622db0a38e345c25a70d0bae8d4063c1ff6c1af892a7ee37d0d66f47284c2524b663c3afe55
fa2ca0c test: Fix intermittent failure in feature_dbcrash (MarcoFalke) Pull request description: Example backtrace https://cirrus-ci.com/task/6005716207009792?command=functional_test#L817 ACKs for top commit: jnewbery: utACK fa2ca0c Tree-SHA512: 978b3ac222f4764c887719240cfd1b29f72cdd273a456345b631e622db0a38e345c25a70d0bae8d4063c1ff6c1af892a7ee37d0d66f47284c2524b663c3afe55
fa2ca0c test: Fix intermittent failure in feature_dbcrash (MarcoFalke) Pull request description: Example backtrace https://cirrus-ci.com/task/6005716207009792?command=functional_test#L817 ACKs for top commit: jnewbery: utACK fa2ca0c Tree-SHA512: 978b3ac222f4764c887719240cfd1b29f72cdd273a456345b631e622db0a38e345c25a70d0bae8d4063c1ff6c1af892a7ee37d0d66f47284c2524b663c3afe55
Example backtrace https://cirrus-ci.com/task/6005716207009792?command=functional_test#L817