https://github.com/Cyfrin/2024-09-president-elector/blob/main/src/RankedChoice.sol#L61-L66
In the RankedChoice::selectPresident function, there is a condition that checks if 4 years have passed since the president was elected: block.timestamp - s_previousVoteEndTimeStamp <= i_presidentalDuration. For the first president, s_previousVoteEndTimeStamp is set to 0, and since block.timestamp > i_presidentalDuration, the selectPresident function won't revert, even though 4 years haven't passed yet, allowing a new president to be selected.
Someone can replace the first president before their 4-year term ends.
Furthermore, if a voter immediately after contract creation (before other voters submit their votes) calls RankedChoice::rankCandidates and then RankedChoice::selectPresident, they could select the president they prefer.
In the constructor, update s_previousVoteEndTimeStamp to block.timestamp:
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.