File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
pallets/admin-utils/src/tests Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -2137,6 +2137,38 @@ fn test_owner_hyperparam_update_rate_limit_enforced() {
21372137 } ) ;
21382138}
21392139
2140+ // Verifies that when the owner hyperparameter rate limit is left at its default (0), hyperparameter
2141+ // updates are not blocked until a non-zero value is set.
2142+ #[ test]
2143+ fn test_hyperparam_rate_limit_not_blocking_with_default ( ) {
2144+ new_test_ext ( ) . execute_with ( || {
2145+ // Setup subnet and owner
2146+ let netuid = NetUid :: from ( 42 ) ;
2147+ add_network ( netuid, 10 ) ;
2148+ let owner: U256 = U256 :: from ( 77 ) ;
2149+ SubnetOwner :: < Test > :: insert ( netuid, owner) ;
2150+
2151+ // Read the default (unset) owner hyperparam rate limit
2152+ let default_limit = SubtensorModule :: get_owner_hyperparam_rate_limit ( ) ;
2153+
2154+ assert_eq ! ( default_limit, 0 ) ;
2155+
2156+ // First owner update should always succeed
2157+ assert_ok ! ( AdminUtils :: sudo_set_kappa(
2158+ <<Test as Config >:: RuntimeOrigin >:: signed( owner) ,
2159+ netuid,
2160+ 1
2161+ ) ) ;
2162+
2163+ // With default == 0, second immediate update should also pass (no rate limiting)
2164+ assert_ok ! ( AdminUtils :: sudo_set_kappa(
2165+ <<Test as Config >:: RuntimeOrigin >:: signed( owner) ,
2166+ netuid,
2167+ 2
2168+ ) ) ;
2169+ } ) ;
2170+ }
2171+
21402172#[ test]
21412173fn test_sudo_set_max_burn ( ) {
21422174 new_test_ext ( ) . execute_with ( || {
You can’t perform that action at this time.
0 commit comments