President Elector

First Flight #24
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Invalid

_selectPresidentRecursive Not Counting Rankings

Summary

_selectPresidentRecursive() does not fully implement a proper ranked-choice voting mechanism.:brEvery candidate receives a vote without accounting for voter preferences and ranking, leading to inaccurate outcome

Vulnerability Details

function _selectPresidentRecursive( //@audit critical vote counting logic.
address[] memory candidateList,
uint256 roundNumber
) internal returns (address[] memory) {
if (candidateList.length == 1) {
return candidateList;
}
// Tally up the picks
for (uint256 i = 0; i < VOTERS.length; i++) {
for (
uint256 j = 0;
j < s_rankings[VOTERS[i]][s_voteNumber].length;
j++
) {
address candidate = s_rankings[VOTERS[i]][s_voteNumber][j];
if (_isInArray(candidateList, candidate)) {
s_candidateVotesByRound[candidate][s_voteNumber][
roundNumber
] += 1;
break;
} else {
continue;
}
}
}

Impact

Candidates are not being ordered by voter provided rank. All candidates provided by voter receive an equal vote.

Tools Used

Manual Review

Recommendations

The contract needs more logic to track and redistribute votes based on voter rankings and candidate eliminations round by round. Only a voter's first ranked candidate should be counted. If their first choice candidate is eliminated, their second ranked candidate should receive a vote in the next round.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Appeal created

nadir_khan_sec Submitter
about 1 year ago
inallhonesty Lead Judge
about 1 year ago
inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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