Skip to content

subnets: event-summary credits WeightsSet 0 distinct setters against a five-figure event count #9308

Description

@JSONbored

GET /api/v1/subnets/{netuid}/event-summary reports hotkey_count: 0 for WeightsSet — typically the highest-volume kind on the subnet — while crediting it a five-figure event_count.

Measured live 2026-08-03, netuid 64, window=30d:

{"event_kind":"WeightsSet","event_count":9830,"hotkey_count":0,"coldkey_count":0}

The real distinct-setter count for that window is 15 (17 at 90d). Every other kind on the card is correct.

Cause

loadSubnetEventSummaryColdTier (landed in #9304) counts distinct participants over hotkey alone:

SELECT event_kind, count(*) AS n FROM (
  SELECT event_kind, hotkey FROM chain.account_events
  WHERE netuid = ? AND observed_at >= ? AND hotkey IS NOT NULL
  GROUP BY event_kind, hotkey
) GROUP BY event_kind

The WeightsSet chain event emits [netuid, uid] and carries no hotkey at allhotkey is NULL on all 50,890,747 rows in the export — so the IS NOT NULL filter drops every row and the kind never appears in the result. The merge then fills the gap with 0.

The retired Postgres route counted a composite identity for exactly this reason, and its own comment said so — "the distinct-actor count uses the same hotkey-or-(netuid,uid) identity as the weight-setters routes (WeightsSet ingestion can omit hotkey)":

COUNT(DISTINCT CASE
  WHEN hotkey IS NOT NULL AND hotkey != '' THEN 'hotkey:' || hotkey
  WHEN uid IS NOT NULL THEN 'uid:' || netuid || ':' || uid END)

So this is a fidelity regression against the route's prior behaviour, not a gap in the source data.

Why it matters

Zero is not a missing value here — it is published as a measured one, on the busiest row of the card. That is the same "confident zero" failure this whole lane has been removing (#9285, #9289). The reader's own header even warns against publishing "9,832 WeightsSet events from 0 hotkeys"; it guards that case against a failed query, but not against the identity itself producing it.

Note the fix must keep coldkey_count as a plain distinct — a WeightsSet has no delegating account, so its zero there is genuine.

Refs #9146

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions