# Fee skipped on alternate path

A second route to the same settlement that omits, zeroes, or mis-scales the fee the main route charges

_Area: DeFi accounting and math bugs. Seen in 12 disclosed reports; one confirmed bounty: $250; latest 2026-06-05. Updated 2026-11-20._

## How it works
A protocol charges a fee on its main settlement path (repay, close, unlock, swap, redeem). A second path reaches the same end state — debt cleared, position changed, funds withdrawn, trade executed — but the fee step is missing, computed from a value that can be zero or stale, or sent to an address that cannot receive it. The assumption that breaks is "every route to settlement passes through the fee code." It does not: alternate entry points, capped amounts, zero-valued multipliers, sentinel addresses and request-time state changes all let value move while the fee stays at zero.

## Where it shows up
- Two functions that settle the same debt or position (direct repay vs forced repay during liquidation) [E7](https://bugbountylibrary.com/r/cantina%3Aalchemix_may2025%3A3.2.2.md)
- A `min()`/cap applied to an unhold or repay amount against the outstanding borrow [E1](https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AH-23.md)
- A fee term multiplied by an adjustment factor that can reach zero [E4](https://bugbountylibrary.com/r/blog%3Amudit-blog-free-blockchain-storage-bug-substrate.md)
- A fee helper that assumes ERC20 semantics but is handed a native-asset sentinel address [E8](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-6.md)
- Shares burned at request time, removed from the fee-accrual denominator, while funds stay in the vault [E5](https://bugbountylibrary.com/r/sherlock%3A2025-07-mellow-flexible-vaults%3AH-6.md)
- A swap's adjusted-balance math missing the `amountIn.mul(fee)` term [E6](https://bugbountylibrary.com/r/c4%3A2025-08-gte-perps-and-launchpad%3AH-10.md)
- A transfer hook that branches on pair reserves to decide fee vs liquidity-add [E2](https://bugbountylibrary.com/r/dhl%3A20260605-dtxt.md)
- A patched fee conditional whose sibling branch compares the wrong operand [E3](https://bugbountylibrary.com/r/cantina%3Asize_february2025%3A3.1.4.md)

## How to review
Enumerate every path that reaches the same end state and diff their side effects. The invariant: for any two paths that clear the same debt, change the same position, release the same funds, or execute the same trade, the fee charged must be identical for identical inputs. Check each fee term's multiplier for a zero floor. Check that any fee depending on mutable state is settled before that state changes. For capped amounts, confirm the cap cannot zero a tracking field while the underlying position survives. For sentinel addresses, confirm the fee helper actually moves funds rather than calling a codeless address. For queued flows, confirm the fee denominator includes in-flight shares.

## How finders spotted it
- Diffed `repay` against `_forceRepay` line by line, saw the protocolFee transfer in one and not the other, then traced that `liquidate` calls `_forceRepay` when earmarked debt exists [E7](https://bugbountylibrary.com/r/cantina%3Aalchemix_may2025%3A3.2.2.md)
- Read `_executeAddMargin`'s `min()` cap against the borrowed amount and reasoned about price movement between leverage updates [E1](https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AH-23.md)
- Read the fee formula against the spec, noticed size fee was scaled by a congestion multiplier whose floor was zero [E4](https://bugbountylibrary.com/r/blog%3Amudit-blog-free-blockchain-storage-bug-substrate.md)
- Read `withdrawToNativeChain`, saw the native guard skip `transferFrom`, then traced `_handleFeeTransfer` using ERC20 `safeTransfer` on the sentinel [E8](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-6.md)
- Read `RedeemQueue.redeem`, noticed shares burn at request time but funds leave at report handling, and the fee denominator counts only allocated shares [E5](https://bugbountylibrary.com/r/sherlock%3A2025-07-mellow-flexible-vaults%3AH-6.md)
- Diffed `swap()` adjusted-balance math against canonical UniswapV2Pair and found the fee subtraction missing [E6](https://bugbountylibrary.com/r/c4%3A2025-08-gte-perps-and-launchpad%3AH-10.md)
- Observed the transfer hook branching on pair reserve state and looked for a cheap way to desync balance from reserve [E2](https://bugbountylibrary.com/r/dhl%3A20260605-dtxt.md)
- Revisited a prior finding after a fix PR, noticed only the RESERVED_ID branch was patched and the existing-position branch still compared the wrong operand [E3](https://bugbountylibrary.com/r/cantina%3Asize_february2025%3A3.1.4.md)

## Variants seen
- Alternate function skips the fee deduction entirely [E7](https://bugbountylibrary.com/r/cantina%3Aalchemix_may2025%3A3.2.2.md)
- Cap on unhold amount zeroes the debt-tracking field while the position stays open [E1](https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AH-23.md)
- Fee multiplier with a zero floor nullifies size and weight fees [E4](https://bugbountylibrary.com/r/blog%3Amudit-blog-free-blockchain-storage-bug-substrate.md)
- Fee helper uses ERC20 transfer on a native sentinel, collecting nothing [E8](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-6.md)
- Request-time share burn removes shares from the fee denominator [E5](https://bugbountylibrary.com/r/sherlock%3A2025-07-mellow-flexible-vaults%3AH-6.md)
- Swap math omits the fee term so the invariant passes fee-free [E6](https://bugbountylibrary.com/r/c4%3A2025-08-gte-perps-and-launchpad%3AH-10.md)
- Reserve-based branch flips classification and skips the sell fee [E2](https://bugbountylibrary.com/r/dhl%3A20260605-dtxt.md)
- Incomplete fix leaves a sibling branch charging no fragmentation fee [E3](https://bugbountylibrary.com/r/cantina%3Asize_february2025%3A3.1.4.md)

## Impact and severity
Fees are lost or debt is under-paid, and the loss scales with volume or repetition: free arbitrarily large extrinsics [E4](https://bugbountylibrary.com/r/blog%3Amudit-blog-free-blockchain-storage-bug-substrate.md), fee avoidance on every liquidation-path repay [E7](https://bugbountylibrary.com/r/cantina%3Aalchemix_may2025%3A3.2.2.md), zero platform fees on native bridges [E8](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-6.md), queued redeems escaping management and performance fees [E5](https://bugbountylibrary.com/r/sherlock%3A2025-07-mellow-flexible-vaults%3AH-6.md), free swaps starving LPs [E6](https://bugbountylibrary.com/r/c4%3A2025-08-gte-perps-and-launchpad%3AH-10.md), and a 35k USDT drain from a Pancake pair [E2](https://bugbountylibrary.com/r/dhl%3A20260605-dtxt.md). E1 combines with price movement and large cross collateral so liquidation does not preempt the maneuver, letting a leveraged position persist with zero recorded borrow [E1](https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AH-23.md). E3 lets looping fragment a lender position N times, amplifying keeper costs and draining collected fees [E3](https://bugbountylibrary.com/r/cantina%3Asize_february2025%3A3.1.4.md). Severity is high where the bypass is repeatable or reaches all funds.

## Seen in real software
Open-source packages and projects, and products, where this pattern was found. If the target runs one, compare the version it runs with the fix.
- **Substrate** (FRAME runtime transaction fee calculation) (version not stated): Free blockchain storage – Tale of a bug in Substrate’s FRAME runtime. Report: https://bugbountylibrary.com/r/blog%3Amudit-blog-free-blockchain-storage-bug-substrate.md

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2024-05-elfi-protocol%3AH-23.md
- E2: https://bugbountylibrary.com/r/dhl%3A20260605-dtxt.md
- E3: https://bugbountylibrary.com/r/cantina%3Asize_february2025%3A3.1.4.md
- E4: https://bugbountylibrary.com/r/blog%3Amudit-blog-free-blockchain-storage-bug-substrate.md
- E5: https://bugbountylibrary.com/r/sherlock%3A2025-07-mellow-flexible-vaults%3AH-6.md
- E6: https://bugbountylibrary.com/r/c4%3A2025-08-gte-perps-and-launchpad%3AH-10.md
- E7: https://bugbountylibrary.com/r/cantina%3Aalchemix_may2025%3A3.2.2.md
- E8: https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-6.md
