ChildkeyThresholdChecks

Storage Map v459 → current

Queue of parent hotkeys whose stake just changed and need a childkey threshold re-check.

Explore chain
Queried by: developersanalytics

The Big Picture

The v459 design keeps stake extrinsics O(1) with respect to the number of subnets by pushing the valuation here. ChildkeyThresholdSuspended is the result the drain writes.

Why This Matters

A parent whose stake dropped is not suspended in the same block; it is queued and checked on the next idle block.

Example Scenario

Parent P unstakes at block N and appears here. The on_idle hook at block N or N + 1 values P, finds it below StakeThreshold, inserts ChildkeyThresholdSuspended(P) and removes the queue entry.

Use Cases

  • Explain why a suspension took a few blocks to appear
  • Monitor on_idle backlog

From Chain Metadata

MAP ( parent ) --> () | Parents with live child relations whose stake just changed. Drained in `on_idle`, where each parent's total stake is re-checked against `StakeThreshold` and `ChildkeyThresholdSuspended` is set or cleared.

Purpose & Usage

Purpose

Defers the all-subnet stake valuation out of the signed stake extrinsics into on_idle, where it runs under a weight budget.

Common Query Patterns

  • Iterate to see which parents are awaiting re-check
  • Presence only; the value is unit

Notes

  • First appears at runtime v459.
  • Inserted by queue_childkey_threshold_check when stake leaves a hotkey that has live child relations or is suspended, and on add_stake to a suspended hotkey (staking/set_children.rs, staking/stake_utils.rs at v467).
  • Drained by process_childkey_threshold_checks from on_idle within the remaining weight; each entry is valued once against StakeThreshold and removed (macros/hooks.rs at v467).
  • Usually empty between blocks. A persistent backlog means idle weight is being consumed by earlier on_idle work such as dissolution cleanup.

Query Keys

#NameTypeDescription
1
parent
AccountId [u8; 32]parent (AccountId, hashed key component) (hex -> SS58)

Stored Value

() (())

Default Value

None (absent keys return no value)

Optional storage: querying a key that has never been written returns no value (None) — do not assume a zero default.

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Query ChildkeyThresholdChecks storage
const parent = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

const result = await api.query.SubtensorModule.ChildkeyThresholdChecks.getValue(parent);
console.log("ChildkeyThresholdChecks:", result);

On-Chain Activity

Write Frequency
●●●●○○ Medium 100K–1M est. writes

100K to 1M writes

#160 most written storage item

Write Source Calls + Hooks

Modified by both user extrinsics and runtime hooks

As of block 9,385,000

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v459
Current Version
v490