-
Notifications
You must be signed in to change notification settings - Fork 37.7k
test: Fix reorg patterns in tests to use proper fork-based approach #32587
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
base: master
Are you sure you want to change the base?
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32587. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. 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. |
feel free to ping me when it's ready |
Sure! |
7bbdba1
to
516c6ce
Compare
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
516c6ce
to
b70c907
Compare
@instagibbs can you review this, will add other tests once this one gets ACK'ed |
b70c907
to
9565415
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.
ACK with the approach . Left some nits
9565415
to
45fad54
Compare
Addressed some nits and rebased with master! |
35414a8
to
c98f361
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.
LGTM c98f361
feel free to add more cases
c98f361
to
3012d6d
Compare
e186193
to
f079571
Compare
01b98dc
to
4ddc577
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.
ACK 4ddc577
4ddc577
to
3afc731
Compare
update: rebased to master! |
reACK 3afc731 just a reminder that you don't need to rebase on master unless a silent merge conflict is detected or drahtbot yells at you about an issue merging
|
code review and tested-ACK This PR is well designed: the refactoring to centralize fork creation and the switch to realistic reorg behavior both improve test clarity and fidelity.
One remaining question on duplication: Across several test files, # Variation A: explicit node parameter
def trigger_reorg(fork_blocks, node):
for block in fork_blocks:
node.submitblock(block.serialize().hex())
assert_equal(node.getbestblockhash(), fork_blocks[-1].hash)
# Variation B: hardcoded to self.nodes[0]
def trigger_reorg(self, fork_blocks):
for block in fork_blocks:
self.nodes[0].submitblock(block.serialize().hex())
assert_equal(self.nodes[0].getbestblockhash(), fork_blocks[-1].hash) Only the node lookup differs. Would it make sense to extract a single trigger_reorg(fork_blocks, node) utility in test_framework/blocktools.py and have all tests call that? |
I am not sure if you have reviewed the code nicely, there isn't any duplication but rather a different approach using time-based timelock, see comment
For now, I think we can keep like this. There are lot's of other tests as well which needs the reorg correction and can be done in a follow-up pr. |
Thanks for the clarification! You’re absolutely right - I should have reviewed the implementation details more carefully. I appreciate you pointing out that these are different approaches (including the time-based timelock approach) rather than simple duplication. Also, you’re correct about my phrasing - “defined twice” was unclear when it’s actually “defined multiple times across files.” Makes sense to address this in a follow-up PR along with other tests that need reorg corrections. |
3afc731
to
a161f05
Compare
update: in mempool_reorg.py: “slighty” -> “slightly” [correct spelling] |
reACK a161f05 spelling fix |
a161f05
to
f56bb5e
Compare
Rebased -> master@672c85cb1ea0d76ef9e596b2a964b2311b11b815 |
think you need to fix issues first |
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
…so that it can be used by other tests as well
f56bb5e
to
cec7ce0
Compare
Fixed conflicts and rebased to master. |
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 cec7ce0
changes since I last reviewed
- the PR has been extended to 5 more tests other than
mempool_reorg.py
- Tested and reviewed the added tests.
Updated functional tests to replace direct use of
invalidateblock
with proper fork-based reorg behaviour. The direct invalidation approach bypasses important validation checks and has depth limitations(10 block) that don't match real-world reorg scenarios. For more details see #32531.Fixes #32531