Closed code423n4 closed 2 years ago
https://github.com/code-423n4/2022-04-dualityfocus/blob/main/contracts/compound_rari_fork/ComptrollerStorage.sol#L74 Consider changing the accountAssets mapping to, mapping(address => mapping(tokenSymbol => CToken)).
With above change, adding or deleting tokens from account's list will be easy and a lot of loop processin can be avoided. E.g. https://github.com/code-423n4/2022-04-dualityfocus/blob/main/contracts/compound_rari_fork/Comptroller.sol#L203, the entire for loop can be eliminated. This can be replicated in many places, saving a lot of as fee and reduce contract size.
Adding to warden's other Gas Optimization #1
https://github.com/code-423n4/2022-04-dualityfocus/blob/main/contracts/compound_rari_fork/ComptrollerStorage.sol#L74 Consider changing the accountAssets mapping to, mapping(address => mapping(tokenSymbol => CToken)).
With above change, adding or deleting tokens from account's list will be easy and a lot of loop processin can be avoided. E.g. https://github.com/code-423n4/2022-04-dualityfocus/blob/main/contracts/compound_rari_fork/Comptroller.sol#L203, the entire for loop can be eliminated. This can be replicated in many places, saving a lot of as fee and reduce contract size.