ImmunityPeriod

Storage Map v101 → v411

Immunity period for new neurons (blocks).

Explore chain
Queried by: minersvalidatorsdeveloperssubnet owners

The Big Picture

New neurons need time to set up, start serving, and build reputation. Without immunity, a newcomer could be immediately pruned by someone else registering. ImmunityPeriod gives new neurons a window to get established before facing the competitive pruning mechanism.

Why This Matters

You just registered - are you safe from being replaced? ImmunityPeriod tells you how many blocks you have before you're subject to normal pruning rules. Use this time wisely to build your scores.

Example Scenario

Query ImmunityPeriod(netuid=1) returns 7200 (7200 blocks ≈ 4 hours at 2s/block). After registering, you have ~4 hours before you can be pruned. Get your miner/validator running and earning during this window.

Common Questions

How do I check if I'm still immune?
Query BlockAtRegistration(netuid, uid) to get when you registered. If current_block - registration_block < ImmunityPeriod, you're still immune.
What happens when immunity ends?
You become subject to normal pruning. If your PruningScore is low and the subnet is full, a new registrant could replace you.
Can subnet owners change this?
Yes, ImmunityPeriod is a tunable hyperparameter. Different subnets may have different immunity durations.
Does immunity protect against anything else?
Immunity specifically protects against pruning during registration replacement. It doesn't affect other mechanisms like weight limits or serving requirements.

Use Cases

  • Check how long you're protected after registration
  • Plan setup time knowing you won't be immediately pruned
  • Understand competitive dynamics - when new neurons become vulnerable
  • Design subnet parameters for appropriate onboarding period
  • Build immunity countdown displays

From Chain Metadata

MAP ( netuid ) --> immunity_period

Purpose & Usage

Purpose

Protect new neurons from pruning - grace period to establish performance before facing competition.

Common Query Patterns

  • Query by netuid to understand protection duration
  • Combine with BlockAtRegistration to calculate immunity status
  • Plan registration timing based on immunity
Part of: Neuron Pruning

Query Keys

#NameTypeDescription
1
netuid
u16 netuid (u16, hashed key component)

Stored Value

immunity_period (u16)

Relationships

Modified By

Related Events

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 ImmunityPeriod storage
const netuid = 1;

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

Version History

v101 block 1 Added
v123 block 720,235 Internal re-bind
v149 block 3,014,339 Internal re-bind
v166–v194 · runtime versions skipped on chain (never deployed)
v195 block 3,791,350 Internal re-bind
v278–v289 · runtime versions skipped on chain (never deployed)
v290 block 5,947,548 Internal re-bind Current

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v101
Current Version
v411