getTargetExternalLendingAmount() when targetUtilization == 0 no check whether enough externalUnderlyingAvailableForWithdraw
in `getTargetExternalLendingAmount()` When `targetUtilization == 0`, it directly returns `targetAmount=0`. It lacks the judgment of whether there is enough `externalUnderlyingAvailableForWithdraw`. This may cause `_rebalanceCurrency()` to `revert` due to insufficient balance for `withdraw`.\\nwhen `setRebalancingTargets()` , we can setting all the targets to zero to immediately exit money it will call `_rebalanceCurrency() -> _isExternalLendingUnhealthy() -> getTargetExternalLendingAmount()`\\n```\\n    function getTargetExternalLendingAmount(\\n        Token memory underlyingToken,\\n        PrimeCashFactors memory factors,\\n        RebalancingTargetData memory rebalancingTargetData,\\n        OracleData memory oracleData,\\n        PrimeRate memory pr\\n    ) internal pure returns (uint256 targetAmount) {\\n        // Short circuit a zero target\\n      if (rebalancingTargetData.targetUtilization == 0) return 0;\\n\\n// rest of code.\\n        if (targetAmount < oracleData.currentExternalUnderlyingLend) {\\n            uint256 forRedemption = oracleData.currentExternalUnderlyingLend - targetAmount;\\n            if (oracleData.externalUnderlyingAvailableForWithdraw < forRedemption) {\\n                // increase target amount so that redemptions amount match externalUnderlyingAvailableForWithdraw\\n                targetAmount = targetAmount.add(\\n                    // unchecked - is safe here, overflow is not possible due to above if conditional\\n                    forRedemption - oracleData.externalUnderlyingAvailableForWithdraw\\n                );\\n            }\\n        }\\n```\\n\\nWhen `targetUtilization==0`, it returns `targetAmount ==0`. It lacks the other judgments of whether the current `externalUnderlyingAvailableForWithdraw` is sufficient. Exceeding `externalUnderlyingAvailableForWithdraw` may cause `_rebalanceCurrency()` to revert.\\nFor example: `currentExternalUnderlyingLend = 100` `externalUnderlyingAvailableForWithdraw = 99` If `targetUtilization` is modified to `0`, then `targetAmount` should be `1`, not `0`. `0` will cause an error due to insufficient available balance for withdrawal.\\nSo, it should still try to withdraw as much deposit as possible first, wait for replenishment, and then withdraw the remaining deposit until the deposit is cleared.
Remove `targetUtilization == 0` directly returning 0.\\nThe subsequent logic of the method can handle `targetUtilization == 0` normally and will not cause an error.\\n```\\n    function getTargetExternalLendingAmount(\\n        Token memory underlyingToken,\\n        PrimeCashFactors memory factors,\\n        RebalancingTargetData memory rebalancingTargetData,\\n        OracleData memory oracleData,\\n        PrimeRate memory pr\\n    ) internal pure returns (uint256 targetAmount) {\\n        // Short circuit a zero target\\n// Remove the line below\\n       if (rebalancingTargetData.targetUtilization == 0) return 0;\\n```\\n
A too small `targetAmount` may cause AAVE withdraw to fail, thereby causing the inability to `setRebalancingTargets()` to fail.
```\\n    function getTargetExternalLendingAmount(\\n        Token memory underlyingToken,\\n        PrimeCashFactors memory factors,\\n        RebalancingTargetData memory rebalancingTargetData,\\n        OracleData memory oracleData,\\n        PrimeRate memory pr\\n    ) internal pure returns (uint256 targetAmount) {\\n        // Short circuit a zero target\\n      if (rebalancingTargetData.targetUtilization == 0) return 0;\\n\\n// rest of code.\\n        if (targetAmount < oracleData.currentExternalUnderlyingLend) {\\n            uint256 forRedemption = oracleData.currentExternalUnderlyingLend - targetAmount;\\n            if (oracleData.externalUnderlyingAvailableForWithdraw < forRedemption) {\\n                // increase target amount so that redemptions amount match externalUnderlyingAvailableForWithdraw\\n                targetAmount = targetAmount.add(\\n                    // unchecked - is safe here, overflow is not possible due to above if conditional\\n                    forRedemption - oracleData.externalUnderlyingAvailableForWithdraw\\n                );\\n            }\\n        }\\n```\\n