President Elector

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

Wrong error message in selectPresident()::RankedChoice.sol

Summary

Wrong error message in selectPresident()::RankedChoice.sol.
https://github.com/Cyfrin/2024-09-president-elector/blob/main/src/RankedChoice.sol#L65

Vulnerability Details

The selectPresident() function starts with a timestamp check (#L60-L66):

block.timestamp - s_previousVoteEndTimeStamp <= i_presidentalDuration

If this condition is respected, then it means that we are in the presidential period, meaning we still have to vote for the next president. We cannot select the new president if the voting period is not finished, hence we shouldn't get an error message saying :

revert RankedChoice__NotTimeToVote();

but instead one of these two :

=> revert RankedChoice__NotTimeToSelectPresident(); or
=> revert RankedChoice__TimeToVote();

Impact

Wrong information returned when transaction failing could mislead the end user.

Tools Used

Github, VisualCode.

Recommendations

Change the error message with one of these :
=> revert RankedChoice__NotTimeToSelectPresident(); or revert RankedChoice__TimeToVote();

Updates

Lead Judging Commences

inallhonesty Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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