Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Invalid

Condition check vote not correct

Summary

Condition to check vote can be complete not correct, it could be make final result not correct.

Vulnerability Details

Contract check if if (totalCurrentVotes * 100 / s_totalAllowedVoters >= MIN_QUORUM)to allow vote round completed but it not correct in some case.
Example: in case need 5 vote

When we have 5 vote:

  • 2 vote For

  • 1 vote Against

Follow exists condition: vote can be completed ( 6/10 > 0.51) and final result is For. Unfortunately, we can easy to see if 2 vote remain is Against then result must be Against

function testVoteCompleteWithWrongResult() public {
console2.log(address(booth).balance);
vm.prank(address(0x1));
booth.vote(true);
vm.prank(address(0x2));
booth.vote(true);
vm.prank(address(0x3));
booth.vote(false);
assert(!booth.isActive());
}

Impact

Wrong result of voting.

Tools Used

Manual review

Recommendations

Should only allow complete if (totalVotesFor | totalVotesAgainst) / s_totalAllowedVoters >= MIN_QUORUM

Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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