Skip to content

feat(chain): alert on first SafeMode use, and mark Sudo as historically dormant #8696

Description

@JSONbored

What prompted this

A check of whether metagraphed tracks "governance proposals". It does not, and it should not — the premise is wrong, which is worth recording so it doesn't get re-raised:

Decoding live finney metadata (state_getMetadata, decoded with @polkadot/api, 2026-07-29) gives 28 pallets:

System, RandomnessCollectiveFlip, Timestamp, Aura, Grandpa, Balances,
TransactionPayment, SubtensorModule, Utility, Sudo, Multisig, Preimage,
Scheduler, Proxy, Commitments, AdminUtils, SafeMode, Ethereum, EVM,
EVMChainId, BaseFee, Drand, Crowdloan, Swap, Contracts, MevShield,
AlphaAssets, LimitOrders

No Triumvirate, no Senate, no Collective, no Democracy, no Referenda. There are no on-chain proposals or votes to display. This confirms #4310's original audit finding.

⚠️ A raw substring grep of the metadata blob does hit Triumvirate and Senate — those are residual type paths, not pallet instances. Anyone re-checking this must decode the pallet list properly (md.asLatest.pallets), not grep the hex.

Governance that does exist is already covered: /api/v1/sudo, /api/v1/sudo/key,
/api/v1/governance/config-changes (AdminUtils), per-subnet hyperparameter history, and
the SubnetOwnerHotkeySet / BurnSet / SubnetLease* events already classified
"governance" in src/account-events.ts.

The actual gap

Four live pallets have zero references anywhere in src/, workers/, or schemas-src/:

Pallet Why it matters Priority
SafeMode Emergency chain pause/unpause. The single most consequential governance action available on this chain, and we would not show it at all. highest
Scheduler + Preimage How root-origin calls are queued. Today we only surface governance actions after they execute — a scheduled sudo call is invisible until it lands. high
Crowdloan Capital formation for subnets. We already claim to cover subnet ownership/funding (SubnetLease*, get_subnet_lease); this is the same story with a gap in it. medium
AlphaAssets, LimitOrders Newer economic pallets adjacent to the OHLC/volume/stake-quote data we already serve. medium

Scheduler/Preimage is the sharpest: it is the difference between "here is what
happened" and "here is what is about to happen". For a registry whose value is
operational awareness, pending root calls are arguably the highest-signal thing on
the chain.

Requirements

  1. Confirm each pallet is actually in use, not merely present in the runtime. A pallet
    with zero historical extrinsics is not worth a route. Report the extrinsic count per
    pallet over the indexed range before building anything — if Crowdloan has never been
    called, say so and drop it from scope rather than shipping an endpoint that returns [].
  2. SafeMode first, independent of the rest: enter/exit events, current state, and
    history. Small surface, highest consequence.
  3. Scheduler/Preimage: surface pending scheduled calls with their target block,
    plus the decoded preimage where available. This is the one that needs real design work —
    a scheduled call is only meaningful if the call itself is decoded, so it must compose
    with the existing call_args decoding (src/postgres-call-args.ts).
  4. Reuse the existing extrinsics D1/Postgres tier and the handleSudo /
    handleGovernanceConfigChanges shape rather than inventing a new one — those are already
    "the extrinsics feed hardcoded to one call_module", which is exactly what these need.
  5. Contract + schema regenerated and committed (npm run build), per the repo's
    contract-drift gate.

Deliverables

Ships as one PR per pallet group, not one giant PR — these are independent:

  • Pallet-usage census (extrinsic counts per pallet over the indexed range), posted as a
    comment here, gating what actually gets built
  • SafeMode state + history route, contract entry, tests
  • Scheduler/Preimage pending-call route with decoded call args, contract entry, tests
  • Crowdloan + AlphaAssets/LimitOrders — only if the census shows real usage

Expected outcome

Every pallet in the live runtime is either surfaced, or has a recorded reason it is not
worth surfacing. No governance-relevant chain activity is invisible to the registry —
and specifically, a scheduled root call is visible before it executes, not after.

Do NOT

Do not add a "proposals" or "votes" surface. There is no pallet backing it. If a future
runtime upgrade adds one, this issue's metadata-decode snippet is the way to detect that.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions