Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: medium
Valid

Slope can round down allowing a voting power forever

Summary

Slope can round down allowing a voting power forever

Vulnerability Details

One of the main ideas behind a voting contract is the fact that the voting power decays to 0 overtime. We have this piece of code to calculate the bias and slope of a lock:

uint256 duration = unlockTime - block.timestamp;
bias = int128(int256(initialPower));
slope = int128(int256(initialPower / duration));

The issue is that the slope can round down which is the amount of bias/power lost each second. Let's imagine some simple numbers:

  • duration = 11 (note that there are no limitations on the duration/unlock time of a lock)

  • bias = 109

  • slope = 109 / 11 = 9, rounded down

Now, in 12 seconds, the bias would be 109 - (12 * 9) = 1. That means that after the lock is over, the user will still have voting power, forever.

Impact

Voting power forever, completely breaks the idea behind voting contract.

Tools Used

Manual Review

Recommendations

Do not allow such round downs

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

VotingPowerLib::calculateAndUpdatePower results in zero slope for small amounts (<MAX_LOCK_DURATION), creating non-decaying voting power that violates linear decay mechanism

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

VotingPowerLib::calculateAndUpdatePower results in zero slope for small amounts (<MAX_LOCK_DURATION), creating non-decaying voting power that violates linear decay mechanism

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!