@@ -305,7 +305,7 @@ fn add_stake_limit_success_executes_within_price_guard() {
305305
306306 pallet_subtensor:: Pallet :: < mock:: Test > :: add_balance_to_coldkey_account (
307307 & coldkey,
308- amount_raw + 1_000_000_000 ,
308+ amount_raw. saturating_add ( 1_000_000_000 ) ,
309309 ) ;
310310
311311 let stake_before =
@@ -1001,17 +1001,24 @@ mod proxy_dispatch_tests {
10011001 let netuid = mock:: add_dynamic_network ( & owner_hotkey, & owner_coldkey) ;
10021002 mock:: setup_reserves (
10031003 netuid,
1004- ( amount_raw * 1_000 ) . into ( ) ,
1005- AlphaCurrency :: from ( amount_raw * 10_000 ) ,
1004+ amount_raw. saturating_mul ( 1_000 ) . into ( ) ,
1005+ AlphaCurrency :: from ( amount_raw. saturating_mul ( 10_000 ) ) ,
10061006 ) ;
10071007 mock:: register_ok_neuron ( netuid, hotkey, real_coldkey, 0 ) ;
10081008
10091009 pallet_subtensor:: Pallet :: < mock:: Test > :: add_balance_to_coldkey_account (
10101010 & real_coldkey,
1011- amount_raw + 1_000_000_000 ,
1011+ amount_raw. saturating_add ( 1_000_000_000 ) ,
10121012 ) ;
10131013
1014- ( real_coldkey, contract, hotkey, U256 :: from ( 10303 ) , amount_raw, netuid. into ( ) )
1014+ (
1015+ real_coldkey,
1016+ contract,
1017+ hotkey,
1018+ U256 :: from ( 10303 ) ,
1019+ amount_raw,
1020+ netuid. into ( ) ,
1021+ )
10151022 }
10161023
10171024 fn stake_and_setup (
@@ -1049,9 +1056,13 @@ mod proxy_dispatch_tests {
10491056 0 ,
10501057 ) ;
10511058
1052- let input =
1053- ( real_coldkey, hotkey, NetUid :: from ( netuid) , TaoCurrency :: from ( amount_raw) )
1054- . encode ( ) ;
1059+ let input = (
1060+ real_coldkey,
1061+ hotkey,
1062+ NetUid :: from ( netuid) ,
1063+ TaoCurrency :: from ( amount_raw) ,
1064+ )
1065+ . encode ( ) ;
10551066 let mut env = MockEnv :: new ( FunctionId :: ProxyAddStakeV1 , contract, input) ;
10561067
10571068 let ret = SubtensorChainExtension :: < mock:: Test > :: dispatch ( & mut env) . unwrap ( ) ;
@@ -1074,9 +1085,13 @@ mod proxy_dispatch_tests {
10741085 0 ,
10751086 ) ;
10761087
1077- let input =
1078- ( real_coldkey, hotkey, NetUid :: from ( netuid) , TaoCurrency :: from ( amount_raw) )
1079- . encode ( ) ;
1088+ let input = (
1089+ real_coldkey,
1090+ hotkey,
1091+ NetUid :: from ( netuid) ,
1092+ TaoCurrency :: from ( amount_raw) ,
1093+ )
1094+ . encode ( ) ;
10801095 let mut env = MockEnv :: new ( FunctionId :: ProxyAddStakeV1 , contract, input) ;
10811096
10821097 let ret = SubtensorChainExtension :: < mock:: Test > :: dispatch ( & mut env) . unwrap ( ) ;
@@ -1089,13 +1104,20 @@ mod proxy_dispatch_tests {
10891104 mock:: new_test_ext ( 1 ) . execute_with ( || {
10901105 let ( real_coldkey, contract, hotkey, _, amount_raw, netuid) = setup_staked_env ( 10 ) ;
10911106
1092- let input =
1093- ( real_coldkey, hotkey, NetUid :: from ( netuid) , TaoCurrency :: from ( amount_raw) )
1094- . encode ( ) ;
1107+ let input = (
1108+ real_coldkey,
1109+ hotkey,
1110+ NetUid :: from ( netuid) ,
1111+ TaoCurrency :: from ( amount_raw) ,
1112+ )
1113+ . encode ( ) ;
10951114 let mut env = MockEnv :: new ( FunctionId :: ProxyAddStakeV1 , contract, input) ;
10961115
10971116 let ret = SubtensorChainExtension :: < mock:: Test > :: dispatch ( & mut env) ;
1098- assert ! ( matches!( ret, Err ( DispatchError :: Other ( "Not authorized proxy" ) ) ) ) ;
1117+ assert ! ( matches!(
1118+ ret,
1119+ Err ( DispatchError :: Other ( "Not authorized proxy" ) )
1120+ ) ) ;
10991121 } ) ;
11001122 }
11011123
@@ -1110,13 +1132,20 @@ mod proxy_dispatch_tests {
11101132 0 ,
11111133 ) ;
11121134
1113- let input =
1114- ( real_coldkey, hotkey, NetUid :: from ( netuid) , TaoCurrency :: from ( amount_raw) )
1115- . encode ( ) ;
1135+ let input = (
1136+ real_coldkey,
1137+ hotkey,
1138+ NetUid :: from ( netuid) ,
1139+ TaoCurrency :: from ( amount_raw) ,
1140+ )
1141+ . encode ( ) ;
11161142 let mut env = MockEnv :: new ( FunctionId :: ProxyAddStakeV1 , contract, input) ;
11171143
11181144 let ret = SubtensorChainExtension :: < mock:: Test > :: dispatch ( & mut env) ;
1119- assert ! ( matches!( ret, Err ( DispatchError :: Other ( "Not authorized proxy" ) ) ) ) ;
1145+ assert ! ( matches!(
1146+ ret,
1147+ Err ( DispatchError :: Other ( "Not authorized proxy" ) )
1148+ ) ) ;
11201149 } ) ;
11211150 }
11221151
@@ -1131,13 +1160,20 @@ mod proxy_dispatch_tests {
11311160 10 ,
11321161 ) ;
11331162
1134- let input =
1135- ( real_coldkey, hotkey, NetUid :: from ( netuid) , TaoCurrency :: from ( amount_raw) )
1136- . encode ( ) ;
1163+ let input = (
1164+ real_coldkey,
1165+ hotkey,
1166+ NetUid :: from ( netuid) ,
1167+ TaoCurrency :: from ( amount_raw) ,
1168+ )
1169+ . encode ( ) ;
11371170 let mut env = MockEnv :: new ( FunctionId :: ProxyAddStakeV1 , contract, input) ;
11381171
11391172 let ret = SubtensorChainExtension :: < mock:: Test > :: dispatch ( & mut env) ;
1140- assert ! ( matches!( ret, Err ( DispatchError :: Other ( "Not authorized proxy" ) ) ) ) ;
1173+ assert ! ( matches!(
1174+ ret,
1175+ Err ( DispatchError :: Other ( "Not authorized proxy" ) )
1176+ ) ) ;
11411177 } ) ;
11421178 }
11431179
@@ -1315,7 +1351,10 @@ mod proxy_dispatch_tests {
13151351 let mut env = MockEnv :: new ( FunctionId :: ProxyTransferStakeV1 , contract, input) ;
13161352
13171353 let ret = SubtensorChainExtension :: < mock:: Test > :: dispatch ( & mut env) ;
1318- assert ! ( matches!( ret, Err ( DispatchError :: Other ( "Not authorized proxy" ) ) ) ) ;
1354+ assert ! ( matches!(
1355+ ret,
1356+ Err ( DispatchError :: Other ( "Not authorized proxy" ) )
1357+ ) ) ;
13191358 } ) ;
13201359 }
13211360
@@ -1422,15 +1461,14 @@ mod proxy_dispatch_tests {
14221461
14231462 pallet_subtensor:: Owner :: < mock:: Test > :: insert ( hotkey, real_coldkey) ;
14241463 pallet_subtensor:: OwnedHotkeys :: < mock:: Test > :: insert ( real_coldkey, vec ! [ hotkey] ) ;
1425- pallet_subtensor:: Uids :: < mock:: Test > :: insert (
1426- NetUid :: from ( netuid) ,
1427- hotkey,
1428- 0u16 ,
1429- ) ;
1464+ pallet_subtensor:: Uids :: < mock:: Test > :: insert ( NetUid :: from ( netuid) , hotkey, 0u16 ) ;
14301465
14311466 let input = ( real_coldkey, NetUid :: from ( netuid) , hotkey) . encode ( ) ;
1432- let mut env =
1433- MockEnv :: new ( FunctionId :: ProxySetColdkeyAutoStakeHotkeyV1 , contract, input) ;
1467+ let mut env = MockEnv :: new (
1468+ FunctionId :: ProxySetColdkeyAutoStakeHotkeyV1 ,
1469+ contract,
1470+ input,
1471+ ) ;
14341472
14351473 let ret = SubtensorChainExtension :: < mock:: Test > :: dispatch ( & mut env) . unwrap ( ) ;
14361474 assert_success ( ret) ;
0 commit comments