kava
kava copied to clipboard
Catch integer overflow panic in sdk.RelativePow
CalculateInterestFactor
in x/hard/interest.go uses sdk.RelativePow
which panics on integer overflow. We need to create a SafeRelativePow
function that wraps the current one that acts as a panic handler and reverts if an overflow occurs.
From https://github.com/Kava-Labs/kava/pull/720#discussion_r534462134.
Related: https://github.com/Kava-Labs/kava/pull/737#issuecomment-745426776