Skip to content

Commit 4112a85

Browse files
authored
Merge pull request #2884 from opentensor/fix/roman/e2e_root_set_weights
Add stake before check `validator_permit`
2 parents 3e33869 + 83c5133 commit 4112a85

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

tests/e2e_tests/test_root_set_weights.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import asyncio
2+
23
import pytest
34

5+
from bittensor.utils.balance import Balance
46
from tests.e2e_tests.utils.chain_interactions import (
57
wait_epoch,
68
sudo_set_hyperparameter_values,
79
)
10+
from tests.e2e_tests.utils.e2e_test_utils import wait_to_start_call
811

912
FAST_BLOCKS_SPEEDUP_FACTOR = 5
1013

@@ -58,9 +61,9 @@ async def test_root_reg_hyperparams(
5861
"""
5962

6063
print("Testing root register, weights, and hyperparams")
61-
netuid = 2
64+
netuid = subtensor.get_total_subnets() # 2
6265

63-
# Default immunity period & tempo set through the subtensor side
66+
# Default immunity period and tempo set through the subtensor side
6467
default_immunity_period = 5000
6568
default_tempo = 10 if subtensor.is_fast_blocks() else 360
6669

@@ -79,10 +82,24 @@ async def test_root_reg_hyperparams(
7982
# Create netuid = 2
8083
assert subtensor.register_subnet(alice_wallet)
8184

82-
# Ensure correct immunity period & tempo is being fetched
85+
assert wait_to_start_call(
86+
subtensor=subtensor, subnet_owner_wallet=alice_wallet, netuid=netuid
87+
)
88+
89+
# Ensure correct immunity period and tempo is being fetched
8390
assert subtensor.immunity_period(netuid=netuid) == default_immunity_period
8491
assert subtensor.tempo(netuid=netuid) == default_tempo
8592

93+
assert subtensor.add_stake(
94+
wallet=bob_wallet,
95+
hotkey_ss58=alice_wallet.hotkey.ss58_address,
96+
netuid=netuid,
97+
amount=Balance.from_tao(1),
98+
wait_for_inclusion=True,
99+
wait_for_finalization=True,
100+
period=16,
101+
), "Unable to stake from Bob to Alice"
102+
86103
async with templates.validator(alice_wallet, netuid):
87104
await asyncio.sleep(5) # Wait a bit for chain to process data
88105

0 commit comments

Comments
 (0)