ImmunityPeriod
Storage Map v101 → v490 · 1 shape changeImmunity period for new neurons (blocks).
Explore chainThe 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) at v454 returns 7200 (24 hours at 12 s per block). After registering, you have a day 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
Migration Notes
key type changed from u16 to NetUid
Update decoders: SCALE encoding is positional, so any signature change (added, removed, or type-changed fields, or storage shape changes) shifts byte offsets and existing decoders will misparse this item. Re-derive types from the new metadata.
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | netuid | NetUid u16 | netuid (NetUid, hashed key component) |
Stored Value
immunity_period (u16)
Default Value
Absent keys read as this value — querying a key that has never been written returns this default, not an error or empty result.
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);On-Chain Activity
Fewer than 10K writes
#243 most written storage item
Modified by both user extrinsics and runtime hooks
As of block 9,385,000
Version History
- key :
u16→NetUid
Runtime Info
View Source- Pallet
- SubtensorModule
- Storage Kind
- Map
- First Version
- v101
- Current Version
- v490