Skip to content

Commit a82606b

Browse files
author
Roman
committed
fix tests/e2e_tests/test_hotkeys.py
1 parent 405236b commit a82606b

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

tests/e2e_tests/test_hotkeys.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,19 @@
1212
NonAssociatedColdKey,
1313
)
1414
from bittensor.utils.btlogging import logging
15-
from tests.e2e_tests.utils.chain_interactions import (
16-
sudo_set_admin_utils,
17-
wait_epoch,
18-
)
15+
from tests.e2e_tests.utils.chain_interactions import sudo_set_admin_utils
1916
from tests.e2e_tests.utils.e2e_test_utils import wait_to_start_call
2017

21-
SET_CHILDREN_COOLDOWN_PERIOD = 15
22-
SET_CHILDREN_RATE_LIMIT = 150
18+
19+
SET_CHILDREN_RATE_LIMIT = 15
2320

2421

2522
def test_hotkeys(subtensor, alice_wallet, dave_wallet):
2623
"""
2724
Tests:
2825
- Check if Hotkey exists
2926
- Check if Hotkey is registered
30-
3127
"""
32-
3328
dave_subnet_netuid = subtensor.get_total_subnets() # 2
3429
assert subtensor.register_subnet(dave_wallet, True, True)
3530
assert subtensor.subnet_exists(dave_subnet_netuid), (
@@ -111,15 +106,15 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
111106
is True
112107
)
113108

114-
# assert (
115-
# sudo_set_admin_utils(
116-
# local_chain,
117-
# alice_wallet,
118-
# call_function="sudo_set_tx_rate_limit",
119-
# call_params={"tx_rate_limit": 100},
120-
# )[0]
121-
# is True
122-
# )
109+
assert (
110+
sudo_set_admin_utils(
111+
local_chain,
112+
alice_wallet,
113+
call_function="sudo_set_tx_rate_limit",
114+
call_params={"tx_rate_limit": 0},
115+
)[0]
116+
is True
117+
)
123118

124119
with pytest.raises(RegistrationNotPermittedOnRootSubnet):
125120
subtensor.set_children(
@@ -269,9 +264,8 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
269264
)
270265

271266
assert pending == [(1.0, bob_wallet.hotkey.ss58_address)]
272-
logging.console.info(f"Cooldown 1 is: {cooldown}")
273267

274-
subtensor.wait_for_block(cooldown + 1)
268+
subtensor.wait_for_block(cooldown + 15)
275269

276270
success, children, error = subtensor.get_children(
277271
alice_wallet.hotkey.ss58_address,
@@ -280,22 +274,24 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
280274

281275
assert error == ""
282276
assert success is True
283-
assert children == [
284-
(
285-
1.0,
286-
bob_wallet.hotkey.ss58_address,
287-
)
288-
]
277+
assert children == [(1.0, bob_wallet.hotkey.ss58_address)]
289278

290279
# pending queue is empty
291280
pending, cooldown = subtensor.get_children_pending(
292281
alice_wallet.hotkey.ss58_address,
293282
netuid=dave_subnet_netuid,
294283
)
295-
296284
assert pending == []
297285

298286
with pytest.raises(TxRateLimitExceeded):
287+
set_children_block = subtensor.get_current_block()
288+
subtensor.set_children(
289+
alice_wallet,
290+
alice_wallet.hotkey.ss58_address,
291+
netuid=dave_subnet_netuid,
292+
children=[],
293+
raise_error=True,
294+
)
299295
subtensor.set_children(
300296
alice_wallet,
301297
alice_wallet.hotkey.ss58_address,
@@ -320,8 +316,6 @@ async def test_children(local_chain, subtensor, alice_wallet, bob_wallet, dave_w
320316
netuid=dave_subnet_netuid,
321317
)
322318

323-
logging.console.info(f"Cooldown 2 is: {cooldown}")
324-
325319
assert pending == []
326320

327321
subtensor.wait_for_block(cooldown)

0 commit comments

Comments
 (0)