Current Value
4096Relevant for: minersvalidatorssubnet ownersdevelopers
The Big Picture
New neurons need time to prove themselves. This constant gives freshly registered neurons protection from being immediately pruned. Without immunity, a new miner could register, get zero weights (no one's evaluated them yet), and be instantly replaced by the next registration. The immunity period is a grace period to establish performance.
Why This Matters
When you register, you have this many blocks to start performing before you're vulnerable to pruning. Use this time to ensure your miner/validator is working correctly.
Example
With ImmunityPeriod of 4096 blocks (~13.5 hours), a newly registered miner cannot be pruned for ~13.5 hours regardless of their score. After that, if they're the lowest performer and the subnet is full, they can be replaced.
Common Questions
- Does immunity guarantee I keep my slot?
- Only during the immunity period. After it expires, you compete on merit. If you're the lowest performer on a full subnet, you can be pruned.
- Can subnet owners change the immunity period?
- Yes, via hyperparameter updates. Longer periods help new participants; shorter periods cycle out non-performers faster.
Use Cases
- Neuron lifecycle
- Pruning
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 InitialImmunityPeriod constant
const value = api.consts[stringCamelCase("SubtensorModule")][stringCamelCase("InitialImmunityPeriod")];
console.log("InitialImmunityPeriod:", value.toHuman());Type Information
- Type
- u16
- Byte Size
- 2 bytes
- Encoding
- fixed
- Raw Hex
- 0x0010
Runtime Info
- Pallet
- SubtensorModule
- First Version
- v101
- Latest Version
- v101
- Current Runtime
- v393