reveal_mechanism_weights

Call v320 → current #116

Reveals weights committed via mechanism commit.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: validatorsdevelopers

The Big Picture

Completes the mechanism weight commit-reveal cycle. After committing with commit_mechanism_weights and waiting for the reveal window, this call publishes your actual weights. The chain verifies they match your commit, then applies them to the mechanism-specific consensus calculations.

Why This Matters

Without revealing, your commitment expires unused. Reveal on time to have your weights count toward the mechanism's consensus. The reveal proves you committed to these specific weights before seeing others' commits.

Example Scenario

You committed mechanism weights for subnet 15. Reveal window opens at block 500,000. Call reveal_mechanism_weights(netuid=15, uids=[...], weights=[...], salt='your_salt'). Chain verifies hash(weights, salt) == your commit. Weights applied to mechanism consensus.

Common Questions

What if I miss the reveal window?
Your commit expires. You don't get penalized, but your weights don't count for that epoch. Set alerts to ensure timely reveals.
Can I use reveal_weights instead of reveal_mechanism_weights?
No - mechanism commits must be revealed with mechanism reveal. The calls are paired by type. Mismatched reveal calls will fail.

Use Cases

  • Complete mechanism weight commit-reveal cycle
  • Publish mechanism weights after commit window closes
  • Participate in mechanism-based subnet consensus

From Chain Metadata

- Used to reveal the weights for a previously committed hash for mechanisms.

Input Parameters

#NameTypeDescription
0
netuid
u16 Subnet/network identifier (0-65535)
1
mecid
u8 mecid (u8)
2
uids
Vec<u16> Vecuids (Vec<u16>)
3
values
Vec<u16> Vecvalues (Vec<u16>)
4
salt
Vec<u16> Vecsalt (Vec<u16>)
5
version_key
u64 version_key (u64)

Permissions

Origin
Signed
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Mechanism commit exists for this validator
  • Reveal matches commitment hash
  • Within reveal window

Effects

Postconditions

  • Mechanism weights applied
  • Commit cleared
  • Weight version incremented

Side Effects

  • Clears mechanism commit
  • Affects mechanism-specific consensus calculations

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 reveal_mechanism_weights call
const netuid = 1;
const mecid = 0;
const uids = 0;
const values = 0;
const salt = 0;
const version_key = 0;

const call = api.tx[stringCamelCase("SubtensorModule")][stringCamelCase("reveal_mechanism_weights")](
  netuid,
  mecid,
  uids,
  values,
  salt,
  version_key
);

Runtime Info

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