From 76a823762e2362031dff2a79ce61193dba3a6a05 Mon Sep 17 00:00:00 2001 From: John Reed <87283488+JohnReedV@users.noreply.github.com> Date: Thu, 3 Jul 2025 11:58:02 -0700 Subject: [PATCH 1/4] allow owner to toggle POW registrations --- pallets/admin-utils/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/admin-utils/src/lib.rs b/pallets/admin-utils/src/lib.rs index 752b834c48..b63e5d1d7e 100644 --- a/pallets/admin-utils/src/lib.rs +++ b/pallets/admin-utils/src/lib.rs @@ -632,7 +632,7 @@ pub mod pallet { netuid: NetUid, registration_allowed: bool, ) -> DispatchResult { - ensure_root(origin)?; + pallet_subtensor::Pallet::::ensure_subnet_owner_or_root(origin, netuid)?; pallet_subtensor::Pallet::::set_network_pow_registration_allowed( netuid, From 4b54033ddcb09627a6e3855751bd3fc8b7d0c18f Mon Sep 17 00:00:00 2001 From: John Reed <87283488+JohnReedV@users.noreply.github.com> Date: Thu, 3 Jul 2025 11:58:24 -0700 Subject: [PATCH 2/4] remove POW-registration from migration --- .../src/migrations/migrate_set_registration_enable.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pallets/subtensor/src/migrations/migrate_set_registration_enable.rs b/pallets/subtensor/src/migrations/migrate_set_registration_enable.rs index d066ed6b74..adb8209662 100644 --- a/pallets/subtensor/src/migrations/migrate_set_registration_enable.rs +++ b/pallets/subtensor/src/migrations/migrate_set_registration_enable.rs @@ -34,11 +34,6 @@ pub fn migrate_set_registration_enable() -> Weight { continue; } - if !Pallet::::get_network_pow_registration_allowed(*netuid) { - Pallet::::set_network_pow_registration_allowed(*netuid, true); - weight = weight.saturating_add(T::DbWeight::get().writes(1)); - } - if !Pallet::::get_network_registration_allowed(*netuid) { Pallet::::set_network_registration_allowed(*netuid, true); weight = weight.saturating_add(T::DbWeight::get().writes(1)); From 32672c28cde09f76c9280c1bb96e2c9aca830f69 Mon Sep 17 00:00:00 2001 From: John Reed <87283488+JohnReedV@users.noreply.github.com> Date: Thu, 3 Jul 2025 12:07:20 -0700 Subject: [PATCH 3/4] revert test --- pallets/admin-utils/src/tests/mod.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/pallets/admin-utils/src/tests/mod.rs b/pallets/admin-utils/src/tests/mod.rs index cfac6310bf..400c55a7fe 100644 --- a/pallets/admin-utils/src/tests/mod.rs +++ b/pallets/admin-utils/src/tests/mod.rs @@ -983,8 +983,6 @@ fn test_sudo_set_network_pow_registration_allowed() { let to_be_set: bool = true; add_network(netuid, 10); - let owner = SubtensorModule::get_subnet_owner(netuid); - let init_value: bool = SubtensorModule::get_network_pow_registration_allowed(netuid); assert_eq!( AdminUtils::sudo_set_network_pow_registration_allowed( @@ -999,19 +997,6 @@ fn test_sudo_set_network_pow_registration_allowed() { init_value ); - assert_eq!( - AdminUtils::sudo_set_network_pow_registration_allowed( - <::RuntimeOrigin>::signed(owner), - netuid, - to_be_set - ), - Err(DispatchError::BadOrigin) - ); - assert_eq!( - SubtensorModule::get_network_pow_registration_allowed(netuid), - init_value - ); - assert_ok!(AdminUtils::sudo_set_network_pow_registration_allowed( <::RuntimeOrigin>::root(), netuid, From 9c805ac36ad41835d4011a16e4c267903793470f Mon Sep 17 00:00:00 2001 From: John Reed <87283488+JohnReedV@users.noreply.github.com> Date: Thu, 3 Jul 2025 12:07:28 -0700 Subject: [PATCH 4/4] update migration test --- pallets/subtensor/src/tests/migration.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/subtensor/src/tests/migration.rs b/pallets/subtensor/src/tests/migration.rs index 0e75a7cc92..13c657b672 100644 --- a/pallets/subtensor/src/tests/migration.rs +++ b/pallets/subtensor/src/tests/migration.rs @@ -936,10 +936,10 @@ fn test_migrate_set_registration_enable() { Test, >(); - // After migration, registration should be enabled for all subnets except root + // After migration, regular registration should be enabled for all subnets except root for netuid in netuids.iter() { assert!(SubtensorModule::get_network_registration_allowed(*netuid)); - assert!(SubtensorModule::get_network_pow_registration_allowed( + assert!(!SubtensorModule::get_network_pow_registration_allowed( *netuid )); }