commit_mechanism_weights
Call v320 → v424, v432 → current #115Commits weights using the standard mechanism .
View calls on chainCall Workflow
Click items to navigate. Pan and zoom to explore.
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.
Migration Notes
netuid changed from u16 to NetUid; mecid changed from u8 to MechId
Update decoders: SCALE encoding is positional, so any signature change (added, removed, or type-changed fields, or storage shape changes) shifts byte offsets and existing decoders will misparse this item. Re-derive types from the new metadata.
Input Parameters
Permissions
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
// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Build commit_mechanism_weights call (typed, named args)
const netuid = 1;
const mecid = undefined as any /* MechId — replace with real value */;
const commit_hash = "0x0000000000000000000000000000000000000000000000000000000000000000";
const tx = api.tx.SubtensorModule.commit_mechanism_weights({
netuid,
mecid,
commit_hash,
});On-Chain Activity
Infrequent
#71 most used call
80–95% of submissions succeed
As of block 9,385,000
Version History
Runtime Info
View Source- Pallet Index
- 7
- Call Index
- 115
- First Version
- v320
- Current Version
- v490