Vanguard

First Flight #56
Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

Code Sanity - Code Organization and Maintainability

Description

  • Functions must be placed under the right heading.

  • The function getCurrentPhase is wrongly placed under the heading INTERNAL FUNCTIONS

  • Instead it must be placed under the heading VIEW FUNCTIONS

/* ™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™ */
/* INTERNAL FUNCTIONS */
/* ™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™™ */
function _resetPerAddressTracking() internal {
addressSwappedAmount[address(0)] = 0;
addressLastSwapBlock[address(0)] = 0;
}
@> function getCurrentPhase() public view returns (uint256) {
if (launchStartBlock == 0) return 0;
uint256 blocksSinceLaunch = block.number - launchStartBlock;
if (blocksSinceLaunch < phase1Duration) {
return 1;
} else if (blocksSinceLaunch < phase1Duration + phase2Duration) {
return 2;
} else {
return 3;
}
}

Risk

Likelihood:

  • NA

  • An attacker cannot exploit this issue. This is related to "sanity" of code.

Impact:

This reduces the readability and "sanity" of the codebase. It hampers the ability of developers and auditors to quickly parse the contract's interface and internal logic.

Recommended Mitigation

Place the function getCurrentPhase under the heading VIEW FUNCTIONS.

Updates

Lead Judging Commences

chaossr Lead Judge
18 days ago

Appeal created

chaossr Lead Judge 17 days ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!