Skip to content

Commit 4039b3b

Browse files
committed
add test for set diff no owner
1 parent 14a8758 commit 4039b3b

File tree

1 file changed

+12
-0
lines changed
  • pallets/admin-utils/src/tests

1 file changed

+12
-0
lines changed

pallets/admin-utils/src/tests/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,18 @@ fn test_sudo_set_difficulty() {
643643
to_be_set
644644
));
645645
assert_eq!(SubtensorModule::get_difficulty_as_u64(netuid), to_be_set);
646+
647+
// Test that SN owner can't set difficulty
648+
pallet_subtensor::SubnetOwner::<Test>::insert(netuid, U256::from(1));
649+
assert_eq!(
650+
AdminUtils::sudo_set_difficulty(
651+
<<Test as Config>::RuntimeOrigin>::signed(U256::from(1)),
652+
netuid,
653+
init_value
654+
),
655+
Err(DispatchError::BadOrigin)
656+
);
657+
assert_eq!(SubtensorModule::get_difficulty_as_u64(netuid), to_be_set); // no change
646658
});
647659
}
648660

0 commit comments

Comments
 (0)