President Elector

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

Use of Private Visibility for State Variables

Description: The contract uses private visibility for several state variables, such as s_currentPresident, s_previousVoteEndTimeStamp, and s_voteNumber. While this restricts access to these variables from outside the contract, it also limits transparency and may hinder testing and debugging efforts.

Impact:

  • Reduced Transparency: External users and other contracts cannot access these variables, which may be necessary for transparency and integration purposes.

  • Testing and Debugging Challenges: Developers may find it difficult to test and debug the contract without visibility into these state variables.

Proof of Concept: The following state variables are declared as private, limiting their visibility:

address private s_currentPresident;
uint256 private s_previousVoteEndTimeStamp;
uint256 private s_voteNumber;

Recommended Mitigation:

  • Consider Using internal or public Visibility:

    • Use internal if the variables need to be accessed by derived contracts.

    • Use public if the variables should be accessible externally for transparency and integration purposes.

  • Provide Getter Functions: If maintaining private visibility is necessary, consider providing public getter functions to allow external access to these variables.

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.