kava icon indicating copy to clipboard operation
kava copied to clipboard

Catch integer overflow panic in sdk.RelativePow

Open denalimarsh opened this issue 4 years ago • 1 comments

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.

denalimarsh avatar Dec 03 '20 13:12 denalimarsh

Related: https://github.com/Kava-Labs/kava/pull/737#issuecomment-745426776

denalimarsh avatar Dec 15 '20 17:12 denalimarsh