The RankedChoice contract's _rankCandidates function does not validate the orderedCandidates array to ensure that each candidate is unique. As a result, voters can rank the same candidate multiple times, potentially skewing the election results and deviating from the expected Ranked Choice Voting (RCV) protocol.
Duplicate Candidates Allowed:
The _rankCandidates function assigns the orderedCandidates array to the voter’s ranking without checking for duplicates.
Allows manipulation of election outcomes by inflating the vote count for specific candidates.
Voters may be unaware that duplicate rankings are allowed, leading to unintentional influence over election results.
Manual Code Review: Identified the absence of duplicate checks within the _rankCandidates function.
Implement Duplicate Checks:
Modify the _rankCandidates function to ensure that each candidate appears only once in the orderedCandidates array.
Emit informative error messages when duplicate candidates are detected to guide users in correcting their submissions.
Utilize more gas-efficient methods for duplicate detection, such as using a temporary mapping within the function scope.
Implement tests to verify that the contract correctly rejects rankings with duplicate candidates.
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.