ImmunityPeriodSet

Event Re-added v101 → v127, v133 → v219, v233 → v265, v273 → v277, v290 → current #23

Emitted when neuron immunity period is changed.

View events on chain
Useful for: minersvalidatorssubnet ownersanalyticsdevelopers

The Big Picture

When you register on a subnet, you start at the bottom - no trust, no track record. The immunity period is your 'grace period' where you can't be pruned for poor performance. This gives you time to set up, sync, and start contributing before being judged. Without immunity, new neurons could be pruned immediately before they have a chance to prove themselves. Longer immunity = safer for new participants, shorter = faster quality enforcement.

Why This Matters

Immunity period is your safety net as a new participant. If you're registering as a miner, you need time to get your model running and start producing valid outputs. If immunity is too short, you might get pruned before you're ready. This event tells you when the rules change.

Example Scenario

Subnet 12 had a 3-day immunity period (7200 blocks at 12s/block). The owner wants faster quality enforcement and reduces it to 1 day (2400 blocks). ImmunityPeriodSet fires. New registrants now only have 1 day to get their systems working before they can be pruned for poor performance.

Common Questions

Does immunity period affect existing neurons?
Only if they're still within their original immunity window. Neurons who already passed their immunity period are unaffected by changes to this parameter.
Can I be pruned during immunity for any reason?
You're protected from performance-based pruning during immunity. However, you can still be removed for other reasons like explicit deregistration or severe violations.
How do I know when my immunity ends?
Track when you registered and add the immunity period in blocks. Monitor your registration block and calculate: end_block = registration_block + immunity_period.

Use Cases

  • Understand protection window for new registrations
  • Plan validator onboarding around immunity period
  • Monitor subnet policy changes affecting new participants
  • Analyze subnet churn dynamics

How to Use This Event

  • Check immunity period before registering to know your safety window
  • Monitor changes that affect new participant experience
  • Track immunity across subnets to compare newcomer-friendliness

From Chain Metadata

immunity period is set for a subnet.

Triggers

Preconditions

  • Caller has admin/sudo privileges
  • New period is within valid range

Effects

Postconditions

  • ImmunityPeriod updated for subnet
  • New registrations use updated immunity window

Side Effects

  • New neurons protected for this many blocks after registration
  • Affects how quickly new registrants can be pruned

Event Data

#NameTypeDescription
0
arg0
u16 Event field #0 (u16)
1
arg1
u16 Event field #1 (u16)

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 });

// Subscribe to ImmunityPeriodSet events
api.query.system.events((events) => {
  events
    .filter(({ event }) =>
      event.section === stringCamelCase("SubtensorModule") &&
      event.method === "ImmunityPeriodSet"
    )
    .forEach(({ event }) => {
      console.log("ImmunityPeriodSet:", event.data.toHuman());
    });
});

Version History

v101 block 1 2 args
v133 block 1,404,224 2 args
v233 block 4,920,350 2 args
v273 block 5,659,032 2 args
v290 block 5,947,548 2 args Current

Runtime Info

View Source
Pallet Index
7
Event Index
23
First Version
v101
Current Version
v393