From 13904da022e1dda84533edbbab79167b3cd8b214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20=C5=BBy=C5=BAniewski?= Date: Mon, 10 Mar 2025 13:34:14 +0100 Subject: [PATCH] wait cooldown period to check set_children effect --- tests/e2e_tests/test_hotkeys.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/e2e_tests/test_hotkeys.py b/tests/e2e_tests/test_hotkeys.py index c6b4445e41..19bc0dc718 100644 --- a/tests/e2e_tests/test_hotkeys.py +++ b/tests/e2e_tests/test_hotkeys.py @@ -6,6 +6,7 @@ ) +SET_CHILDREN_COOLDOWN_PERIOD = 15 SET_CHILDREN_RATE_LIMIT = 150 @@ -54,17 +55,13 @@ def test_hotkeys(subtensor, alice_wallet): ) -@pytest.mark.skip( - reason="""The behavior of set_children changes: Instead of setting children immediately, the children will be set in the subnet epoch after a cool down period (7200 blocks). -https://github.com/opentensor/subtensor/pull/1050 -""", -) @pytest.mark.asyncio async def test_children(subtensor, alice_wallet, bob_wallet): """ Tests: - Get default children (empty list) - Update children list + - Checking cooldown period - Trigger rate limit - Clear children list """ @@ -102,6 +99,20 @@ async def test_children(subtensor, alice_wallet, bob_wallet): assert error == "" assert success is True + set_children_block = subtensor.get_current_block() + + success, children, error = subtensor.get_children( + alice_wallet.hotkey.ss58_address, + block=set_children_block, + netuid=1, + ) + + assert success is True + assert children == [] + assert error == "" + + subtensor.wait_for_block(set_children_block + SET_CHILDREN_COOLDOWN_PERIOD) + await wait_epoch(subtensor, netuid=1) success, children, error = subtensor.get_children( @@ -128,7 +139,7 @@ async def test_children(subtensor, alice_wallet, bob_wallet): assert "`TxRateLimitExceeded(Module)`" in error assert success is False - subtensor.wait_for_block(subtensor.block + SET_CHILDREN_RATE_LIMIT) + subtensor.wait_for_block(set_children_block + SET_CHILDREN_RATE_LIMIT) success, error = set_children( subtensor,