Skip to content

Commit

Permalink
GO AWAY
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhaleking committed Aug 22, 2024
1 parent 491012c commit f45a5d8
Showing 1 changed file with 0 additions and 88 deletions.
88 changes: 0 additions & 88 deletions src/bittensor/chain_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,94 +114,6 @@ def from_neuron_info(cls, neuron_info: dict) -> "AxonInfo":
coldkey=neuron_info["coldkey"],
)

@dataclass
class SubnetHyperparameters:
"""Dataclass for subnet hyperparameters."""

rho: int
kappa: int
immunity_period: int
min_allowed_weights: int
max_weight_limit: float
tempo: int
min_difficulty: int
max_difficulty: int
weights_version: int
weights_rate_limit: int
adjustment_interval: int
activity_cutoff: int
registration_allowed: bool
target_regs_per_interval: int
min_burn: int
max_burn: int
bonds_moving_avg: int
max_regs_per_block: int
serving_rate_limit: int
max_validators: int
adjustment_alpha: int
difficulty: int
commit_reveal_weights_interval: int
commit_reveal_weights_enabled: bool
alpha_high: int
alpha_low: int
liquid_alpha_enabled: bool

@classmethod
def from_vec_u8(cls, vec_u8: list[int]) -> Optional["SubnetHyperparameters"]:
"""Returns a SubnetHyperparameters object from a ``vec_u8``."""
if len(vec_u8) == 0:
return None

decoded = from_scale_encoding(vec_u8, ChainDataType.SubnetHyperparameters)
if decoded is None:
return None

return SubnetHyperparameters.fix_decoded_values(decoded)

@classmethod
def list_from_vec_u8(cls, vec_u8: list[int]) -> list["SubnetHyperparameters"]:
"""Returns a list of SubnetHyperparameters objects from a ``vec_u8``."""
decoded = from_scale_encoding(
vec_u8, ChainDataType.SubnetHyperparameters, is_vec=True, is_option=True
)
if decoded is None:
return []

return [SubnetHyperparameters.fix_decoded_values(d) for d in decoded]

@classmethod
def fix_decoded_values(cls, decoded: dict) -> "SubnetHyperparameters":
"""Returns a SubnetInfo object from a decoded SubnetInfo dictionary."""
return SubnetHyperparameters(
rho=decoded["rho"],
kappa=decoded["kappa"],
immunity_period=decoded["immunity_period"],
min_allowed_weights=decoded["min_allowed_weights"],
max_weight_limit=decoded["max_weights_limit"],
tempo=decoded["tempo"],
min_difficulty=decoded["min_difficulty"],
max_difficulty=decoded["max_difficulty"],
weights_version=decoded["weights_version"],
weights_rate_limit=decoded["weights_rate_limit"],
adjustment_interval=decoded["adjustment_interval"],
activity_cutoff=decoded["activity_cutoff"],
registration_allowed=decoded["registration_allowed"],
target_regs_per_interval=decoded["target_regs_per_interval"],
min_burn=decoded["min_burn"],
max_burn=decoded["max_burn"],
max_regs_per_block=decoded["max_regs_per_block"],
max_validators=decoded["max_validators"],
serving_rate_limit=decoded["serving_rate_limit"],
bonds_moving_avg=decoded["bonds_moving_avg"],
adjustment_alpha=decoded["adjustment_alpha"],
difficulty=decoded["difficulty"],
commit_reveal_weights_interval=decoded["commit_reveal_weights_interval"],
commit_reveal_weights_enabled=decoded["commit_reveal_weights_enabled"],
alpha_high=decoded["alpha_high"],
alpha_low=decoded["alpha_low"],
liquid_alpha_enabled=decoded["liquid_alpha_enabled"],
)


@dataclass
class SubnetHyperparameters:
Expand Down

0 comments on commit f45a5d8

Please sign in to comment.