The StabilityPool aims to be upgradeable but is prone to storage collisions when not upgraded carefully. Adding a storage gap fixes this.
The StabilityPool aims to be upgradeable. When dealing with upgradeable contracts there's always a risk of storage collisions. This is because changing or adding a variable in a contract that's upgraded, can change the storage layout, which conflicts with the currently deployed version, resulting in corrupted data and the contract possibly no longer working.
Therefore, upgradeable contracts ideally make use of storage gaps to "reserve" a slot space for future upgrades.
In future upgrades of StabilityPool, the contract could introduce storage collisions when either changing or adding variables, or when it's becoming part of an inheritance chain (which is often the recommended way to extend contracts as part of an upgrade).
Manual review.
Introduce a storage gap to reserve some space in the contract's layout. This way adding fields to the upgradeable contract is possible without introducing collisions of storage slots.
Here's what this could look like:
https://solodit.cyfrin.io/issues/m-07-smartaccountsol-is-intended-to-be-upgradable-but-inherits-from-contracts-that-contain-storage-and-no-gaps-code4rena-biconomy-biconomy-smart-contract-wallet-contest-git
https://solodit.cyfrin.io/issues/m-18-future-upgrades-may-be-difficult-or-impossible-sherlock-elfi-git
https://solodit.cyfrin.io/issues/m-05-no-storage-gap-for-upgradeable-contract-might-lead-to-storage-slot-collision-code4rena-alchemix-alchemix-contest-git
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.