NetworkDissolveCleanupCompleted
Event v432 → v440, v441 → current #126Emitted when the phased cleanup walk for a dissolved subnet finishes and the subnet 's storage is fully cleared.
View events on chainThe Big Picture
Dissolution is not atomic. NetworkRemoved marks the start; this event marks the end. In between, the runtime walks a 26-phase cleanup in on_idle, bounded by whatever block weight is spare, resuming across blocks from a stored cursor. This event is the only signal the chain publishes that the walk is done and the subnet's storage is genuinely gone.
Why This Matters
Between NetworkRemoved and this event, a stake entry is readable in Alpha and AlphaV2 for a position whose holder has already been paid out in TAO. Reading storage in that window and treating the later clearing as a disposal counts the same position twice. This event tells you the window has closed.
Example Scenario
Subnet 35 is removed. Your indexer sees NetworkRemoved and reads Alpha for the subnet, finding live positions. Several blocks later NetworkDissolveCleanupCompleted fires for netuid 35 and the same reads return nothing. The payouts happened in the AlphaInOutStakesSettleStakes phase, before the AlphaInOutStakesAlpha phase cleared the entries you read.
Common Questions
- How long does cleanup take?
- There is no fixed duration. The walk consumes only spare block weight via on_idle, so it depends on how much subnet state there is and how busy the chain is. The walk is also skipped entirely while the beta-basket seed migration is in progress, and resumes on the first idle block after that migration completes.
- Does this event exist for every dissolution in history?
- No. The phased cleanup machinery, this event, DissolveCleanupQueue, CurrentDissolveCleanupStatus and NetworkRegistrationQueued all first appear at runtime v432, from block 8636190. Dissolutions before that block publish no completion event.
- Which event index should I decode against?
- The variant index moved from 122 (v432 to v440) to 126 (v441 onward). Resolve the index per runtime version rather than hardcoding it.
Use Cases
- Know when it is safe to read subnet storage as authoritatively empty
- Drive a position-closing step in an indexer or portfolio tracker
- Measure how long dissolution cleanup actually took
- Detect when a netuid slot is free to be reused
How to Use This Event
- → Subscribe alongside NetworkRemoved and pair the two by netuid
- → Treat storage reads for a dissolving netuid as provisional until this event arrives
- → Gate netuid reuse logic on this event rather than on NetworkRemoved
From Chain Metadata
data for a dissolved network has been cleaned up.
Triggers
Preconditions
- The netuid was removed earlier and pushed onto DissolveCleanupQueue
- Every DissolveCleanupPhase has completed, ending with NetworkAlphaAssetCounters
May fail with
Effects
Postconditions
- All subnet-scoped storage for this netuid is cleared
- The netuid is removed from DissolveCleanupQueue
- The netuid becomes available for reuse by a queued registration
Side Effects
- CurrentDissolveCleanupStatus is cleared when the queue empties
- process_network_registration_queue can now assign this netuid to a waiting registration
Event Data
| # | Name | Type | Description |
|---|---|---|---|
| 0 | netuid | NetUid | netuid: Subnet ID (u16, 0-65535) |
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 NetworkDissolveCleanupCompleted events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.SubtensorModule.NetworkDissolveCleanupCompleted.get(block.hash);
for (const evt of events) {
console.log("NetworkDissolveCleanupCompleted:", evt.payload);
}
});Version History
Runtime Info
View Source- Pallet Index
- 7
- Event Index
- 126
- First Version
- v432
- Current Version
- v472