# If rewards are not distributed to some gauges in an epoch, it can lead to incorrect rewards distribution in the next epoch

Skipping a gauge's reward distribution in one epoch leaves its index stale, so next epoch's delta overpays it and reverts distribution.

- Payout: Audit contest
- Severity: medium
- Program: Fenix Finance
- Found by: KupiaSec
- Disclosed: 2024-10-11
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-09-fenix-finance-findings/issues/16
- Library page: https://bugbountylibrary.com/r/c4%3A2024-09-fenix-finance%3AM-03
- Tags: area:web3 domain:web3 impact:dos impact:funds-loss kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:reward-distribution

**Target:** VoterUpgradeableV2.notifyRewardAmount reward index accounting
**Root cause:** Per-gauge index only advances when distribute is called; a skipped gauge keeps an old index, so its next delta spans two epochs while weightsPerEpoch reflects only the current epoch.
**Steps:**
1. Two pools gaugeA/gaugeB, weights 50/50, totalWeightsPerEpoch=100.
2. Week 2: call distribute only for poolA; index=100*1e18/100=1e18; gaugeA gets 50*1e18/1e18=50; gaugeB index stays 0.
3. Week 3: votes shift to 10 for poolA, 90 for poolB.
4. Call distribute for both; index=2e18; gaugeA amount=10*1e18/1e18=10; gaugeB amount=90*2e18/1e18=180.
5. Contract holds only 150 FNX but attempts 190, reverting distribution.
**How found:** Code reading of notifyRewardAmount: noticed amount uses delta index times current-epoch weightsPerEpoch, and that gauge index only updates on distribute, so a skipped gauge's delta spans multiple epochs.
**Insight:** In ve(3,3) voter forks, check whether per-gauge index accrual assumes every gauge is poked each epoch; a lazy per-gauge index combined with per-epoch weights lets a skipped gauge's delta multiply against a later epoch's weight.

