-
Notifications
You must be signed in to change notification settings - Fork 38.7k
validation: remove BLOCK_FAILED_CHILD #32950
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?
validation: remove BLOCK_FAILED_CHILD #32950
Conversation
…InvalidateBlock - there is no functional difference between BLOCK_FAILED_VALID and BLOCK_FAILED_CHILD and it's unnecessary code complexity to correctly categorise them.
|
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/32950. 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. LLM Linter (✨ experimental)Possible typos and grammar issues:
drahtbot_id_5_m |
|
Concept ACK |
Prabhat1308
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.
Concept ACK
I think removing is a better option. The only weak argument that we could have for not removing is that BLOCK_FAILED_VALID right now marks the start of the invalid block chain and is better for debugging manually. However , the burden of maintaining this distinction seems too high for debugging purposes with no actual benefit functionally.
mzumsande
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.
Concept ACK
naiyoma
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.
Concept ACK,
Wondering if the CI failure is related to this issue. ->#32855
yuvicc
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.
Concept ACK
The CI failure looks like due to #32855
stickies-v
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.
Concept ACK for removing it.
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.
TestedACK 06db700a1315bb655ac7fa12578c626990a22ea5
Block 2 (valid)
/ \
(valid)Block height 3 Block height 3 (BLOCK_FAILED_CHILD)
| |
(valid) Block height 4 Block height 4(BLOCK_FAILED_CHILD)
| |
Before removing BLOCK_FAILED_CHILD,this test(#32173 (comment)) would fail at: self.log.info(self.nodes[0].reconsiderblock(res["bestblock"]))
(Reconsidering block at height 3 — which has BLOCK_FAILED_CHILD)
This failure happened because:
This check fails, block 3 has BLOCK_FAILED_CHILD (not BLOCK_FAILED_VALID).
and so in this assertion -> https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L5363
pindex->nStatus & BLOCK_FAILED_MASK) != 0.
after removing BLOCK_FAILED_CHILD:
block 3 , status is BLOCK_FAILED_VALID, and pindexFirstInvalid is set correctly.
mzumsande
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 good - just some minor comments.
06db700 to
2e040d8
Compare
sipa
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.
Concept ACK
stickies-v
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.
Approach ACK 2e040d8b3c861c96c536754a82f4352b635c4d01
Intuitively it seems helpful to track something like BLOCK_FAILED_CHILD, but since it's been unused for so long it seems the use case isn't really there. Block validation logic is complex and critical and simplifying it is worth the effort, so I think this is the way to go.
2e040d8 to
cfadc80
Compare
|
thanks @stickies-v! I've addressed your review comments.
|
Improve upon the variable name for `invalid_walk_tip` to make the InvalidateBlock logic easier to read. Block tip before disconnection is now tracked directly via `disconnected_tip`, and `new_tip` is the tip after the disconnect. Co-authored-by: stickies-v <[email protected]>
even though we have a distinction between BLOCK_FAILED_VALID and BLOCK_FAILED_CHILD in the codebase, we don't use it for anything. since there's no functional difference between them and it's unnecessary code complexity to categorise them correctly, just mark as BLOCK_FAILED_VALID instead.
since it's the same as BLOCK_FAILED_VALID now
…ng from disk - there maybe existing block indexes stored in disk with BLOCK_FAILED_CHILD - since they don't exist anymore, clean up block index entries with BLOCK_FAILED_CHILD and reset it to BLOCK_FAILED_VALID.
Add a test for block index transitioning from legacy BLOCK_FAILED_CHILD to BLOCK_FAILED_VALID behavior. In the scenario where a valid block has a BLOCK_FAILED_CHILD parent and a BLOCK_FAILED_VALID grandparent, ensure that all three blocks are correctly marked as BLOCK_FAILED_VALID after reloading the block index.
cfadc80 to
b22d8b8
Compare
|
thanks for the great catches @stringintech and the nicer tests @stickies-v! I've pushed an update. |
|
🐙 This pull request conflicts with the target branch and needs rebase. |
Fixes #32173
even though we have a distinction between
BLOCK_FAILED_VALIDandBLOCK_FAILED_CHILDin the codebase,we don't use it for anything. Whenever we check for BlockStatus, we use
BLOCK_FAILED_MASKwhich encompasses both of them.Since there is no functional difference between
BLOCK_FAILED_VALIDandBLOCK_FAILED_CHILDand it's addedcode complexity to correctly categorise them (ex: #31405 (comment), #16856 (comment)), we could just remove it.
Looking for conceptual feedback on whether it's better to improve handling of
BLOCK_FAILED_CHILDin the codebase or removeBLOCK_FAILED_CHILD.Of less relevance, but it would also fix a
reconsiderblockcrash that could happen in the situation mentioned in #32173 (comment)Similar attempt in the past in #16856 (comment)