In the _selectPresidentRecursive
function, when a candidate is eliminated, their votes are not redistributed to the voters' next preferred candidates. This deviates from the standard Ranked Choice Voting algorithm and can result in incorrect election outcomes.
Affected Function: _selectPresidentRecursive
Issue Explanation:
No Redistribution: After eliminating the candidate with the fewest votes, the function does not reallocate those votes to the next available choices on each affected ballot.
Algorithm Deviation: Proper Ranked Choice Voting requires that when a voter's top choice is eliminated, their vote transfers to their next preferred candidate who is still in the race.
Impact on Results: Without redistribution, the election may not accurately reflect voters' preferences, leading to potentially incorrect or unfair outcomes.
Severity: High
Incorrect Election Results: The winner may not be the candidate who would have won under proper Ranked Choice Voting.
Voter Disenfranchisement: Voters whose top choices are eliminated effectively lose their votes.
Manual Code Review: Identified missing logic for vote redistribution after candidate elimination.
Comparison with RCV Algorithm: Noted discrepancies between the implemented logic and standard RCV procedures.
Implement Vote Redistribution Logic:
After eliminating the candidate with the fewest votes, update the vote counts by transferring votes to the next preferred candidate on each affected ballot.
Example Implementation:
Call _redistributeVotes
after each elimination.
Test Thoroughly:
Ensure the updated function correctly follows the RCV algorithm by writing comprehensive unit tests.
Optimize for Gas Efficiency:
Since redistribution can be gas-intensive, consider optimizing data structures and loops.
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.