Beginner FriendlyFoundryDeFiOracle
100 EXP
View results
Submission Details
Severity: high
Valid

STORAGE_LAYOUT_COLLISION_FOR_UPGRADED_CONTRACT

Summary

Inconsistent storage layout on the old and new ThunderLoan that will be overwritten

Vulnerability Details

Contract ThunderLoan has the following storage layout:

mapping(IERC20 => AssetToken) public s_tokenToAssetToken;
uint256 private s_feePrecision;
uint256 private s_flashLoanFee;
mapping(IERC20 token => bool currentlyFlashLoaning) private s_currentlyFlashLoaning;

While ThunderLoanUpgraded has the following:

mapping(IERC20 => AssetToken) public s_tokenToAssetToken;
uint256 private s_flashLoanFee; // 0.3% ETH fee
// uint256 public constant FEE_PRECISION = 1e18; Not in storage now
mapping(IERC20 token => bool currentlyFlashLoaning) private s_currentlyFlashLoaning;

Impact

Incorrect value for state variables s_flashLoanFee, s_currentlyFlashLoaning after upgrade

Tools Used

Recommendations

Do not change the existed storage layout for the upgraded contract

Updates

Lead Judging Commences

0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

storage collision on upgrade

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.