AppStorage Manual Review Findings

AppStorage Manual Review Findings

ASE-01M: Potentially Incompatible Storage Layout

Description:

The storage structure of AppStorage appears to be incompatible with the previous one defined within the AppStorageOld contract.

Example:

protocol/contracts/farm/AppStorage.sol
171struct AppStorage {
172 uint8 index;
173 int8[32] cases;
174 bool paused;
175 uint128 pausedAt;
176 Storage.Season season;
177 Storage.Contracts c;
178 Storage.Field f;
179 Storage.Governance g;
180 Storage.Oracle o;
181 Storage.Rain r;
182 Storage.Silo s;
183 uint256 depreciated1;
184 Storage.Weather w;
185 Storage.AssetSilo bean;
186 Storage.AssetSilo lp;
187 Storage.IncreaseSilo si;
188 Storage.SeasonOfPlenty sop;
189 Storage.V1IncreaseSilo v1SI;
190 uint256 unclaimedRoots;
191 uint256 v2SIBeans;
192 mapping (uint32 => uint256) sops;
193 mapping (address => Account.State) a;
194 uint32 bip0Start;
195 uint32 hotFix3Start;
196 mapping (uint32 => Storage.Fundraiser) fundraisers;
197 uint32 fundraiserIndex;
198}

Recommendation:

We advise this deviation to be documented as well as the deprecated1 variable to be justified.

Alleviation:

The depreciated1 variable was renamed to reentrantStatus and is now utilized to protect the system against re-entrancy with initialization code in the InitDiamond contract assigning its default value. Additionally, several variables were introduced at the end of the storage structure and extensive documentation was introduced to provide the reasoning behind the storage updates thereby alleviating this exhibit.

View Fix on GitHub
Navigated to AppStorage Manual Review Findings