sherlock-audit / 2024-11-telcoin-judging

0 stars 0 forks source link

TessKimy - Missing gap on upgradable contract #218

Open sherlock-admin2 opened 1 week ago

sherlock-admin2 commented 1 week ago

TessKimy

Medium

Missing gap on upgradable contract

Summary

Missing gap on upgradable contract

Root Cause

Due to missing gap in Stablecoinhandler contract. Contract cannot be upgraded properly in future versions.

AmirX still can be upgradable using the last storage of the contract but we can't upgrade Stablecoinhandler and reflect those changes to AmirX contract. If we make any change on Stablecoinhandler, it will cause storage collusion due to improper handling.

Impact

Medium - Protocol can't upgrade Stablecoinhandler because in AmirX the state variables of the Stablecoinhandler is stored at the top of the AmirX contract and then the state variables of AmirX comes in the storage.

In conclusion, any change on Stablecoinhandler will overwrite to AmirX storage variables and the data will corrupted.

Mitigation

Add simple __gap at the end of the state variable definitions of Stablecoinhandler