# Users could overpay fees when buying votes

Ethos ReputationMarket applies fees to the full user-supplied funds rather than the actual amount spent buying votes, causing users to overpay fees.

- Payout: Audit contest
- Severity: high
- Program: Ethos Network
- Found by: 0x486776
- Disclosed: 2024-11-20
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-11-ethos-network-ii-judging/issues/314
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-ethos-network-ii%3AH-2
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error

**Target:** ReputationMarket.sol buyVotes / _calculateBuy
**Root cause:** previewFees is applied to the full user-supplied `funds` before the vote-buying loop, but the loop may consume less than that amount, so fees are computed on unspent funds.
**Steps:**
1. User submits buyVotes with `funds` sized for N votes at current price.
2. Another buy lands first, raising votePrice so fewer votes fit in fundsAvailable.
3. Loop exits with leftover fundsAvailable; protocolFee was already taken on the original `funds`.
4. User pays fee on the full `funds` while only a fraction was actually spent on votes.
**How found:** Code reading of _calculateBuy: noticed previewFees(funds, true) is computed on the input `funds` before the while loop, while fundsPaid only accumulates actual vote prices plus that precomputed fee.
**Exploitation:** Not an attacker-driven exploit; a user overpays fees whenever the vote price moves between submission and execution, or when the loop cannot consume all fundsAvailable.
**Insight:** In bonding-curve buy loops, check whether fees are computed on the user's max input or on the actually-consumed amount; price movement between quote and execution leaves a fee-on-unspent-funds gap.

