Several upgradeable contracts in the codebase inherit from OpenZeppelin's upgradeable contracts but do not implement the required storage gap variable (__gap
). The following contracts are affected:
BaseAdapter.sol
and its implementations:
UniswapV2Adapter.sol
UniswapV3Adapter.sol
CurveAdapter.sol
PriceAdapter.sol
Whitelist.sol
Referral.sol
ZlpVault.sol
TradingAccountNFT.sol
BaseKeeper.sol
and its implementations:
DebtSettlementKeeper.sol
FeeConversionKeeper.sol
UsdTokenSwapKeeper.sol
When new variables are added to base contracts in future upgrades, they could overlap with the storage of the derived contracts, corrupting the state of the contract. The __gap
array reserves storage slots for future versions, preventing storage collision during upgrades.
Storage collisions could occur during contract upgrades if new variables are added to base contracts
Could lead to corrupted state variables and unexpected behavior
Particularly important for contracts handling user funds like ZlpVault
and DEX adapters
Add a storage gap variable to all upgradeable contracts. Example for each contract type:
The size of the gap should be adjusted based on each contract's needs, typically aiming to reserve enough slots for future upgrades while considering gas costs. This pattern must be implemented in all the listed contracts to ensure safe upgradeability.
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.