# Liquidation threshold diverges from schedule

Check that liquidation sizing and health math use the same per-market parameters and timestamps as the quoted schedule.

_Area: DeFi oracles, liquidations and flash loans. Seen in 3 disclosed reports; latest 2024-05-09. Updated 2026-10-24._

## How it works
A protocol publishes one rule for when a position is liquidatable or how much is seized, but the code that actually enforces liquidation computes the threshold differently. The user-facing or quoted schedule (due date, target health, net value) and the internal check use different inputs: an averaged parameter instead of a per-market one, a different reference timestamp, or a scaling factor applied to one term but not another. The assumption that breaks is that the quoted rule and the enforced rule are the same function. When they diverge, a position that satisfies the published rule can still be liquidated.

## Where it shows up
- Liquidation sizing computed from portfolio-wide averages while execution targets a single market with its own risk parameter [E2](https://bugbountylibrary.com/r/sherlock%3A2024-04-interest-rate-model%3AM-10.md)
- A user-facing deadline function and a separate internal liquidation check using different timestamps or arithmetic [E3](https://bugbountylibrary.com/r/sherlock%3A2023-03-teller%3AM-2.md)
- Health/net-value formulas where a subtracted term is multiplied by a factor (liquidation factor) while the added margin term is fixed [E1](https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AH-25.md)
- Any state change (leverage update, repay) that moves the two sides of the health equation at different rates

## How to review
Find both the quoted/scheduled rule and the enforced check, then diff their inputs. The invariant: for any position that satisfies the published schedule, the enforcement function must report it as safe, and the liquidation amount must match the quoted target. Concretely: same reference timestamp and arithmetic in both functions [E3](https://bugbountylibrary.com/r/sherlock%3A2023-03-teller%3AM-2.md); per-market adjust/collateral factors used in sizing, not an average [E2](https://bugbountylibrary.com/r/sherlock%3A2024-04-interest-rate-model%3AM-10.md); and net value monotonic under the operations users can perform [E1](https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AH-25.md). Test boundary positions where the two formulas are closest.

## Variants seen
- Averaged adjust factor vs per-market factor in liquidation sizing [E2](https://bugbountylibrary.com/r/sherlock%3A2024-04-interest-rate-model%3AM-10.md)
- Mismatched time math between due-date and liquidation check [E3](https://bugbountylibrary.com/r/sherlock%3A2023-03-teller%3AM-2.md)
- Scaling factor on one term breaking monotonicity under leverage changes [E1](https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AH-25.md)

## Impact and severity
In the evidence this enabled unfair liquidation of compliant positions [E1](https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AH-25.md)[E3](https://bugbountylibrary.com/r/sherlock%3A2023-03-teller%3AM-2.md) and liquidation sizing that misses the target health factor [E2](https://bugbountylibrary.com/r/sherlock%3A2024-04-interest-rate-model%3AM-10.md). Severity is high where it lets a borrower be penalized despite following the quoted rule. It worsens when the divergence is small enough to pass casual review but large enough to cross the threshold at the boundary.

## Why fixes fail
Not shown in the evidence.

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AH-25.md
- E2: https://bugbountylibrary.com/r/sherlock%3A2024-04-interest-rate-model%3AM-10.md
- E3: https://bugbountylibrary.com/r/sherlock%3A2023-03-teller%3AM-2.md
