bittensor-cli 9.22.0__tar.gz → 9.22.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/PKG-INFO +2 -2
  2. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/cli.py +2 -6
  3. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/__init__.py +30 -49
  4. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/chain_data.py +108 -135
  5. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/subtensor_interface.py +8 -25
  6. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/utils.py +2 -6
  7. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/lock/list.py +1 -1
  8. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/pyproject.toml +2 -2
  9. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/README.md +0 -0
  10. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/__init__.py +0 -0
  11. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/doc_generation_helper.py +0 -0
  12. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/__init__.py +0 -0
  13. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/balances.py +0 -0
  14. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/extrinsics/__init__.py +0 -0
  15. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/extrinsics/mev_shield.py +0 -0
  16. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/extrinsics/registration.py +0 -0
  17. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/extrinsics/root.py +0 -0
  18. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/extrinsics/serving.py +0 -0
  19. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/extrinsics/transfer.py +0 -0
  20. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/locks.py +0 -0
  21. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/minigraph.py +0 -0
  22. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/networking.py +0 -0
  23. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/main-filters.j2 +0 -0
  24. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/main-header.j2 +0 -0
  25. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/neuron-details.j2 +0 -0
  26. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/price-multi.j2 +0 -0
  27. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/price-single.j2 +0 -0
  28. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/subnet-details-header.j2 +0 -0
  29. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/subnet-details.j2 +0 -0
  30. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/subnet-metrics.j2 +0 -0
  31. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/subnets-table.j2 +0 -0
  32. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/table.j2 +0 -0
  33. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/view.css +0 -0
  34. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/view.j2 +0 -0
  35. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/bittensor/templates/view.js +0 -0
  36. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/__init__.py +0 -0
  37. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/axon/__init__.py +0 -0
  38. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/axon/axon.py +0 -0
  39. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/crowd/__init__.py +0 -0
  40. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/crowd/contribute.py +0 -0
  41. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/crowd/contributors.py +0 -0
  42. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/crowd/create.py +0 -0
  43. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/crowd/dissolve.py +0 -0
  44. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/crowd/refund.py +0 -0
  45. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/crowd/update.py +0 -0
  46. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/crowd/utils.py +0 -0
  47. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/crowd/view.py +0 -0
  48. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/liquidity/__init__.py +0 -0
  49. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/liquidity/liquidity.py +0 -0
  50. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/liquidity/utils.py +0 -0
  51. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/lock/__init__.py +0 -0
  52. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/lock/add.py +0 -0
  53. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/lock/common.py +0 -0
  54. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/lock/mode.py +0 -0
  55. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/lock/move.py +0 -0
  56. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/proxy.py +0 -0
  57. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/stake/__init__.py +0 -0
  58. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/stake/add.py +0 -0
  59. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/stake/auto_staking.py +0 -0
  60. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/stake/children_hotkeys.py +0 -0
  61. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/stake/claim.py +0 -0
  62. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/stake/list.py +0 -0
  63. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/stake/move.py +0 -0
  64. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/stake/remove.py +0 -0
  65. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/stake/wizard.py +0 -0
  66. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/subnets/__init__.py +0 -0
  67. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/subnets/mechanisms.py +0 -0
  68. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/subnets/price.py +0 -0
  69. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/subnets/subnets.py +0 -0
  70. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/sudo.py +0 -0
  71. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/view.py +0 -0
  72. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/wallets.py +0 -0
  73. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/src/commands/weights.py +0 -0
  74. {bittensor_cli-9.22.0 → bittensor_cli-9.22.2}/bittensor_cli/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bittensor-cli
3
- Version: 9.22.0
3
+ Version: 9.22.2
4
4
  Summary: Bittensor CLI
5
5
  Author: bittensor.com
6
6
  Requires-Python: >=3.10
@@ -27,7 +27,7 @@ Requires-Dist: netaddr~=1.3.0
27
27
  Requires-Dist: Jinja2
28
28
  Requires-Dist: PyYAML~=6.0
29
29
  Requires-Dist: rich>=15.0,<16.0
30
- Requires-Dist: cyscale>=0.3.3,<1.0.0
30
+ Requires-Dist: cyscale==0.4.0
31
31
  Requires-Dist: typer~=0.26.0
32
32
  Requires-Dist: typing_extensions>4.0.0; python_version<'3.11'
33
33
  Requires-Dist: bittensor-wallet==4.1.0
@@ -12,7 +12,6 @@ import ssl
12
12
  import sys
13
13
  import traceback
14
14
  import warnings
15
- from dataclasses import fields
16
15
  from pathlib import Path
17
16
  from typing import Coroutine, Optional, Union
18
17
 
@@ -48,7 +47,6 @@ from bittensor_cli.src import (
48
47
  )
49
48
  from bittensor_cli.src.bittensor import utils
50
49
  from bittensor_cli.src.bittensor.balances import Balance
51
- from bittensor_cli.src.bittensor.chain_data import SubnetHyperparameters
52
50
  from bittensor_cli.src.bittensor.subtensor_interface import (
53
51
  SubtensorInterface,
54
52
  best_connection,
@@ -4921,7 +4919,7 @@ class CLIManager:
4921
4919
  json_output: bool = Options.json_output,
4922
4920
  ):
4923
4921
  """
4924
- View one active stake lock and its local projection.
4922
+ View one active stake lock and its lock projection.
4925
4923
 
4926
4924
  If --netuid is omitted, btcli prompts from the coldkey's active lock
4927
4925
  netuids.
@@ -7349,9 +7347,7 @@ class CLIManager:
7349
7347
  "Param name not supplied with `--no-prompt` flag. Cannot continue"
7350
7348
  )
7351
7349
  return False
7352
- hyperparam_list = sorted(
7353
- [field.name for field in fields(SubnetHyperparameters)]
7354
- )
7350
+ hyperparam_list = sorted(HYPERPARAMS.keys())
7355
7351
  console.print("Available hyperparameters:\n")
7356
7352
 
7357
7353
  # Create a table to show hyperparameters with descriptions
@@ -581,17 +581,12 @@ class RootSudoOnly(Enum):
581
581
 
582
582
  HYPERPARAMS = {
583
583
  # btcli name: (subtensor method, root-only enum)
584
- "rho": ("sudo_set_rho", RootSudoOnly.FALSE),
585
584
  "kappa": ("sudo_set_kappa", RootSudoOnly.TRUE),
586
585
  "immunity_period": ("sudo_set_immunity_period", RootSudoOnly.FALSE),
587
586
  "min_allowed_weights": ("sudo_set_min_allowed_weights", RootSudoOnly.FALSE),
588
- "max_weights_limit": ("sudo_set_max_weight_limit", RootSudoOnly.FALSE),
589
587
  "tempo": ("sudo_set_tempo", RootSudoOnly.TRUE),
590
- "min_difficulty": ("sudo_set_min_difficulty", RootSudoOnly.TRUE),
591
- "max_difficulty": ("sudo_set_max_difficulty", RootSudoOnly.FALSE),
592
588
  "weights_version": ("sudo_set_weights_version_key", RootSudoOnly.FALSE),
593
589
  "weights_rate_limit": ("sudo_set_weights_set_rate_limit", RootSudoOnly.TRUE),
594
- "adjustment_interval": ("sudo_set_adjustment_interval", RootSudoOnly.TRUE),
595
590
  "activity_cutoff": ("sudo_set_activity_cutoff", RootSudoOnly.FALSE),
596
591
  "target_regs_per_interval": (
597
592
  "sudo_set_target_registrations_per_interval",
@@ -603,8 +598,6 @@ HYPERPARAMS = {
603
598
  "max_regs_per_block": ("sudo_set_max_registrations_per_block", RootSudoOnly.TRUE),
604
599
  "serving_rate_limit": ("sudo_set_serving_rate_limit", RootSudoOnly.FALSE),
605
600
  "max_validators": ("sudo_set_max_allowed_validators", RootSudoOnly.TRUE),
606
- "adjustment_alpha": ("sudo_set_adjustment_alpha", RootSudoOnly.FALSE),
607
- "difficulty": ("sudo_set_difficulty", RootSudoOnly.TRUE),
608
601
  "commit_reveal_period": (
609
602
  "sudo_set_commit_reveal_weights_interval",
610
603
  RootSudoOnly.FALSE,
@@ -632,10 +625,16 @@ HYPERPARAMS = {
632
625
  "sn_owner_hotkey": ("sudo_set_sn_owner_hotkey", RootSudoOnly.FALSE),
633
626
  "subnet_owner_hotkey": ("sudo_set_sn_owner_hotkey", RootSudoOnly.FALSE),
634
627
  "recycle_or_burn": ("sudo_set_recycle_or_burn", RootSudoOnly.FALSE),
628
+ "owner_cut_enabled": ("sudo_set_owner_cut_enabled", RootSudoOnly.FALSE),
629
+ "owner_cut_auto_lock_enabled": (
630
+ "sudo_set_owner_cut_auto_lock_enabled",
631
+ RootSudoOnly.FALSE,
632
+ ),
635
633
  # Note: These are displayed but not directly settable via HYPERPARAMS
636
634
  # They are derived or set via other mechanisms
637
635
  "alpha_high": ("", RootSudoOnly.FALSE), # Derived from alpha_values
638
636
  "alpha_low": ("", RootSudoOnly.FALSE), # Derived from alpha_values
637
+ #
639
638
  "subnet_is_active": ("", RootSudoOnly.FALSE), # Set via btcli subnets start
640
639
  "yuma_version": ("", RootSudoOnly.FALSE), # Related to yuma3_enabled
641
640
  "max_allowed_uids": ("sudo_set_max_allowed_uids", RootSudoOnly.FALSE),
@@ -649,12 +648,6 @@ HYPERPARAMS_MODULE = {
649
648
 
650
649
  # Hyperparameter metadata: descriptions, side-effects, ownership, and documentation links
651
650
  HYPERPARAMS_METADATA = {
652
- "rho": {
653
- "description": "Rho controls the rate at which weights decay over time.",
654
- "side_effects": "Changing rho affects how quickly neurons' influence diminishes, impacting consensus dynamics.",
655
- "owner_settable": True,
656
- "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#rho",
657
- },
658
651
  "kappa": {
659
652
  "description": "Kappa determines the scaling factor for consensus calculations.",
660
653
  "side_effects": "Modifying kappa changes how validator votes are weighted in consensus mechanisms.",
@@ -673,30 +666,12 @@ HYPERPARAMS_METADATA = {
673
666
  "owner_settable": True,
674
667
  "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#minallowedweights",
675
668
  },
676
- "max_weights_limit": {
677
- "description": "Maximum number of weight connections a neuron can have with other neurons.",
678
- "side_effects": "Limits the maximum out-degree of the network graph, affecting network topology and consensus.",
679
- "owner_settable": True,
680
- "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#maxweightslimit",
681
- },
682
669
  "tempo": {
683
670
  "description": "Number of blocks between epoch transitions",
684
671
  "side_effects": "Lower tempo means more frequent updates but higher chain load. Higher tempo reduces frequency but may slow responsiveness.",
685
672
  "owner_settable": False,
686
673
  "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#tempo",
687
674
  },
688
- "min_difficulty": {
689
- "description": "Minimum proof-of-work difficulty required for registration",
690
- "side_effects": "Increasing min_difficulty raises the computational barrier for new neuron registrations.",
691
- "owner_settable": False,
692
- "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#mindifficulty",
693
- },
694
- "max_difficulty": {
695
- "description": "Maximum proof-of-work difficulty cap.",
696
- "side_effects": "Caps the maximum computational requirement, ensuring registration remains feasible.",
697
- "owner_settable": True,
698
- "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#maxdifficulty",
699
- },
700
675
  "weights_version": {
701
676
  "description": "Version key for weight sets.",
702
677
  "side_effects": "Changing this invalidates all existing weights, forcing neurons to resubmit weights.",
@@ -709,12 +684,6 @@ HYPERPARAMS_METADATA = {
709
684
  "owner_settable": False,
710
685
  "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#weightsratelimit--commitmentratelimit",
711
686
  },
712
- "adjustment_interval": {
713
- "description": "Number of blocks between automatic difficulty adjustments.",
714
- "side_effects": "Shorter intervals make difficulty more responsive but may cause volatility. Longer intervals provide stability.",
715
- "owner_settable": False,
716
- "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#adjustmentinterval",
717
- },
718
687
  "activity_cutoff": {
719
688
  "description": "Minimum activity level required for neurons to remain active.",
720
689
  "side_effects": "Lower values keep more neurons active; higher values prune inactive neurons more aggressively.",
@@ -763,18 +732,6 @@ HYPERPARAMS_METADATA = {
763
732
  "owner_settable": False,
764
733
  "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#maxallowedvalidators",
765
734
  },
766
- "adjustment_alpha": {
767
- "description": "Alpha parameter for difficulty adjustment algorithm.",
768
- "side_effects": "Higher values make difficulty adjustments more aggressive; lower values provide smoother transitions.",
769
- "owner_settable": True,
770
- "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#adjustmentalpha",
771
- },
772
- "difficulty": {
773
- "description": "Current proof-of-work difficulty for registration.",
774
- "side_effects": "Directly affects registration cost and time. Higher difficulty makes registration harder and more expensive.",
775
- "owner_settable": False,
776
- "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#difficulty",
777
- },
778
735
  "commit_reveal_period": {
779
736
  "description": "Duration (in blocks) for commit-reveal weight submission scheme.",
780
737
  "side_effects": "Longer periods provide more time for commits but delay weight revelation. Shorter periods increase frequency.",
@@ -896,6 +853,30 @@ HYPERPARAMS_METADATA = {
896
853
  "owner_settable": True,
897
854
  "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#maxalloweduids",
898
855
  },
856
+ "owner_cut_enabled": {
857
+ "description": "Whether the subnet owner cut is taken from the subnet's emissions.",
858
+ "side_effects": "When disabled, no owner cut is deducted and the full emission goes to the subnet participants.",
859
+ "owner_settable": True,
860
+ "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#ownercutenabled",
861
+ },
862
+ "owner_cut_auto_lock_enabled": {
863
+ "description": "Whether the subnet owner cut is automatically locked when collected.",
864
+ "side_effects": "When enabled, the owner cut is auto-locked rather than paid out as liquid stake.",
865
+ "owner_settable": True,
866
+ "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#ownercutautolockenabled",
867
+ },
868
+ "burn_half_life": {
869
+ "description": "Half-life (in blocks) controlling how quickly the registration burn price decays back toward min_burn.",
870
+ "side_effects": "Larger values make the registration burn price decay more slowly after registrations; smaller values let it fall back to min_burn faster.",
871
+ "owner_settable": True,
872
+ "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#burnhalflife",
873
+ },
874
+ "burn_increase_mult": {
875
+ "description": "Multiplier applied to the registration burn price after each successful registration.",
876
+ "side_effects": "Higher values make the burn price jump more sharply with each registration, raising the cost of rapid successive registrations.",
877
+ "owner_settable": True,
878
+ "docs_link": "docs.learnbittensor.org/subnets/subnet-hyperparameters#burnincreasemult",
879
+ },
899
880
  }
900
881
 
901
882
  # Help Panels for cli help
@@ -1,11 +1,12 @@
1
+ import re
1
2
  from abc import abstractmethod
2
- from dataclasses import dataclass
3
+ from dataclasses import dataclass, field
3
4
  from decimal import Decimal
4
5
  from enum import Enum
5
- from typing import Optional, Any, Union
6
+ from typing import Optional, Any
6
7
 
7
8
  import netaddr
8
- from scalecodec.utils.math import FixedPoint, fixed_to_decimal
9
+ from scalecodec.utils.math import fixed_to_decimal
9
10
  from scalecodec.utils.ss58 import ss58_encode
10
11
 
11
12
  from bittensor_cli.src.bittensor.balances import Balance, fixed_to_float
@@ -69,7 +70,7 @@ class AxonInfo:
69
70
  return self.ip != "0.0.0.0"
70
71
 
71
72
  @classmethod
72
- def from_neuron_info(cls, neuron_info: dict) -> "AxonInfo":
73
+ def from_neuron_info(cls, neuron_info: dict) -> Self:
73
74
  """
74
75
  Converts a dictionary to an AxonInfo object.
75
76
 
@@ -121,11 +122,11 @@ class LockState:
121
122
  last_update: int
122
123
 
123
124
  @classmethod
124
- def zero(cls, now: int) -> "LockState":
125
+ def zero(cls, now: int) -> Self:
125
126
  return cls(locked_mass=0, conviction=Decimal(0), last_update=now)
126
127
 
127
128
  @classmethod
128
- def from_any(cls, decoded: Any) -> "LockState":
129
+ def from_any(cls, decoded: Any) -> Self:
129
130
  return cls(
130
131
  locked_mass=int(decoded["locked_mass"]),
131
132
  conviction=fixed_to_decimal(decoded["conviction"]),
@@ -156,129 +157,103 @@ class SubnetLockAggregates:
156
157
  owner_decay_lock: Optional[LockState]
157
158
 
158
159
 
160
+ # Fixed-point type tags (e.g. `U64F64`, `I32F32`) encode their integer and
161
+ # fractional bit-widths in the name; the second group gives the fractional bits.
162
+ _FIXED_POINT_TAG = re.compile(r"^[UI]\d+F(\d+)$")
163
+
164
+
159
165
  @dataclass
160
166
  class SubnetHyperparameters(InfoBase):
161
167
  """
162
- This class represents the hyperparameters for a subnet.
163
- Attributes:
164
- rho (int): The rate of decay of some value.
165
- kappa (int): A constant multiplier used in calculations.
166
- immunity_period (int): The period during which immunity is active.
167
- min_allowed_weights (int): Minimum allowed weights.
168
- max_weight_limit (float): Maximum weight limit.
169
- tempo (int): The tempo or rate of operation.
170
- min_difficulty (int): Minimum difficulty for some operations.
171
- max_difficulty (int): Maximum difficulty for some operations.
172
- weights_version (int): The version number of the weights used.
173
- weights_rate_limit (int): Rate limit for processing weights.
174
- adjustment_interval (int): Interval at which adjustments are made.
175
- activity_cutoff (int): Activity cutoff threshold.
176
- registration_allowed (bool): Indicates if registration is allowed.
177
- target_regs_per_interval (int): Target number of registrations per interval.
178
- min_burn (int): Minimum burn value.
179
- max_burn (int): Maximum burn value.
180
- bonds_moving_avg (int): Moving average of bonds.
181
- max_regs_per_block (int): Maximum number of registrations per block.
182
- serving_rate_limit (int): Limit on the rate of service.
183
- max_validators (int): Maximum number of validators.
184
- adjustment_alpha (int): Alpha value for adjustments.
185
- difficulty (int): Difficulty level.
186
- commit_reveal_period (int): Interval for commit-reveal weights.
187
- commit_reveal_weights_enabled (bool): Flag indicating if commit-reveal weights are enabled.
188
- alpha_high (int): High value of alpha.
189
- alpha_low (int): Low value of alpha.
190
- liquid_alpha_enabled (bool): Flag indicating if liquid alpha is enabled.
191
- alpha_sigmoid_steepness (float):
192
- yuma_version (int): Version of yuma.
193
- subnet_is_active (bool): Indicates if subnet is active after START CALL.
194
- transfers_enabled (bool): Flag indicating if transfers are enabled.
195
- bonds_reset_enabled (bool): Flag indicating if bonds are reset enabled.
196
- user_liquidity_enabled (bool): Flag indicating if user liquidity is enabled.
168
+ Dynamic container for a subnet's hyperparameters.
169
+
170
+ The chain returns hyperparameters from the `get_subnet_hyperparams_v3`
171
+ runtime API as a list of `{"name": str, "value": {<type_tag>: <payload>}}`
172
+ records. Rather than a fixed struct, this class decodes whatever records the
173
+ runtime returns into a plain ``name -> value`` mapping, so hyperparameters can
174
+ be added to or removed from the chain without requiring code changes here.
175
+
176
+ Values are decoded to native Python types (`int` for integers and balances in
177
+ rao, `bool` for booleans, `float` for fixed-point numbers). Human-readable
178
+ normalization for display happens separately in
179
+ :func:`bittensor_cli.src.bittensor.utils.normalize_hyperparameters`.
180
+
181
+ Decoded values are exposed via attribute access (``params.tempo``), item access
182
+ (`params["tempo"]`), membership tests (`"tempo" in params`), and iteration
183
+ (`params.items()`, `params.keys()`, `params.values()`).
197
184
  """
198
185
 
199
- rho: int
200
- kappa: int
201
- immunity_period: int
202
- min_allowed_weights: int
203
- max_weight_limit: float
204
- tempo: int
205
- min_difficulty: int
206
- max_difficulty: int
207
- weights_version: int
208
- weights_rate_limit: int
209
- adjustment_interval: int
210
- activity_cutoff: int
211
- registration_allowed: bool
212
- target_regs_per_interval: int
213
- min_burn: int
214
- max_burn: int
215
- bonds_moving_avg: int
216
- max_regs_per_block: int
217
- serving_rate_limit: int
218
- max_validators: int
219
- adjustment_alpha: int
220
- difficulty: int
221
- commit_reveal_period: int
222
- commit_reveal_weights_enabled: bool
223
- alpha_high: int
224
- alpha_low: int
225
- liquid_alpha_enabled: bool
226
- alpha_sigmoid_steepness: float
227
- yuma_version: int
228
- subnet_is_active: bool
229
- transfers_enabled: bool
230
- bonds_reset_enabled: bool
231
- user_liquidity_enabled: bool
232
- burn_increase_mult: FixedPoint
233
- burn_half_life: int
186
+ hyperparameters: dict[str, Any] = field(default_factory=dict)
187
+
188
+ @staticmethod
189
+ def _decode_value(value: Any) -> Any:
190
+ """Decode a single ``{<type_tag>: <payload>}`` hyperparameter value.
191
+
192
+ Unrecognized or already-flat values are returned unchanged so callers can
193
+ pass in pre-decoded data (e.g. in tests).
194
+ """
195
+ if not isinstance(value, dict) or len(value) != 1:
196
+ return value
197
+ ((type_tag, payload),) = value.items()
198
+ if type_tag == "Bool":
199
+ return bool(payload)
200
+ if match := _FIXED_POINT_TAG.match(type_tag):
201
+ return fixed_to_float(payload, frac_bits=int(match.group(1)))
202
+ # Everything else (U8/U16/U32/U64/U128, signed ints, TaoBalance, ...) is an
203
+ # integer; balances are left as raw rao for downstream normalization.
204
+ try:
205
+ return int(payload)
206
+ except (TypeError, ValueError):
207
+ return payload
234
208
 
235
209
  @classmethod
236
210
  def _fix_decoded(
237
211
  cls,
238
- decoded: Union[dict, "SubnetHyperparameters"],
239
- ) -> "SubnetHyperparameters":
240
- burn_increase_mult: FixedPoint = decoded["burn_increase_mult"]
241
- burn_half_life: int = decoded["burn_half_life"]
212
+ decoded: list | dict | Self,
213
+ ) -> Self:
214
+ if isinstance(decoded, SubnetHyperparameters):
215
+ return decoded
216
+ if isinstance(decoded, dict):
217
+ # Already keyed by name (either {name: {tag: payload}} or flat).
218
+ entries = decoded.items()
219
+ else:
220
+ # V3 format: list of {"name": ..., "value": ...} records.
221
+ entries = ((record["name"], record["value"]) for record in decoded)
242
222
  return cls(
243
- activity_cutoff=decoded["activity_cutoff"],
244
- adjustment_alpha=decoded["adjustment_alpha"],
245
- adjustment_interval=decoded["adjustment_interval"],
246
- alpha_high=decoded["alpha_high"],
247
- alpha_low=decoded["alpha_low"],
248
- alpha_sigmoid_steepness=fixed_to_float(
249
- decoded["alpha_sigmoid_steepness"], frac_bits=32
250
- ),
251
- bonds_moving_avg=decoded["bonds_moving_avg"],
252
- bonds_reset_enabled=decoded["bonds_reset_enabled"],
253
- commit_reveal_weights_enabled=decoded["commit_reveal_weights_enabled"],
254
- commit_reveal_period=decoded["commit_reveal_period"],
255
- difficulty=decoded["difficulty"],
256
- immunity_period=decoded["immunity_period"],
257
- kappa=decoded["kappa"],
258
- liquid_alpha_enabled=decoded["liquid_alpha_enabled"],
259
- max_burn=decoded["max_burn"],
260
- max_difficulty=decoded["max_difficulty"],
261
- max_regs_per_block=decoded["max_regs_per_block"],
262
- max_validators=decoded["max_validators"],
263
- max_weight_limit=decoded["max_weights_limit"],
264
- min_allowed_weights=decoded["min_allowed_weights"],
265
- min_burn=decoded["min_burn"],
266
- min_difficulty=decoded["min_difficulty"],
267
- registration_allowed=decoded["registration_allowed"],
268
- rho=decoded["rho"],
269
- serving_rate_limit=decoded["serving_rate_limit"],
270
- subnet_is_active=decoded["subnet_is_active"],
271
- target_regs_per_interval=decoded["target_regs_per_interval"],
272
- tempo=decoded["tempo"],
273
- transfers_enabled=decoded["transfers_enabled"],
274
- user_liquidity_enabled=decoded["user_liquidity_enabled"],
275
- weights_rate_limit=decoded["weights_rate_limit"],
276
- weights_version=decoded["weights_version"],
277
- yuma_version=decoded["yuma_version"],
278
- burn_increase_mult=burn_increase_mult,
279
- burn_half_life=burn_half_life,
223
+ hyperparameters={name: cls._decode_value(value) for name, value in entries}
280
224
  )
281
225
 
226
+ def __getattr__(self, item: str) -> Any:
227
+ # Only invoked when normal attribute lookup fails, so ``hyperparameters``
228
+ # itself is always resolved normally and this cannot recurse.
229
+ try:
230
+ return self.__dict__["hyperparameters"][item]
231
+ except KeyError:
232
+ raise AttributeError(
233
+ f"{type(self).__name__!r} object has no hyperparameter {item!r}"
234
+ )
235
+
236
+ def __getitem__(self, item: str) -> Any:
237
+ return self.hyperparameters[item]
238
+
239
+ def __contains__(self, item: str) -> bool:
240
+ return item in self.hyperparameters
241
+
242
+ def __iter__(self):
243
+ return iter(self.hyperparameters)
244
+
245
+ def get(self, item: str, default: Any = None) -> Any:
246
+ return self.hyperparameters.get(item, default)
247
+
248
+ def items(self):
249
+ return self.hyperparameters.items()
250
+
251
+ def keys(self):
252
+ return self.hyperparameters.keys()
253
+
254
+ def values(self):
255
+ return self.hyperparameters.values()
256
+
282
257
 
283
258
  @dataclass
284
259
  class StakeInfo(InfoBase):
@@ -295,7 +270,7 @@ class StakeInfo(InfoBase):
295
270
  is_registered: bool
296
271
 
297
272
  @classmethod
298
- def _fix_decoded(cls, decoded: Any) -> "StakeInfo":
273
+ def _fix_decoded(cls, decoded: Any) -> Self:
299
274
  hotkey = decoded.get("hotkey")
300
275
  coldkey = decoded.get("coldkey")
301
276
  netuid = int(decoded.get("netuid"))
@@ -353,7 +328,7 @@ class NeuronInfo(InfoBase):
353
328
  neuron_lite: "NeuronInfoLite",
354
329
  weights_as_dict: dict[int, list[tuple[int, int]]],
355
330
  bonds_as_dict: dict[int, list[tuple[int, int]]],
356
- ) -> "NeuronInfo":
331
+ ) -> Self:
357
332
  n_dict = neuron_lite.__dict__
358
333
  n_dict["weights"] = weights_as_dict.get(neuron_lite.uid, [])
359
334
  n_dict["bonds"] = bonds_as_dict.get(neuron_lite.uid, [])
@@ -389,7 +364,7 @@ class NeuronInfo(InfoBase):
389
364
  return neuron
390
365
 
391
366
  @classmethod
392
- def _fix_decoded(cls, decoded: Any) -> "NeuronInfo":
367
+ def _fix_decoded(cls, decoded: Any) -> Self:
393
368
  netuid = decoded.get("netuid")
394
369
  stake_dict = process_stake_data(decoded.get("stake"), netuid=netuid)
395
370
  total_stake = sum(stake_dict.values()) if stake_dict else Balance(0)
@@ -454,7 +429,7 @@ class NeuronInfoLite(InfoBase):
454
429
  dividends: float
455
430
  last_update: int
456
431
  validator_permit: bool
457
- axon_info: AxonInfo
432
+ axon_info: Optional[AxonInfo]
458
433
  pruning_score: int
459
434
  is_null: bool = False
460
435
 
@@ -485,7 +460,7 @@ class NeuronInfoLite(InfoBase):
485
460
  return neuron
486
461
 
487
462
  @classmethod
488
- def _fix_decoded(cls, decoded: Union[dict, "NeuronInfoLite"]) -> "NeuronInfoLite":
463
+ def _fix_decoded(cls, decoded: dict | Self) -> Self:
489
464
  active = decoded.get("active")
490
465
  axon_info = decoded.get("axon_info", {})
491
466
  coldkey = decoded.get("coldkey")
@@ -572,7 +547,7 @@ class DelegateInfo(InfoBase):
572
547
  total_daily_return: Balance # Total daily return of the delegate
573
548
 
574
549
  @classmethod
575
- def _fix_decoded(cls, decoded: "DelegateInfo") -> "DelegateInfo":
550
+ def _fix_decoded(cls, decoded: Self) -> Self:
576
551
  hotkey = decoded.get("hotkey_ss58")
577
552
  owner = decoded.get("owner_ss58")
578
553
  nominators = [(x, Balance.from_rao(y)) for x, y in decoded.get("nominators")]
@@ -611,7 +586,7 @@ class DelegateInfoLite(InfoBase):
611
586
  owner_stake: Balance # Own stake of the delegate
612
587
 
613
588
  @classmethod
614
- def _fix_decoded(cls, decoded: Any) -> "DelegateInfoLite":
589
+ def _fix_decoded(cls, decoded: Any) -> Self:
615
590
  """Fixes the decoded values."""
616
591
  decoded_take = decoded.get("take")
617
592
 
@@ -654,7 +629,7 @@ class SubnetInfo(InfoBase):
654
629
  owner_ss58: str
655
630
 
656
631
  @classmethod
657
- def _fix_decoded(cls, decoded: "SubnetInfo") -> "SubnetInfo":
632
+ def _fix_decoded(cls, decoded: Self) -> Self:
658
633
  return cls(
659
634
  netuid=decoded.get("netuid"),
660
635
  rho=decoded.get("rho"),
@@ -694,7 +669,7 @@ class SubnetIdentity(InfoBase):
694
669
  additional: str
695
670
 
696
671
  @classmethod
697
- def _fix_decoded(cls, decoded: dict) -> "SubnetIdentity":
672
+ def _fix_decoded(cls, decoded: dict) -> Self:
698
673
  if isinstance(subnet_name := decoded["subnet_name"], list):
699
674
  subnet_name = bytes(subnet_name).decode("utf-8")
700
675
  return cls(
@@ -737,7 +712,7 @@ class DynamicInfo(InfoBase):
737
712
  moving_price: float
738
713
 
739
714
  @classmethod
740
- def _fix_decoded(cls, decoded: Any) -> "DynamicInfo":
715
+ def _fix_decoded(cls, decoded: Any) -> Self:
741
716
  """Returns a DynamicInfo object from a decoded DynamicInfo dictionary."""
742
717
 
743
718
  netuid = int(decoded.get("netuid"))
@@ -924,9 +899,7 @@ class ColdkeySwapAnnouncementInfo(InfoBase):
924
899
  new_coldkey_hash: str
925
900
 
926
901
  @classmethod
927
- def _fix_decoded(
928
- cls, coldkey: str, decoded: tuple
929
- ) -> "ColdkeySwapAnnouncementInfo":
902
+ def _fix_decoded(cls, coldkey: str, decoded: tuple) -> Self:
930
903
  execution_block, new_coldkey_hash = decoded
931
904
  return cls(
932
905
  coldkey=coldkey,
@@ -957,7 +930,7 @@ class SubnetState(InfoBase):
957
930
  emission_history: list[list[int]]
958
931
 
959
932
  @classmethod
960
- def _fix_decoded(cls, decoded: Any) -> "SubnetState":
933
+ def _fix_decoded(cls, decoded: Any) -> Self:
961
934
  netuid = decoded.get("netuid")
962
935
  return cls(
963
936
  netuid=netuid,
@@ -1005,7 +978,7 @@ class ChainIdentity(InfoBase):
1005
978
  additional: str
1006
979
 
1007
980
  @classmethod
1008
- def _from_dict(cls, decoded: dict) -> "ChainIdentity":
981
+ def _from_dict(cls, decoded: dict) -> Self:
1009
982
  """Returns a ChainIdentity object from decoded chain data."""
1010
983
  return cls(
1011
984
  name=decoded["name"],
@@ -1122,7 +1095,7 @@ class MetagraphInfo(InfoBase):
1122
1095
  subuid: int = 0
1123
1096
 
1124
1097
  @classmethod
1125
- def _fix_decoded(cls, decoded: dict) -> "MetagraphInfo":
1098
+ def _fix_decoded(cls, decoded: dict) -> Self:
1126
1099
  """Returns a MetagraphInfo object from decoded chain data."""
1127
1100
  # Subnet index
1128
1101
  _netuid, _subuid = get_netuid_and_subuid_by_storage_index(decoded["netuid"])
@@ -1236,7 +1209,7 @@ class SimSwapResult:
1236
1209
  alpha_fee: Balance
1237
1210
 
1238
1211
  @classmethod
1239
- def from_dict(cls, d: dict, netuid: int) -> "SimSwapResult":
1212
+ def from_dict(cls, d: dict, netuid: int) -> Self:
1240
1213
  return cls(
1241
1214
  tao_amount=Balance.from_rao(d["tao_amount"]).set_unit(0),
1242
1215
  alpha_amount=Balance.from_rao(d["alpha_amount"]).set_unit(netuid),
@@ -1261,7 +1234,7 @@ class CrowdloanData(InfoBase):
1261
1234
  call_details: Optional[dict] = None
1262
1235
 
1263
1236
  @classmethod
1264
- def _fix_decoded(cls, decoded: dict[str, Any]) -> "CrowdloanData":
1237
+ def _fix_decoded(cls, decoded: dict[str, Any]) -> Self:
1265
1238
  creator = decoded.get("creator")
1266
1239
  funds_account = decoded.get("funds_account")
1267
1240
  target_address = decoded.get("target_address")
@@ -83,7 +83,7 @@ class SubtensorInterface:
83
83
  self.chain_endpoint = Constants.network_map[network]
84
84
  self.network = network
85
85
  if network == "local":
86
- console.log(
86
+ console.print(
87
87
  "[yellow]Warning[/yellow]: Verify your local subtensor is running on port 9944."
88
88
  )
89
89
  else:
@@ -1631,7 +1631,7 @@ class SubtensorInterface:
1631
1631
 
1632
1632
  async def get_subnet_hyperparameters(
1633
1633
  self, netuid: int, block_hash: Optional[str] = None
1634
- ) -> Optional[Union[list, SubnetHyperparameters]]:
1634
+ ) -> SubnetHyperparameters:
1635
1635
  """
1636
1636
  Retrieves the hyperparameters for a specific subnet within the Bittensor network. These hyperparameters
1637
1637
  define the operational settings and rules governing the subnet's behavior.
@@ -1644,31 +1644,14 @@ class SubtensorInterface:
1644
1644
  Understanding the hyperparameters is crucial for comprehending how subnets are configured and
1645
1645
  managed, and how they interact with the network's consensus and incentive mechanisms.
1646
1646
  """
1647
- if block_hash is None:
1648
- block_hash = await self.substrate.get_chain_head()
1649
- result, burn_increase_mult, burn_half_life = await asyncio.gather(
1650
- self.query_runtime_api(
1651
- runtime_api="SubnetInfoRuntimeApi",
1652
- method="get_subnet_hyperparams_v2",
1653
- params=[netuid],
1654
- block_hash=block_hash,
1655
- ),
1656
- self.substrate.query(
1657
- "SubtensorModule", "BurnIncreaseMult", [netuid], block_hash=block_hash
1658
- ),
1659
- self.substrate.query(
1660
- "SubtensorModule", "BurnHalfLife", [netuid], block_hash=block_hash
1661
- ),
1647
+ result = await self.query_runtime_api(
1648
+ runtime_api="SubnetInfoRuntimeApi",
1649
+ method="get_subnet_hyperparams_v3",
1650
+ params=[netuid],
1651
+ block_hash=block_hash,
1662
1652
  )
1663
- if not result:
1664
- return []
1665
-
1666
- additional = {
1667
- "burn_increase_mult": burn_increase_mult.value,
1668
- "burn_half_life": burn_half_life.value,
1669
- }
1670
1653
 
1671
- return SubnetHyperparameters.from_any(result | additional)
1654
+ return SubnetHyperparameters.from_any(result)
1672
1655
 
1673
1656
  async def get_subnet_mechanisms(
1674
1657
  self, netuid: int, block_hash: Optional[str] = None
@@ -31,7 +31,6 @@ import typer
31
31
 
32
32
  from bittensor_cli.src.bittensor.balances import Balance
33
33
  from bittensor_cli.src import defaults, Constants
34
- from scalecodec.utils.math import fixed_to_float
35
34
 
36
35
  if TYPE_CHECKING:
37
36
  from bittensor_cli.src.bittensor.chain_data import SubnetHyperparameters
@@ -848,21 +847,18 @@ def normalize_hyperparameters(
848
847
  "max_difficulty": u64_normalized_float,
849
848
  "difficulty": u64_normalized_float,
850
849
  "bonds_moving_avg": u64_normalized_float,
851
- "max_weight_limit": u16_normalized_float,
850
+ "max_weights_limit": u16_normalized_float,
852
851
  "kappa": u16_normalized_float,
853
852
  "alpha_high": u16_normalized_float,
854
853
  "alpha_low": u16_normalized_float,
855
854
  "alpha_sigmoid_steepness": u16_normalized_float,
856
855
  "min_burn": Balance.from_rao,
857
856
  "max_burn": Balance.from_rao,
858
- "burn_increase_mult": fixed_to_float,
859
- "burn_half_life": u16_normalized_float,
860
857
  }
861
858
 
862
859
  normalized_values: list[tuple[str, str, str]] = []
863
- subnet_dict = subnet.__dict__
864
860
 
865
- for param, value in subnet_dict.items():
861
+ for param, value in subnet.items():
866
862
  try:
867
863
  if param in param_mappings:
868
864
  norm_value = param_mappings[param](value)
@@ -96,7 +96,7 @@ async def stake_lock_show(
96
96
  verbose: bool = False,
97
97
  show_graph: bool = True,
98
98
  ) -> None:
99
- """Display one active stake lock and its local projection."""
99
+ """Display one active stake lock and its lock projection."""
100
100
  if coldkey_ss58 is None:
101
101
  raise ValueError("coldkey_ss58 is required")
102
102
 
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
4
4
 
5
5
  [project]
6
6
  name = "bittensor-cli"
7
- version = "9.22.0"
7
+ version = "9.22.2"
8
8
  description = "Bittensor CLI"
9
9
  readme = "README.md"
10
10
  authors = [
@@ -37,7 +37,7 @@ dependencies = [
37
37
  "Jinja2",
38
38
  "PyYAML~=6.0",
39
39
  "rich>=15.0,<16.0",
40
- "cyscale>=0.3.3,<1.0.0",
40
+ "cyscale==0.4.0",
41
41
  "typer~=0.26.0",
42
42
  "typing_extensions>4.0.0; python_version<'3.11'",
43
43
  "bittensor-wallet==4.1.0",
File without changes