BatchWeightsCompleted

Event v216 → v247, v252 → v265, v273 → v277, v290 → v315, v320 → v326, v334 → v367, v372 → v377, v385 → v402, v411 → current Changed in v411 #87

Emitted when a batch of weights is successfully set across multiple subnets.

View events on chain
Useful for: validatorssubnet ownersanalyticsdevelopers

The 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

Effects

Postconditions

  • Weights updated on all specified subnets

Side Effects

  • More efficient than individual set_weights calls

Event Data

#NameTypeDescription
0
arg0
→ list_of_compact_netuid
Vec<Compact<u16>> Vec list of compact-encoded Subnet ID (u16, 0-65535)
1
arg1
→ account
AccountId Account address (32 bytes, SS58-encoded) (hex -> SS58)

Code Examples

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

// Subscribe to BatchWeightsCompleted events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.SubtensorModule.BatchWeightsCompleted.get(block.hash);
  for (const evt of events) {
    console.log("BatchWeightsCompleted:", evt.payload);
  }
});

Version History

v216 block 4,510,996 2 args
v252 block 5,163,656 2 args
v273 block 5,659,032 2 args
v290 block 5,947,548 2 args
v320 block 6,523,566 2 args
v334 block 6,811,690 2 args
v372 block 7,430,358 2 args
v385 block 7,782,670 2 args
v411 block 8,283,784 2 args Current

Runtime Info

View Source
Pallet Index
7
Event Index
87
First Version
v216
Current Version
v411