Dust calculation is wrong when dust is greater than 1 WEI.
When totalRewards - rewardPerVoter * totalVotesFor
is greater than 1 WEI some WEI are left on the contract. For example when allowing 9 voters, after 5 afirmative votes and with a reward not divisible by 5.
Some WEI are left on the contract, which are lost, since there is no way to retrieve them.
forge test
Failing test:
Since we are sending the funds in the loop, by the time we reach the last for voter only their reward plus the dust are left on the contract, then we can send them all the account balance replacing line 207 by:
This issue was given Low severity since at most MAX_VOTERS - 2 WEI are lost.
This issue was reported as a separate issue, since fixing the reward calculation would not fix this other issue.
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.