1
1
import asyncio
2
+
2
3
import pytest
3
4
5
+ from bittensor .utils .balance import Balance
4
6
from tests .e2e_tests .utils .chain_interactions import (
5
7
wait_epoch ,
6
8
sudo_set_hyperparameter_values ,
7
9
)
10
+ from tests .e2e_tests .utils .e2e_test_utils import wait_to_start_call
8
11
9
12
FAST_BLOCKS_SPEEDUP_FACTOR = 5
10
13
@@ -58,9 +61,9 @@ async def test_root_reg_hyperparams(
58
61
"""
59
62
60
63
print ("Testing root register, weights, and hyperparams" )
61
- netuid = 2
64
+ netuid = subtensor . get_total_subnets () # 2
62
65
63
- # Default immunity period & tempo set through the subtensor side
66
+ # Default immunity period and tempo set through the subtensor side
64
67
default_immunity_period = 5000
65
68
default_tempo = 10 if subtensor .is_fast_blocks () else 360
66
69
@@ -79,10 +82,24 @@ async def test_root_reg_hyperparams(
79
82
# Create netuid = 2
80
83
assert subtensor .register_subnet (alice_wallet )
81
84
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
83
90
assert subtensor .immunity_period (netuid = netuid ) == default_immunity_period
84
91
assert subtensor .tempo (netuid = netuid ) == default_tempo
85
92
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
+
86
103
async with templates .validator (alice_wallet , netuid ):
87
104
await asyncio .sleep (5 ) # Wait a bit for chain to process data
88
105
0 commit comments