Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pallets/admin-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ pub mod pallet {
netuid: NetUid,
registration_allowed: bool,
) -> DispatchResult {
ensure_root(origin)?;
pallet_subtensor::Pallet::<T>::ensure_subnet_owner_or_root(origin, netuid)?;

pallet_subtensor::Pallet::<T>::set_network_pow_registration_allowed(
netuid,
Expand Down
15 changes: 0 additions & 15 deletions pallets/admin-utils/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -999,19 +997,6 @@ fn test_sudo_set_network_pow_registration_allowed() {
init_value
);

assert_eq!(
AdminUtils::sudo_set_network_pow_registration_allowed(
<<Test as Config>::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(
<<Test as Config>::RuntimeOrigin>::root(),
netuid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ pub fn migrate_set_registration_enable<T: Config>() -> Weight {
continue;
}

if !Pallet::<T>::get_network_pow_registration_allowed(*netuid) {
Pallet::<T>::set_network_pow_registration_allowed(*netuid, true);
weight = weight.saturating_add(T::DbWeight::get().writes(1));
}

if !Pallet::<T>::get_network_registration_allowed(*netuid) {
Pallet::<T>::set_network_registration_allowed(*netuid, true);
weight = weight.saturating_add(T::DbWeight::get().writes(1));
Expand Down
4 changes: 2 additions & 2 deletions pallets/subtensor/src/tests/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
));
}
Expand Down
Loading