code-423n4 / 2023-08-reserve-mitigation-findings

0 stars 0 forks source link

M-03 MitigationConfirmed #21

Open code423n4 opened 1 year ago

code423n4 commented 1 year ago

Lines of code

Vulnerability details

Comments

The mitigation mainly solves the issue that when the distributor rate is changed to 0, the corresponding token gets stuck in the RevenueTrader. So the mitigation adds a returnTokens function which can be called when the rate is zero to send the tokens back to the backingManager:

        if (tokenToBuy == rsr) {
            require(revTotals.rsrTotal == 0, "rsrTotal > 0");
        } else if (address(tokenToBuy) == address(rToken)) {
            require(revTotals.rTokenTotal == 0, "rTokenTotal > 0");
        }

However there is a little issue need to be noticed, that if the asset is unregistered by governance, the token will still be stuck in the RevenueTrader because of the require(assetRegistry.isRegistered(erc20s[i]) check.

But I think its risk is acceptable becuase governance has no motive to do that and governance can also register the asset again at any time to get these tokens back to the BM.

c4-judge commented 1 year ago

0xean marked the issue as satisfactory