Open code423n4 opened 2 years ago
Semi duplicate of #63, #37 which describes the power sum issue
Also a semi duplicate of #9 which describes the block size issue
these are both valid and should be assigned congruent severity with the duplicates.
reopening as per judges assessment as "primary issue" on findings sheet
Handle
hrkrshnn
Vulnerability details
updateValset
does not have enough sanity checksIn 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:
N
validators are needed to get the total threshold abovestate_powerThreshold
.ecrecover
, costing at least3000
gas, the minimum gas needed for getting a proposal overstate_powerThreshold
would beN * 3000
N * 3000
cannot be more than theblock.gaslimit
Currently, this putsN
to be less than10000
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 doesn't have gas limit issues in doing so.