-
Notifications
You must be signed in to change notification settings - Fork 506
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
[Blockchain] Simplify block verification #544
Conversation
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. Great job on breaking up the WriteBlock
logic as well as adding test coverage 🙏
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.
Just a few comments
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.
Just a comment. Blockchain struct will be no longer safe because it's possible to insert block with incorrect parent hash due to wrong way to use Blockchain. (Please correct me if I'm misreading)
My suggestion is to add checking ParentHash in WriteBlock at least.
You're right, but it comes down to the semantics of After I've decoupled these concepts, I needed to add a @dbrajovic what do you think about @Kourin1996's suggestion? |
@zivkovicmilos I don't think this is the verification. It's like a nil check before inserting. |
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! I have manually tested branch with old chain for backwards compactibility. It works
I've added a notice to the People who need to call |
Judging by all the places where As for the naming, it is anti-pattern, but so is the blockchain module doing any verification in the first place. This should be tackled in a separate PR, imo. |
@zivkovicmilos Could you check whether node check each CommittedSeals signature before inserting block? |
I've gone into a detailed comparison between checks done on develop and checks done on this branch - the only thing that I found missing was the CommittedSeals check before inserting a block, as it was previously contained inside I've fixed this in: |
Description
This PR aims to separate out block insertion and block verification.
There are 2 kinds of block verifications that can occur:
It also refactors the way the blockchain module is tested.
Changes include
Checklist
Testing
Additional comments
Fixes EDGE-469