BatchWeightsCompleted
Event Re-added v216 → v247, v252 → v265, v273 → v277, v290 → v315, v320 → v326, v334 → v367, v372 → v377, v385 → current #86Emitted when a batch of weights is successfully set across multiple subnets.
View events on chainThe Big Picture
Validators operating on multiple subnets can set all their weights in one transaction instead of submitting separately to each subnet. This saves fees, reduces complexity, and ensures atomic updates. BatchWeightsCompleted confirms all weights in the batch were successfully applied - your multi-subnet validation is current.
Why This Matters
Managing weights on 5+ subnets with individual transactions is expensive and error-prone. Batch operations let you update everything at once. This event confirms the batch succeeded completely - all subnets updated, all weights applied.
Example Scenario
You validate on subnets 1, 3, 5, 7, and 9. Instead of 5 set_weights calls, you batch them. BatchWeightsCompleted fires, confirming all 5 subnets received their weight updates in a single transaction. Your operational costs are lower and your updates are atomic.
Common Questions
- What if one subnet's weights fail validation?
- Check BatchWeightItemFailed events for specific failures. The batch might partially succeed or completely fail depending on implementation - check your runtime's batch semantics.
- Is there a limit to how many subnets I can batch?
- Likely yes, due to transaction size limits. Check the batch weight function documentation for maximum items per batch.
- Can I mix commit-reveal and direct weights in a batch?
- Depends on the batch function. Some batch operations are for direct weights only, others might support mixed operations. Check your specific batch function's capabilities.
Use Cases
- Confirm batch weight setting succeeded across subnets
- Track multi-subnet validator efficiency
- Monitor batch operations for validation optimization
- Build efficient multi-subnet validator tools
How to Use This Event
- → Confirm batch weight operations succeeded
- → Track validator efficiency across subnets
- → Build batch operation monitoring tools
From Chain Metadata
A batch of weights (or commits) have been force-set. **netuids**: The netuids these weights were successfully set/committed for. **who**: The hotkey that set this batch.
Triggers
Emitted by
Preconditions
- Validator registered on all target subnets
- Valid weight vectors for each subnet
May fail with
Effects
Storage Modified
Postconditions
- Weights updated on all specified subnets
Side Effects
- More efficient than individual set_weights calls
Event Data
| # | Name | Type | Description |
|---|---|---|---|
| 0 | arg0 | Vec<Compact<u16>> Vec | Event field #0 (Vec<Compact<u16>>) |
| 1 | arg1 | AccountId | Event field #1 (AccountId) (hex -> SS58) |
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 BatchWeightsCompleted events
api.query.system.events((events) => {
events
.filter(({ event }) =>
event.section === stringCamelCase("SubtensorModule") &&
event.method === "BatchWeightsCompleted"
)
.forEach(({ event }) => {
console.log("BatchWeightsCompleted:", event.data.toHuman());
});
});Version History
Runtime Info
View Source- Pallet Index
- 7
- Event Index
- 86
- First Version
- v216
- Current Version
- v393