# Potential incorrect index update in revived gauge under specific conditions

reviveGauge fails to sync a killed gauge's index to the global index, letting the revived gauge claim excess rewards for epochs it was dead.

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

**Target:** VoterV2 gauge reward distribution contract
**Root cause:** reviveGauge sets isAlive=true but leaves gaugesState[gauge_].index at its stale value; _distribute computes delta = index - state.index, so the revived gauge accrues rewards for the entire killed period.
**Steps:**
1. Deploy pools A and B, create gaugeA and gaugeB via createV2Gauge.
2. Epoch X: vote equally for poolA and poolB.
3. Epoch X+1: advance time, call distributeAll, then killGauge(gaugeA); vote only for poolB.
4. Epoch X+2: advance time, call distribute([gaugeB]) only (simulating gas-limited distributeAll skipping gaugeA), then reviveGauge(gaugeA).
5. Assert gaugesState(gaugeA).index < Voter.index() — stale index confirmed.
6. Vote equally for poolA and poolB; Epoch X+3 advance and call distribute([gaugeA]); gaugeA receives more reward than gaugeB despite equal weight.
**How found:** Code review of reviveGauge vs _distribute: noticed reviveGauge only flips isAlive without touching index, while _distribute relies on index delta; hypothesized that distributeAll's per-epoch index sync normally masks this, so constructed a scenario where gas limits prevent distributeAll from reaching the killed gauge before revival.
**Exploitation:** Governance revives a killed gauge before any distribute call updates its index; on next distribution the large delta (global index minus stale index) is multiplied by the gauge's vote weight, minting excess claimable rewards and draining the Voter's token balance, leaving other gauges underfunded.
**Insight:** When a state flag gates reward accrual, check whether re-enabling the flag resets the accrual checkpoint (index/timestamp); any pause/resume or kill/revive path that skips checkpoint sync lets the entity back-claim the paused period.

