File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -2744,6 +2744,42 @@ fn test_delegate_take_can_be_decreased() {
27442744 } ) ;
27452745}
27462746
2747+ // Verify delegate take can be decreased
2748+ #[ test]
2749+ fn test_can_set_zero_take_ok ( ) {
2750+ new_test_ext ( 1 ) . execute_with ( || {
2751+ // Make account
2752+ let hotkey0 = U256 :: from ( 1 ) ;
2753+ let coldkey0 = U256 :: from ( 3 ) ;
2754+
2755+ // Add balance
2756+ SubtensorModule :: add_balance_to_coldkey_account ( & coldkey0, 100000 ) ;
2757+
2758+ // Register the neuron to a new network
2759+ let netuid = 1 ;
2760+ add_network ( netuid, 0 , 0 ) ;
2761+ register_ok_neuron ( netuid, hotkey0, coldkey0, 124124 ) ;
2762+
2763+ // Coldkey / hotkey 0 become delegates
2764+ assert_ok ! ( SubtensorModule :: do_become_delegate(
2765+ <<Test as Config >:: RuntimeOrigin >:: signed( coldkey0) ,
2766+ hotkey0
2767+ ) ) ;
2768+
2769+ // Coldkey / hotkey 0 decreases take to 0%
2770+ assert_ok ! ( SubtensorModule :: do_decrease_take(
2771+ <<Test as Config >:: RuntimeOrigin >:: signed( coldkey0) ,
2772+ hotkey0,
2773+ netuid,
2774+ 0
2775+ ) ) ;
2776+ assert_eq ! (
2777+ SubtensorModule :: get_delegate_take( & hotkey0, netuid) ,
2778+ 0
2779+ ) ;
2780+ } ) ;
2781+ }
2782+
27472783// Verify delegate take can not be increased with do_decrease_take
27482784#[ test]
27492785fn test_delegate_take_can_not_be_increased_with_decrease_take ( ) {
You can’t perform that action at this time.
0 commit comments