Omniscia vfat Audit

LendingMigrator Manual Review Findings

LendingMigrator Manual Review Findings

LMR-01M: Inexistent Validation of Flash-Loan Validity

Description:

The FlashloanStrategy permits multiple flash-loan types as well as multi-collateral flash-loans to be executed, however, the LendingMigrator contract that is delegated-to by Sickles solely supports a single-asset flash-loan.

Impact:

The LendingMigrator while incompatible with multi-collateral flash-loans does not denote this so during its validation, causing a flash-loan repayment error to be yielded for the top-level transaction that would be identical to the contract failing for miscalculating the flash-loan repayment amounts.

Example:

contracts/strategies/LendingMigrator.sol
70function flashloanRepayForCallback(
71 address[] calldata assets,
72 uint256[] calldata amounts,
73 uint256[] calldata premiums,
74 bytes calldata extraData
75) public onlyRegisteredSickle {
76 if (msg.sender != address(flashloanStrategy)) {
77 revert FlashloanStrategy.NotFlashloanStrategy();
78 }
79
80 MigratePositionParams memory params =
81 abi.decode(extraData, (MigratePositionParams));
82
83 uint256 assetIndex = amounts[0] > 0 ? 0 : 1;

Recommendation:

We advise the code to ensure that the input assets length is either 1 or 2, with the latter case also validating that either of the amounts is 0.

Alleviation (6ab7af3bb495b817ffec469255ea679b1813eecb):

The alleviation of the FLI-01M exhibit would render further sanitization within the LendingMigrator::flashloanRepayForCallback function to be redundant, causing this exhibit to have been alleviated indirectly.

LMR-02M: Potential Strategy Incompatibility

Description:

The LendingMigrator::flashloanRepayForCallback function logic that is meant to utilize an ILendingConnector::repayFor operation is solely compatible with the CompoundMarketConnector as the MorphoConnector does not support a 0 value argument to indicate a full repayment.

Impact:

The MorphoConnector is presently incompatible with the LendingMigrator in the execution scenario highlighted.

Example:

contracts/strategies/LendingMigrator.sol
99_delegateTo(
100 connectorRegistry.connectorOf(params.lendingMarket),
101 abi.encodeCall(
102 ILendingConnector.repayFor, // Repay all
103 (params.lendingMarket, params.borrowerAddress, 0, "")
104 )
105);

Recommendation:

We advise either the MorphoConnector to be updated to support a full repayment via the definition of a 0 repay operation, or the code to denote that it is solely compatible with CompoundMarketConnector lending market migrations (and to be renamed as such).

Alleviation (6ab7af3bb495b817ffec469255ea679b1813eecb):

The code of the MorphoConnector was updated to handle a full repayment operation as being signaled via a zero-value input argument, rendering the LendingMigrator compatible with it and thus alleviating this exhibit in full.