@@ -19,7 +19,7 @@ async def test_stake_fee_api(local_chain, subtensor, alice_wallet, bob_wallet):
19
19
netuid = 2
20
20
root_netuid = 0
21
21
stake_amount = Balance .from_tao (100 ) # 100 TAO
22
- min_stake_fee = Balance .from_rao ( 50_000 )
22
+ min_stake_fee = Balance .from_tao ( 0.299076829 )
23
23
24
24
# Register subnet as Alice
25
25
assert subtensor .register_subnet (alice_wallet ), "Unable to register the subnet"
@@ -33,21 +33,19 @@ async def test_stake_fee_api(local_chain, subtensor, alice_wallet, bob_wallet):
33
33
hotkey_ss58 = alice_wallet .hotkey .ss58_address ,
34
34
)
35
35
assert isinstance (stake_fee_0 , Balance ), "Stake fee should be a Balance object"
36
- assert stake_fee_0 > = min_stake_fee , (
37
- "Stake fee should be greater than the minimum stake fee"
36
+ assert stake_fee_0 = = min_stake_fee , (
37
+ "Stake fee should be equal the minimum stake fee"
38
38
)
39
39
40
40
# Test unstake fee
41
- stake_fee_1 = subtensor .get_unstake_fee (
41
+ unstake_fee_root = subtensor .get_unstake_fee (
42
42
amount = stake_amount ,
43
43
netuid = root_netuid ,
44
44
coldkey_ss58 = alice_wallet .coldkeypub .ss58_address ,
45
45
hotkey_ss58 = bob_wallet .hotkey .ss58_address ,
46
46
)
47
- assert isinstance (stake_fee_1 , Balance ), "Stake fee should be a Balance object"
48
- assert stake_fee_1 >= min_stake_fee , (
49
- "Stake fee should be greater than the minimum stake fee"
50
- )
47
+ assert isinstance (unstake_fee_root , Balance ), "Stake fee should be a Balance object"
48
+ assert unstake_fee_root == 0 , "Root unstake fee should be 0."
51
49
52
50
# Test various stake movement scenarios
53
51
movement_scenarios = [
@@ -59,6 +57,7 @@ async def test_stake_fee_api(local_chain, subtensor, alice_wallet, bob_wallet):
59
57
"dest_netuid" : netuid ,
60
58
"dest_hotkey" : alice_wallet .hotkey .ss58_address ,
61
59
"dest_coldkey" : alice_wallet .coldkeypub .ss58_address ,
60
+ "stake_fee" : min_stake_fee ,
62
61
},
63
62
# Move between hotkeys on root
64
63
{
@@ -68,15 +67,27 @@ async def test_stake_fee_api(local_chain, subtensor, alice_wallet, bob_wallet):
68
67
"dest_netuid" : root_netuid ,
69
68
"dest_hotkey" : bob_wallet .hotkey .ss58_address ,
70
69
"dest_coldkey" : alice_wallet .coldkeypub .ss58_address ,
70
+ "stake_fee" : 0 ,
71
71
},
72
- # Move between coldkeys
72
+ # Move between coldkeys on root
73
73
{
74
74
"origin_netuid" : root_netuid ,
75
75
"origin_hotkey" : bob_wallet .hotkey .ss58_address ,
76
76
"origin_coldkey" : alice_wallet .coldkeypub .ss58_address ,
77
77
"dest_netuid" : root_netuid ,
78
78
"dest_hotkey" : bob_wallet .hotkey .ss58_address ,
79
79
"dest_coldkey" : bob_wallet .coldkeypub .ss58_address ,
80
+ "stake_fee" : 0 ,
81
+ },
82
+ # Move between coldkeys on non-root
83
+ {
84
+ "origin_netuid" : netuid ,
85
+ "origin_hotkey" : bob_wallet .hotkey .ss58_address ,
86
+ "origin_coldkey" : alice_wallet .coldkeypub .ss58_address ,
87
+ "dest_netuid" : netuid ,
88
+ "dest_hotkey" : bob_wallet .hotkey .ss58_address ,
89
+ "dest_coldkey" : bob_wallet .coldkeypub .ss58_address ,
90
+ "stake_fee" : min_stake_fee ,
80
91
},
81
92
]
82
93
@@ -91,7 +102,7 @@ async def test_stake_fee_api(local_chain, subtensor, alice_wallet, bob_wallet):
91
102
destination_coldkey_ss58 = scenario ["dest_coldkey" ],
92
103
)
93
104
assert isinstance (stake_fee , Balance ), "Stake fee should be a Balance object"
94
- assert stake_fee >= min_stake_fee , (
105
+ assert stake_fee >= scenario [ "stake_fee" ] , (
95
106
"Stake fee should be greater than the minimum stake fee"
96
107
)
97
108
0 commit comments