The election of the first president is not time-limited. Therefore, it can be selected right after submitting the rankCandidates()
function at least once.
During contract deployment the s_previousVoteEndTimeStamp
variable is set to 0. If `block.timestamp' is older than 4 years, it is possible to elect a new president. An attacker can vote immediately after the contract deployment and select the president.
Immediately after deploymnet first voter can vote for their candidate and run selectPresident()
function to set new president for the next 4 years.
In the setUp()
funciton (in RankedChoice.t.sol
), just before deploying the rankChoice
contract insert the following line so to modify timestamp of deployment (by default it is set to 1 by foundry which is unrealistic).
Then run the following test:
Set s_previousVoteEndTimeStamp
variable to present timestamp during the deployment by adding the line to the constructor()
function:
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.