-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix missing staking info #225
base: dev
Are you sure you want to change the base?
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.
To understand the trigger condition, can it occur when the current block number does not exceed MaxHeaderFetch
(192)?
@hyunsooda Yes, and the startup issue can happen on any block. |
@hyeonLewis Uhm..? https://github.com/kaiachain/kaia/pull/225/files#diff-99163d68e23ed18d94f9b098d41c9d8c23eeb3e71299102c5c25c9a4ef6245e8R832-R833 To be |
@hyunsooda Downloader has no issue after 192, but I mean missing staking info to validate peer when starting up the node. |
Yes, state regeneration is a prerequisite (1. resolving startup issue to validate peer). The question was about the trigger condition against selecting the ancestor header number, which should have state. (2. resolving header selection which has state, but prerequisite is still required) |
Will be rebased on top of #229 to fix the test failure. |
Proposed changes
We've found there's a missing staking info issue after deleting CreateSnapshot at node startup. The staking info for the current block (=stateAt(parent)) is needed to validate that the peer is in validator sets if the node is CN. To fix this, I modified
kaiax/staking
module slightly.RewindTo
for setHead operation.Start
without this.And in the downloader, it doesn't request a block range that contains current block when it is lower than
MaxHeaderFetch
, which results in missing staking info. Let's assume the current head is 74.Types of changes
Please put an x in the boxes related to your change.
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
I have read the CLA Document and I hereby sign the CLA
in first time contribute$ make test
)Related issues
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...