# Incorrect reward distribution due to feeShares minting order

SiloVault mints fee shares after distributing rewards, so fee recipient misses accrued rewards each claim cycle while existing holders over-earn.

- Payout: Contest reward
- Severity: medium
- Program: Silo Finance
- Credited: t0x1c
- Disclosed: 2025-05-23
- Write-up quality: 6/10
- Original: https://code4rena.com/reports/2025-03-silo-finance#m-05
- Library page: https://bugbountylibrary.com/r/c4%3A2025-03-silo-finance%3AM-05
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:reward-distribution

**Target:** SiloVault.sol reward/fee accounting (ERC4626 vault)
**Root cause:** _update() calls _claimRewards() before super._update() mints feeShares, so retrospectively-minted fee shares are excluded from the current reward distribution.
**Steps:**
1. Bob is sole depositor holding 100% shares.
2. Yield and rewards accrue between t and t2.
3. Call `claimRewards()`: it runs `_updateLastTotalAssets(_accrueFee())` then `_claimRewards()`.
4. `_accrueFee()` computes feeShares via `_accruedFeeShares()` and calls `_mint(feeRecipient, feeShares)`.
5. `_mint` triggers overridden `_update()`, which calls `_claimRewards()` before `super._update()` increases totalSupply.
6. Rewards distributed entirely to Bob (100% shares); feeShares minted afterward get nothing this cycle.
7. Second `_claimRewards()` on L499 finds no remaining rewards.
**How found:** Code review of claimRewards/_accrueFee/_update ordering; noticed _claimRewards() runs inside _update() before feeShares minted, and traced the reward accounting to confirm fee recipient exclusion.
**Insight:** When a vault hooks reward claiming into share-transfer _update(), any shares minted via internal _mint (fees, incentives) inherit the pre-mint claim ordering; check whether retrospectively-minted shares should be included in the current distribution.
