@@ -1180,154 +1180,6 @@ fn test_sudo_set_target_stakes_per_interval() {
11801180 } ) ;
11811181}
11821182
1183- #[ test]
1184- fn alpha_low_can_only_be_called_by_admin ( ) {
1185- new_test_ext ( ) . execute_with ( || {
1186- let netuid: u16 = 1 ;
1187- let to_be_set: u16 = 52428 ; // 0.8 i.e. 0.8 x u16::MAX
1188- assert_eq ! (
1189- AdminUtils :: sudo_set_alpha_low(
1190- <<Test as Config >:: RuntimeOrigin >:: signed( U256 :: from( 1 ) ) ,
1191- netuid,
1192- to_be_set
1193- ) ,
1194- Err ( DispatchError :: BadOrigin )
1195- ) ;
1196- } ) ;
1197- }
1198-
1199- #[ test]
1200- fn sets_alpha_low_valid_value ( ) {
1201- new_test_ext ( ) . execute_with ( || {
1202- let netuid: u16 = 1 ;
1203- let to_be_set: u16 = 52428 ; // 0.8 i.e. 0.8 x u16::MAX
1204- let init_value = SubtensorModule :: get_alpha_low ( netuid) ;
1205- assert_eq ! ( SubtensorModule :: get_alpha_low( netuid) , init_value) ;
1206- assert_ok ! ( AdminUtils :: sudo_set_liquid_alpha_enabled(
1207- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1208- netuid,
1209- true ,
1210- ) ) ;
1211- assert_ok ! ( AdminUtils :: sudo_set_alpha_low(
1212- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1213- netuid,
1214- to_be_set
1215- ) ) ;
1216- assert_eq ! ( SubtensorModule :: get_alpha_low( netuid) , to_be_set) ;
1217- } ) ;
1218- }
1219-
1220- #[ test]
1221- fn alpha_low_fails_if_liquid_alpha_disabled ( ) {
1222- new_test_ext ( ) . execute_with ( || {
1223- let netuid: u16 = 1 ;
1224- let to_be_set: u16 = 52428 ; // 0.8 i.e. 0.8 x u16::MAX
1225- assert_eq ! (
1226- AdminUtils :: sudo_set_alpha_low(
1227- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1228- netuid,
1229- to_be_set
1230- ) ,
1231- Err ( SubtensorError :: <Test >:: LiquidAlphaDisabled . into( ) )
1232- ) ;
1233- } ) ;
1234- }
1235-
1236- #[ test]
1237- fn alpha_low_fails_if_alpha_low_too_low ( ) {
1238- new_test_ext ( ) . execute_with ( || {
1239- let netuid: u16 = 1 ;
1240- let to_be_set: u16 = 0 ; // Invalid value
1241- assert_ok ! ( AdminUtils :: sudo_set_liquid_alpha_enabled(
1242- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1243- netuid,
1244- true ,
1245- ) ) ;
1246- assert_eq ! (
1247- AdminUtils :: sudo_set_alpha_low(
1248- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1249- netuid,
1250- to_be_set
1251- ) ,
1252- Err ( SubtensorError :: <Test >:: AlphaLowTooLow . into( ) )
1253- ) ;
1254- } ) ;
1255- }
1256-
1257- #[ test]
1258- fn alpha_high_can_only_be_called_by_admin ( ) {
1259- new_test_ext ( ) . execute_with ( || {
1260- let netuid: u16 = 1 ;
1261- let to_be_set: u16 = 60000 ; // Valid value
1262- assert_eq ! (
1263- AdminUtils :: sudo_set_alpha_high(
1264- <<Test as Config >:: RuntimeOrigin >:: signed( U256 :: from( 1 ) ) ,
1265- netuid,
1266- to_be_set
1267- ) ,
1268- Err ( DispatchError :: BadOrigin )
1269- ) ;
1270- } ) ;
1271- }
1272-
1273- #[ test]
1274- fn sets_a_valid_value ( ) {
1275- new_test_ext ( ) . execute_with ( || {
1276- let netuid: u16 = 1 ;
1277- let to_be_set: u16 = 60000 ; // Valid value
1278- let init_value = SubtensorModule :: get_alpha_high ( netuid) ;
1279- assert_eq ! ( SubtensorModule :: get_alpha_high( netuid) , init_value) ;
1280- assert_ok ! ( AdminUtils :: sudo_set_liquid_alpha_enabled(
1281- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1282- netuid,
1283- true ,
1284- ) ) ;
1285- assert_ok ! ( AdminUtils :: sudo_set_alpha_high(
1286- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1287- netuid,
1288- to_be_set
1289- ) ) ;
1290- assert_eq ! ( SubtensorModule :: get_alpha_high( netuid) , to_be_set) ;
1291- } ) ;
1292- }
1293-
1294- #[ test]
1295- fn alpha_high_fails_if_liquid_alpha_disabled ( ) {
1296- new_test_ext ( ) . execute_with ( || {
1297- let netuid: u16 = 1 ;
1298- let to_be_set: u16 = 60000 ; // Valid value
1299- assert_eq ! (
1300- AdminUtils :: sudo_set_alpha_high(
1301- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1302- netuid,
1303- to_be_set
1304- ) ,
1305- Err ( SubtensorError :: <Test >:: LiquidAlphaDisabled . into( ) )
1306- ) ;
1307- } ) ;
1308- }
1309-
1310- #[ test]
1311- fn fails_if_alpha_high_too_low ( ) {
1312- new_test_ext ( ) . execute_with ( || {
1313- let netuid: u16 = 1 ;
1314- let to_be_set: u16 = 50000 ; // Invalid value, less than 52428
1315- assert_ok ! ( AdminUtils :: sudo_set_liquid_alpha_enabled(
1316- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1317- netuid,
1318- true ,
1319- ) ) ;
1320- assert_eq ! (
1321- AdminUtils :: sudo_set_alpha_high(
1322- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1323- netuid,
1324- to_be_set
1325- ) ,
1326- Err ( SubtensorError :: <Test >:: AlphaHighTooLow . into( ) )
1327- ) ;
1328- } ) ;
1329- }
1330-
13311183#[ test]
13321184fn test_sudo_set_liquid_alpha_enabled ( ) {
13331185 new_test_ext ( ) . execute_with ( || {
0 commit comments