Skip to content

Commit fbef78a

Browse files
author
Roman
committed
add stake before check validator_permit
1 parent 3e33869 commit fbef78a

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

tests/e2e_tests/test_root_set_weights.py

Lines changed: 18 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,22 @@ 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(subtensor=subtensor, subnet_owner_wallet=alice_wallet, netuid=netuid)
86+
87+
# Ensure correct immunity period and tempo is being fetched
8388
assert subtensor.immunity_period(netuid=netuid) == default_immunity_period
8489
assert subtensor.tempo(netuid=netuid) == default_tempo
8590

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

0 commit comments

Comments
 (0)