# Funding Mis-Accrual Due to Missing Time Normalization in _calcFundingIndex

FundingRateEngine accrues funding without scaling by elapsed time, so frequent settlements overcharge funding versus one long settlement, distorting PnL and risking unfair liquidations.

- Payout: Contest reward
- Severity: medium
- Program: GTE
- Credited: Psycharis
- Disclosed: 2026-02-05
- Write-up quality: 6/10
- Original: https://code4rena.com/reports/2025-08-gte-perps-and-launchpad#m-11
- Library page: https://bugbountylibrary.com/r/c4%3A2025-08-gte-perps-and-launchpad%3AM-11
- Tags: domain:web3 impact:funds-loss impact:integrity kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** FundingRateEngine.sol cumulativeFundingIndex accrual
**Root cause:** cumulativeFundingIndex is incremented as fundingRate × indexTwap without multiplying by elapsed time relative to the funding interval, making accrual path-dependent on settlement frequency.
**Steps:**
1. Read perps/types/FundingRateEngine.sol L98-L117 _calcFundingIndex.
2. Observe fundingIndex = fundingRate × indexTwap with no elapsed/baseInterval scaling.
3. Compare N settlements of Δt each (≈ N × funding) against one settlement over N × Δt (much less).
4. Confirm invariant ΔCFI(10h) ≠ Σ ΔCFI(1h) is violated.
**How found:** Code reading of the accrual step: noticed elapsed time is used for TWAPs and interval checks but ignored in the funding index increment, then tested path-independence by comparing many short settlements to one long one.
**Exploitation:** If settlement frequency can be influenced, an actor can trigger many short settlements to amplify funding charged to counterparties or dampen funding owed, extracting value from longs/shorts; even without malice, downtime causes mis-accrual.
**Escalation:** Accumulated errors distort PnL, accounting, insurance-fund flows, and can cause unintended liquidations.
**Insight:** When a protocol uses elapsed time for TWAP/interval gating, verify the accrual formula itself is time-proportional; test path-independence (N×Δt vs 1×NΔt) as an invariant to catch frequency-dependent accounting.
