# Rewards might be lost due to the error that _updateRewardIndex() might advance lastBalance without advancing index for a token

RewardManager advances lastBalance by full accrued amount while index rounds down to zero, silently losing accrued rewards for low-decimal tokens or frequent updates.

- Payout: Audit contest
- Severity: high
- Program: LoopFi
- Found by: chaduke
- Disclosed: 2025-02-17
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-10-loopfi-findings/issues/25
- Library page: https://bugbountylibrary.com/r/c4%3A2024-10-loopfi%3AH-01
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:solidity vuln:accounting-error vuln:precision-loss vuln:reward-distribution

**Target:** Pendle rewards RewardManager contract (_updateRewardIndex)
**Root cause:** _updateRewardIndex advances lastBalance by the full accrued amount but computes index delta as accrued.divDown(totalShares), which truncates to zero when accrued < totalShares, so rewards are consumed without increasing the index.
**Steps:**
1. Have reward token with few decimals (e.g. USDC 6 decimals) and large totalShares (e.g. 200M shares in 18 decimals)
2. Accrue small rewards so accrued.divDown(totalShares) == 0
3. Call deposit/withdraw/getRewards to trigger `_updateRewardIndex()`
4. Observe lastBalance advanced by accrued while index unchanged, so rewards are lost
**How found:** Code reading of _updateRewardIndex noticed index uses divDown while lastBalance advances by full accrued; reasoned that divDown can truncate to zero for low-decimal tokens or large totalShares, then considered frequent-call scenario to keep accrued small.
**Exploitation:** Repeatedly calling getRewards() (cheap on Arbitrum) or high-frequency deposits/withdraws keeps accrued small per update, causing index to never advance while lastBalance is consumed, permanently losing rewards; rounding loss accumulates over time.
**Insight:** When a reward accumulator updates a stored balance and an index separately, check that both advance by the same rounded quantity; truncation in the index divisor silently burns rewards, and low-decimal reward tokens or high-frequency callers make it reachable.

