Skip to content

Commit 36f12f6

Browse files
Merge branch 'staging' into fix/zyzniewski/burned_register_supports_root_subnet
2 parents f43b004 + 9ded430 commit 36f12f6

File tree

8 files changed

+34
-34
lines changed

8 files changed

+34
-34
lines changed

tests/e2e_tests/test_commit_reveal_v3.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import re
2-
import time
32

43
import numpy as np
54
import pytest
65
from bittensor.utils.btlogging import logging
7-
from bittensor.utils.balance import Balance
86
from bittensor.utils.weight_utils import convert_weights_and_uids_for_emit
97
from tests.e2e_tests.utils.chain_interactions import (
108
sudo_set_admin_utils,
119
sudo_set_hyperparameter_bool,
12-
sudo_set_hyperparameter_values,
1310
wait_interval,
1411
next_tempo,
1512
)
@@ -57,14 +54,16 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
5754
logging.console.info("Commit reveal enabled")
5855

5956
# Change the weights rate limit on the subnet
60-
assert sudo_set_hyperparameter_values(
57+
status, error = sudo_set_admin_utils(
6158
local_chain,
6259
alice_wallet,
6360
call_function="sudo_set_weights_set_rate_limit",
6461
call_params={"netuid": netuid, "weights_set_rate_limit": "0"},
65-
return_error_message=True,
6662
)
6763

64+
assert error is None
65+
assert status is True
66+
6867
# Verify weights rate limit was changed
6968
assert (
7069
subtensor.get_subnet_hyperparameters(netuid=netuid).weights_rate_limit == 0
@@ -81,7 +80,6 @@ async def test_commit_and_reveal_weights_cr3(local_chain, subtensor, alice_walle
8180
alice_wallet,
8281
call_function="sudo_set_tempo",
8382
call_params={"netuid": netuid, "tempo": tempo_set},
84-
return_error_message=True,
8583
)[0]
8684
is True
8785
)

tests/e2e_tests/test_commit_weights.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from tests.e2e_tests.utils.chain_interactions import (
88
sudo_set_admin_utils,
99
sudo_set_hyperparameter_bool,
10-
sudo_set_hyperparameter_values,
1110
wait_epoch,
1211
)
1312

@@ -54,15 +53,18 @@ async def test_commit_and_reveal_weights_legacy(local_chain, subtensor, alice_wa
5453
assert (
5554
subtensor.weights_rate_limit(netuid=netuid) > 0
5655
), "Weights rate limit is below 0"
56+
5757
# Lower the rate limit
58-
assert sudo_set_hyperparameter_values(
58+
status, error = sudo_set_admin_utils(
5959
local_chain,
6060
alice_wallet,
6161
call_function="sudo_set_weights_set_rate_limit",
6262
call_params={"netuid": netuid, "weights_set_rate_limit": "0"},
63-
return_error_message=True,
6463
)
6564

65+
assert error is None
66+
assert status is True
67+
6668
assert (
6769
subtensor.get_subnet_hyperparameters(netuid=netuid).weights_rate_limit == 0
6870
), "Failed to set weights_rate_limit"
@@ -77,7 +79,6 @@ async def test_commit_and_reveal_weights_legacy(local_chain, subtensor, alice_wa
7779
"netuid": netuid,
7880
"tempo": 100,
7981
},
80-
return_error_message=True,
8182
)
8283

8384
# Commit-reveal values
@@ -192,15 +193,18 @@ async def test_commit_weights_uses_next_nonce(local_chain, subtensor, alice_wall
192193
assert (
193194
subtensor.weights_rate_limit(netuid=netuid) > 0
194195
), "Weights rate limit is below 0"
196+
195197
# Lower the rate limit
196-
assert sudo_set_hyperparameter_values(
198+
status, error = sudo_set_admin_utils(
197199
local_chain,
198200
alice_wallet,
199201
call_function="sudo_set_weights_set_rate_limit",
200202
call_params={"netuid": netuid, "weights_set_rate_limit": "0"},
201-
return_error_message=True,
202203
)
203204

205+
assert error is None
206+
assert status is True
207+
204208
assert (
205209
subtensor.get_subnet_hyperparameters(netuid=netuid).weights_rate_limit == 0
206210
), "Failed to set weights_rate_limit"

tests/e2e_tests/test_delegate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ def test_nominator_min_required_stake(local_chain, subtensor, alice_wallet, bob_
320320
call_params={
321321
"min_stake": "100000000000000",
322322
},
323-
return_error_message=True,
324323
)
325324

326325
minimum_required_stake = subtensor.get_minimum_required_stake()

tests/e2e_tests/test_dendrite.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from bittensor.utils.btlogging import logging
77
from tests.e2e_tests.utils.chain_interactions import (
88
sudo_set_admin_utils,
9-
sudo_set_hyperparameter_values,
109
wait_epoch,
1110
)
1211

@@ -44,21 +43,22 @@ async def test_dendrite(local_chain, subtensor, templates, alice_wallet, bob_wal
4443
"netuid": netuid,
4544
"max_allowed_validators": 1,
4645
},
47-
return_error_message=True,
4846
)
4947

5048
# update weights_set_rate_limit for fast-blocks
51-
assert sudo_set_hyperparameter_values(
49+
status, error = sudo_set_admin_utils(
5250
local_chain,
5351
alice_wallet,
5452
call_function="sudo_set_weights_set_rate_limit",
5553
call_params={
5654
"netuid": netuid,
5755
"weights_set_rate_limit": 10,
5856
},
59-
return_error_message=True,
6057
)
6158

59+
assert error is None
60+
assert status is True
61+
6262
# Register Bob to the network
6363
assert subtensor.burned_register(
6464
bob_wallet, netuid

tests/e2e_tests/test_hotkeys.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ async def test_children(subtensor, alice_wallet, bob_wallet):
151151
assert error == ""
152152
assert success is True
153153

154+
subtensor.wait_for_block(subtensor.block + SET_CHILDREN_COOLDOWN_PERIOD)
155+
154156
await wait_epoch(subtensor, netuid=1)
155157

156158
success, children, error = subtensor.get_children(

tests/e2e_tests/test_incentive.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44

55
from tests.e2e_tests.utils.chain_interactions import (
6-
sudo_set_hyperparameter_values,
6+
sudo_set_admin_utils,
77
wait_epoch,
88
)
99

@@ -66,18 +66,20 @@ async def test_incentive(local_chain, subtensor, templates, alice_wallet, bob_wa
6666
assert bob_neuron.trust == 0
6767

6868
# update weights_set_rate_limit for fast-blocks
69-
assert sudo_set_hyperparameter_values(
69+
status, error = sudo_set_admin_utils(
7070
local_chain,
7171
alice_wallet,
7272
call_function="sudo_set_weights_set_rate_limit",
7373
call_params={"netuid": netuid, "weights_set_rate_limit": 10},
74-
return_error_message=True,
7574
)
7675

76+
assert error is None
77+
assert status is True
78+
7779
async with templates.miner(bob_wallet, netuid):
7880
async with templates.validator(alice_wallet, netuid) as validator:
7981
# wait for the Validator to process and set_weights
80-
async with asyncio.timeout(15):
82+
async with asyncio.timeout(60):
8183
await validator.set_weights.wait()
8284

8385
# Wait few epochs

tests/e2e_tests/test_set_weights.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from bittensor.utils.weight_utils import convert_weights_and_uids_for_emit
66
from tests.e2e_tests.utils.chain_interactions import (
77
sudo_set_hyperparameter_bool,
8-
sudo_set_hyperparameter_values,
98
sudo_set_admin_utils,
109
wait_epoch,
1110
)
@@ -35,15 +34,13 @@ async def test_set_weights_uses_next_nonce(local_chain, subtensor, alice_wallet)
3534
alice_wallet,
3635
call_function="sudo_set_network_rate_limit",
3736
call_params={"rate_limit": "0"}, # No limit
38-
return_error_message=True,
3937
)
4038
# Set lock reduction interval
4139
sudo_set_admin_utils(
4240
local_chain,
4341
alice_wallet,
4442
call_function="sudo_set_lock_reduction_interval",
4543
call_params={"interval": "1"}, # 1 block # reduce lock every block
46-
return_error_message=True,
4744
)
4845

4946
# Try to register the subnets
@@ -84,15 +81,18 @@ async def test_set_weights_uses_next_nonce(local_chain, subtensor, alice_wallet)
8481
assert (
8582
subtensor.weights_rate_limit(netuid=netuid) > 0
8683
), "Weights rate limit is below 0"
84+
8785
# Lower the rate limit
88-
assert sudo_set_hyperparameter_values(
86+
status, error = sudo_set_admin_utils(
8987
local_chain,
9088
alice_wallet,
9189
call_function="sudo_set_weights_set_rate_limit",
9290
call_params={"netuid": netuid, "weights_set_rate_limit": "0"},
93-
return_error_message=True,
9491
)
9592

93+
assert error is None
94+
assert status is True
95+
9696
assert (
9797
subtensor.get_subnet_hyperparameters(netuid=netuid).weights_rate_limit == 0
9898
), "Failed to set weights_rate_limit"

tests/e2e_tests/utils/chain_interactions.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ def sudo_set_admin_utils(
150150
wallet: "Wallet",
151151
call_function: str,
152152
call_params: dict,
153-
return_error_message: bool = False,
154-
) -> tuple[bool, str]:
153+
) -> tuple[bool, Optional[dict]]:
155154
"""
156155
Wraps the call in sudo to set hyperparameter values using AdminUtils.
157156
@@ -160,10 +159,9 @@ def sudo_set_admin_utils(
160159
wallet (Wallet): Wallet object with the keypair for signing.
161160
call_function (str): The AdminUtils function to call.
162161
call_params (dict): Parameters for the AdminUtils function.
163-
return_error_message (bool): If True, returns the error message along with the success status.
164162
165163
Returns:
166-
Union[bool, tuple[bool, Optional[str]]]: Success status or (success status, error message).
164+
tuple[bool, Optional[dict]]: (success status, error details).
167165
"""
168166
inner_call = substrate.compose_call(
169167
call_module="AdminUtils",
@@ -185,10 +183,7 @@ def sudo_set_admin_utils(
185183
wait_for_finalization=True,
186184
)
187185

188-
if return_error_message:
189-
return response.is_success, response.error_message
190-
191-
return response.is_success, ""
186+
return response.is_success, response.error_message
192187

193188

194189
async def root_set_subtensor_hyperparameter_values(

0 commit comments

Comments
 (0)