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
En 8340/selection at end of epoch #2541
En 8340/selection at end of epoch #2541
Conversation
…h' into EN-8340/Selection-at-end-of-epoch
if len(waitingKeys) > 0 { | ||
selectedKeys = append(selectedKeys, eligibleKeys...) | ||
} | ||
|
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.
do you think it's a good idea to sort the selectedKeys slice so the reslice on L360 will always trim the same nodes based on their keys? Kind of a way for a validator to predict each time which node will be unstaked?
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 yes.
} | ||
|
||
var vmOutput *vmcommon.VMOutput | ||
for _, blsKey := range nodesToUnStake { |
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 can be another function as to keep the same abstraction level
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.
done
@@ -910,7 +1101,8 @@ func (s *systemSCProcessor) EpochConfirmed(epoch uint32) { | |||
s.flagDelegationEnabled.Toggle(epoch == s.delegationEnableEpoch) | |||
log.Debug("systemSCProcessor: delegation", "enabled", epoch >= s.delegationEnableEpoch) | |||
|
|||
s.flagStakingV2Enabled.Toggle(epoch == s.stakingV2EnableEpoch) | |||
s.flagSetOwnerEnabled.Toggle(epoch == s.stakingV2EnableEpoch) |
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.
why do we need an additional 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.
One has to be called only once. The other at every start of epoch. Activated by the same enabled epoch value
|
||
validatorInfo := &state.ValidatorInfo{ | ||
PublicKey: blsKey, | ||
ShardId: peerAcc.GetShardId(), |
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.
What shardID would they have here, is it default "0"?
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.
Default is 0. It does not really matter :) as shuffler will put the actual ID a little later
epochStart/metachain/systemSCs.go
Outdated
@@ -809,7 +980,11 @@ func (s *systemSCProcessor) updateSystemSCContractsCode(contractMetadata []byte) | |||
return nil | |||
} | |||
|
|||
func (s *systemSCProcessor) stakeNodesFromWaitingList(nodesToStake uint32, nonce uint64) error { | |||
func (s *systemSCProcessor) stakeNodesFromWaitingList( |
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.
Can we rename this to stakeNodesFromStakingQueue
not to be confused with the shards waiting lists.
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.
Yes. Will do
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.
done
return nil, nil, nil, fmt.Errorf("%w, error: totalStaked string returned is not a number", epochStart.ErrExecutingSystemScCode) | ||
} | ||
|
||
return topUpValue, totalStakedValue, vmOutput.ReturnData[2:], 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.
Are the "leaving" keys also among the returned keys 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.
All the blsKeys are returned. Everything which was registered
logic has been implemented - tests and fixes of broken tests in next commits