# Treasury cap restriction will not hold and one block per month will be compromised

Allora mint module never checks ecosystem treasury cap before minting emissions, so once cap is hit the BeginBlocker panics and one block per month is compromised.

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

**Target:** Cosmos SDK mint module BeginBlocker emission logic
**Root cause:** Emission minting in abci.go calls AddEcosystemTokensMinted without comparing tokensToMint against GetEcosystemMintSupplyRemaining, so minted supply can exceed the ecosystem treasury cap.
**Steps:**
1. Monthly emission runs in BeginBlocker; blockEmission exceeds ecosystemBalance.
2. tokensToMint = blockEmission - ecosystemBalance is minted and AddEcosystemTokensMinted records it with no cap check.
3. EcosystemTokensMinted exceeds ecosystemMaxSupply, so GetEcosystemMintSupplyRemaining returns a negative Int.
4. Negative remaining flows into emission calc, ret.IsNegative() triggers ErrNegativeTargetEmissionPerToken, aborting the block.
**How found:** Code reading of the mint BeginBlocker: noticed AddEcosystemTokensMinted called with no cap comparison, then traced GetEcosystemMintSupplyRemaining subtraction to show it goes negative and trips the negative-emission error.
**Insight:** In Cosmos BeginBlocker/EndBlocker mint logic, trace every minted-amount accumulator against its cap subtraction; a missing clamp turns a supply invariant into a deterministic per-epoch block abort rather than a silent over-mint.
