-
Notifications
You must be signed in to change notification settings - Fork 120
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
Add invalidate block method and invalidated_blocks field to NonFinalizedState #9167
Add invalidate block method and invalidated_blocks field to NonFinalizedState #9167
Conversation
…se in vectors.rs. Updates non finalized state to track invalidated_blocks
…date-block-method-to-nonfinalizedstate
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.
Thank you for getting this done.
This looks excellent. I left some optional suggestions, but none of them are blockers so feel free to resolve them without making changes if you'd like this to merge as-is.
… values with Arc. Optimizies invalidate_block fn to return early if root has hash of desired block.
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.
Thank you for the updates!
I left a suggestion for refactoring the methods, but if you'd prefer to keep it as-is, the only blocker is updating the invalidated_blocks
field before returning early in NonFinalizedState.invalidate_block()
.
…Refactors invalidate_block in NonFinalizedState.
I refactored the functions with the 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.
Thanks again!
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks:
You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. If you want to requeue this pull request, you need to post a comment with the text: |
@mergify requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
…zedState (#9167) * Adds new invalidate_block method to non finalized state. Adds test case in vectors.rs. Updates non finalized state to track invalidated_blocks * Removes InvalidatedBlockData struct. Wraps invalidated_blocks HashMap values with Arc. Optimizies invalidate_block fn to return early if root has hash of desired block. * Update metrics whenever chain_set is modified * Adds child_blocks method and refactors invalidate_block in chain.rs. Refactors invalidate_block in NonFinalizedState. --------- Co-authored-by: Elijah Hampton <[email protected]>
Motivation
This PR implements a new method invalidate_block to invalidate a block based on the block::Hash along with the blocks descendants. This PR closes the following issue: #8840 , #8841
Specifications & References
Reference: #8634
Solution
Tests
Follow-up Work
PR Author's Checklist
PR Reviewer's Checklist