Skip to content
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

Merged
merged 4 commits into from
Oct 8, 2020

Conversation

AdoAdoAdo
Copy link
Contributor

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.

@iulianpascalau iulianpascalau self-requested a review October 7, 2020 14:01
@AdoAdoAdo AdoAdoAdo changed the base branch from master to development October 7, 2020 16:00
}

newMinNodes := big.NewInt(0).SetBytes(args.Arguments[0]).Int64()
// TODO: newMinNodes extra validation?
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@LucianMincu LucianMincu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System tests passed.

@LucianMincu LucianMincu merged commit 3507f68 into development Oct 8, 2020
@LucianMincu LucianMincu deleted the add-hysteresis-to-min-nodes branch October 8, 2020 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants