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
3 changes: 2 additions & 1 deletion .github/workflows/e2e-subtensor-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ jobs:
- name: Install deps for collection
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
python -m pip install uv
uv pip install -e ".[dev]" --system
- name: Find test files
id: get-tests
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Changelog
## 9.12.2 /2025-10-30
* Use uv pip for e2e dependency installation by @thewhaleking in https://github.com/opentensor/bittensor/pull/3109
* Fix for `test_liquidity` by @basfroman in https://github.com/opentensor/bittensor/pull/3114
* Apply default `era.period` to all subtensor extrinsic calls by @basfroman in https://github.com/opentensor/bittensor/pull/3115
* set root owner for fast runtime time by @basfroman in https://github.com/opentensor/bittensor/pull/3118
* Allow python 3.14 by @thewhaleking in https://github.com/opentensor/bittensor/pull/3122

**Full Changelog**: https://github.com/opentensor/bittensor/compare/v9.12.1...v9.12.2

## 9.12.1 /2025-10-20

Expand Down
107 changes: 59 additions & 48 deletions bittensor/core/async_subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
unstake_multiple_extrinsic,
)
from bittensor.core.metagraph import AsyncMetagraph
from bittensor.core.settings import version_as_int, TYPE_REGISTRY
from bittensor.core.settings import version_as_int, TYPE_REGISTRY, DEFAULT_PERIOD
from bittensor.core.types import (
ParamWithTypes,
Salt,
Expand Down Expand Up @@ -956,7 +956,11 @@ async def bonds(
return b_map

async def commit(
self, wallet: "Wallet", netuid: int, data: str, period: Optional[int] = None
self,
wallet: "Wallet",
netuid: int,
data: str,
period: Optional[int] = DEFAULT_PERIOD,
) -> bool:
"""Commits arbitrary data to the Bittensor network by publishing metadata.

Expand Down Expand Up @@ -2385,6 +2389,17 @@ async def get_liquidity_list(
logging.debug(f"Subnet {netuid} is not active.")
return None

positions_response = await self.query_map(
module="Swap",
name="Positions",
params=[netuid, wallet.coldkeypub.ss58_address],
block=block,
block_hash=block_hash,
reuse_block=reuse_block,
)
if len(positions_response.records) == 0:
return []

block_hash = await self.determine_block_hash(
block=block, block_hash=block_hash, reuse_block=reuse_block
)
Expand All @@ -2408,25 +2423,20 @@ async def get_liquidity_list(
params=[netuid],
block_hash=block_hash,
)

(
(fee_global_tao_query, fee_global_alpha_query, sqrt_price_query),
positions_response,
) = await asyncio.gather(
self.substrate.query_multi(
[
fee_global_tao_query_sk,
fee_global_alpha_query_sk,
sqrt_price_query_sk,
],
block_hash=block_hash,
),
self.query_map(
module="Swap",
name="Positions",
block=block,
params=[netuid, wallet.coldkeypub.ss58_address],
),
fee_global_tao_query,
fee_global_alpha_query,
sqrt_price_query,
) = await self.substrate.query_multi(
storage_keys=[
fee_global_tao_query_sk,
fee_global_alpha_query_sk,
sqrt_price_query_sk,
],
block_hash=block_hash,
)

# convert to floats
fee_global_tao = fixed_to_float(fee_global_tao_query[1])
fee_global_alpha = fixed_to_float(fee_global_alpha_query[1])
Expand Down Expand Up @@ -4043,7 +4053,7 @@ async def set_reveal_commitment(
data: str,
blocks_until_reveal: int = 360,
block_time: Union[int, float] = 12,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> tuple[bool, int]:
"""
Commits arbitrary data to the Bittensor network by publishing metadata.
Expand Down Expand Up @@ -4437,7 +4447,7 @@ async def sign_and_send_extrinsic(
wait_for_finalization: bool = False,
sign_with: str = "coldkey",
use_nonce: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
nonce_key: str = "hotkey",
raise_error: bool = False,
) -> tuple[bool, str]:
Expand Down Expand Up @@ -4480,6 +4490,7 @@ async def sign_and_send_extrinsic(
getattr(wallet, nonce_key).ss58_address
)
extrinsic_data["nonce"] = next_nonce

if period is not None:
extrinsic_data["era"] = {"period": period}

Expand Down Expand Up @@ -4523,7 +4534,7 @@ async def add_stake(
safe_staking: bool = False,
allow_partial_stake: bool = False,
rate_tolerance: float = 0.005,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> bool:
"""
Adds a stake from the specified wallet to the neuron identified by the SS58 address of its hotkey in specified
Expand Down Expand Up @@ -4581,7 +4592,7 @@ async def add_liquidity(
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> tuple[bool, str]:
"""
Adds liquidity to the specified price range.
Expand Down Expand Up @@ -4664,7 +4675,7 @@ async def burned_register(
netuid: int,
wait_for_inclusion: bool = False,
wait_for_finalization: bool = True,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> bool:
"""
Registers a neuron on the Bittensor network by recycling TAO. This method of registration involves recycling
Expand Down Expand Up @@ -4713,7 +4724,7 @@ async def commit_weights(
wait_for_inclusion: bool = False,
wait_for_finalization: bool = False,
max_retries: int = 5,
period: Optional[int] = 16,
period: Optional[int] = DEFAULT_PERIOD,
mechid: int = 0,
) -> tuple[bool, str]:
"""
Expand Down Expand Up @@ -4788,7 +4799,7 @@ async def modify_liquidity(
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> tuple[bool, str]:
"""Modifies liquidity in liquidity position by adding or removing liquidity from it.

Expand Down Expand Up @@ -4861,7 +4872,7 @@ async def move_stake(
amount: Optional[Balance] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
move_all_stake: bool = False,
) -> bool:
"""
Expand Down Expand Up @@ -4913,7 +4924,7 @@ async def register(
num_processes: Optional[int] = None,
update_interval: Optional[int] = None,
log_verbose: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
):
"""
Registers a neuron on the Bittensor network using the provided wallet.
Expand Down Expand Up @@ -4967,7 +4978,7 @@ async def register_subnet(
wallet: "Wallet",
wait_for_inclusion: bool = False,
wait_for_finalization: bool = True,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> bool:
"""
Registers a new subnetwork on the Bittensor network.
Expand Down Expand Up @@ -5001,7 +5012,7 @@ async def remove_liquidity(
hotkey: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> tuple[bool, str]:
"""Remove liquidity and credit balances back to wallet's hotkey stake.

Expand Down Expand Up @@ -5049,7 +5060,7 @@ async def reveal_weights(
wait_for_inclusion: bool = False,
wait_for_finalization: bool = False,
max_retries: int = 5,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
mechid: int = 0,
) -> tuple[bool, str]:
"""
Expand Down Expand Up @@ -5114,7 +5125,7 @@ async def root_set_pending_childkey_cooldown(
cooldown: int,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> tuple[bool, str]:
"""Sets the pending childkey cooldown.

Expand Down Expand Up @@ -5150,7 +5161,7 @@ async def root_register(
block_hash: Optional[str] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> bool:
"""
Register neuron by recycling some TAO.
Expand Down Expand Up @@ -5185,7 +5196,7 @@ async def root_set_weights(
version_key: int = 0,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> bool:
"""
Set weights for the root network.
Expand Down Expand Up @@ -5223,7 +5234,7 @@ async def set_auto_stake(
wallet: "Wallet",
netuid: int,
hotkey_ss58: str,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
raise_error: bool = False,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
Expand Down Expand Up @@ -5267,7 +5278,7 @@ async def set_children(
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
raise_error: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> tuple[bool, str]:
"""
Allows a coldkey to set children-keys.
Expand Down Expand Up @@ -5321,7 +5332,7 @@ async def set_delegate_take(
wait_for_inclusion: bool = True,
wait_for_finalization: bool = True,
raise_error: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> tuple[bool, str]:
"""
Sets the delegate 'take' percentage for a neuron identified by its hotkey.
Expand Down Expand Up @@ -5404,7 +5415,7 @@ async def set_subnet_identity(
subnet_identity: SubnetIdentity,
wait_for_inclusion: bool = False,
wait_for_finalization: bool = True,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> tuple[bool, str]:
"""
Sets the identity of a subnet for a specific wallet and network.
Expand Down Expand Up @@ -5454,7 +5465,7 @@ async def set_weights(
wait_for_finalization: bool = False,
max_retries: int = 5,
block_time: float = 12.0,
period: Optional[int] = 8,
period: Optional[int] = DEFAULT_PERIOD,
mechid: int = 0,
commit_reveal_version: int = 4,
):
Expand Down Expand Up @@ -5579,7 +5590,7 @@ async def serve_axon(
wait_for_inclusion: bool = False,
wait_for_finalization: bool = True,
certificate: Optional[Certificate] = None,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> bool:
"""
Registers an ``Axon`` serving endpoint on the Bittensor network for a specific neuron. This function is used to
Expand Down Expand Up @@ -5617,7 +5628,7 @@ async def start_call(
netuid: int,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> tuple[bool, str]:
"""
Submits a start_call extrinsic to the blockchain, to trigger the start call process for a subnet (used to start
Expand Down Expand Up @@ -5658,7 +5669,7 @@ async def swap_stake(
safe_staking: bool = False,
allow_partial_stake: bool = False,
rate_tolerance: float = 0.005,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> bool:
"""
Moves stake between subnets while keeping the same coldkey-hotkey pair ownership.
Expand Down Expand Up @@ -5717,7 +5728,7 @@ async def toggle_user_liquidity(
enable: bool,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> tuple[bool, str]:
"""Allow to toggle user liquidity for specified subnet.

Expand Down Expand Up @@ -5757,7 +5768,7 @@ async def transfer(
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
keep_alive: bool = True,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> bool:
"""
Transfer token of amount to destination.
Expand Down Expand Up @@ -5800,7 +5811,7 @@ async def transfer_stake(
amount: Balance,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> bool:
"""
Transfers stake from one subnet to another while changing the coldkey owner.
Expand Down Expand Up @@ -5846,7 +5857,7 @@ async def unstake(
safe_staking: bool = False,
allow_partial_stake: bool = False,
rate_tolerance: float = 0.005,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
unstake_all: bool = False,
) -> bool:
"""
Expand Down Expand Up @@ -5903,7 +5914,7 @@ async def unstake_all(
rate_tolerance: Optional[float] = 0.005,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
) -> tuple[bool, str]:
"""Unstakes all TAO/Alpha associated with a hotkey from the specified subnets on the Bittensor network.

Expand Down Expand Up @@ -5987,7 +5998,7 @@ async def unstake_multiple(
amounts: Optional[list[Balance]] = None,
wait_for_inclusion: bool = True,
wait_for_finalization: bool = False,
period: Optional[int] = None,
period: Optional[int] = DEFAULT_PERIOD,
unstake_all: bool = False,
) -> bool:
"""
Expand Down
3 changes: 3 additions & 0 deletions bittensor/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
# Wallet ss58 address length
SS58_ADDRESS_LENGTH = 48

# Default period for extrinsic Era
DEFAULT_PERIOD = 32

# Block Explorers map network to explorer url
# Must all be polkadotjs explorer urls
NETWORK_EXPLORER_MAP = {
Expand Down
Loading
Loading