6
6
"""
7
7
Verify commands:
8
8
9
+ * btcli s burn-cost
9
10
* btcli subnets create
11
+ * btcli subnets set-identity
12
+ * btcli subnets get-identity
10
13
* btcli subnets register
11
14
* btcli stake add
12
15
* btcli stake remove
@@ -40,6 +43,21 @@ def test_staking(local_chain, wallet_setup):
40
43
wallet_path_alice
41
44
)
42
45
46
+ burn_cost = exec_command_alice (
47
+ "subnets" ,
48
+ "burn-cost" ,
49
+ extra_args = [
50
+ "--network" ,
51
+ "ws://127.0.0.1:9945" ,
52
+ "--json-output" ,
53
+ ],
54
+ )
55
+ burn_cost_output = json .loads (burn_cost .stdout )
56
+ expected_burn_cost = Balance .from_tao (1000.0 )
57
+ assert burn_cost_output ["error" ] == ""
58
+ assert burn_cost_output ["burn_cost" ]["rao" ] == expected_burn_cost .rao
59
+ assert burn_cost_output ["burn_cost" ]["tao" ] == expected_burn_cost .tao
60
+
43
61
# Register a subnet with sudo as Alice
44
62
result = exec_command_alice (
45
63
command = "subnets" ,
@@ -68,9 +86,12 @@ def test_staking(local_chain, wallet_setup):
68
86
"--additional-info" ,
69
87
"Created by Alice" ,
70
88
"--no-prompt" ,
89
+ "--json-output" ,
71
90
],
72
91
)
73
- assert f"✅ Registered subnetwork with netuid: { netuid } " in result .stdout
92
+ result_output = json .loads (result .stdout )
93
+ assert result_output ["success" ] is True
94
+ assert result_output ["netuid" ] == 2
74
95
75
96
# Register Alice in netuid = 1 using her hotkey
76
97
register_subnet = exec_command_alice (
@@ -92,6 +113,84 @@ def test_staking(local_chain, wallet_setup):
92
113
)
93
114
assert "✅ Already Registered" in register_subnet .stdout
94
115
116
+ register_subnet_json = exec_command_alice (
117
+ command = "subnets" ,
118
+ sub_command = "register" ,
119
+ extra_args = [
120
+ "--wallet-path" ,
121
+ wallet_path_alice ,
122
+ "--wallet-name" ,
123
+ wallet_alice .name ,
124
+ "--hotkey" ,
125
+ wallet_alice .hotkey_str ,
126
+ "--netuid" ,
127
+ netuid ,
128
+ "--chain" ,
129
+ "ws://127.0.0.1:9945" ,
130
+ "--no-prompt" ,
131
+ "--json-output" ,
132
+ ],
133
+ )
134
+ register_subnet_json_output = json .loads (register_subnet_json .stdout )
135
+ assert register_subnet_json_output ["success" ] is True
136
+ assert register_subnet_json_output ["msg" ] == "Already registered"
137
+
138
+ # set identity
139
+ set_identity = exec_command_alice (
140
+ "subnets" ,
141
+ "set-identity" ,
142
+ extra_args = [
143
+ "--wallet-path" ,
144
+ wallet_path_alice ,
145
+ "--wallet-name" ,
146
+ wallet_alice .name ,
147
+ "--hotkey" ,
148
+ wallet_alice .hotkey_str ,
149
+ "--chain" ,
150
+ "ws://127.0.0.1:9945" ,
151
+ "--netuid" ,
152
+ netuid ,
153
+ "--subnet-name" ,
154
+ sn_name := "Test Subnet" ,
155
+ "--github-repo" ,
156
+ sn_github := "https://github.com/username/repo" ,
157
+ "--subnet-contact" ,
158
+ sn_contact := "[email protected] " ,
159
+ "--subnet-url" ,
160
+ sn_url := "https://testsubnet.com" ,
161
+ "--discord" ,
162
+ sn_discord := "alice#1234" ,
163
+ "--description" ,
164
+ sn_description := "A test subnet for e2e testing" ,
165
+ "--additional-info" ,
166
+ sn_add_info := "Created by Alice" ,
167
+ "--json-output" ,
168
+ "--no-prompt" ,
169
+ ],
170
+ )
171
+ set_identity_output = json .loads (set_identity .stdout )
172
+ assert set_identity_output ["success" ] is True
173
+
174
+ get_identity = exec_command_alice (
175
+ "subnets" ,
176
+ "get-identity" ,
177
+ extra_args = [
178
+ "--chain" ,
179
+ "ws://127.0.0.1:9945" ,
180
+ "--netuid" ,
181
+ netuid ,
182
+ "--json-output" ,
183
+ ],
184
+ )
185
+ get_identity_output = json .loads (get_identity .stdout )
186
+ assert get_identity_output ["subnet_name" ] == sn_name
187
+ assert get_identity_output ["github_repo" ] == sn_github
188
+ assert get_identity_output ["subnet_contact" ] == sn_contact
189
+ assert get_identity_output ["subnet_url" ] == sn_url
190
+ assert get_identity_output ["discord" ] == sn_discord
191
+ assert get_identity_output ["description" ] == sn_description
192
+ assert get_identity_output ["additional" ] == sn_add_info
193
+
95
194
# Add stake to Alice's hotkey
96
195
add_stake = exec_command_alice (
97
196
command = "stake" ,
0 commit comments