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
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
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | key1 | u16 | key1 (u16) |
Stored Value
value (u16)
Relationships
Modified By
Related Events
Code Examples
import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";
const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });
// Query ImmunityPeriod storage
const key1 = 0;
const result = await api.query
[stringCamelCase("SubtensorModule")]
[stringCamelCase("ImmunityPeriod")](
key1
);
console.log("ImmunityPeriod:", result.toHuman());Runtime Info
View Source- Pallet
- SubtensorModule
- Storage Kind
- Map
- First Version
- v101
- Current Version
- v393