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
Move all waiting list related code from staking.go to stakingWaitingList.go #3866
Move all waiting list related code from staking.go to stakingWaitingList.go #3866
Conversation
…st-from-staking # Conflicts: # vm/systemSmartContracts/staking.go
…st-from-staking # Conflicts: # vm/systemSmartContracts/staking.go
there seems to be some tests that are directly related to waitingList, and i think they can be moved to another test file, or maybe you already planned to handle unit tests (if needed) in another PR |
return vmcommon.Ok | ||
} | ||
|
||
func (s *stakingSC) getTotalNumberOfRegisteredNodes(args *vmcommon.ContractCallInput) vmcommon.ReturnCode { |
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.
this is not old code - this can be moved back.
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.
Right, this is not old, it just used the waiting list, but it is not legacy. Moved it back
return vmcommon.Ok | ||
} | ||
|
||
func (s *stakingSC) unStake(args *vmcommon.ContractCallInput) vmcommon.ReturnCode { |
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.
unStake should be in the base file - not here.
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.
maybe make a refactor - unStakeV1 and unStakeV2 -> and call them depending on flag.
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.
Good suggestion with unStakeV1 & unStakeV2. Applied it !
return nil | ||
} | ||
|
||
func (s *stakingSC) unStakeAtEndOfEpoch(args *vmcommon.ContractCallInput) vmcommon.ReturnCode { |
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.
this again should be in the base file - this is not legacy - this will work with stakingV4 as well.
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.
Right, when I started this refactor, I just had in mind "files with/without waiting list", not legacy. Will move it back
afterLastJailed bool | ||
} | ||
|
||
func (s *stakingSC) processStake(blsKey []byte, registrationData *StakedDataV2_0, addFirst bool) error { |
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.
make processStakeV1 and V2 - one with legacy only with v4 in mind. in v4 you need to set the registernonce - line31 and the last 2 lines - like 51 and 52.
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.
Good suggestion, thank you, applied it !
return nil | ||
} | ||
|
||
if !s.flagStakingV4.IsSet() { |
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.
this is not needed - this is duplicated check
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.
Good catch, deleted it, thank you
staking.go
which is related to the staking queue/waiting list, which is going to be obsolete since staking v4 has been moved to a new file:stakingWaitingList.go