Upgrading the proxy to new implementation ThunderLoanUpgraded
breaks the storage, as the new ThunderLoanUpgraded::s_flashLoanFee
variable will point to ThunderLoan::s_feePrecision
initial slot
ThunderLoan
is the current implementation of the proxy contract. It defines two variables in storage as follows:
However, the new implementation ThunderLoanUpgraded
has an issue, as the s_flashLoanFee
is now pointing to the slot of s_feePrecision
High. When the contract is upgraded, s_flashLoanFee
now read the value stored in that slot, which was initialized as 1e18
in the first implementation. This means that flash loan fee will be 100% fee in ETH (s_flashLoanFee/FEE_PRECISION
), and not 0.3% ETH fee as intended. This is basically a DoS to users that want to keep making flash loans.
Running the test will output:
Foundry
If the idea is to leave the precision as constant, add a storage variable to occupy the slot of s_feePrecision
so storage reads are not affected. Ideally, keep the previous storage layout intact.
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.