5
5
from tests .helpers .helpers import ApproxBalance
6
6
from tests .e2e_tests .utils .e2e_test_utils import wait_to_start_call
7
7
8
- logging .enable_debug ()
9
-
10
8
11
9
def test_single_operation (subtensor , alice_wallet , bob_wallet ):
12
10
"""
@@ -28,29 +26,31 @@ def test_single_operation(subtensor, alice_wallet, bob_wallet):
28
26
assert wait_to_start_call (subtensor , alice_wallet , alice_subnet_netuid )
29
27
30
28
subtensor .burned_register (
31
- alice_wallet ,
29
+ wallet = alice_wallet ,
32
30
netuid = alice_subnet_netuid ,
33
31
wait_for_inclusion = True ,
34
32
wait_for_finalization = True ,
35
33
)
34
+ logging .console .success (f"Alice is registered in subnet { alice_subnet_netuid } " )
36
35
subtensor .burned_register (
37
- bob_wallet ,
36
+ wallet = bob_wallet ,
38
37
netuid = alice_subnet_netuid ,
39
38
wait_for_inclusion = True ,
40
39
wait_for_finalization = True ,
41
40
)
41
+ logging .console .success (f"Bob is registered in subnet { alice_subnet_netuid } " )
42
42
43
43
stake = subtensor .get_stake (
44
- alice_wallet .coldkey .ss58_address ,
45
- bob_wallet .hotkey .ss58_address ,
44
+ coldkey_ss58 = alice_wallet .coldkey .ss58_address ,
45
+ hotkey_ss58 = bob_wallet .hotkey .ss58_address ,
46
46
netuid = alice_subnet_netuid ,
47
47
)
48
48
49
49
assert stake == Balance (0 ).set_unit (alice_subnet_netuid )
50
50
51
51
success = subtensor .add_stake (
52
- alice_wallet ,
53
- bob_wallet .hotkey .ss58_address ,
52
+ wallet = alice_wallet ,
53
+ hotkey_ss58 = bob_wallet .hotkey .ss58_address ,
54
54
netuid = alice_subnet_netuid ,
55
55
amount = Balance .from_tao (1 ),
56
56
wait_for_inclusion = True ,
@@ -61,24 +61,26 @@ def test_single_operation(subtensor, alice_wallet, bob_wallet):
61
61
assert success is True
62
62
63
63
stake_alice = subtensor .get_stake (
64
- alice_wallet .coldkey .ss58_address ,
65
- alice_wallet .hotkey .ss58_address ,
64
+ coldkey_ss58 = alice_wallet .coldkey .ss58_address ,
65
+ hotkey_ss58 = alice_wallet .hotkey .ss58_address ,
66
66
netuid = alice_subnet_netuid ,
67
67
)
68
+ logging .console .info (f"Alice stake: { stake_alice } " )
68
69
69
70
stake_bob = subtensor .get_stake (
70
- alice_wallet .coldkey .ss58_address ,
71
- bob_wallet .hotkey .ss58_address ,
71
+ coldkey_ss58 = alice_wallet .coldkey .ss58_address ,
72
+ hotkey_ss58 = bob_wallet .hotkey .ss58_address ,
72
73
netuid = alice_subnet_netuid ,
73
74
)
74
75
76
+ logging .console .info (f"Bob stake: { stake_bob } " )
75
77
assert stake_bob > Balance (0 ).set_unit (alice_subnet_netuid )
76
78
77
79
stakes = subtensor .get_stake_for_coldkey (alice_wallet .coldkey .ss58_address )
78
80
79
- assert stakes = = [
81
+ expected_stakes = [
80
82
StakeInfo (
81
- hotkey_ss58 = alice_wallet . hotkey . ss58_address ,
83
+ hotkey_ss58 = stakes [ 0 ]. hotkey_ss58 ,
82
84
coldkey_ss58 = alice_wallet .coldkey .ss58_address ,
83
85
netuid = alice_subnet_netuid ,
84
86
stake = get_dynamic_balance (stakes [0 ].stake .rao , alice_subnet_netuid ),
@@ -87,42 +89,31 @@ def test_single_operation(subtensor, alice_wallet, bob_wallet):
87
89
drain = 0 ,
88
90
is_registered = True ,
89
91
),
90
- StakeInfo (
91
- hotkey_ss58 = bob_wallet .hotkey .ss58_address ,
92
- coldkey_ss58 = alice_wallet .coldkey .ss58_address ,
93
- netuid = alice_subnet_netuid ,
94
- stake = get_dynamic_balance (stakes [1 ].stake .rao , alice_subnet_netuid ),
95
- locked = Balance (0 ).set_unit (alice_subnet_netuid ),
96
- emission = get_dynamic_balance (stakes [1 ].emission .rao , alice_subnet_netuid ),
97
- drain = 0 ,
98
- is_registered = True ,
99
- ),
100
92
]
101
93
102
- stakes = subtensor .get_stake_info_for_coldkey (alice_wallet .coldkey .ss58_address )
103
-
104
- assert stakes == [
105
- StakeInfo (
106
- hotkey_ss58 = alice_wallet .hotkey .ss58_address ,
107
- coldkey_ss58 = alice_wallet .coldkey .ss58_address ,
108
- netuid = alice_subnet_netuid ,
109
- stake = get_dynamic_balance (stakes [0 ].stake .rao , alice_subnet_netuid ),
110
- locked = Balance (0 ).set_unit (alice_subnet_netuid ),
111
- emission = get_dynamic_balance (stakes [0 ].emission .rao , alice_subnet_netuid ),
112
- drain = 0 ,
113
- is_registered = True ,
114
- ),
115
- StakeInfo (
116
- hotkey_ss58 = bob_wallet .hotkey .ss58_address ,
117
- coldkey_ss58 = alice_wallet .coldkey .ss58_address ,
118
- netuid = alice_subnet_netuid ,
119
- stake = get_dynamic_balance (stakes [1 ].stake .rao , alice_subnet_netuid ),
120
- locked = Balance (0 ).set_unit (alice_subnet_netuid ),
121
- emission = get_dynamic_balance (stakes [1 ].emission .rao , alice_subnet_netuid ),
122
- drain = 0 ,
123
- is_registered = True ,
124
- ),
125
- ]
94
+ fast_blocks_stake = (
95
+ [
96
+ StakeInfo (
97
+ hotkey_ss58 = stakes [1 ].hotkey_ss58 ,
98
+ coldkey_ss58 = alice_wallet .coldkey .ss58_address ,
99
+ netuid = alice_subnet_netuid ,
100
+ stake = get_dynamic_balance (stakes [1 ].stake .rao , alice_subnet_netuid ),
101
+ locked = Balance (0 ).set_unit (alice_subnet_netuid ),
102
+ emission = get_dynamic_balance (
103
+ stakes [1 ].emission .rao , alice_subnet_netuid
104
+ ),
105
+ drain = 0 ,
106
+ is_registered = True ,
107
+ )
108
+ ]
109
+ if subtensor .is_fast_blocks ()
110
+ else []
111
+ )
112
+
113
+ expected_stakes += fast_blocks_stake
114
+
115
+ assert stakes == expected_stakes
116
+ assert subtensor .get_stake_for_coldkey == subtensor .get_stake_info_for_coldkey
126
117
127
118
stakes = subtensor .get_stake_for_coldkey_and_hotkey (
128
119
alice_wallet .coldkey .ss58_address ,
0 commit comments