sherlock-audit / 2023-05-ironbank-judging

2 stars 2 forks source link

0xMAKEOUTHILL - Market not delisted properly #457

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

0xMAKEOUTHILL

medium

Market not delisted properly

Summary

Struct not deleted properly, leaving the nested mappings in the Market struct untouched

Vulnerability Detail

Whenever there is a nested mapping in a struct, you have to traverse through the mapping in order to delete the values, otherwise the values from the mapping will persist and the market won't be deleted successfully

Impact

When deleting a market, it won't delete users borrows and supplies. When added back again, users will benefit.

Code Snippet

https://github.com/sherlock-audit/2023-05-ironbank/blob/main/ib-v2/src/protocol/pool/IronBank.sol#L599-L607 https://github.com/sherlock-audit/2023-05-ironbank/blob/main/ib-v2/src/libraries/DataTypes.sol#L30-L41

Tool used

Manual Review

Recommendation