This report evaluates the optimization potential of marking unused public
functions as external
if they are not utilized internally within the smart contract code. The aim is to optimize clarity in the contract code, ensure appropriate function scoping, and potentially optimize gas costs.
The vulnerability lies in the potential inefficiency and lack of clarity caused by having unused public
functions that could be marked as external
. By default, Solidity functions are public
, meaning they can be accessed internally within the contract and externally by other contracts. However, if a function is not used internally within the contract, it may be more appropriate to mark it as external
to clarify its intended usage and potentially save gas costs.
The impact of not marking unused public
functions as external
includes:
Gas Inefficiency: Unused public
functions that remain public
may incur unnecessary gas costs when deployed, as they are callable externally even if they are not intended to be.
Code Clarity: Leaving unused functions as public
may lead to confusion for developers reviewing the contract code, as it may not be clear whether the function is meant to be externally callable.
Manual code review
Evaluate unused public
functions and consider marking them as external
if they are not utilized internally within the contract code.
https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity
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.