Submitted by inh3l, also found by Bauchibred, Evo, and MSaptarshi
https://github.com/code-423n4/2024-12-lambowin/blob/874fafc7b27042c59bdd765073f5e412a3b79192/src/rebalance/LamboRebalanceOnUniwap.sol#L89-L114
Rebalancing interacts with OKXRouter to swap weth for tokens in certain pools and vice versa. But OKXRouter may charge commissions on both the from token and to token, which reduces potential profit to be made from the rebalance operation, if high enough causes there to be no profit made, which will cause the operation to fail, or in extreme cases, if the commision is set beyond its expected limits, cause a permanent dos of the function.
rebalance calls morpho flashloan which calls the onMorphoFlashLoan hook.
onMorphoFlashLoan, depending on the set direction executes buy or sell transaction using OKXRouter.
OKXRouter, for its transactions charges a fee from both the from and to token. This is important as according to the readme, issues from external integrations enabling fees while affecting the protocol are in scope.
From the routers uniswapV3SwapTo function, we can see that a commission is taken from the from token and from the to token after swap. The presence of these fees, for the first part reduces the potential profit that the protocol stands to make from the flashloan, leading to a loss of positive yield. Worse still is if the commision is high enough, no profit will be made, causing the rebalance function to revert due to the requirement that profit is made during every rebalance operation.
And finally, if the commission rate exceeds exceeds its preset commissionRateLimit either for the fromToken or toToken, will also cause the function to also revert, dossing rebalancing.
