Submitted by hyh
Lenders Illuminate and Yield lend() mistreats the principal type p requested by a user, producing another type each time: when p == uint8(MarketPlace.Principals.Yield the Illuminate PT is minted to the user, and vice versa, when  p == uint8(MarketPlace.Principals.Illuminate the Yield PT is minted to the user.
Setting the severity to be high as thats a violation of systems logic, that can lead to various errors on user side, and particularly in downstream systems.
For example, any additional income can be missed as a downstream system expects Yield PT to appear and tries to stake it further somewhere, while it will be in fact not available and no staking will be done. Say with if (amount/balance > 0) {...} type of logic, which is correct and common, there will be no revert in such a case. Generally such types of mistakes are hard to notice in production and a silent loss of an additional yield is quite probable here.
Currently when type is Principals.Yield the Yield PT is minted to Lender contract and Illuminate PT is minted to the user, while when type is Principals.Illuminate the Yield PT is minted to the user:
https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L214-L234
https://github.com/code-423n4/2022-06-illuminate/blob/912be2a90ded4a557f121fe565d12ec48d0c4684/lender/Lender.sol#L199-L202
When p == uint8(MarketPlace.Principals.Yield the Yield PT to be minted to the user, while when p == uint8(MarketPlace.Principals.Illuminate the Yield PT to be minted to Lender contract and Illuminate PT to be minted to the user, i.e. the logic should be switched.
For example:
sourabhmarathe (Illuminate) disputed and commented:
gzeoneth (judge) commented:
hyh (warden) commented:
gzeoneth (judge) decreased severity to Medium and commented:
