https://github.com/hackenproof-public/tokenomics_contract
There exists a low severity issue in sources/voting_escrow.move. The voting power bias calculation in check_point_internal() can overflow for users attempting to lock extremely large amounts of DXLYN tokens (≥50M DXLYN), causing transaction failures and preventing whale participants from using the voting escrow system.
The voting power calculation system uses bias and slope values to track voting power decay over time. The bias represents the current voting power, while slope represents the rate of decay. These calculations involve multiplying large token amounts by scaling factors and time differences:
// Lines 1447-1450 & 1453-1456 in check_point_internal()
if (old_locked.end > current_time && old_locked.amount > 0) {
u_old.slope = (old_locked.amount * AMOUNT_SCALE) / MAXTIME; // @audit Potential overflow
u_old.bias = u_old.slope * (old_locked.end - current_time);
};
if (new_locked.end > current_time && new_locked.amount > 0) {
u_new.slope = (new_locked.amount * AMOUNT_SCALE) / MAXTIME; // @audit Potential overflow
u_new.bias = u_new.slope * (new_locked.end - current_time);
};
The overflow occurs in the slope calculation: u_new.slope = (new_locked.amount * AMOUNT_SCALE) / MAXTIME;
Large token amounts can cause the intermediate calculations to exceed u64 limits. In fact, when locked.amount = 1.84*10^19 / 10^4 = 1.84*10^15 (which is 18,400,000 DXLYN), the slope calculation overflows. This is around 18.4% of the total supply, making it feasible for large stakeholders to hit this limit.
This overflow issue has the following impacts:
The issue is classified as low severity because:
As demonstrated above, when locked.amount = 1.84*10^19 / 10^4 = 1.84*10^15, the slope calculation overflows.
Cast to u256 for intermediate calculations to prevent overflow.
See above