InitialWeightsVersionKey

Constant v101 → current u64

Ensures validators run compatible software.

Current Value

0
Relevant for: validatorssubnet ownersdevelopers

The Big Picture

When validators set weights, they must include a version key matching the subnet's expected version. This ensures validators run compatible software. If a subnet updates its validation mechanism, it increments the version key, forcing validators to update before they can continue setting weights.

Why This Matters

If your validator uses outdated software, your set_weights calls will fail version validation. Keep your validator software updated to match the subnet's expected version.

Example

A subnet updates from validation v2 to v3, changing WeightsVersionKey from 2 to 3. Validators still running v2 software have their set_weights calls rejected until they upgrade. This forces coordinated upgrades.

Common Questions

How do I find the current version key?
Query WeightsVersionKey storage for your subnet. Your validator software should include this in set_weights calls.
What if I'm running old software?
Your weight-setting calls fail. You won't earn emissions until you upgrade. The subnet continues without you until you update.

Use Cases

  • Weight validation
  • Version checks

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 InitialWeightsVersionKey constant
const value = api.consts[stringCamelCase("SubtensorModule")][stringCamelCase("InitialWeightsVersionKey")];
console.log("InitialWeightsVersionKey:", value.toHuman());

// Convert RAO to TAO if this is a balance value
const taoValue = value.toBigInt() / BigInt(1e9);
console.log("TAO:", taoValue.toString());

Type Information

Type
u64
Byte Size
8 bytes
Encoding
fixed
Raw Hex
0x0000000000000000

Runtime Info

Pallet
SubtensorModule
First Version
v101
Latest Version
v101
Current Runtime
v393