Submitted by deadrxsezzz, also found by kutugu, said, QiuhaoLi, 0xMango, pep7siup, and 0xDING99YA
Possible full DoS for ReLPContract
When taking out a bond in RdpxV2Core if isReLPActive == true, a call to ReLPContract#reLP is made which re-LPs the pool` (takes out an amount of RDPX, while still perfectly maintaining the token ratio of the pool).
The problem is that the protocol wrongfully assumes that it owns all of the liquidity within the pool. This leads to faulty calculations. In best case scenario wrong amounts are passed. However, when the protocol doesnt own the majority of the pool LP balance, this could lead to full DoS, as lpToRemove will be calculated to be more than the LP balance of UniV2LiquidityAmo and the transaction will revert.
This can all be easily proven by a simple PoC (add the test to the given Periphery.t.sol)
Note: theres an added console.log in ReLPContract#reLP, just before the transferFrom in order to better showcase the issue
And the logs:
Change the logic and base all calculations on the pair balance of UniV2LiquidityAmo
psytama (Dopex) confirmed and commented:
Alex the Entreprenerd (Judge) commented:
