22
33import pytest
44
5- from bittensor import Balance
6-
75from tests .e2e_tests .utils .chain_interactions import (
86 sudo_set_hyperparameter_values ,
97 wait_epoch ,
10- sudo_set_admin_utils ,
118)
129
1310
1411@pytest .mark .asyncio
15- @pytest .mark .parametrize ("local_chain" , [False ], indirect = True )
1612async def test_incentive (local_chain , subtensor , templates , alice_wallet , bob_wallet ):
1713 """
1814 Test the incentive mechanism and interaction of miners/validators
@@ -35,21 +31,6 @@ async def test_incentive(local_chain, subtensor, templates, alice_wallet, bob_wa
3531 # Verify subnet <netuid> created successfully
3632 assert subtensor .subnet_exists (netuid ), "Subnet wasn't created successfully"
3733
38- # Change tempo to 10
39- tempo_set = 10
40- assert (
41- sudo_set_admin_utils (
42- local_chain ,
43- alice_wallet ,
44- call_function = "sudo_set_tempo" ,
45- call_params = {"netuid" : netuid , "tempo" : tempo_set },
46- return_error_message = True ,
47- )[0 ]
48- is True
49- )
50- tempo = subtensor .get_subnet_hyperparameters (netuid = netuid ).tempo
51- assert tempo_set == tempo
52-
5334 # Register Bob as a neuron on the subnet
5435 assert subtensor .burned_register (
5536 bob_wallet , netuid
@@ -60,27 +41,6 @@ async def test_incentive(local_chain, subtensor, templates, alice_wallet, bob_wa
6041 len (subtensor .neurons (netuid = netuid )) == 2
6142 ), "Alice & Bob not registered in the subnet"
6243
63- # Add stake for Alice
64- assert subtensor .add_stake (
65- alice_wallet ,
66- netuid = netuid ,
67- amount = Balance .from_tao (1_000 ),
68- wait_for_inclusion = True ,
69- wait_for_finalization = True ,
70- ), "Failed to add stake for Alice"
71-
72- # Wait for the first epoch to pass
73- await wait_epoch (subtensor , netuid )
74-
75- # Add further stake so validator permit is activated
76- assert subtensor .add_stake (
77- alice_wallet ,
78- netuid = netuid ,
79- amount = Balance .from_tao (1_000 ),
80- wait_for_inclusion = True ,
81- wait_for_finalization = True ,
82- ), "Failed to add stake for Alice"
83-
8444 # Get latest metagraph
8545 metagraph = subtensor .metagraph (netuid )
8646
@@ -110,11 +70,11 @@ async def test_incentive(local_chain, subtensor, templates, alice_wallet, bob_wa
11070
11171 async with templates .miner (bob_wallet , netuid ):
11272 async with templates .validator (alice_wallet , netuid ):
113- # Wait for the Validator to process and set_weights
73+ # wait for the Validator to process and set_weights
11474 await asyncio .sleep (5 )
11575
11676 # Wait few epochs
117- await wait_epoch (subtensor , netuid , times = 2 )
77+ await wait_epoch (subtensor , netuid , times = 4 )
11878
11979 # Refresh metagraph
12080 metagraph = subtensor .metagraph (netuid )
0 commit comments