Skip to content

Commit db6614e

Browse files
committed
don't dissolve root
1 parent 66a07b4 commit db6614e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pallets/subtensor/src/coinbase/root.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ impl<T: Config> Pallet<T> {
367367
pub fn do_dissolve_network(netuid: NetUid) -> dispatch::DispatchResult {
368368
// 1. --- The network exists?
369369
ensure!(
370-
Self::if_subnet_exist(netuid),
370+
Self::if_subnet_exist(netuid) && netuid != NetUid::ROOT,
371371
Error::<T>::SubNetworkDoesNotExist
372372
);
373373

@@ -418,7 +418,7 @@ impl<T: Config> Pallet<T> {
418418
for (uid_i, weights_i) in <Weights<T> as frame_support::storage::IterableStorageDoubleMap<
419419
NetUid,
420420
u16,
421-
sp_std::vec::Vec<(u16, u16)>,
421+
Vec<(u16, u16)>,
422422
>>::iter_prefix(NetUid::ROOT)
423423
{
424424
let mut modified_weights = weights_i.clone();

pallets/subtensor/src/tests/networks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ fn prune_selection_complex_state_exhaustive() {
11141114
// Remove n5; now n6 (price=0) should be selected.
11151115
// This validates robustness to holes / non-contiguous netuids.
11161116
// ---------------------------------------------------------------------
1117-
SubtensorModule::remove_network(n5);
1117+
SubtensorModule::do_dissolve_network(n5).expect("Expected not to panic");
11181118
assert_eq!(
11191119
SubtensorModule::get_network_to_prune(),
11201120
Some(n6),

0 commit comments

Comments
 (0)