# Invalid condition falls back to minimum value

Error or edge branches collapsing to zero price, minimum premium, or default rate in financial math

_Area: DeFi accounting and math bugs. Seen in 3 disclosed reports; latest 2025-08-11. Updated 2026-10-30._

## How it works
A calculation has several distinct failure or edge states, but the code funnels them all into one fallback value: zero price, minimum premium, or a default rate. The assumption that breaks is that "cannot compute normally" means "use the cheap/safe default." In reality the fallback is a real number multiplied into fees, funding, premiums, or withdrawals, so an abnormal state silently produces a wrong economic outcome instead of reverting or being handled per-case.

## Where it shows up
- A helper returns a single boolean for multiple conditions with different economic meaning, and the caller treats all `false` cases identically [E3](https://bugbountylibrary.com/r/sherlock%3A2023-02-carapace%3AM-3.md).
- Oracle requests or updates are conditionally skipped for no-op paths, yet settlement still reads a default (e.g. `price=0`) [E1](https://bugbountylibrary.com/r/sherlock%3A2024-02-perennial-v2-3%3AH-1.md).
- Integrations that call only one withdrawal/stake path while the target toggles modes via an admin-set duration [E2](https://bugbountylibrary.com/r/cantina%3Ajigsaw_june2025%3A3.2.7.md).
- Fallback constants (min premium, zero rate, default price) appearing inside accumulation or share math.
- `if (!ok) return MIN;` style branches feeding fee, funding, or exchange-rate formulas.

## How to review
For each fallback, enumerate every condition that reaches it and confirm they are economically equivalent. The invariant: a fallback value must never be multiplied into balances, fees, funding, or share prices; abnormal states must revert or be handled distinctly. Check that skipped oracle/update paths cannot be settled against a default version [E1](https://bugbountylibrary.com/r/sherlock%3A2024-02-perennial-v2-3%3AH-1.md), and that every branch of an integrated contract's mode modifiers is handled by the caller [E2](https://bugbountylibrary.com/r/cantina%3Ajigsaw_june2025%3A3.2.7.md).

## Variants seen
- Multi-condition boolean collapsed to minimum premium, letting protection be bought too cheaply when capital is low [E3](https://bugbountylibrary.com/r/sherlock%3A2023-02-carapace%3AM-3.md).
- Skipped oracle request settled with `price=0`, zeroing fees and funding for makers [E1](https://bugbountylibrary.com/r/sherlock%3A2024-02-perennial-v2-3%3AH-1.md).
- Single-path integration (`unstake()`) returning zero assets when the target's cooldown mode is off [E2](https://bugbountylibrary.com/r/cantina%3Ajigsaw_june2025%3A3.2.7.md).

## Impact and severity
Loss of funds to one side (makers zeroed [E1](https://bugbountylibrary.com/r/sherlock%3A2024-02-perennial-v2-3%3AH-1.md)), mispriced protection [E3](https://bugbountylibrary.com/r/sherlock%3A2023-02-carapace%3AM-3.md), and blocked withdrawals [E2](https://bugbountylibrary.com/r/cantina%3Ajigsaw_june2025%3A3.2.7.md). Severity rises when the fallback feeds accumulators that persist across positions, and when the triggering state (low capital, disabled cooldown) is reachable by normal operation or admin action.

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2024-02-perennial-v2-3%3AH-1.md
- E2: https://bugbountylibrary.com/r/cantina%3Ajigsaw_june2025%3A3.2.7.md
- E3: https://bugbountylibrary.com/r/sherlock%3A2023-02-carapace%3AM-3.md
