@@ -3805,7 +3805,7 @@ fn test_revoke_child_no_min_stake_check() {
3805
3805
add_network ( netuid, 13 , 0 ) ;
3806
3806
register_ok_neuron ( netuid, parent, coldkey, 0 ) ;
3807
3807
3808
- // Set below minimum stake for setting children
3808
+ // Set minimum stake for setting children
3809
3809
let parent_total_stake_original = TotalHotkeyStake :: < Test > :: get ( parent) ;
3810
3810
StakeThreshold :: < Test > :: put ( 1_000_000_000_000 ) ;
3811
3811
TotalHotkeyStake :: < Test > :: insert ( parent, StakeThreshold :: < Test > :: get ( ) ) ;
@@ -3856,3 +3856,42 @@ fn test_revoke_child_no_min_stake_check() {
3856
3856
assert_eq ! ( children_after, vec![ ] ) ;
3857
3857
} ) ;
3858
3858
}
3859
+
3860
+ // Test that setting childkeys works even if subnet registration is disabled
3861
+ #[ test]
3862
+ fn test_do_set_child_registration_disabled ( ) {
3863
+ new_test_ext ( 1 ) . execute_with ( || {
3864
+ let coldkey = U256 :: from ( 1 ) ;
3865
+ let parent = U256 :: from ( 2 ) ;
3866
+ let child = U256 :: from ( 3 ) ;
3867
+ let netuid: u16 = 1 ;
3868
+ let proportion: u64 = 1000 ;
3869
+
3870
+ // Add network and register hotkey
3871
+ add_network ( netuid, 13 , 0 ) ;
3872
+ register_ok_neuron ( netuid, parent, coldkey, 0 ) ;
3873
+
3874
+ // Set minimum stake for setting children
3875
+ let parent_total_stake_original = TotalHotkeyStake :: < Test > :: get ( parent) ;
3876
+ StakeThreshold :: < Test > :: put ( 1_000_000_000_000 ) ;
3877
+ TotalHotkeyStake :: < Test > :: insert ( parent, StakeThreshold :: < Test > :: get ( ) ) ;
3878
+
3879
+ // Disable subnet registrations
3880
+ NetworkRegistrationAllowed :: < Test > :: insert ( netuid, false ) ;
3881
+
3882
+ // Schedule parent-child relationship
3883
+ assert_ok ! ( SubtensorModule :: do_schedule_children(
3884
+ RuntimeOrigin :: signed( coldkey) ,
3885
+ parent,
3886
+ netuid,
3887
+ vec![ ( proportion, child) ] ,
3888
+ ) ) ;
3889
+
3890
+ wait_and_set_pending_children ( netuid) ;
3891
+ TotalHotkeyStake :: < Test > :: insert ( parent, parent_total_stake_original) ;
3892
+
3893
+ // Ensure the childkeys are applied
3894
+ let children_after = SubtensorModule :: get_children ( & parent, netuid) ;
3895
+ assert_eq ! ( children_after, vec![ ( proportion, child) ] ) ;
3896
+ } ) ;
3897
+ }
0 commit comments