superform-xyz / superform-core

Other
98 stars 37 forks source link

fix: insert tolerance into `redeemShare()` checks [SUP-8853] #645

Closed TamaraRingas closed 3 weeks ago

TamaraRingas commented 3 weeks ago

https://github.com/yAudit/superform-report/issues/2

deposit4626() is used to redeem vault assets and deposit them in a superform vault. However, in _redeemShare(), there is a strict equality balance check, that, in case of stETH, will always revert.

Technical Details

Lido stETH has a know rounding down problem as stated in their docs. When trying to redeem stETH with deposit4626(), the balance check will always fail leading the function to revert.

Impact

Low. It is not possible to use deposit4626() with a stETH vault and any other token that have a similar behaviour.

Recommendation

Avoid to use strict equality and insert a tolerance in the balance check to handle the 1-2 wei corner case in the same way that is done here.

linear[bot] commented 3 weeks ago

SUP-8835 Completed multi-vault tx still markes as processing on Activity Page/SuperScan

linear[bot] commented 3 weeks ago

SUP-8853 Insert tolerance in `_redeemShare()` of `deposit4626()` function