Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: low
Invalid

Redundant Import of `OwnableUpgradeable` in `Swan.sol` May Cause Contract Ambiguity

Summary

The Swan.sol contract redundantly imports OwnableUpgradeable, even though it already inherits this functionality through SwanManager. This redundancy may create initialization conflicts or ambiguity within the contract. Removing the import from Swan.sol resolves this issue, streamlining the contract’s structure and reducing the risk of unexpected behavior related to ownership management.

Vulnerability Description

In the Swan.sol contract, OwnableUpgradeable from OpenZeppelin is imported redundantly despite already being inherited by SwanManager. Since Swan.sol inherits from SwanManager, it inherits OwnableUpgradeable indirectly. This duplicate import could introduce potential conflicts or ambiguity in the contract’s ownership management, especially if initialization is attempted from both SwanManager and Swan.sol.

Impact

While the import does not lead to an immediate security vulnerability, it introduces unnecessary complexity in dependency resolution and contract maintenance. Furthermore, redundant imports of upgradeable modules can lead to unexpected conflicts during initialization, potentially causing the contract to initialize the wrong instance of OwnableUpgradeable and thus impacting ownership functionality.

Tools Used

Manual review

Recommendation

Remove the redundant OwnableUpgradeable import from Swan.sol. With OwnableUpgradeable imported solely in SwanManager, the dependency is correctly managed, and Swan.sol can safely inherit the upgradeable ownership features from SwanManager.

Proposed Code Change:

// Remove this line from Swan.sol
// import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 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.