# Topics wont activate even with a sufficient stake

Allora topic activation uses EMA-smoothed weight, so a stake meeting the raw threshold never activates the topic and EndBlocker never activates it later.

- Payout: Contest reward
- Severity: medium
- Program: Allora
- Credited: carrotsmuggler
- Disclosed: 2024-06-24
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-06-allora-judging/issues/95
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-06-allora%3AM-23
- Tags: domain:web3 impact:dos kind:contest platform:sherlock sev:medium tech:go technique:source-review vuln:business-logic

**Target:** Cosmos SDK emissions module topic staking/activation logic
**Root cause:** activateTopicIfWeightAtLeastGlobalMin compares the EMA-smoothed topic weight (which lags fresh stake) against MinTopicWeight, while EndBlocker only deactivates topics and never activates ones whose EMA later crosses the threshold.
**Steps:**
1. Alice calls AddStake with 100 tokens on an inactive topic (threshold 0.5, alpha 0.5).
2. activateTopicIfWeightAtLeastGlobalMin computes EMA = 0*0.5 + 100*0.5 = 50, below MinTopicWeight, so ActivateTopic is not called.
3. Subsequent blocks raise EMA (75, 87.5...) above threshold via GetAndUpdateActiveTopicWeights in EndBlocker.
4. EndBlocker only deactivates below-threshold topics; it never activates, so topic stays inactive despite sufficient stake.
**How found:** Code reading of AddStake's activation path noticed the weight check uses CalcEma rather than raw weight, then traced EndBlocker and found it lacks an activation branch, yielding a state where EMA crosses threshold but nothing triggers activation.
**Insight:** When a threshold check uses a smoothed/lagged metric (EMA, moving average, TWAP) but the state transition is only triggered at deposit time, check whether any periodic job re-evaluates and applies the transition; missing activation in the periodic path strands the state permanently.
