Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: low
Invalid

Wrong Error Naming in `LendingPool::initiateLiquidation` Can Cause Confusion on Failure

Summary

In LendingPool::initiateLiquidation, the error message HealthFactorTooLow() is thrown when the health factor is actually too high for liquidation, causing confusing feedback for users and frontends.

Vulnerability Details

[](https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/core/pools/LendingPool/LendingPool.sol#L457)

// Current implementation:
if (healthFactor >= healthFactorLiquidationThreshold) revert HealthFactorTooLow();
// Logic is correct (can't liquidate if health factor is too high)
// But error message suggests the opposite of actual condition

When a position cannot be liquidated because it's healthy (health factor above threshold), the error message suggests the health factor is too low, which is contradictory to the actual check.

Example:

  • Position has health factor of 1.2

  • Liquidation threshold is 1.0

  • Liquidation attempt fails because 1.2 > 1.0

  • Error says "HealthFactorTooLow" when health factor is actually too high

Impact

The logic is correct, but the misleading error message can:

  • Confuse users trying to understand why their liquidation failed

  • Cause frontend developers to display incorrect error messages

  • Make integration testing and debugging more difficult

Tools Used

Foundry

Recommendations

Inside ILendingPool add:
error HealthFactorTooHigh();

Replace the error with HealthFactorTooHigh:

- if (healthFactor >= healthFactorLiquidationThreshold) revert HealthFactorTooLow();
+ if (healthFactor >= healthFactorLiquidationThreshold) revert HealthFactorTooHigh();
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 month ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
inallhonesty Lead Judge about 1 month ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.