High Severity: The reward distribution calculation in the closePot
function is susceptible to precision loss due to integer division, potentially leaving a small amount of tokens undisbursed and permanently locked in the contract as dead funds.
In the closePot
function, the calculation of each claimant's share of the remaining rewards uses integer division:
Since Solidity performs integer division, any remainder resulting from the division is discarded. This truncation leads to precision loss, where the total amount distributed does not exactly match the remainingRewards
. As a result, a small number of tokens may remain in the contract after the distribution, which cannot be claimed or utilized and are effectively locked as dead funds.
Vulnerability Location:
Pot.sol: Line 57
The impact of this vulnerability includes:
Dead Funds: Small amounts of tokens (remainders) can become permanently locked in the contract, reducing the efficiency of fund distribution.
Potential Financial Loss: Even small amounts of dead funds can accumulate over multiple distributions, leading to a significant total loss over time.
Inefficient Fund Management: The presence of dead funds could be perceived as poor management and a lack of precision in the contract's financial operations, potentially reducing user trust.
Manual Review
To mitigate this issue, the contract should include logic to handle any remainders left after dividing the rewards among claimants. These remainders could be redistributed in a way that prevents them from becoming dead funds or handled as part of the manager's cut or a future distribution. Although it still depends on the team how they choose to manage these funds, the following approach is one possible way to address the issue:
Updated Function Example to Handle Remainders:
By implementing this logic, the contract ensures that any leftover tokens (remainders) are not permanently locked as dead funds, maintaining efficient fund management and full utilization of the pot's resources.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.