Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.5.0 bugfixes #2541

Merged
merged 5 commits into from
Dec 16, 2024
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
15 changes: 11 additions & 4 deletions bittensor/core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@

from __future__ import annotations

from bittensor.core.synapse import Synapse
from typing import Optional, TYPE_CHECKING

from substrateinterface.exceptions import SubstrateRequestException

class ChainError(BaseException):
if TYPE_CHECKING:
from bittensor.core.synapse import Synapse


class ChainError(SubstrateRequestException):
"""Base error for any chain related errors."""


Expand Down Expand Up @@ -81,7 +86,9 @@ class InvalidRequestNameError(Exception):


class SynapseException(Exception):
def __init__(self, message="Synapse Exception", synapse: "Synapse" | None = None):
def __init__(
self, message="Synapse Exception", synapse: Optional["Synapse"] = None
):
self.message = message
self.synapse = synapse
super().__init__(self.message)
Expand Down Expand Up @@ -123,7 +130,7 @@ class SynapseDendriteNoneException(SynapseException):
def __init__(
self,
message="Synapse Dendrite is None",
synapse: "Synapse" | None = None,
synapse: Optional["Synapse"] = None,
):
self.message = message
super().__init__(self.message, synapse)
6 changes: 3 additions & 3 deletions bittensor/core/subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def query_runtime_api(
self,
runtime_api: str,
method: str,
params: Optional[Union[list[int], dict[str, int]]],
params: Optional[Union[list[int], dict[str, int]]] = None,
block: Optional[int] = None,
) -> Optional[str]:
"""
Expand Down Expand Up @@ -956,13 +956,13 @@ def get_neuron_certificate(

@networking.ensure_connected
def neuron_for_uid(
self, uid: Optional[int], netuid: int, block: Optional[int] = None
self, uid: int, netuid: int, block: Optional[int] = None
) -> "NeuronInfo":
"""
Retrieves detailed information about a specific neuron identified by its unique identifier (UID) within a specified subnet (netuid) of the Bittensor network. This function provides a comprehensive view of a neuron's attributes, including its stake, rank, and operational status.

Args:
uid (Optional[int]): The unique identifier of the neuron.
uid (int): The unique identifier of the neuron.
netuid (int): The unique identifier of the subnet.
block (Optional[int]): The blockchain block number for the query.

Expand Down
Loading