InitialMinAllowedWeights

Constant v101 → current u16

Prevents sparse weight matrices that could destabilize consensus.

Current Value

1024
Relevant for: validatorssubnet ownersdevelopers

The Big Picture

Validators set weights on miners to rate their performance. This constant ensures validators evaluate enough miners rather than concentrating rewards on just a few. Sparse weight matrices (evaluating only 1-2 miners) would allow validators to collude or game rewards. A minimum forces broader participation in the consensus mechanism.

Why This Matters

When writing validation code, you must set at least this many non-zero weights or your set_weights call will fail. This ensures fair distribution of emissions across the subnet.

Example

If MinAllowedWeights is 16, your validator must evaluate and assign non-zero weights to at least 16 different UIDs. Setting weights on only 5 UIDs will be rejected by the chain.

Common Questions

What if there are fewer miners than MinAllowedWeights?
The minimum is capped by the actual number of neurons. If only 10 miners exist, you can set weights on 10.
Can I set all weights to the same value?
Yes, the chain only checks count, not distribution. But equal weights mean equal emissions, which defeats the purpose of evaluation.

Use Cases

  • Weight validation
  • Network registration

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

Type Information

Type
u16
Byte Size
2 bytes
Encoding
fixed
Raw Hex
0x0004

Runtime Info

Pallet
SubtensorModule
First Version
v101
Latest Version
v101
Current Runtime
v393