# Zero-rate path skips accrual

Zero amount, rate, or factor branches that skip reward/interest accrual or revert on no-op

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

## How it works
Accounting code often has a fast path for the "nothing to do" case: zero interest, zero amount, zero rate, or zero scaling factor. The bug is that this path is not a true no-op. It either skips accrual that should still happen, or it still calls an external distributor that rejects zero input. The assumption that breaks is "zero means harmless": in reality zero is a valid state that must be handled explicitly, and downstream contracts may revert or silently mis-account when handed it.

## Where it shows up
- Interest/reward realization functions that call an external distributor unconditionally, with no `if (amount == 0) return` guard [E1](https://bugbountylibrary.com/r/sherlock%3A2025-07-cap%3AM-3.md).
- Newly registered tokens or markets whose rate/index defaults to zero and only refreshes at the next epoch [E2](https://bugbountylibrary.com/r/c4%3A2024-07-loopfi%3AH-03.md).
- Scaling factors (e.g. `depositFactor = 1/slashingFactor`) consumed by paths that revert on a zero factor [E3](https://bugbountylibrary.com/r/cantina%3Aeigenlayer_mar2025%3A3.2.2.md).
- Any `require(x != 0)` or division by a factor that can legitimately reach zero.

## How to review
For every zero-capable value (amount, rate, factor, index), trace each consumer and ask: does the zero case still preserve the invariant that balances and accrued rewards match reality? The property that must hold: a zero input either performs the correct zero-effect bookkeeping and returns cleanly, or is rejected before any external call. Check that reward distributors are not invoked with nothing to distribute, and that default-zero state cannot be used to accrue at a wrong rate before refresh.

## Variants seen
- Unconditional distributor call on zero realized interest, reverting in the reward contract and DoSing repay/borrow/liquidation [E1](https://bugbountylibrary.com/r/sherlock%3A2025-07-cap%3AM-3.md).
- Default-zero rate on new quota tokens letting borrowers take interest-free quota until the next epoch [E2](https://bugbountylibrary.com/r/c4%3A2024-07-loopfi%3AH-03.md).
- Zero slashing factor blocking recovery of post-slash deposits through the share-increase path [E3](https://bugbountylibrary.com/r/cantina%3Aeigenlayer_mar2025%3A3.2.2.md).

## Impact and severity
Ranges from lost protocol revenue [E2](https://bugbountylibrary.com/r/c4%3A2024-07-loopfi%3AH-03.md) to full DoS of core operations [E1](https://bugbountylibrary.com/r/sherlock%3A2025-07-cap%3AM-3.md) and permanently locked funds [E3](https://bugbountylibrary.com/r/cantina%3Aeigenlayer_mar2025%3A3.2.2.md). Severity rises when the zero path is on a hot path (repay, liquidation) or when the zero state is unrecoverable without an upgrade.

## Why fixes fail
Forks that re-implement an upstream guard can drop it; the patched zero-rate check must be verified in the fork's own copy [E2](https://bugbountylibrary.com/r/c4%3A2024-07-loopfi%3AH-03.md).

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2025-07-cap%3AM-3.md
- E2: https://bugbountylibrary.com/r/c4%3A2024-07-loopfi%3AH-03.md
- E3: https://bugbountylibrary.com/r/cantina%3Aeigenlayer_mar2025%3A3.2.2.md
