President Elector

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

Lack of Incentive or Enforcement to Call `selectPresident` Causes Election Delays

Summary

The RankedChoice.sol contract does not enforce or incentivize users to call the selectPresident function after the 4-year term ends. This can lead to delays in selecting a new president and potential stagnation in the election process, as there is no mechanism to ensure timely transition to the next election.

Vulnerability Details

The contract is designed such that after every 4-year presidential term (1460 days), anyone can call selectPresident to trigger the election process and select the next president. However, the contract does not enforce or incentivize users to call this function, which can result in significant delays if users do not act promptly.

Without proper enforcement or incentive, the election process can be stalled. Users may not take the initiative to trigger the selection of a new president, which can cause the contract to stagnate and prevent the protocol from functioning as intended. This lack of automatic or incentivized action leaves the system vulnerable to manipulation and delays.

Impact

The lack of enforcement or incentive to call selectPresident can lead to:

  • Delays in selecting a new president, preventing the contract from moving forward as expected.

  • Stagnation in the election process, as the contract waits indefinitely for someone to trigger the next election.

  • Potential manipulation, where a user may intentionally delay the selection of a new president for personal benefit.

Tools Used

Manual code review.

Recommendations

Introduce an Incentive for Calling selectPresident: Implement a reward mechanism that provides an incentive for users to call selectPresident when the election period has ended. This could be a small fee paid to the user who triggers the election.

Example:

function selectPresident() external {
require(block.timestamp - s_previousVoteEndTimeStamp > i_presidentalDuration, "Not time to vote");
// reward logic
uint256 reward = calculateReward();
payable(msg.sender).transfer(reward);
// existing election logic
}
function calculateReward() internal view returns (uint256) {
// Logic to calculate reward for calling selectPresident
return 1 ether; // Example reward
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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