One wei left in the contract after distribution when MIN_FUNDING
is an odd number
Assume the reward calculation bug is fixed and now we are distributing among totalVotesFor
amount of voters.
Now, when contract is deployed with an odd number for the MIN_FUNDING
, when quorum passes and totalVotesFor
is also an odd number, rounding down the rewardPerVoter
in VotingBooth.sol#L192
will leave 1 wei left to distribute. Although VotingBooth.sol#L206
tries to account for this, it rounds up and the distribution will end up leaving 1 wei in the contract.
Medium impact, is not a significant lost, but if this contract is used to do multiple different votings, then the funds lost will grow. Besides, this breaks the invariant that the contract should not have any balance after voting is over.
Manual Review
Foundry Fuzzing
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.