Skip to content

Commit a5c5cfc

Browse files
Merge pull request #2733 from opentensor/tests/zyzniewski/fix_e2e_test_children
E2E Test: wait cooldown period to check set_children effect
2 parents d6ae4fa + 13904da commit a5c5cfc

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

tests/e2e_tests/test_hotkeys.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
)
77

88

9+
SET_CHILDREN_COOLDOWN_PERIOD = 15
910
SET_CHILDREN_RATE_LIMIT = 150
1011

1112

@@ -54,17 +55,13 @@ def test_hotkeys(subtensor, alice_wallet):
5455
)
5556

5657

57-
@pytest.mark.skip(
58-
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).
59-
https://github.com/opentensor/subtensor/pull/1050
60-
""",
61-
)
6258
@pytest.mark.asyncio
6359
async def test_children(subtensor, alice_wallet, bob_wallet):
6460
"""
6561
Tests:
6662
- Get default children (empty list)
6763
- Update children list
64+
- Checking cooldown period
6865
- Trigger rate limit
6966
- Clear children list
7067
"""
@@ -102,6 +99,20 @@ async def test_children(subtensor, alice_wallet, bob_wallet):
10299
assert error == ""
103100
assert success is True
104101

102+
set_children_block = subtensor.get_current_block()
103+
104+
success, children, error = subtensor.get_children(
105+
alice_wallet.hotkey.ss58_address,
106+
block=set_children_block,
107+
netuid=1,
108+
)
109+
110+
assert success is True
111+
assert children == []
112+
assert error == ""
113+
114+
subtensor.wait_for_block(set_children_block + SET_CHILDREN_COOLDOWN_PERIOD)
115+
105116
await wait_epoch(subtensor, netuid=1)
106117

107118
success, children, error = subtensor.get_children(
@@ -128,7 +139,7 @@ async def test_children(subtensor, alice_wallet, bob_wallet):
128139
assert "`TxRateLimitExceeded(Module)`" in error
129140
assert success is False
130141

131-
subtensor.wait_for_block(subtensor.block + SET_CHILDREN_RATE_LIMIT)
142+
subtensor.wait_for_block(set_children_block + SET_CHILDREN_RATE_LIMIT)
132143

133144
success, error = set_children(
134145
subtensor,

0 commit comments

Comments
 (0)