@@ -251,9 +251,20 @@ fn test_subtoken_enable_reject_trading_before_enable() {
251251 let hotkey_account_2_id: U256 = U256 :: from ( 3 ) ;
252252 let amount = DefaultMinStake :: < Test > :: get ( ) * 10 ;
253253
254+ let stake_bal = 10_000_000_000 ; // 10 Alpha
255+
256+ let limit_price = 1_000_000_000 ; // not important
257+
254258 add_network_disable_subtoken ( netuid, 10 , 0 ) ;
255259 add_network_disable_subtoken ( netuid2, 10 , 0 ) ;
256260
261+ assert ! ( !SubtokenEnabled :: <Test >:: get( netuid) ) ;
262+ assert ! ( !SubtokenEnabled :: <Test >:: get( netuid2) ) ;
263+
264+ // Set liq high enough to not trigger other errors
265+ SubnetTAO :: < Test > :: set ( netuid, 20_000_000_000 ) ;
266+ SubnetAlphaIn :: < Test > :: set ( netuid, 20_000_000_000 ) ;
267+
257268 // Register so staking *could* work
258269 register_ok_neuron ( netuid, hotkey_account_id, coldkey_account_id, 0 ) ;
259270 register_ok_neuron ( netuid2, hotkey_account_id, coldkey_account_id, 100 ) ;
@@ -262,6 +273,14 @@ fn test_subtoken_enable_reject_trading_before_enable() {
262273
263274 SubtensorModule :: add_balance_to_coldkey_account ( & coldkey_account_id, 10_000 ) ;
264275
276+ // Give some stake
277+ SubtensorModule :: increase_stake_for_hotkey_and_coldkey_on_subnet (
278+ & hotkey_account_id,
279+ & coldkey_account_id,
280+ netuid,
281+ stake_bal,
282+ ) ;
283+
265284 // all trading extrinsic should be rejected.
266285 assert_noop ! (
267286 SubtensorModule :: add_stake(
@@ -273,6 +292,66 @@ fn test_subtoken_enable_reject_trading_before_enable() {
273292 Error :: <Test >:: SubtokenDisabled
274293 ) ;
275294
295+ assert_noop ! (
296+ SubtensorModule :: add_stake_limit(
297+ RuntimeOrigin :: signed( coldkey_account_id) ,
298+ hotkey_account_id,
299+ netuid,
300+ amount,
301+ limit_price,
302+ false
303+ ) ,
304+ Error :: <Test >:: SubtokenDisabled
305+ ) ;
306+
307+ // For unstake_all and unstake_all_alpha, the result is Ok, but the
308+ // operation is not performed.
309+ assert_ok ! (
310+ SubtensorModule :: unstake_all(
311+ RuntimeOrigin :: signed( coldkey_account_id) ,
312+ hotkey_account_id
313+ ) ,
314+ ( )
315+ ) ;
316+ // Check that the stake is still the same
317+ assert_eq ! (
318+ SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet(
319+ & hotkey_account_id,
320+ & coldkey_account_id,
321+ netuid
322+ ) ,
323+ stake_bal
324+ ) ;
325+
326+ assert_ok ! (
327+ SubtensorModule :: unstake_all_alpha(
328+ RuntimeOrigin :: signed( coldkey_account_id) ,
329+ hotkey_account_id
330+ ) ,
331+ ( )
332+ ) ;
333+ // Check that the stake is still the same
334+ assert_eq ! (
335+ SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet(
336+ & hotkey_account_id,
337+ & coldkey_account_id,
338+ netuid
339+ ) ,
340+ stake_bal
341+ ) ;
342+
343+ assert_noop ! (
344+ SubtensorModule :: remove_stake_limit(
345+ RuntimeOrigin :: signed( coldkey_account_id) ,
346+ hotkey_account_id,
347+ netuid,
348+ amount,
349+ limit_price,
350+ false
351+ ) ,
352+ Error :: <Test >:: SubtokenDisabled
353+ ) ;
354+
276355 assert_noop ! (
277356 SubtensorModule :: remove_stake(
278357 RuntimeOrigin :: signed( coldkey_account_id) ,
0 commit comments