Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

Public Function Not Used Internally

Description: If a function is marked public but is not called internally by other functions in the contract, it can be more gas-efficient and semantically clear to mark it as external. This is because external functions use less gas when called externally and do not need to be stored in the contract’s internal function selector.

Impact: Marking a function as public when it's not used internally can increase gas costs unnecessarily, as external function calls are more optimized in terms of gas usage. Furthermore, using external where appropriate improves the readability of the contract by making it clear that the function is intended for external calls only.

Proof of Concept: For Instances, a function like EggVault::depositEgg can be marked as external instead of public if it is not called internally in the contract. Changing public to external reduces gas costs and clarifies the intended use of the function.

Recommended Mitigation: Change the visibility of the functions from public to external if they are only intended to be called externally (not inside the contract itself).

Updates

Lead Judging Commences

m3dython Lead Judge 2 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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