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

Upgraded contract has different storage slots for state variables

Summary

The upgraded contract ThunderLoanUpgraded has different storage slots for s_flashLoanFee and s_feePrecision (renamed to FEE_PRECISION in upgraded contract). This causes ThunderLoanUpgraded::FEE_PRECISION to have an incorrect value and will cause incorrect fee calculations.

Vulnerability Details

Different storage layouts between implementation versions.

Impact

Incorrect fee calculation

Tools Used

  • VS code diff tool

Recommendations

  • Storage layouts should be the same between implementation versions

  • If new storage variables needs to be added in new implementation versions, append the new storage variables to existing hierarchy.

Modify ThunderLoanUpgraded storage variables

+ uint256 public constant FEE_PRECISION = 1e18;
uint256 private s_flashLoanFee; // 0.3% ETH fee
- uint256 public constant FEE_PRECISION = 1e18;
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.