-
Notifications
You must be signed in to change notification settings - Fork 198
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
add hysteresis to minimum number of nodes #2346
Conversation
} | ||
|
||
newMinNodes := big.NewInt(0).SetBytes(args.Arguments[0]).Int64() | ||
// TODO: newMinNodes extra validation? |
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.
there is no other access here to check. Can remain like this.
@@ -412,5 +468,10 @@ func (s *systemSCProcessor) IsInterfaceNil() bool { | |||
// EpochConfirmed is called whenever a new epoch is confirmed | |||
func (s *systemSCProcessor) EpochConfirmed(epoch uint32) { | |||
s.flagSwitchEnabled.Toggle(epoch >= s.switchEnableEpoch) | |||
|
|||
// only toggle on exact epoch. In future epochs the config should have already been synchronized from peers |
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.
👍
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.
System tests passed.
Currently the minimum number of nodes in the network is given to the system staking SC at genesis and is equal to
nbShards * nbEligiblePerShard
The waiting list does not have a minimum number of nodes, which means it can reach 0 nodes.
No nodes in waiting list will prevent shuffling between shards, so we need to ensure a minimum number of nodes for shuffling.
Decision is to use the hysteresis config for this, and when enabling adaptivity to add also another parameter targetHysteresis > hysteresis. Hysteresis will then be renamed to minHysteresis and used to decide merging of shards and targetHysteresis will be used to decide splitting shards.
This PR uses an enabling epoch for considering also the hysteresis in the SystemStakingSC when deciding the minimum number of nodes. For this reason a StakingSC Function was defined for updating the staking SC storage for minimum number of nodes and a SystemSC method was defined for calling the staking SC function on epochStart with the right credentials when the feature becomes active.