Conversation
| let weight_used = Self::remove_network(*netuid, remaining_weight); | ||
| remaining_weight = remaining_weight.saturating_sub(weight_used); | ||
|
|
||
| DissolvedNetworks::<T>::mutate(|networks| networks.retain(|n| *n != *netuid)); |
There was a problem hiding this comment.
Since we use WeightMeterWrapper that does early return, we might have a situation where there is not enough weight to finish some particular operation. As a result, we will have partially cleaned data, but the removal will be marked as finalized. It would be great to simulate it in the test to check if this scenario is possible.
There was a problem hiding this comment.
I will add such test case.
|
|
||
| for netuid in dissolved_networks.iter() { | ||
| let weight_used = | ||
| Self::finalize_all_subnet_root_dividends(*netuid, remaining_weight); |
There was a problem hiding this comment.
Seems like we missed dissolve_all_liquidity_providers, is it intentional?
There was a problem hiding this comment.
It should be included. I mistake it is only called by disable_lp.
| root_claim_type: RootClaimTypeEnum, | ||
| ignore_minimum_condition: bool, | ||
| ) { | ||
| if DissolvedNetworks::<T>::get().contains(&netuid) { |
There was a problem hiding this comment.
Since we have a gap between the network that is marked for deletion and the actual deletion, shouldn't we add this check at all the other places? staking, etc.
There was a problem hiding this comment.
Usually we use the NetworksAdded or if_subnet_exist to check if the subnet is deleted. Maybe use the if_subnet_exist is better, I will check.
Description
The PR will fix the #2411, and optimize the process of dissolve a network.
Instead of remove all storages related to the netuid once, it will use the on_idle hook to remove these step by step.
and take the weights into consideration.
Related Issue(s)
Type of Change
Breaking Change
If this PR introduces a breaking change, please provide a detailed description of the impact and the migration path for existing applications.
Checklist
./scripts/fix_rust.shto ensure my code is formatted and linted correctlyScreenshots (if applicable)
Please include any relevant screenshots or GIFs that demonstrate the changes made.
Additional Notes
Please provide any additional information or context that may be helpful for reviewers.