When the ETH_REWARD is set to certain values (such as 101 ether and 1001 ether) and when the ether is divided among the FOR voters dust remains in the contract. Suspect that this has to do with how the rewardPerVoter
is calculated.
To recreate this, simply manually change the ETH_REWARD in the test file to 101 ether. And test: testVotePassesAndMoneyIsSent()
.
Can add an emit log_uint(address(booth).balance);
to the test function to see the remaining dust.
Suspect that the cause is found on on line 207 of VoterBooth.sol
: rewardPerVoter = Math.mulDiv(totalRewards, 1, totalVotes, Math.Rounding.Ceil);
Under certain circumstances will lead to dust remaining in the contract.
Manual and Fuzzing.
Consider a different rounding method.
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.