President Elector

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

Lack of events emission

Summary

The contract currently does not emit any events making it difficult to track important state changes and interactions with the contract off-chain.

Impact

  • Reduced transparency: Off-chain systems cannot easily monitor key actions like vote casting or president selection.

  • Limitation: It's difficult to reconstruct the voting history or verify the contract's operation over time.

  • Poor user experience: Front-end applications lack real-time updates on contract state changes.

Tools Used

  • Manual Review

Recommendations

  • Add event declarations:

event NewPresident(address indexed president, uint256 indexed voteNumber);
event VoteCast(address indexed voter, uint256 indexed voteNumber);
  • Emit events in relevant functions:

function selectPresident() external {
// ... existing code ...
s_currentPresident = winnerList[0];
emit NewPresident(s_currentPresident, s_voteNumber);
// ... rest of the function ...
}
function _rankCandidates(
address[] memory orderedCandidates,
address voter
) internal {
// ... existing code ...
s_rankings[voter][s_voteNumber] = orderedCandidates;
emit VoteCast(voter, s_voteNumber);
}
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.