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

Distributing rewards immediately after reaching `MIN_QUORUM` prohibits some legitimate voters from voting

Description: The VotingBooth::vote function closes the voting immediately after reaching 51% of voters, which does not give to some legitimate voters any chance to vote.

@> if (totalCurrentVotes * 100 / s_totalAllowedVoters >= MIN_QUORUM) {
// mark voting as having been completed
s_votingComplete = true;
// distribute the voting rewards
_distributeRewards();
}

It violates the voters' equal rights principle. After the MIN_QUORUM is reached, the allowed voter who has not voted yet will receive an error: DP: voting has been completed on this proposal instead of successful voting, on which the voter has every right. It prevents the legitimate voter to receive rewarding.
For example, if there 3 voters, and each of them want to vote "for", the last one will not be able to vote, and thus will not receive the reward. The outcome is not appropriate to what all voters want, which destroys democracy and justice.

Impact: Voting will be closed before accounting all legitimate voters' vote

Proof of Concept:

There are no possibility to vote by every legitimate voter. The voting will be closed immediately after reaching MIN_QUORUM.

Code

Place the following into VotingBoothTest.t.sol

function testAllVotersCannotVote() public {
uint256 ETH_REWARD = 3e18;
deal(address(this), ETH_REWARD);
address[] memory voters = new address[](3);
voters[0] = address(0x1);
voters[1] = address(0x2);
voters[2] = address(0x3);
booth = new VotingBooth{value: ETH_REWARD}(voters);
vm.prank(address(0x1));
booth.vote(true);
vm.prank(address(0x2));
booth.vote(true);
// This voter has a rigth to vote, but cannot
vm.expectRevert("DP: voting has been completed on this proposal");
vm.prank(address(0x3));
booth.vote(true);
}

Recommended Mitigation: Remove the automatic voting closing after the MIN_QUORUM has been reached. Add manual voting closure by anyone or a trusted creator after the specific publicly known deadline. Thus every voter's vote will matter.

Updates

Lead Judging Commences

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

Support

FAQs

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