# Lagging median gas price when the set of observers changes

ZetaChain's median gas price includes stale votes from inactive observers, causing underpriced outbound transactions that stall in the mempool and underpaid fees.

- Payout: Contest reward
- Severity: medium
- Program: ZetaChain
- Credited: berndartmueller
- Disclosed: 2024-09-06
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2023-11-zetachain-findings/issues/393
- Library page: https://bugbountylibrary.com/r/c4%3A2023-11-zetachain%3AM-22
- Tags: domain:web3 impact:dos kind:contest platform:code4rena sev:medium tech:go technique:source-review vuln:business-logic vuln:fee-bypass

**Target:** crosschain keeper GasPriceVoter median calculation
**Root cause:** GasPrice.Prices retains votes from observers that stopped voting; median is computed over all stored entries without filtering by vote block height, so stale low prices drag the median down.
**Steps:**
1. Observers submit MsgGasPriceVoter, stored in GasPrice.Prices with BlockNums.
2. Observers go inactive (exit, slashing, admin removal) but their entries remain.
3. Remaining observers report spiked prices; median over all entries (including stale) yields a lagging value.
4. Outbound txns priced with lagging median underpay gas and pend in mempool.
**How found:** Code review of GasPriceVoter median logic; noticed Prices array never pruned and BlockNums stored but unused, hypothesized stale votes skew median when observer set shrinks.
**Insight:** When a median/aggregate is computed over a fixed-size array of per-reporter values, check whether reporters can leave without their entries being removed; unused timestamp/height fields alongside the values are a hint that staleness filtering was intended but omitted.
