Dria

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

Missing __gap Variable in Upgradeable Contracts

Summary

The implementation of upgradeable contracts is missing the __gap variable, which is crucial for maintaining storage compatibility across contract upgrades. This oversight could lead to unexpected behavior or state corruption in future contract versions.
https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/llm/LLMOracleCoordinator.sol
https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/swan/Swan.sol

Vulnerability Details

In upgradeable contracts, the __gap variable acts as a buffer to prevent new storage variables from overwriting existing ones, avoiding storage collisions and possible data loss.

Impact

If the __gap variable is not included, future upgrades to the contract may inadvertently overwrite existing state variables. This could lead to:

  • Data loss or corruption.

  • Security vulnerabilities as critical state information may be lost or manipulated.

  • Increased complexity in maintaining the contract and ensuring compatibility with future versions.

Tools Used

manual Review

Recommendations

Add the uint256[50] private __gap; line to all upgradeable contracts to reserve storage space for future upgrades.

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.