# distribute() won't update epoch[tigAsset] when totalShares[tigAsset]==0 which can cause later created bond for this tigAsset to have wrong mint epoch

BondNFT.distribute() early-returns when totalShares==0, leaving epoch stale so the next bond mints with an outdated epoch and inflated reward shares.

- Payout: Contest reward
- Severity: medium
- Program: Tigris Trade
- Credited: unforgiven
- Disclosed: 2023-02-17
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2022-12-tigris-findings/issues/436
- Library page: https://bugbountylibrary.com/r/c4%3A2022-12-tigris%3AM-16
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:reward-distribution

**Target:** BondNFT / Lock smart contracts (Solidity)
**Root cause:** distribute() returns early when totalShares[_tigAsset]==0 or asset not allowed, so epoch[_tigAsset] is never advanced; createLock() then reads a stale epoch as the bond's mint epoch.
**Steps:**
1. Observe distribute() early-returns on `totalShares[_tigAsset]==0 || !allowedAsset[_tigAsset]`, skipping epoch update.
2. Let epoch[asset1] go stale (e.g. asset disabled 30 days, totalShares 0).
3. Attacker calls `Lock.lock(asset1, amount, 32)`; claimGovFees() runs distribute() which still skips epoch update.
4. createLock() sets mint epoch = stale epoch (30 days ago), expireEpoch = stale+32, shares = amount*32/365.
5. Rewards distributed; attacker claims rewards for 32-day lock while only locking ~2 days.
**How found:** Code reading of distribute()'s early-return guard and tracing how createLock() consumes epoch[_tigAsset] without any other update path.
**Exploitation:** Attacker waits for an asset whose epoch is stale (totalShares==0 or asset re-enabled), locks for a short real duration but with a period that, added to the stale epoch, yields a long nominal lock and inflated shares; claims yield then releases.
**Insight:** When a reward-accrual function early-returns on zero shares, check whether the epoch/index it would have advanced is consumed elsewhere as a time anchor; stale epochs become inflated share/duration calculations.
