Skip to content

Commit caf8c70

Browse files
author
Roman
committed
optimization + period for test
1 parent 7fef30f commit caf8c70

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

bittensor/core/async_subtensor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
check_and_convert_to_balance,
9999
)
100100
from bittensor.utils.btlogging import logging
101-
from bittensor.utils.weight_utils import generate_weight_hash
101+
from bittensor.utils.weight_utils import generate_weight_hash, convert_uids_and_weights
102102

103103
if TYPE_CHECKING:
104104
from async_substrate_interface.types import ScaleObj
@@ -3794,8 +3794,7 @@ async def root_set_weights(
37943794
Returns:
37953795
`True` if the setting of weights is successful, `False` otherwise.
37963796
"""
3797-
netuids_ = np.array(netuids, dtype=np.int64)
3798-
weights_ = np.array(weights, dtype=np.float32)
3797+
netuids_, weights_ = convert_uids_and_weights(netuids, weights)
37993798
logging.info(f"Setting weights in network: [blue]{self.network}[/blue]")
38003799
# Run the set weights operation.
38013800
return await set_root_weights_extrinsic(

bittensor/core/subtensor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
check_and_convert_to_balance,
102102
)
103103
from bittensor.utils.btlogging import logging
104-
from bittensor.utils.weight_utils import generate_weight_hash
104+
from bittensor.utils.weight_utils import generate_weight_hash, convert_uids_and_weights
105105

106106
if TYPE_CHECKING:
107107
from bittensor_wallet import Wallet
@@ -3080,8 +3080,7 @@ def root_set_weights(
30803080
Returns:
30813081
`True` if the setting of weights is successful, `False` otherwise.
30823082
"""
3083-
netuids_ = np.array(netuids, dtype=np.int64)
3084-
weights_ = np.array(weights, dtype=np.float32)
3083+
netuids_, weights_ = convert_uids_and_weights(netuids, weights)
30853084
logging.info(f"Setting weights in network: [blue]{self.network}[/blue]")
30863085
return set_root_weights_extrinsic(
30873086
subtensor=self,

tests/e2e_tests/test_staking.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ def test_single_operation(subtensor, alice_wallet, bob_wallet):
169169
amount=stake_bob,
170170
wait_for_inclusion=True,
171171
wait_for_finalization=True,
172+
period=16,
172173
)
173174

174175
assert success is True

0 commit comments

Comments
 (0)