Public Function Visibility + Gas Optimization
Functions should use the most restrictive visibility modifier appropriate for their intended use to optimize gas consumption and improve code clarity.
Several functions are marked as public
but are never called internally within the contract, meaning they should be marked as external
to reduce gas costs and improve the contract's interface design.
Likelihood:
Gas inefficiency occurs on every function call since public functions generate additional code for internal accessibility
Code clarity issues arise when function visibility doesn't match actual usage patterns
Impact:
Increased gas costs for users calling these functions due to unnecessary internal call handling overhead
Reduced code maintainability and clarity as visibility modifiers don't accurately reflect function usage
Potential confusion for developers who might assume these functions are used internally when they are not
Larger contract bytecode size due to additional internal call handling code generation
The gas difference between public and external functions can be demonstrated through gas consumption analysis:
Gas Cost Analysis: Public functions consume more gas because the compiler generates additional code to handle both internal and external calls:
Change the visibility of functions that are only called externally from public
to external
to optimize gas usage and improve code clarity:
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.