-
Notifications
You must be signed in to change notification settings - Fork 366
exit queue #4771
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?
exit queue #4771
Conversation
ab6f762 to
54ee78d
Compare
| if err != nil { | ||
| return false, errors.Wrap(err, "failed to get current height") | ||
| } | ||
| if cand.ExitBlock != 0 && cand.ExitBlock < curr { |
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.
we should not select it as active candidate if it exit during next epoch
envestcc
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.
btw, how about the ExitBlock influence the unstake of selfstake bucket?
|
| err: errors.New("no candidate exit queue"), | ||
| failureStatus: iotextypes.ReceiptStatus_ErrUnknown, | ||
| } | ||
| } |
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.
I have double-checked the handling of handleError—it will be settled rather than skipped. Therefore, the "checks allowed after the hardfork" should be moved to Protocol.Validate().
| return nil, nil, errCandNotExist | ||
| } | ||
| if cand.SelfStakeBucketIdx == candidateNoSelfStakeBucketIndex { | ||
| return nil, nil, ErrInvalidSelfStkIndex |
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.
should wrap ErrInvalidSelfStkIndex with handleError{}
| return nil, nil, errors.New("invalid operation") | ||
| } | ||
| if err != nil { | ||
| return nil, nil, err |
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.
could wrap the err with csmErrorToHandleError()
| if err := csm.candCenter.Upsert(cand); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| return csm.putCandidate(cand) |
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.
could replace with csm.upsert(cand) instead
| epochStartHeight := rp.GetEpochHeight(currentEpochNum) | ||
| if epochStartHeight == blkCtx.BlockHeight { | ||
| var last lastExitEpoch | ||
| if _, err := sr.State(&last, protocol.NamespaceOption(CandsMapNS), protocol.KeyOption(_lastExitEpoch)); err != nil { |
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.
should handle the ErrStateNotExist error for the first time



Delegates who want to exit need to submit a request.
At the beginning of each epoch, allowed a delegate to exit if there is no exit in last 24 epoch.
If a candidate is ready to exit, it won't be selected as delegate.
A few TODOs:
Fixes #(issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: