# Tallying a Data Request with a wildcard expression in its consensus filter will store non-deterministic data and cause a chain halt

Wildcard JSONPath in a Data Request consensus filter returns map elements in non-deterministic order, so validators store divergent tally results and the chain halts.

- Payout: Audit contest
- Severity: high
- Program: Seda Protocol
- Found by: g
- Disclosed: 2024-12-20
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-12-seda-protocol-judging/issues/245
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-12-seda-protocol%3AH-11
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:dos

**Target:** Cosmos SDK tally module consensus filter (JSONPath evaluation)
**Root cause:** The filter accepts arbitrary JSONPath expressions including wildcards like `$.*`, whose GetNodes result order is non-deterministic; only elems[0] is used, so different validators pick different elements and compute different outliers/consensus.
**Steps:**
1. Submit a valid Data Request whose consensus filter uses a wildcard path such as `$.*` over a reveal JSON object with multiple keys.
2. Wait until the request reaches Tallying status so EndBlock processes it.
3. Each validator evaluates `expr.GetNodes(obj)` and takes elems[0]; map iteration order differs per validator.
4. Divergent dataList/freq/maxFreq produce different outliers, consensus, Result, ExitCode and GasUsed.
5. Data results are hashed and stored via SetDataResultForBatching with differing values, diverging the state root and halting the chain.
**How found:** Code review of the tally filter path: noticed arbitrary JSONPath is parsed and only the 0th element of GetNodes is used, then reasoned that wildcard expressions over JSON objects yield non-deterministic ordering across validators.
**Exploitation:** Attacker posts multiple valid Data Requests with `$.*` consensus filters; once tallied, every validator stores different Data Results for batching, causing state root divergence and a chain halt.
**Insight:** In consensus-critical code, any library call returning collections (JSONPath wildcards, map iteration) must be sorted before indexing; audit filter/query DSLs for order-dependent selection of the first element.

