WeightsCommitted

Event Re-added v205 → v212, v216 → v247, v252 → v265, v273 → v277, v290 → v315, v320 → v326, v334 → v367, v372 → v377, v385 → current #83

Emitted when a validator commits a hash of their weights for later reveal.

View events on chain
Useful for: validatorssubnet ownersdevelopersanalytics

The Big Picture

Commit-reveal prevents weight copying attacks. Instead of publishing weights directly (where others can see and copy them), you commit a hash first. The hash hides your weights until the reveal phase. This ensures validators evaluate miners independently, making consensus more honest.

Why This Matters

In direct weight-setting, dishonest validators can copy others' weights. Commit-reveal fixes this: you commit a hash (proving you decided), then reveal actual weights later. If you don't reveal in time, your weights aren't counted. This event confirms your commit is locked in.

Example Scenario

You're validating subnet 3 which uses commit-reveal. You evaluate miners, compute weights, and submit a commit with hash(weights + salt). WeightsCommitted fires with your hotkey and the commit block. Now you wait for the reveal period, then call reveal_weights with your actual weights and salt.

Common Questions

What happens if I don't reveal in time?
Your commit expires. You get no weights set for that period and may lose validator trust/rewards. Always ensure your reveal mechanism is reliable.
Can I change my weights after committing?
No, you must reveal the exact weights you committed to (the hash must match). If you want different weights, you'd need to wait for this commit to expire or be revealed.
Why does only some subnets use commit-reveal?
Subnet owners decide. Commit-reveal adds complexity but improves consensus honesty. High-value subnets often enable it; simpler subnets may not need it.

Use Cases

  • Verify your weight commit was accepted
  • Monitor validator participation in commit-reveal
  • Track commit timing for consensus analysis
  • Build validator activity dashboards

How to Use This Event

  • Subscribe to your own hotkey to confirm commits
  • Monitor subnet-wide commit activity
  • Track timing between commits and reveals

From Chain Metadata

Weights have been successfully committed. **who**: The account ID of the user committing the weights. **netuid**: The network identifier. **commit_hash**: The hash representing the committed weights.

Triggers

Effects

Storage Modified

Postconditions

  • Commit hash stored in WeightCommits
  • Commit block recorded

Side Effects

  • Must reveal before commit expires
  • Cannot set weights directly while commit pending

Event Data

#NameTypeDescription
0
arg0
AccountId Event field #0 (AccountId) (hex -> SS58)
1
arg1
u16 Event field #1 (u16)
2
arg2
H256 Event field #2 (H256)

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

// Subscribe to WeightsCommitted events
api.query.system.events((events) => {
  events
    .filter(({ event }) =>
      event.section === stringCamelCase("SubtensorModule") &&
      event.method === "WeightsCommitted"
    )
    .forEach(({ event }) => {
      console.log("WeightsCommitted:", event.data.toHuman());
    });
});

On-Chain Activity

Emission Frequency
●●○○○○ Moderate 10K–100K emissions

Occasional use

#47 most emitted event

As of block 7,429,232

Version History

v205 block 4,209,446 3 args
v216 block 4,510,996 3 args
v252 block 5,163,656 3 args
v273 block 5,659,032 3 args
v290 block 5,947,548 3 args
v320 block 6,523,566 3 args
v334 block 6,811,690 3 args
v372 block 7,430,358 3 args
v385 block 7,782,670 3 args Current

Runtime Info

View Source
Pallet Index
7
Event Index
83
First Version
v205
Current Version
v393