From a67b3b7ff3995cd3d0ec7808966b373449250840 Mon Sep 17 00:00:00 2001 From: BD Himes <37844818+thewhaleking@users.noreply.github.com> Date: Thu, 30 Oct 2025 21:55:17 +0200 Subject: [PATCH 1/2] Release/9.12.2 (#3126) * Use uv pip for e2e dependency installation (#3109) * improve `subtensor.get_liquidity_list` * update `test_liquidity` (non functional) * add storage_keys * fix unit tests * apply default era.period to all extrinsics * apply default era.period to all subtensor extrinsic calls * fix *do tests * replace sn0 owner keys * Allow python 3.14 (#3122) * 9.12.2: changelog + version (#3125) changelog + version --------- Co-authored-by: Roman Chkhaidze Co-authored-by: Roman <167799377+basfroman@users.noreply.github.com> --- .github/workflows/e2e-subtensor-tests.yaml | 3 +- CHANGELOG.md | 8 ++ bittensor/core/async_subtensor.py | 107 ++++++++++-------- bittensor/core/settings.py | 3 + bittensor/core/subtensor.py | 87 +++++++------- pyproject.toml | 4 +- tests/e2e_tests/test_liquidity.py | 3 +- tests/e2e_tests/test_metagraph.py | 4 +- tests/e2e_tests/test_subtensor_functions.py | 16 +-- tests/e2e_tests/test_transfer.py | 3 +- tests/helpers/helpers.py | 2 + .../extrinsics/asyncex/test_commit_reveal.py | 1 + .../extrinsics/test_commit_reveal.py | 1 + tests/unit_tests/test_async_subtensor.py | 41 +++---- tests/unit_tests/test_subtensor.py | 57 +++++----- 15 files changed, 185 insertions(+), 155 deletions(-) diff --git a/.github/workflows/e2e-subtensor-tests.yaml b/.github/workflows/e2e-subtensor-tests.yaml index d56e9a726d..919989813f 100644 --- a/.github/workflows/e2e-subtensor-tests.yaml +++ b/.github/workflows/e2e-subtensor-tests.yaml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8334220b5d..f42a42ba6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/bittensor/core/async_subtensor.py b/bittensor/core/async_subtensor.py index 50851218a4..4c996be5ab 100644 --- a/bittensor/core/async_subtensor.py +++ b/bittensor/core/async_subtensor.py @@ -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, @@ -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. @@ -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 ) @@ -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]) @@ -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. @@ -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]: @@ -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} @@ -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 @@ -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. @@ -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 @@ -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]: """ @@ -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. @@ -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: """ @@ -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. @@ -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. @@ -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. @@ -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]: """ @@ -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. @@ -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. @@ -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. @@ -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, @@ -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. @@ -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. @@ -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. @@ -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, ): @@ -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 @@ -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 @@ -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. @@ -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. @@ -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. @@ -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. @@ -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: """ @@ -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. @@ -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: """ diff --git a/bittensor/core/settings.py b/bittensor/core/settings.py index 3e5edae0d6..f8ff494f1e 100644 --- a/bittensor/core/settings.py +++ b/bittensor/core/settings.py @@ -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 = { diff --git a/bittensor/core/subtensor.py b/bittensor/core/subtensor.py index 5866624777..68c5ca6f31 100644 --- a/bittensor/core/subtensor.py +++ b/bittensor/core/subtensor.py @@ -93,6 +93,7 @@ from bittensor.core.metagraph import Metagraph from bittensor.core.settings import ( version_as_int, + DEFAULT_PERIOD, SS58_FORMAT, TYPE_REGISTRY, ) @@ -544,7 +545,11 @@ def bonds( return b_map def commit( - self, 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. @@ -1615,6 +1620,16 @@ def get_liquidity_list( logging.debug(f"Subnet {netuid} is not active.") return None + # Fetch positions + positions_response = self.query_map( + module="Swap", + name="Positions", + block=block, + params=[netuid, wallet.coldkeypub.ss58_address], + ) + if len(positions_response.records) == 0: + return [] + block_hash = self.determine_block_hash(block) # Fetch global fees and current price @@ -1638,7 +1653,7 @@ def get_liquidity_list( ) fee_global_tao_query, fee_global_alpha_query, sqrt_price_query = ( self.substrate.query_multi( - [ + storage_keys=[ fee_global_tao_query_sk, fee_global_alpha_query_sk, sqrt_price_query_sk, @@ -1652,13 +1667,6 @@ def get_liquidity_list( sqrt_price = fixed_to_float(sqrt_price_query[1]) current_tick = price_to_tick(sqrt_price**2) - # Fetch positions - positions_response = self.query_map( - module="Swap", - name="Positions", - block=block, - params=[netuid, wallet.coldkeypub.ss58_address], - ) positions_values: list[tuple[dict, int, int]] = [] positions_storage_keys: list[StorageKey] = [] for _, p in positions_response: @@ -2962,7 +2970,7 @@ 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. @@ -3255,7 +3263,7 @@ 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]: @@ -3298,6 +3306,7 @@ 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} @@ -3341,7 +3350,7 @@ 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 @@ -3400,7 +3409,7 @@ 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. @@ -3448,7 +3457,7 @@ def add_stake_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, ) -> bool: """ Adds stakes to multiple neurons identified by their hotkey SS58 addresses. @@ -3488,7 +3497,7 @@ 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 @@ -3538,7 +3547,7 @@ 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]: """ @@ -3609,7 +3618,7 @@ 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. @@ -3682,7 +3691,7 @@ 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: """ @@ -3734,7 +3743,7 @@ 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, ) -> bool: """ Registers a neuron on the Bittensor network using the provided wallet. @@ -3789,7 +3798,7 @@ 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. @@ -3823,7 +3832,7 @@ 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. @@ -3871,7 +3880,7 @@ def reveal_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]: """ @@ -3935,7 +3944,7 @@ def root_register( wallet: "Wallet", wait_for_inclusion: bool = False, wait_for_finalization: bool = True, - period: Optional[int] = None, + period: Optional[int] = DEFAULT_PERIOD, ) -> bool: """ Register neuron by recycling some TAO. @@ -3967,7 +3976,7 @@ 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. @@ -4004,7 +4013,7 @@ def root_set_weights( version_key: int = 0, wait_for_inclusion: bool = False, wait_for_finalization: bool = False, - period: Optional[int] = None, + period: Optional[int] = DEFAULT_PERIOD, ) -> bool: """ Set weights for the root network. @@ -4043,7 +4052,7 @@ 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, @@ -4087,7 +4096,7 @@ 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. @@ -4129,7 +4138,7 @@ 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. @@ -4211,7 +4220,7 @@ 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. @@ -4261,7 +4270,7 @@ 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, ) -> tuple[bool, str]: @@ -4372,7 +4381,7 @@ 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 @@ -4412,7 +4421,7 @@ 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 @@ -4455,7 +4464,7 @@ 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. @@ -4515,7 +4524,7 @@ 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. @@ -4555,7 +4564,7 @@ def transfer( wait_for_finalization: bool = False, transfer_all: bool = False, keep_alive: bool = True, - period: Optional[int] = None, + period: Optional[int] = DEFAULT_PERIOD, ) -> bool: """ Transfer token of amount to destination. @@ -4600,7 +4609,7 @@ 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. @@ -4646,7 +4655,7 @@ 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: """ @@ -4703,7 +4712,7 @@ 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. @@ -4786,7 +4795,7 @@ 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: """ diff --git a/pyproject.toml b/pyproject.toml index 487092f7fe..0c03309682 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,14 +4,14 @@ build-backend = "setuptools.build_meta" [project] name = "bittensor" -version = "9.12.1" +version = "9.12.2" description = "Bittensor" readme = "README.md" authors = [ {name = "bittensor.com"} ] license = { file = "LICENSE" } -requires-python = ">=3.9,<3.14" +requires-python = ">=3.9,<3.15" dependencies = [ "wheel", "setuptools~=70.0.0", diff --git a/tests/e2e_tests/test_liquidity.py b/tests/e2e_tests/test_liquidity.py index e037d81fba..fc539c656f 100644 --- a/tests/e2e_tests/test_liquidity.py +++ b/tests/e2e_tests/test_liquidity.py @@ -5,8 +5,7 @@ from bittensor.utils.liquidity import LiquidityPosition -@pytest.mark.asyncio -async def test_liquidity(local_chain, subtensor, alice_wallet, bob_wallet): +def test_liquidity(subtensor, alice_wallet, bob_wallet): """ Tests the liquidity mechanism diff --git a/tests/e2e_tests/test_metagraph.py b/tests/e2e_tests/test_metagraph.py index b1b6d5ccc9..4955ca0743 100644 --- a/tests/e2e_tests/test_metagraph.py +++ b/tests/e2e_tests/test_metagraph.py @@ -304,8 +304,8 @@ def test_metagraph_info(subtensor, alice_wallet, bob_wallet): symbol="Τ", identity=None, network_registered_at=0, - owner_hotkey="5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM", - owner_coldkey="5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM", + owner_hotkey="5Dt9sidKJJxfvznECukm6ptHMWP7AykqkooeZijhDfBQFDqe", # //Alice_hk + owner_coldkey="5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", # //Alice block=1, tempo=100, last_step=0, diff --git a/tests/e2e_tests/test_subtensor_functions.py b/tests/e2e_tests/test_subtensor_functions.py index 286b16e076..bd66882229 100644 --- a/tests/e2e_tests/test_subtensor_functions.py +++ b/tests/e2e_tests/test_subtensor_functions.py @@ -65,25 +65,13 @@ async def test_subtensor_extrinsics(subtensor, templates, alice_wallet, bob_wall pre_subnet_creation_cost = subtensor.get_subnet_burn_cost() # Register subnet - assert subtensor.register_subnet(alice_wallet, True, True), ( + assert subtensor.register_subnet(alice_wallet, True, True, None), ( "Unable to register the subnet" ) - # TODO: in SDKv10 replace this logic with using `ExtrinsicResponse.extrinsic_fee` - call = subtensor.substrate.compose_call( - call_module="SubtensorModule", - call_function="register_network", - call_params={ - "hotkey": alice_wallet.hotkey.ss58_address, - "mechid": 1, - }, - ) - register_fee = get_extrinsic_fee(call, alice_wallet.hotkey, subtensor) - # Subnet burn cost is increased immediately after a subnet is registered post_subnet_creation_cost = subtensor.get_subnet_burn_cost() - # TODO: in SDKv10 replace this logic with using `ExtrinsicResponse.extrinsic_fee` call = subtensor.substrate.compose_call( call_module="SubtensorModule", call_function="register_network", @@ -158,7 +146,7 @@ async def test_subtensor_extrinsics(subtensor, templates, alice_wallet, bob_wall assert wait_to_start_call(subtensor, alice_wallet, netuid) # Register Bob to the subnet - assert subtensor.burned_register(bob_wallet, netuid), ( + assert subtensor.burned_register(bob_wallet, netuid, period=None), ( "Unable to register Bob as a neuron" ) diff --git a/tests/e2e_tests/test_transfer.py b/tests/e2e_tests/test_transfer.py index 0663b540b2..0735f96ccb 100644 --- a/tests/e2e_tests/test_transfer.py +++ b/tests/e2e_tests/test_transfer.py @@ -43,8 +43,9 @@ def test_transfer(subtensor: "SubtensorApi", alice_wallet): wallet=alice_wallet, dest=dest_coldkey, amount=transfer_value, + period=None, wait_for_finalization=True, - wait_for_inclusion=True, + wait_for_inclusion=False, ) # Account details after transfer balance_after = subtensor.get_balance(alice_wallet.coldkeypub.ss58_address) diff --git a/tests/helpers/helpers.py b/tests/helpers/helpers.py index 5896df51b0..08980a84c5 100644 --- a/tests/helpers/helpers.py +++ b/tests/helpers/helpers.py @@ -14,6 +14,7 @@ from websockets.uri import parse_uri from bittensor.core.chain_data import AxonInfo, NeuronInfo, PrometheusInfo +from bittensor.core.subtensor import DEFAULT_PERIOD from bittensor.utils.balance import Balance from tests.helpers.integration_websocket_data import WEBSOCKET_RESPONSES @@ -96,6 +97,7 @@ def assert_submit_signed_extrinsic( extrinsic = { "call": substrate.compose_call.return_value, "keypair": keypair, + "era": {"period": DEFAULT_PERIOD} } if era: diff --git a/tests/unit_tests/extrinsics/asyncex/test_commit_reveal.py b/tests/unit_tests/extrinsics/asyncex/test_commit_reveal.py index 137a5d8d41..01cf15799a 100644 --- a/tests/unit_tests/extrinsics/asyncex/test_commit_reveal.py +++ b/tests/unit_tests/extrinsics/asyncex/test_commit_reveal.py @@ -1,6 +1,7 @@ from bittensor.core import async_subtensor as subtensor_module from bittensor.core.chain_data import SubnetHyperparameters from bittensor.core.extrinsics.asyncex import commit_reveal as async_commit_reveal +from bittensor.core.settings import DEFAULT_PERIOD import pytest import torch import numpy as np diff --git a/tests/unit_tests/extrinsics/test_commit_reveal.py b/tests/unit_tests/extrinsics/test_commit_reveal.py index 42ae3e14d9..8a6e93ffd1 100644 --- a/tests/unit_tests/extrinsics/test_commit_reveal.py +++ b/tests/unit_tests/extrinsics/test_commit_reveal.py @@ -5,6 +5,7 @@ from bittensor.core import subtensor as subtensor_module from bittensor.core.chain_data import SubnetHyperparameters from bittensor.core.extrinsics import commit_reveal +from bittensor.core.settings import DEFAULT_PERIOD @pytest.fixture diff --git a/tests/unit_tests/test_async_subtensor.py b/tests/unit_tests/test_async_subtensor.py index 23b55b8a16..58d67042be 100644 --- a/tests/unit_tests/test_async_subtensor.py +++ b/tests/unit_tests/test_async_subtensor.py @@ -15,6 +15,7 @@ StakeInfo, SelectiveMetagraphIndex, ) +from bittensor.core.settings import DEFAULT_PERIOD from bittensor.utils import U64_MAX from bittensor.utils.balance import Balance from tests.helpers.helpers import assert_submit_signed_extrinsic @@ -1727,7 +1728,7 @@ async def fake_is_success(): # Asserts mocked_create_signed_extrinsic.assert_called_once_with( - call=fake_call, keypair=fake_wallet.coldkey + call=fake_call, keypair=fake_wallet.coldkey, era={"period": DEFAULT_PERIOD} ) mocked_submit_extrinsic.assert_called_once_with( fake_extrinsic, @@ -1778,7 +1779,7 @@ async def fake_error_message(): # Asserts mocked_create_signed_extrinsic.assert_called_once_with( - call=fake_call, keypair=fake_wallet.coldkey + call=fake_call, keypair=fake_wallet.coldkey, era={"period": DEFAULT_PERIOD} ) mocked_submit_extrinsic.assert_called_once_with( fake_extrinsic, @@ -1814,7 +1815,7 @@ async def test_sign_and_send_extrinsic_success_without_inclusion_finalization( # Asserts mocked_create_signed_extrinsic.assert_awaited_once() mocked_create_signed_extrinsic.assert_called_once_with( - call=fake_call, keypair=fake_wallet.coldkey + call=fake_call, keypair=fake_wallet.coldkey, era={"period": DEFAULT_PERIOD} ) mocked_submit_extrinsic.assert_awaited_once() mocked_submit_extrinsic.assert_called_once_with( @@ -2603,7 +2604,7 @@ async def test_transfer_success(subtensor, fake_wallet, mocker): wait_for_inclusion=True, wait_for_finalization=False, keep_alive=True, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_transfer_extrinsic.return_value @@ -2637,7 +2638,7 @@ async def test_register_success(subtensor, fake_wallet, mocker): wait_for_finalization=True, wait_for_inclusion=False, wallet=fake_wallet, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_register_extrinsic.return_value @@ -2675,7 +2676,7 @@ async def test_set_children(subtensor, fake_wallet, mocker): wait_for_finalization=True, wait_for_inclusion=True, raise_error=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_set_children_extrinsic.return_value @@ -2802,7 +2803,7 @@ async def test_set_weights_success(subtensor, fake_wallet, mocker): wait_for_finalization=False, wait_for_inclusion=False, weights=fake_weights, - period=8, + period=DEFAULT_PERIOD, mechid=0, ) mocked_weights_rate_limit.assert_called_once_with(fake_netuid) @@ -2891,7 +2892,7 @@ async def test_root_set_weights_success(subtensor, fake_wallet, mocker): version_key=0, wait_for_finalization=True, wait_for_inclusion=True, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_set_root_weights_extrinsic.return_value @@ -2933,7 +2934,7 @@ async def test_commit_weights_success(subtensor, fake_wallet, mocker): weights=fake_weights, wait_for_inclusion=False, wait_for_finalization=False, - period=16, + period=DEFAULT_PERIOD, mechid=0, ) assert result is True @@ -3035,7 +3036,7 @@ async def test_set_subnet_identity(mocker, subtensor, fake_wallet): additional=fake_subnet_identity.additional, wait_for_finalization=True, wait_for_inclusion=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -3141,7 +3142,7 @@ async def test_start_call(subtensor, mocker): netuid=netuid, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -3493,7 +3494,7 @@ async def test_unstake_all(subtensor, fake_wallet, mocker): rate_tolerance=0.005, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == fake_unstake_all_extrinsic.return_value @@ -3662,7 +3663,7 @@ async def test_get_liquidity_list_happy_path(subtensor, fake_wallet, mocker): ], ] - fake_result = mocker.AsyncMock(autospec=list) + fake_result = mocker.AsyncMock(records=fake_positions, autospec=list) fake_result.__aiter__.return_value = iter(fake_positions) mocked_query_map = mocker.AsyncMock(return_value=fake_result) @@ -3682,8 +3683,10 @@ async def test_get_liquidity_list_happy_path(subtensor, fake_wallet, mocker): mocked_query_map.assert_awaited_once_with( module="Swap", name="Positions", - block=None, params=[netuid, fake_wallet.coldkeypub.ss58_address], + block=None, + block_hash=None, + reuse_block=False, ) assert len(result) == len(fake_positions) assert all([isinstance(p, async_subtensor.LiquidityPosition) for p in result]) @@ -3716,7 +3719,7 @@ async def test_add_liquidity(subtensor, fake_wallet, mocker): hotkey=None, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -3749,7 +3752,7 @@ async def test_modify_liquidity(subtensor, fake_wallet, mocker): hotkey=None, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -3780,7 +3783,7 @@ async def test_remove_liquidity(subtensor, fake_wallet, mocker): hotkey=None, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -3810,7 +3813,7 @@ async def test_toggle_user_liquidity(subtensor, fake_wallet, mocker): enable=enable, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -4320,7 +4323,7 @@ async def test_set_auto_stake(subtensor, mocker): wallet=wallet, netuid=netuid, hotkey_ss58=hotkey, - period=None, + period=DEFAULT_PERIOD, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True, diff --git a/tests/unit_tests/test_subtensor.py b/tests/unit_tests/test_subtensor.py index d7411e02dc..295e5066f8 100644 --- a/tests/unit_tests/test_subtensor.py +++ b/tests/unit_tests/test_subtensor.py @@ -16,7 +16,7 @@ from bittensor.core.axon import Axon from bittensor.core.chain_data import SubnetHyperparameters, SelectiveMetagraphIndex from bittensor.core.extrinsics.serving import do_serve_axon -from bittensor.core.settings import version_as_int +from bittensor.core.settings import version_as_int, DEFAULT_PERIOD from bittensor.core.subtensor import Subtensor from bittensor.core.types import AxonServeCallParams from bittensor.utils import ( @@ -1206,7 +1206,7 @@ def test_set_weights(subtensor, mocker, fake_wallet): version_key=settings.version_as_int, wait_for_inclusion=fake_wait_for_inclusion, wait_for_finalization=fake_wait_for_finalization, - period=8, + period=DEFAULT_PERIOD, mechid=0, ) assert result == expected_result @@ -1238,7 +1238,7 @@ def test_serve_axon(subtensor, mocker): wait_for_inclusion=fake_wait_for_inclusion, wait_for_finalization=fake_wait_for_finalization, certificate=fake_certificate, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_serve_axon_extrinsic.return_value @@ -1273,7 +1273,7 @@ def test_commit(subtensor, fake_wallet, mocker): netuid=fake_netuid, data_type=f"Raw{len(fake_data)}", data=fake_data.encode(), - period=None, + period=DEFAULT_PERIOD, ) assert result is mocked_publish_metadata.return_value @@ -1331,7 +1331,7 @@ def test_transfer(subtensor, fake_wallet, mocker): wait_for_inclusion=fake_wait_for_inclusion, wait_for_finalization=fake_wait_for_finalization, keep_alive=True, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_transfer_extrinsic.return_value @@ -1986,7 +1986,7 @@ def test_commit_weights(subtensor, fake_wallet, mocker): weights=weights, wait_for_inclusion=wait_for_inclusion, wait_for_finalization=wait_for_finalization, - period=16, + period=DEFAULT_PERIOD, mechid=0, ) assert result == expected_result @@ -2029,7 +2029,7 @@ def test_reveal_weights(subtensor, fake_wallet, mocker): salt=salt, wait_for_inclusion=False, wait_for_finalization=False, - period=16, + period=DEFAULT_PERIOD, mechid=0, ) @@ -2862,7 +2862,7 @@ def test_add_stake_success(mocker, fake_wallet, subtensor): safe_staking=False, allow_partial_stake=False, rate_tolerance=0.005, - period=None, + period=DEFAULT_PERIOD, ) assert result == mock_add_stake_extrinsic.return_value @@ -2902,7 +2902,7 @@ def test_add_stake_with_safe_staking(mocker, fake_wallet, subtensor): safe_staking=True, allow_partial_stake=False, rate_tolerance=fake_rate_tolerance, - period=None, + period=DEFAULT_PERIOD, ) assert result == mock_add_stake_extrinsic.return_value @@ -2936,7 +2936,7 @@ def test_add_stake_multiple_success(mocker, fake_wallet, subtensor): amounts=fake_amount, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mock_add_stake_multiple_extrinsic.return_value @@ -2973,7 +2973,7 @@ def test_unstake_success(mocker, subtensor, fake_wallet): safe_staking=False, allow_partial_stake=False, rate_tolerance=0.005, - period=None, + period=DEFAULT_PERIOD, unstake_all=False, ) assert result == mock_unstake_extrinsic.return_value @@ -3011,7 +3011,7 @@ def test_unstake_with_safe_staking(mocker, subtensor, fake_wallet): safe_staking=True, allow_partial_stake=True, rate_tolerance=fake_rate_tolerance, - period=None, + period=DEFAULT_PERIOD, unstake_all=False, ) assert result == mock_unstake_extrinsic.return_value @@ -3056,7 +3056,7 @@ def test_swap_stake_success(mocker, subtensor, fake_wallet): safe_staking=False, allow_partial_stake=False, rate_tolerance=0.005, - period=None, + period=DEFAULT_PERIOD, ) assert result == mock_swap_stake_extrinsic.return_value @@ -3101,7 +3101,7 @@ def test_swap_stake_with_safe_staking(mocker, subtensor, fake_wallet): safe_staking=True, allow_partial_stake=True, rate_tolerance=fake_rate_tolerance, - period=None, + period=DEFAULT_PERIOD, ) assert result == mock_swap_stake_extrinsic.return_value @@ -3135,7 +3135,7 @@ def test_unstake_multiple_success(mocker, subtensor, fake_wallet): amounts=fake_amounts, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, unstake_all=False, ) assert result == mock_unstake_multiple_extrinsic.return_value @@ -3185,7 +3185,7 @@ def test_set_weights_with_commit_reveal_enabled(subtensor, fake_wallet, mocker): wait_for_inclusion=fake_wait_for_inclusion, wait_for_finalization=fake_wait_for_finalization, block_time=12.0, - period=8, + period=DEFAULT_PERIOD, commit_reveal_version=4, mechid=0, ) @@ -3246,7 +3246,7 @@ def test_set_subnet_identity(mocker, subtensor, fake_wallet): additional=fake_subnet_identity.additional, wait_for_finalization=True, wait_for_inclusion=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -3346,7 +3346,7 @@ def test_start_call(subtensor, mocker): netuid=netuid, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -3774,7 +3774,7 @@ def test_set_children(subtensor, fake_wallet, mocker): wait_for_finalization=True, wait_for_inclusion=True, raise_error=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_set_children_extrinsic.return_value @@ -3801,7 +3801,7 @@ def test_unstake_all(subtensor, fake_wallet, mocker): rate_tolerance=0.005, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == fake_unstake_all_extrinsic.return_value @@ -3868,7 +3868,10 @@ def test_get_liquidity_list_happy_path(subtensor, fake_wallet, mocker): ), ], ] - mocked_query_map = mocker.MagicMock(return_value=fake_positions) + fake_result = mocker.MagicMock(records=fake_positions, autospec=list) + fake_result.__iter__.return_value = iter(fake_positions) + + mocked_query_map = mocker.Mock(return_value=fake_result) mocker.patch.object(subtensor, "query_map", new=mocked_query_map) # Mock storage key creation @@ -3913,8 +3916,8 @@ def test_get_liquidity_list_happy_path(subtensor, fake_wallet, mocker): mocked_query_map.assert_called_once_with( module="Swap", name="Positions", - block=None, params=[netuid, fake_wallet.coldkeypub.ss58_address], + block=None, ) assert mock_query_multi.call_count == 2 # one for fees, one for ticks assert len(result) == len(fake_positions) @@ -3947,7 +3950,7 @@ def test_add_liquidity(subtensor, fake_wallet, mocker): hotkey=None, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -3979,7 +3982,7 @@ def test_modify_liquidity(subtensor, fake_wallet, mocker): hotkey=None, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -4009,7 +4012,7 @@ def test_remove_liquidity(subtensor, fake_wallet, mocker): hotkey=None, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -4038,7 +4041,7 @@ def test_toggle_user_liquidity(subtensor, fake_wallet, mocker): enable=enable, wait_for_inclusion=True, wait_for_finalization=False, - period=None, + period=DEFAULT_PERIOD, ) assert result == mocked_extrinsic.return_value @@ -4507,7 +4510,7 @@ def test_set_auto_stake(subtensor, mocker): wallet=wallet, netuid=netuid, hotkey_ss58=hotkey, - period=None, + period=DEFAULT_PERIOD, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True, From 0d979f36a849009ba9f24ec5a299631abec06cab Mon Sep 17 00:00:00 2001 From: Ragnar Date: Wed, 5 Nov 2025 21:10:22 +0100 Subject: [PATCH 2/2] Update axon_info.py --- bittensor/core/chain_data/axon_info.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/bittensor/core/chain_data/axon_info.py b/bittensor/core/chain_data/axon_info.py index 7b9e666bc2..bbb0aea567 100644 --- a/bittensor/core/chain_data/axon_info.py +++ b/bittensor/core/chain_data/axon_info.py @@ -52,20 +52,17 @@ def ip_str(self) -> str: return networking.ip__str__(self.ip_type, self.ip, self.port) def __eq__(self, other: "AxonInfo"): - if other is None: + if other is None or not isinstance(other, AxonInfo): return False - if ( + return ( self.version == other.version and self.ip == other.ip and self.port == other.port and self.ip_type == other.ip_type and self.coldkey == other.coldkey and self.hotkey == other.hotkey - ): - return True - - return False + ) def __str__(self): return f"AxonInfo( {self.ip_str()}, {self.hotkey}, {self.coldkey}, {self.version} )"