Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
871ac9e
`set_children_extrinsic` and `root_set_pending_childkey_cooldown_extr…
Sep 3, 2025
3547a93
`.commit_reveal_extrinsic` and `subtensor.set_weights` + tests
Sep 3, 2025
049810b
`wait_for_inclusion = True` and `wait_for_finalization = True` for `s…
Sep 3, 2025
07105bc
test
Sep 3, 2025
0ef19bf
`.add_liquidity_extrinsic` and `subtensor.add_liquidity`
Sep 3, 2025
f695bdf
`.modify_liquidity_extrinsic` and `subtensor.modify_liquidity` + `.re…
Sep 3, 2025
6993732
`.transfer_stake_extrinsic` and `subtensor.transfer_stake`
Sep 4, 2025
7005ada
`.swap_stake_extrinsic` and `subtensor.swap_stake`
Sep 4, 2025
e49d89d
`.move_stake_extrinsic` and `subtensor.move_stake` + renamed parameters
Sep 4, 2025
e546c49
`.burned_register_extrinsic` and `subtensor.burned_register`
Sep 4, 2025
bdbd1ba
fix `test_move_stake_*` e2e tests
Sep 4, 2025
97a677a
docstring refactoring
Sep 4, 2025
31cce62
`.register_subnet_extrinsic` and `subtensor.register_subnet`
Sep 4, 2025
22e0c0a
fix registration subnets in e2e tests
Sep 4, 2025
8b0ae89
fix registration subnets in e2e tests
Sep 4, 2025
f792c4e
`.register_extrinsic` and `subtensor.register`
Sep 4, 2025
de1607b
fix tests related with async register
Sep 4, 2025
3789e64
`.set_subnet_identity_extrinsic` and `subtensor.set_subnet_identity`
Sep 4, 2025
db123b6
update `subtensor.subnets.burned_register` call
Sep 4, 2025
db71ccd
oops, period=None
Sep 4, 2025
c6043fe
oops again - need to take a rest 😴
Sep 4, 2025
dcfd789
`.root_register_extrinsic`, `subtensor.burned_register` and `subtenso…
Sep 4, 2025
1596818
`.serve_extrinsic`, `.serve_axon_extrinsic` and `subtensor.serve_axon`
Sep 4, 2025
2083d88
change default values
Sep 4, 2025
3c04659
`.publish_metadata`, `subtensor.set_commitment` and `subtenor.set_rev…
Sep 4, 2025
a6f6aa0
`.add_stake_extrinsic`, `subtensor.add_stake` + `.add_stake_multiple_…
Sep 4, 2025
1cc391b
`.start_call_extrinsic`, `subtensor.start_call`
Sep 4, 2025
3820147
fix `test_dendrite`
Sep 4, 2025
162e30d
`.increase_take_extrinsic`, `.decrease_take_extrinsic` and `subtenor.…
Sep 4, 2025
af272fa
Merge branch 'SDKv10' into feat/roman/extrinsics-part-2
Sep 4, 2025
6f17d02
no flaky behavior for `tests/e2e_tests/test_dendrite.py`
Sep 4, 2025
7626866
`.transfer_extrinsic` and `subtensor.transfer`
Sep 4, 2025
232a12c
`.unstake_extrinsic` and `subtensor.unstake` + changes + tests
Sep 4, 2025
3bc569e
`.unstake_all_extrinsic` and `subtensor.unstake_all` + tests
Sep 4, 2025
80d21a2
`.unstake_multiple_extrinsic` and `subtensor.unstake_multiple` + tests
Sep 4, 2025
1528bbc
`.unstake_multiple_extrinsic` and `subtensor.unstake_multiple` + tests
Sep 4, 2025
f1eb2d1
`.reveal_weights_extrinsic` and `subtensor.reveal_weights`
Sep 4, 2025
12c22b0
update migration.md
Sep 4, 2025
4098506
`.set_weights_extrinsic` and `subtensor.set_weights`
Sep 4, 2025
f3d6633
parameter `safe_staking: bool` renamed to `safe_unstaking: bool` for …
Sep 4, 2025
2a925bc
in `.unstake_extrinsic` and `subtensor.unstake` parameter `safe_staki…
Sep 4, 2025
f37c1ca
update migration.md
Sep 4, 2025
779717c
`test_dendrite*` no flaky
Sep 5, 2025
9c33939
Merge branch 'feat/roman/extrinsics-part-2' into feat/roman/extrinsic…
Sep 5, 2025
b8c8982
Merge pull request #3046 from opentensor/feat/roman/extrinsics-part-3
basfroman Sep 5, 2025
e22bf9b
test_dendrite
Sep 5, 2025
1c7678d
Changes in `.add_stake_extrinsic` and `subtensor.add_stake`: see migr…
Sep 5, 2025
e00cbdb
Changes in `.add_stake_multiple_extrinsic` and `subtensor.add_stake_m…
Sep 5, 2025
37f49e6
limit `max-parallel` to 16 * 4 (py versions in reusable workflow)
Sep 5, 2025
2afa67d
`amount: Optional[Balance] = None` in `move_stake_extrinsic` bbc of l…
Sep 5, 2025
70db449
improved `unstake_multiple_extrinsic` logic
Sep 5, 2025
150bb5f
Merge branch 'SDKv10' into feat/roman/extrinsics-part-2
Sep 5, 2025
d01b2a9
updated migration.md
Sep 5, 2025
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
1 change: 1 addition & 0 deletions .github/workflows/e2e-subtensor-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ jobs:
- pull-docker-image
strategy:
fail-fast: false
max-parallel: 16
matrix:
include: ${{ fromJson(needs.find-tests.outputs.test-files) }}
uses: ./.github/workflows/_run-e2e-single.yaml
Expand Down
896 changes: 490 additions & 406 deletions bittensor/core/async_subtensor.py

Large diffs are not rendered by default.

53 changes: 36 additions & 17 deletions bittensor/core/extrinsics/asyncex/children.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,31 @@ async def set_children_extrinsic(
hotkey: str,
netuid: int,
children: list[tuple[float, str]],
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
raise_error: bool = False,
period: Optional[int] = None,
):
raise_error: bool = False,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
) -> tuple[bool, str]:
"""
Allows a coldkey to set children-keys.

Arguments:
subtensor: bittensor subtensor.
Parameters:
subtensor: The Subtensor client instance used for blockchain interaction.
wallet: bittensor wallet instance.
hotkey: The ``SS58`` address of the neuron's hotkey.
netuid: The netuid value.
children: A list of children with their proportions.
wait_for_inclusion: Waits for the transaction to be included in a block.
wait_for_finalization: Waits for the transaction to be finalized on the blockchain.
raise_error: Raises a relevant exception rather than returning `False` if unsuccessful.
period: The number of blocks during which the transaction will remain valid after it's submitted. If the
transaction is not included in a block within that number of blocks, it will expire and be rejected. You can
think of it as an expiration date for the transaction.
raise_error: Raises a relevant exception rather than returning `False` if unsuccessful.
wait_for_inclusion: Waits for the transaction to be included in a block.
wait_for_finalization: Waits for the transaction to be finalized on the blockchain.

Returns:
tuple[bool, str]: A tuple where the first element is a boolean indicating success or failure of the operation,
and the second element is a message providing additional information.
Tuple[bool, str]:
- True and a success message if the extrinsic is successfully submitted or processed.
- False and an error message if the submission fails or the wallet cannot be unlocked.

Raises:
DuplicateChild: There are duplicates in the list of children.
Expand Down Expand Up @@ -75,10 +76,10 @@ async def set_children_extrinsic(
success, message = await subtensor.sign_and_send_extrinsic(
call=call,
wallet=wallet,
period=period,
raise_error=raise_error,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
raise_error=raise_error,
period=period,
)

if not wait_for_finalization and not wait_for_inclusion:
Expand All @@ -94,12 +95,29 @@ async def root_set_pending_childkey_cooldown_extrinsic(
subtensor: "AsyncSubtensor",
wallet: "Wallet",
cooldown: int,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
raise_error: bool = False,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
) -> tuple[bool, str]:
"""
Allows a coldkey to set children-keys.
Allows a root coldkey to set children-keys.

Parameters:
subtensor: The Subtensor client instance used for blockchain interaction.
wallet: The wallet used to sign the extrinsic (must be unlocked).
cooldown: The cooldown period in blocks.
period: The number of blocks during which the transaction will remain valid after it's submitted. If the
transaction is not included in a block within that number of blocks, it will expire and be rejected. You can
think of it as an expiration date for the transaction.
raise_error: Raises a relevant exception rather than returning `False` if unsuccessful.
wait_for_inclusion: Waits for the transaction to be included in a block.
wait_for_finalization: Waits for the transaction to be finalized on the blockchain.

Returns:
Tuple[bool, str]:
- True and a success message if the extrinsic is successfully submitted or processed.
- False and an error message if the submission fails or the wallet cannot be unlocked.
"""
unlock = unlock_key(wallet)

Expand All @@ -122,9 +140,10 @@ async def root_set_pending_childkey_cooldown_extrinsic(
success, message = await subtensor.sign_and_send_extrinsic(
call=sudo_call,
wallet=wallet,
period=period,
raise_error=raise_error,
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
period=period,
)

if not wait_for_finalization and not wait_for_inclusion:
Expand Down
34 changes: 19 additions & 15 deletions bittensor/core/extrinsics/asyncex/commit_reveal.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,37 @@ async def commit_reveal_extrinsic(
netuid: int,
uids: Union[NDArray[np.int64], "torch.LongTensor", list],
weights: Union[NDArray[np.float32], "torch.FloatTensor", list],
block_time: Union[int, float] = 12.0,
commit_reveal_version: int = 4,
version_key: int = version_as_int,
period: Optional[int] = None,
raise_error: bool = False,
wait_for_inclusion: bool = False,
wait_for_finalization: bool = False,
block_time: Union[int, float] = 12.0,
period: Optional[int] = None,
commit_reveal_version: int = 4,
) -> tuple[bool, str]:
"""
Commits and reveals weights for a given subtensor and wallet with provided uids and weights.

Arguments:
subtensor: The AsyncSubtensor instance.
Parameters:
subtensor: The Subtensor instance.
wallet: The wallet to use for committing and revealing.
netuid: The id of the network.
uids: The uids to commit.
weights: The weights associated with the uids.
version_key: The version key to use for committing and revealing. Default is version_as_int.
wait_for_inclusion: Whether to wait for the inclusion of the transaction. Default is False.
wait_for_finalization: Whether to wait for the finalization of the transaction. Default is False.
block_time (float): The number of seconds for block duration. Default is 12.0 seconds.
period (Optional[int]): The number of blocks during which the transaction will remain valid after it's submitted. If
the transaction is not included in a block within that number of blocks, it will expire and be rejected.
You can think of it as an expiration date for the transaction.
commit_reveal_version: The version of the chain commit-reveal protocol to use. Default is ``4``.
block_time: The number of seconds for block duration.
commit_reveal_version: The version of the chain commit-reveal protocol to use.
version_key: The version key to use for committing and revealing.
period: The number of blocks during which the transaction will remain valid after it's submitted. If the
transaction is not included in a block within that number of blocks, it will expire and be rejected. You can
think of it as an expiration date for the transaction.
raise_error: Raises a relevant exception rather than returning `False` if unsuccessful.
wait_for_inclusion: Whether to wait for the inclusion of the transaction.
wait_for_finalization: Whether to wait for the finalization of the transaction.

Returns:
tuple[bool, str]: A tuple where the first element is a boolean indicating success or failure, and the second
element is a message associated with the result
Tuple[bool, str]:
- True and a success message if the extrinsic is successfully submitted or processed.
- False and an error message if the submission fails or the wallet cannot be unlocked.
"""
try:
uids, weights = convert_and_normalize_weights_and_uids(uids, weights)
Expand Down Expand Up @@ -96,6 +99,7 @@ async def commit_reveal_extrinsic(
wait_for_finalization=wait_for_finalization,
sign_with="hotkey",
period=period,
raise_error=raise_error,
)

if not success:
Expand Down
84 changes: 48 additions & 36 deletions bittensor/core/extrinsics/asyncex/liquidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,36 @@ async def add_liquidity_extrinsic(
price_low: Balance,
price_high: Balance,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
raise_error: bool = False,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
) -> tuple[bool, str]:
"""
Adds liquidity to the specified price range.

Arguments:
Parameters:
subtensor: The Subtensor client instance used for blockchain interaction.
wallet: The wallet used to sign the extrinsic (must be unlocked).
netuid: The UID of the target subnet for which the call is being initiated.
liquidity: The amount of liquidity to be added.
price_low: The lower bound of the price tick range.
price_high: The upper bound of the price tick range.
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
the transaction is not included in a block within that number of blocks, it will expire and be rejected.
You can think of it as an expiration date for the transaction.
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used.
period: The number of blocks during which the transaction will remain valid after it's submitted. If the
transaction is not included in a block within that number of blocks, it will expire and be rejected. You can
think of it as an expiration date for the transaction.
raise_error: Raises a relevant exception rather than returning `False` if unsuccessful.
wait_for_inclusion: Whether to wait for the inclusion of the transaction.
wait_for_finalization: Whether to wait for the finalization of the transaction.

Returns:
Tuple[bool, str]:
- True and a success message if the extrinsic is successfully submitted or processed.
- False and an error message if the submission fails or the wallet cannot be unlocked.

Note: Adding is allowed even when user liquidity is enabled in specified subnet. Call
`toggle_user_liquidity_extrinsic` to enable/disable user liquidity.
`toggle_user_liquidity_extrinsic` to enable/disable user liquidity.
"""
if not (unlock := unlock_key(wallet)).success:
logging.error(unlock.message)
Expand Down Expand Up @@ -73,6 +75,7 @@ async def add_liquidity_extrinsic(
wait_for_finalization=wait_for_finalization,
use_nonce=True,
period=period,
raise_error=raise_error,
)


Expand All @@ -83,24 +86,26 @@ async def modify_liquidity_extrinsic(
position_id: int,
liquidity_delta: Balance,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
raise_error: bool = False,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
) -> tuple[bool, str]:
"""Modifies liquidity in liquidity position by adding or removing liquidity from it.

Arguments:
Parameters:
subtensor: The Subtensor client instance used for blockchain interaction.
wallet: The wallet used to sign the extrinsic (must be unlocked).
netuid: The UID of the target subnet for which the call is being initiated.
position_id: The id of the position record in the pool.
liquidity_delta: The amount of liquidity to be added or removed (add if positive or remove if negative).
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
the transaction is not included in a block within that number of blocks, it will expire and be rejected.
You can think of it as an expiration date for the transaction.
period: The number of blocks during which the transaction will remain valid after it's submitted. If the
transaction is not included in a block within that number of blocks, it will expire and be rejected. You can
think of it as an expiration date for the transaction.
raise_error: Raises a relevant exception rather than returning `False` if unsuccessful.
wait_for_inclusion: Whether to wait for the inclusion of the transaction.
wait_for_finalization: Whether to wait for the finalization of the transaction.

Returns:
Tuple[bool, str]:
Expand Down Expand Up @@ -132,6 +137,7 @@ async def modify_liquidity_extrinsic(
wait_for_finalization=wait_for_finalization,
use_nonce=True,
period=period,
raise_error=raise_error,
)


Expand All @@ -141,31 +147,33 @@ async def remove_liquidity_extrinsic(
netuid: int,
position_id: int,
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
raise_error: bool = False,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
) -> tuple[bool, str]:
"""Remove liquidity and credit balances back to wallet's hotkey stake.

Arguments:
Parameters:
subtensor: The Subtensor client instance used for blockchain interaction.
wallet: The wallet used to sign the extrinsic (must be unlocked).
netuid: The UID of the target subnet for which the call is being initiated.
position_id: The id of the position record in the pool.
hotkey: The hotkey with staked TAO in Alpha. If not passed then the wallet hotkey is used. Defaults to `None`.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
the transaction is not included in a block within that number of blocks, it will expire and be rejected.
You can think of it as an expiration date for the transaction.
period: The number of blocks during which the transaction will remain valid after it's submitted. If the
transaction is not included in a block within that number of blocks, it will expire and be rejected. You can
think of it as an expiration date for the transaction.
raise_error: Raises a relevant exception rather than returning `False` if unsuccessful.
wait_for_inclusion: Whether to wait for the inclusion of the transaction.
wait_for_finalization: Whether to wait for the finalization of the transaction.

Returns:
Tuple[bool, str]:
- True and a success message if the extrinsic is successfully submitted or processed.
- False and an error message if the submission fails or the wallet cannot be unlocked.

Note: Adding is allowed even when user liquidity is enabled in specified subnet.
Call `toggle_user_liquidity_extrinsic` to enable/disable user liquidity.
Note: Adding is allowed even when user liquidity is enabled in specified subnet. Call
`toggle_user_liquidity_extrinsic` to enable/disable user liquidity.
"""
if not (unlock := unlock_key(wallet)).success:
logging.error(unlock.message)
Expand All @@ -188,6 +196,7 @@ async def remove_liquidity_extrinsic(
wait_for_finalization=wait_for_finalization,
use_nonce=True,
period=period,
raise_error=raise_error,
)


Expand All @@ -196,22 +205,24 @@ async def toggle_user_liquidity_extrinsic(
wallet: "Wallet",
netuid: int,
enable: bool,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
raise_error: bool = False,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
) -> tuple[bool, str]:
"""Allow to toggle user liquidity for specified subnet.

Arguments:
Parameters:
subtensor: The Subtensor client instance used for blockchain interaction.
wallet: The wallet used to sign the extrinsic (must be unlocked).
netuid: The UID of the target subnet for which the call is being initiated.
enable: Boolean indicating whether to enable user liquidity.
wait_for_inclusion: Whether to wait for the extrinsic to be included in a block. Defaults to True.
wait_for_finalization: Whether to wait for finalization of the extrinsic. Defaults to False.
period: The number of blocks during which the transaction will remain valid after it's submitted. If
the transaction is not included in a block within that number of blocks, it will expire and be rejected.
You can think of it as an expiration date for the transaction.
period: The number of blocks during which the transaction will remain valid after it's submitted. If the
transaction is not included in a block within that number of blocks, it will expire and be rejected. You can
think of it as an expiration date for the transaction.
raise_error: Raises a relevant exception rather than returning `False` if unsuccessful.
wait_for_inclusion: Whether to wait for the inclusion of the transaction.
wait_for_finalization: Whether to wait for the finalization of the transaction.

Returns:
Tuple[bool, str]:
Expand All @@ -234,4 +245,5 @@ async def toggle_user_liquidity_extrinsic(
wait_for_inclusion=wait_for_inclusion,
wait_for_finalization=wait_for_finalization,
period=period,
raise_error=raise_error,
)
Loading