Dria

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

M-02 SwanManager Contract Lacks Storage Gap Protection

Summary

The SwanManager contract, which follows the upgradeable pattern and is inherited by Swan.sol, does not implement a storage gap mechanism, exposing it to potential storage layout conflicts during future upgrades.

Vulnerability Details

In SwanManager.sol:30, the contract fails to include a storage padding mechanism that's essential for safely upgrading contracts. This gap is required to ensure that future additions to the contract's storage layout don't interfere with existing storage variables, particularly in inherited contracts. Without this safety measure, adding new state variables in future versions could corrupt the storage layout of contracts in the inheritance chain.

The OpenZeppelin documentation provides detailed information about this requirement: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable

Impact

A missing storage gap in upgradeable contracts presents significant risks when adding new state variables in future implementations. The absence of this protection means that any storage additions to the base contract could potentially overwrite existing storage slots in derived contracts. This limitation severely restricts the ability to evolve the contract safely over time and could lead to data corruption if not addressed.

Tools Used

Manual Review

Recommendations

Implement a storage gap in the SwanManager contract by adding the following at the end of the contract:

uint256[50] private __gap;
Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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