onflow/flow-core-contracts

Add pre-conditions to candidate limits and slot limits enforcing size

Opened this issue · 0 comments

Issue To Be Solved

In general, we expect that:

the candidate limit exceeds the slot limit by a large margin (probably about an order of magnitude)
the number of new approved nodes is small relative to the difference between slot limit and candidate limit
In addition, nodes which are already staked do not take up candidate spots.

Suggest A Solution

It would be more useful to enforce some logical consistency in the two setter functions:

setSlotLimits panics if a slot limit is set higher than the candidate limit
setCandidateNodeLimit panics if a slot limit is set higher than the candidate limit

Need tests to test positive and negative cases