Submitted by Ruhum
When migrating from one strategy to another, the controller pulls out the funds of the old strategy and deposits them into the new one. But, it doesnt verify that both strategies use the same base token. If the new one uses a different base token, it wont know about the tokens it received on migration. It wont be able to deposit and transfer them. Effectively they would be lost.
The migration is done by the owner. So the owner must make a mistake and migrate to the wrong strategy by accident. In a basic protocol with 1 controller and a single active strategy managing that should be straightforward. There shouldnt be a real risk of that mistake happening. But, if you have multiple controllers running at the same time each with a different base token, it gets increasingly likelier.
According to the IStrategy interface, there is a function to retrieve the strategys base token: getBaseToken(). Id recommend adding a check in the migrate() function to verify that the new strategy uses the correct base token to prevent this issue from being possible.
SingleStrategyController.sol#L51-L72
IStrategy.sol#L52
Add  require(_baseToken == _newStrategy.getBaseToken()); to the beginning of migrate().
ramenforbreakfast (prePO) confirmed and commented:
gzeon (judge) commented:
