11from bittensor import logging
22from bittensor .core .chain_data .stake_info import StakeInfo
33from bittensor .utils .balance import Balance
4- from tests .e2e_tests .utils .chain_interactions import ANY_BALANCE
4+ from tests .e2e_tests .utils .chain_interactions import get_dynamic_balance
55from tests .helpers .helpers import ApproxBalance
66
77logging .enable_info ()
@@ -177,8 +177,10 @@ def test_batch_operations(subtensor, alice_wallet, bob_wallet):
177177 )
178178
179179 assert balances == {
180- alice_wallet .coldkey .ss58_address : ANY_BALANCE ,
181- bob_wallet .coldkey .ss58_address : Balance .from_tao (999_998 ),
180+ alice_wallet .coldkey .ss58_address : get_dynamic_balance (
181+ balances [alice_wallet .coldkey .ss58_address ].rao , 2
182+ ),
183+ bob_wallet .coldkey .ss58_address : Balance .from_tao (999_998 ).set_unit (3 ),
182184 }
183185
184186 alice_balance = balances [alice_wallet .coldkey .ss58_address ]
@@ -240,7 +242,9 @@ def test_batch_operations(subtensor, alice_wallet, bob_wallet):
240242 )
241243
242244 assert balances == {
243- alice_wallet .coldkey .ss58_address : ANY_BALANCE ,
245+ alice_wallet .coldkey .ss58_address : get_dynamic_balance (
246+ balances [alice_wallet .coldkey .ss58_address ].rao , 2
247+ ),
244248 bob_wallet .coldkey .ss58_address : Balance .from_tao (999_998 ),
245249 }
246250 assert balances [alice_wallet .coldkey .ss58_address ] > alice_balance
@@ -525,6 +529,7 @@ def test_move_stake(subtensor, alice_wallet, bob_wallet):
525529 - Moving stake from one hotkey-subnet pair to another
526530 """
527531
532+ netuid = 1
528533 subtensor .burned_register (
529534 alice_wallet ,
530535 netuid = 1 ,
@@ -535,7 +540,7 @@ def test_move_stake(subtensor, alice_wallet, bob_wallet):
535540 assert subtensor .add_stake (
536541 alice_wallet ,
537542 alice_wallet .hotkey .ss58_address ,
538- netuid = 1 ,
543+ netuid = netuid ,
539544 amount = Balance .from_tao (1_000 ),
540545 wait_for_inclusion = True ,
541546 wait_for_finalization = True ,
@@ -547,10 +552,10 @@ def test_move_stake(subtensor, alice_wallet, bob_wallet):
547552 StakeInfo (
548553 hotkey_ss58 = alice_wallet .hotkey .ss58_address ,
549554 coldkey_ss58 = alice_wallet .coldkey .ss58_address ,
550- netuid = 1 ,
551- stake = ANY_BALANCE ,
555+ netuid = netuid ,
556+ stake = get_dynamic_balance ( stakes [ 0 ]. stake . rao , netuid ) ,
552557 locked = Balance (0 ),
553- emission = ANY_BALANCE ,
558+ emission = get_dynamic_balance ( stakes [ 0 ]. emission . rao , netuid ) ,
554559 drain = 0 ,
555560 is_registered = True ,
556561 ),
@@ -571,14 +576,15 @@ def test_move_stake(subtensor, alice_wallet, bob_wallet):
571576
572577 stakes = subtensor .get_stake_for_coldkey (alice_wallet .coldkey .ss58_address )
573578
579+ netuid = 2
574580 assert stakes == [
575581 StakeInfo (
576582 hotkey_ss58 = bob_wallet .hotkey .ss58_address ,
577583 coldkey_ss58 = alice_wallet .coldkey .ss58_address ,
578- netuid = 2 ,
579- stake = ANY_BALANCE ,
584+ netuid = netuid ,
585+ stake = get_dynamic_balance ( stakes [ 0 ]. stake . rao , netuid ) ,
580586 locked = Balance (0 ),
581- emission = ANY_BALANCE ,
587+ emission = get_dynamic_balance ( stakes [ 0 ]. emission . rao , netuid ) ,
582588 drain = 0 ,
583589 is_registered = True ,
584590 ),
@@ -589,20 +595,21 @@ def test_transfer_stake(subtensor, alice_wallet, bob_wallet, dave_wallet):
589595 """
590596 Tests:
591597 - Adding stake
592- - Transfering stake from one coldkey-subnet pair to another
598+ - Transferring stake from one coldkey-subnet pair to another
593599 """
600+ netuid = 1
594601
595602 subtensor .burned_register (
596603 alice_wallet ,
597- netuid = 1 ,
604+ netuid = netuid ,
598605 wait_for_inclusion = True ,
599606 wait_for_finalization = True ,
600607 )
601608
602609 assert subtensor .add_stake (
603610 alice_wallet ,
604611 alice_wallet .hotkey .ss58_address ,
605- netuid = 1 ,
612+ netuid = netuid ,
606613 amount = Balance .from_tao (1_000 ),
607614 wait_for_inclusion = True ,
608615 wait_for_finalization = True ,
@@ -614,10 +621,10 @@ def test_transfer_stake(subtensor, alice_wallet, bob_wallet, dave_wallet):
614621 StakeInfo (
615622 hotkey_ss58 = alice_wallet .hotkey .ss58_address ,
616623 coldkey_ss58 = alice_wallet .coldkey .ss58_address ,
617- netuid = 1 ,
618- stake = ANY_BALANCE ,
624+ netuid = netuid ,
625+ stake = get_dynamic_balance ( alice_stakes [ 0 ]. stake . rao , netuid ) ,
619626 locked = Balance (0 ),
620- emission = ANY_BALANCE ,
627+ emission = get_dynamic_balance ( alice_stakes [ 0 ]. emission . rao , netuid ) ,
621628 drain = 0 ,
622629 is_registered = True ,
623630 ),
@@ -652,14 +659,15 @@ def test_transfer_stake(subtensor, alice_wallet, bob_wallet, dave_wallet):
652659
653660 bob_stakes = subtensor .get_stake_for_coldkey (bob_wallet .coldkey .ss58_address )
654661
662+ netuid = 2
655663 assert bob_stakes == [
656664 StakeInfo (
657665 hotkey_ss58 = alice_wallet .hotkey .ss58_address ,
658666 coldkey_ss58 = bob_wallet .coldkey .ss58_address ,
659667 netuid = 2 ,
660- stake = ANY_BALANCE ,
668+ stake = get_dynamic_balance ( bob_stakes [ 0 ]. stake . rao , netuid ) ,
661669 locked = Balance (0 ),
662- emission = ANY_BALANCE ,
670+ emission = get_dynamic_balance ( bob_stakes [ 0 ]. emission . rao , netuid ) ,
663671 drain = 0 ,
664672 is_registered = False ,
665673 ),
0 commit comments