Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bittensor/core/extrinsics/set_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def do_set_weights(
version_key: int = version_as_int,
wait_for_inclusion: bool = False,
wait_for_finalization: bool = False,
period: int = 5,
) -> tuple[bool, Optional[str]]: # (success, error_message)
"""
Internal method to send a transaction to the Bittensor blockchain, setting weights for specified neurons. This method constructs and submits the transaction, handling retries and blockchain communication.
Expand All @@ -58,6 +59,7 @@ def do_set_weights(
version_key (int): Version key for compatibility with the network.
wait_for_inclusion (bool): Waits for the transaction to be included in a block.
wait_for_finalization (bool): Waits for the transaction to be finalized on the blockchain.
period (int): Period dictates how long the extrinsic will stay as part of waiting pool.

Returns:
tuple[bool, Optional[str]]: A tuple containing a success flag and an optional response message.
Expand All @@ -79,7 +81,7 @@ def do_set_weights(
extrinsic = self.substrate.create_signed_extrinsic(
call=call,
keypair=wallet.hotkey,
era={"period": 5},
era={"period": period},
)
response = submit_extrinsic(
substrate=self.substrate,
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e_tests/test_incentive.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
from bittensor.core.metagraph import Metagraph


FAST_BLOCKS_SPEEDUP_FACTOR = 5


@pytest.mark.asyncio
async def test_incentive(local_chain):
"""
Expand Down Expand Up @@ -158,6 +161,7 @@ async def test_incentive(local_chain):
version_key=0,
wait_for_inclusion=True,
wait_for_finalization=True,
period=5 * FAST_BLOCKS_SPEEDUP_FACTOR,
)
logging.info("Alice neuron set weights successfully")

Expand Down