commit_mechanism_weights

Call v320 → current #115

Commits weights using the standard mechanism .

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: validatorsdevelopers

The Big Picture

Some subnets use 'mechanism weights' - a weighted consensus approach that may differ from standard Yuma. This call commits to mechanism weights specifically. The 'mechanism' part indicates these weights feed into a particular consensus algorithm or incentive mechanism defined by the subnet.

Why This Matters

Different subnets can have different consensus mechanisms. If your subnet uses mechanism weights, you must commit using this call (not generic commit_weights). The commitment format and reveal process are mechanism-specific.

Example Scenario

Subnet 15 uses a custom mechanism requiring mechanism weight commits. Evaluate miners according to the mechanism's rules, compute commitment hash. Call commit_mechanism_weights(netuid=15, commit_hash=hash). Wait for reveal window, then use reveal_mechanism_weights to complete the cycle.

Common Questions

What's the difference from regular commit_weights?
commit_weights is for standard Yuma consensus. commit_mechanism_weights is for subnet-specific mechanisms. Use whichever the subnet requires.
How do I know which commit call to use?
Check subnet configuration (WeightMechanism parameter or documentation). The subnet owner specifies which weight system is in use.

Use Cases

  • Submit weight commitments on mechanism-based subnets
  • Participate in consensus requiring mechanism-aware commits
  • Standard way to commit when subnet uses mechanism weights

From Chain Metadata

- Used to commit a hash of your weight values to later be revealed for mechanisms.

Input Parameters

#NameTypeDescription
0
netuid
u16 Subnet/network identifier (0-65535)
1
mecid
u8 mecid (u8)
2
commit_hash
H256 commit_hash (H256)

Permissions

Origin
Signed
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Commit-reveal enabled
  • Validator registered on subnet
  • Valid commitment hash provided

Effects

Events Emitted

Storage Modified

Postconditions

  • Weight commit stored
  • Commit timestamp recorded

Side Effects

  • Must reveal before expiration
  • Locks validator into committed weights

Possible Errors

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

// Build commit_mechanism_weights call
const netuid = 1;
const mecid = 0;
const commit_hash = 0 as any /* H256 */;

const call = api.tx[stringCamelCase("SubtensorModule")][stringCamelCase("commit_mechanism_weights")](
  netuid,
  mecid,
  commit_hash
);

Runtime Info

View Source
Pallet Index
7
Call Index
115
First Version
v320
Current Version
v393