File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
pallets/admin-utils/src/tests Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -2269,3 +2269,39 @@ fn test_sudo_set_subsubnet_count() {
22692269 ) ) ;
22702270 } ) ;
22712271}
2272+
2273+ #[ test]
2274+ fn test_sudo_set_ck_burn ( ) {
2275+ new_test_ext ( ) . execute_with ( || {
2276+ let netuid = NetUid :: from ( 1 ) ;
2277+ let to_be_set: u64 = 1000000 ;
2278+
2279+ // Set up a network
2280+ add_network ( netuid, 10 ) ;
2281+
2282+ let init_value = pallet_subtensor:: CKBurn :: < Test > :: get ( netuid) ;
2283+
2284+ // Test that non-root origin fails
2285+ assert_eq ! (
2286+ AdminUtils :: sudo_set_ck_burn(
2287+ <<Test as Config >:: RuntimeOrigin >:: signed( U256 :: from( 1 ) ) ,
2288+ netuid,
2289+ to_be_set
2290+ ) ,
2291+ Err ( DispatchError :: BadOrigin )
2292+ ) ;
2293+ // Value should remain unchanged
2294+ assert_eq ! ( SubtensorModule :: get_ck_burn( netuid) , init_value) ;
2295+
2296+ // Test that root can set the CK burn successfully
2297+ assert_ok ! ( AdminUtils :: sudo_set_ck_burn(
2298+ <<Test as Config >:: RuntimeOrigin >:: root( ) ,
2299+ netuid,
2300+ to_be_set
2301+ ) ) ;
2302+
2303+ // Verify the value was set correctly
2304+ let set_value = pallet_subtensor:: CKBurn :: < Test > :: get ( netuid) ;
2305+ assert_eq ! ( set_value, to_be_set) ;
2306+ } ) ;
2307+ }
You can’t perform that action at this time.
0 commit comments