Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Valid

Dust Handling is inneffective

Summary

The logic put in place to handle remainder dust is ineffective.

Vulnerability Details

The function calculates the rewardPerVoter by dividing the totalRewards by totalVotes. In Solidity, division of integers always rounds down, which means that if totalRewards is not perfectly divisible by totalVotes, there will be some amount of "dust" (a small remainder of Ether) left over.

Impact

The function attempts to handle this by rounding up for the last voter, but this only accounts for up to 1 wei of dust. If the rounding down in the earlier payouts accumulates to more than 1 wei, the remaining dust will not be distributed.

Tools Used

Recommendations

This could potentially be improved by using a more precise method of division that can handle dust more accurately.

Updates

Lead Judging Commences

0xnevi Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

VotingBooth._distributeRewards(): Dust amount can still remain in contract

Support

FAQs

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

Give us feedback!