WeightsCommitted
Event Re-added v205 → v212, v216 → v247, v252 → v265, v273 → v277, v290 → v315, v320 → v326, v334 → v367, v372 → v377, v385 → current #83Emitted when a validator commits a hash of their weights for later reveal.
View events on chainThe 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
Preconditions
- Caller is registered validator on subnet
- Commit-reveal is enabled for this subnet
- No pending commit from this validator (or commit expired)
May fail with
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
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
Occasional use
#47 most emitted event
As of block 7,429,232
Version History
Runtime Info
View Source- Pallet Index
- 7
- Event Index
- 83
- First Version
- v205
- Current Version
- v393