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).
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.