In the context of upgradeable contracts, ensuring forward compatibility between different contract versions is a critical concern. One key strategy for ensuring this compatibility is the use of a __gap
storage variable.
The __gap
variable acts as a reserved space in the contract's storage layout. This space can then be utilized for adding new state variables in future contract upgrades, while maintaining the original storage layout of the contract.
Without the __gap
storage variable, adding new state variables in a contract upgrade can risk overwriting the existing contract storage, potentially leading to unpredictable behavior or data loss.
Therefore, if your contract is designed to be upgradeable, it's crucial to include a __gap
storage variable. The absence of this variable in an upgradeable contract can signify a potential risk for future upgrades.
VSCode
add __gap[50]
storage variable
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.