smart-contracts
smart-contracts copied to clipboard
overflow possible in get Imbalance - very low likliehood.
In the getImbalance function, the multiplication totalImbalance *= resolution is performed unchecked. Since the resolution field can be arbitrarily big and totalImbalance can reach 2
63−1, overflows are possible.
A check on writing the resolution variable could be introduced to avoid this. Since the function is only used to retrieve information and in a benevolent case resolution should not be this big, this is unlikely. But because this function is used in the getRate function, a consequence could be returning a wrong rate to users. The same applies to currentBlockImbalance *= resolution.
Adjusted in this PR https://github.com/KyberNetwork/smart-contracts/pull/422