Gearbox-protocol / core-v3

Other
28 stars 4 forks source link

fix: facade functions revert on no-ops #272

Closed lekhovitsky closed 1 month ago

lekhovitsky commented 1 month ago

Fixes:

StErMi commented 1 month ago

@lekhovitsky the partiallyLiquidateCreditAccount function executes the _addCollateral and _withdrawCollateral functions that do not perform the check that would revert if amount == 0.

Is this behavior intended? This is the only case in the whole CreditFacadeV3 that skips those checks.

Other than that, the code seems good and implements the recommendations from the findings.

lekhovitsky commented 1 month ago

@StErMi If amount passed to partiallyLiquidateCreditAccount is 0, the code would revert inside _manageDebt. This looks safer compared to reverting inside _withdrawCollateral if feeAmount rounds down to 0 for some reason.