GivingThanks

First Flight #28
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Unused Ownable Import in the GivingThanks Contract

Summary

The GivingThanks contract imports the Ownable contract from OpenZeppelin, but this imported module is not used anywhere in the contract's code. Unused imports can clutter the codebase, increase bytecode size, and may even introduce unnecessary dependencies, which can complicate the contract's security and auditability.

Vulnerability Details

The GivingThanks contract imports Ownable from OpenZeppelin, a module that provides ownership and access control functions. However, Ownable is not referenced in the contract; the imported module is never inherited or utilized to restrict access. Importing libraries or contracts without purpose may be overlooked during audits and introduce potential risks or misleading assumptions about functionality.

  • Root Cause: The Ownable module is imported but not used or implemented in the contract’s logic.

  • Instances: The Ownable import at the beginning of the contract is unnecessary.

Impact

Unused imports can add unnecessary complexity to the codebase, making it harder for developers and auditors to read, understand, and maintain the code. Additionally, the unused dependency slightly increases the contract's compiled bytecode size, potentially leading to marginally higher deployment costs.

Tools Used

  1. Manual Code Review: Inspected the contract for references to Ownable-related functions or inheritance.

  2. Static Analysis: Confirmed the unused import with static analysis tools like Slither.

  3. Best Practice References: Consulted Solidity coding best practices to verify the importance of removing unused imports.

Recommendations

  1. Remove the Unused Import: Remove the Ownable import to reduce complexity and avoid misleading readers regarding the contract’s functionality.

- import "@openzeppelin/contracts/access/Ownable.sol";
Updates

Lead Judging Commences

n0kto Lead Judge 10 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.