Submitted by hrkrshnn, also found by pauliax and shw
In the updateValset function, the current set of validators adds a new set.
It is missing the check that the combined power of all new validators is above the state_powerThreshold. If this is false, then the contract is effectively stuck. Consider adding an on-chain check for this.
It is also worth adding a that the size of the new validator check is less than a certain number.
Here is a rough calculation explaining how 10000 validators (an extreme example) is too much:
Another approach to solve the above potential problems is to do the updating as a two step process:
This guarantees that the new set of validators has enough power to pass threshold and doesnt have gas limit issues in doing so.
jkilpatr (Althea) confirmed:
