Rock Paper Scissors

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

Unused public Functions Can Be Marked external

Summary

Several functions in the codebase are marked as public but are never called internally. In such cases, the external visibility specifier is more appropriate, as it reduces gas costs slightly when the function is called externally.

Vulnerability Details

In Solidity, public functions can be accessed both internally and externally, while external functions can only be called from outside the contract. If a function is not used internally, using external is a gas optimization.

Found Instances:

function tokenOwner() public view returns (address) {
function decimals() public view virtual override returns (uint8) {

• tokenOwner() is not called anywhere within the contract, so it can be safely marked external.

• decimals() is overriding the base ERC20 contract and needs to stay public for compatibility with ERC20 interfaces, so this instance is not actionable and can be ignored.

Impact

Low.

Changing public to external can result in minor gas savings when the function is called externally. It also improves clarity by enforcing intended usage boundaries.

Tools Used

  • Manual Review

  • Solidity Compiler Warnings

Recommendations

- function tokenOwner() public view returns (address) {
+ function tokenOwner() external view returns (address) {
Updates

Appeal created

m3dython Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational

Code suggestions or observations that do not pose a direct security risk.

m3dython Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational

Code suggestions or observations that do not pose a direct security risk.

Support

FAQs

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