bittensor 6.7.0__tar.gz → 6.7.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.
- {bittensor-6.7.0/bittensor.egg-info → bittensor-6.7.2}/PKG-INFO +46 -3
- {bittensor-6.7.0 → bittensor-6.7.2}/README.md +1 -1
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/__init__.py +1 -1
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/axon.py +8 -5
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/btlogging.py +14 -10
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/chain_data.py +26 -17
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/delegates.py +1 -1
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/metagraph.py +5 -3
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/network.py +1 -1
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/overview.py +7 -5
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/register.py +2 -2
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/root.py +5 -3
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/senate.py +5 -3
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/wallets.py +3 -3
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/config.py +10 -7
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/dendrite.py +88 -85
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/errors.py +22 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/registration.py +3 -3
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/set_weights.py +62 -8
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/keyfile.py +85 -61
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/mock/subtensor_mock.py +14 -8
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/stream.py +7 -8
- bittensor-6.7.2/bittensor/subnets/api.py +297 -0
- bittensor-6.7.2/bittensor/subnets/cache.py +230 -0
- bittensor-6.7.2/bittensor/subnets/registry.py +53 -0
- bittensor-6.7.2/bittensor/subnets/request.py +143 -0
- bittensor-6.7.2/bittensor/subnets/utils.py +68 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/subtensor.py +227 -233
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/synapse.py +75 -63
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/tensor.py +2 -2
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/threadpool.py +7 -5
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/utils/networking.py +1 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/utils/weight_utils.py +1 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/wallet.py +1 -0
- {bittensor-6.7.0 → bittensor-6.7.2/bittensor.egg-info}/PKG-INFO +46 -3
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor.egg-info/SOURCES.txt +6 -2
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor.egg-info/requires.txt +3 -2
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/integration_tests/test_cli.py +184 -5
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/integration_tests/test_subtensor_integration.py +3 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/unit_tests/test_axon.py +23 -0
- bittensor-6.7.2/tests/unit_tests/test_chain_data.py +557 -0
- bittensor-6.7.2/tests/unit_tests/test_keyfile.py +598 -0
- bittensor-6.7.2/tests/unit_tests/test_metagraph.py +121 -0
- bittensor-6.7.2/tests/unit_tests/test_subtensor.py +175 -0
- bittensor-6.7.2/tests/unit_tests/test_wallet.py +399 -0
- bittensor-6.7.2/tests/unit_tests/utils/test_balance.py +509 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/unit_tests/utils/test_networking.py +1 -1
- bittensor-6.7.2/tests/unit_tests/utils/test_utils.py +307 -0
- bittensor-6.7.2/tests/unit_tests/utils/test_weight_utils.py +307 -0
- bittensor-6.7.0/bittensor/extrinsics/log_utilities.py +0 -764
- bittensor-6.7.0/bittensor/utils/stats.py +0 -83
- bittensor-6.7.0/tests/unit_tests/test_keyfile.py +0 -478
- bittensor-6.7.0/tests/unit_tests/test_metagraph.py +0 -118
- bittensor-6.7.0/tests/unit_tests/test_subtensor.py +0 -189
- bittensor-6.7.0/tests/unit_tests/test_wallet.py +0 -388
- bittensor-6.7.0/tests/unit_tests/utils/test_balance.py +0 -507
- bittensor-6.7.0/tests/unit_tests/utils/test_utils.py +0 -774
- bittensor-6.7.0/tests/unit_tests/utils/test_weight_utils.py +0 -110
- {bittensor-6.7.0 → bittensor-6.7.2}/LICENSE +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bin/btcli +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/cli.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/__init__.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/identity.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/inspect.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/list.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/misc.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/stake.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/transfer.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/unstake.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/commands/utils.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/__init__.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/delegation.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/network.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/prometheus.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/root.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/senate.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/serving.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/staking.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/transfer.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/extrinsics/unstaking.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/metagraph.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/mock/__init__.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/mock/keyfile_mock.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/mock/wallet_mock.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/types.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/utils/__init__.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/utils/_register_cuda.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/utils/balance.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/utils/formatting.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/utils/registration.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/utils/test_utils.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor/utils/wallet_utils.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor.egg-info/dependency_links.txt +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/bittensor.egg-info/top_level.txt +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/setup.cfg +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/setup.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/__init__.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/helpers/__init__.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/helpers/helpers.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/integration_tests/__init__.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/integration_tests/test_cli_no_network.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/integration_tests/test_metagraph_integration.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/unit_tests/__init__.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/unit_tests/test_dendrite.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/unit_tests/test_synapse.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/unit_tests/test_tensor.py +0 -0
- {bittensor-6.7.0 → bittensor-6.7.2}/tests/unit_tests/utils/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: bittensor
|
|
3
|
-
Version: 6.7.
|
|
3
|
+
Version: 6.7.2
|
|
4
4
|
Summary: bittensor
|
|
5
5
|
Home-page: https://github.com/opentensor/bittensor
|
|
6
6
|
Author: bittensor.com
|
|
@@ -22,8 +22,51 @@ Classifier: Topic :: Software Development :: Libraries
|
|
|
22
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
23
|
Requires-Python: >=3.8
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
|
-
Provides-Extra: dev
|
|
26
25
|
License-File: LICENSE
|
|
26
|
+
Requires-Dist: aiohttp==3.9.0b0
|
|
27
|
+
Requires-Dist: ansible==6.7.0
|
|
28
|
+
Requires-Dist: ansible_vault==2.1.0
|
|
29
|
+
Requires-Dist: backoff
|
|
30
|
+
Requires-Dist: black==23.7.0
|
|
31
|
+
Requires-Dist: cryptography==41.0.3
|
|
32
|
+
Requires-Dist: ddt==1.6.0
|
|
33
|
+
Requires-Dist: fuzzywuzzy>=0.18.0
|
|
34
|
+
Requires-Dist: fastapi==0.99.1
|
|
35
|
+
Requires-Dist: loguru==0.7.0
|
|
36
|
+
Requires-Dist: munch==2.5.0
|
|
37
|
+
Requires-Dist: netaddr
|
|
38
|
+
Requires-Dist: numpy
|
|
39
|
+
Requires-Dist: msgpack-numpy-opentensor==0.5.0
|
|
40
|
+
Requires-Dist: nest_asyncio
|
|
41
|
+
Requires-Dist: pycryptodome<4.0.0,>=3.18.0
|
|
42
|
+
Requires-Dist: pyyaml
|
|
43
|
+
Requires-Dist: password_strength
|
|
44
|
+
Requires-Dist: pydantic!=1.8,!=1.8.1,<2.0.0,>=1.7.4
|
|
45
|
+
Requires-Dist: PyNaCl<=1.5.0,>=1.3.0
|
|
46
|
+
Requires-Dist: pytest-asyncio
|
|
47
|
+
Requires-Dist: python-Levenshtein
|
|
48
|
+
Requires-Dist: pytest
|
|
49
|
+
Requires-Dist: retry
|
|
50
|
+
Requires-Dist: requests
|
|
51
|
+
Requires-Dist: rich
|
|
52
|
+
Requires-Dist: scalecodec==1.2.7
|
|
53
|
+
Requires-Dist: shtab==1.6.5
|
|
54
|
+
Requires-Dist: substrate-interface==1.7.5
|
|
55
|
+
Requires-Dist: termcolor
|
|
56
|
+
Requires-Dist: torch>=1.13.1
|
|
57
|
+
Requires-Dist: tqdm
|
|
58
|
+
Requires-Dist: uvicorn==0.22.0
|
|
59
|
+
Requires-Dist: wheel
|
|
60
|
+
Provides-Extra: dev
|
|
61
|
+
Requires-Dist: pytest==7.2.0; extra == "dev"
|
|
62
|
+
Requires-Dist: pytest-mock==3.12.0; extra == "dev"
|
|
63
|
+
Requires-Dist: pytest-split==0.8.0; extra == "dev"
|
|
64
|
+
Requires-Dist: pytest-xdist==3.0.2; extra == "dev"
|
|
65
|
+
Requires-Dist: pytest-rerunfailures==10.2; extra == "dev"
|
|
66
|
+
Requires-Dist: coveralls==3.3.1; extra == "dev"
|
|
67
|
+
Requires-Dist: pytest-cov==4.0.0; extra == "dev"
|
|
68
|
+
Requires-Dist: ddt==1.6.0; extra == "dev"
|
|
69
|
+
Requires-Dist: hypothesis==6.81.1; extra == "dev"
|
|
27
70
|
|
|
28
71
|
<div align="center">
|
|
29
72
|
|
|
@@ -36,7 +79,7 @@ License-File: LICENSE
|
|
|
36
79
|
|
|
37
80
|
### Internet-scale Neural Networks <!-- omit in toc -->
|
|
38
81
|
|
|
39
|
-
[Discord](
|
|
82
|
+
[Discord](https://discord.gg/qasY3HA9F9) • [Network](https://taostats.io/) • [Research](https://bittensor.com/whitepaper)
|
|
40
83
|
|
|
41
84
|
</div>
|
|
42
85
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
### Internet-scale Neural Networks <!-- omit in toc -->
|
|
11
11
|
|
|
12
|
-
[Discord](
|
|
12
|
+
[Discord](https://discord.gg/qasY3HA9F9) • [Network](https://taostats.io/) • [Research](https://bittensor.com/whitepaper)
|
|
13
13
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
""" Create and initialize Axon, which services the forward and backward requests from other neurons.
|
|
2
2
|
"""
|
|
3
|
+
|
|
3
4
|
# The MIT License (MIT)
|
|
4
5
|
# Copyright © 2021 Yuma Rao
|
|
5
6
|
# Copyright © 2022 Opentensor Foundation
|
|
@@ -1028,7 +1029,7 @@ class AxonMiddleware(BaseHTTPMiddleware):
|
|
|
1028
1029
|
synapse: bittensor.Synapse = await self.preprocess(request)
|
|
1029
1030
|
|
|
1030
1031
|
# Logs the start of the request processing
|
|
1031
|
-
bittensor.logging.
|
|
1032
|
+
bittensor.logging.trace(
|
|
1032
1033
|
f"axon | <-- | {request.headers.get('content-length', -1)} B | {synapse.name} | {synapse.dendrite.hotkey} | {synapse.dendrite.ip}:{synapse.dendrite.port} | 200 | Success "
|
|
1033
1034
|
)
|
|
1034
1035
|
|
|
@@ -1100,7 +1101,7 @@ class AxonMiddleware(BaseHTTPMiddleware):
|
|
|
1100
1101
|
finally:
|
|
1101
1102
|
# Log the details of the processed synapse, including total size, name, hotkey, IP, port,
|
|
1102
1103
|
# status code, and status message, using the debug level of the logger.
|
|
1103
|
-
bittensor.logging.
|
|
1104
|
+
bittensor.logging.trace(
|
|
1104
1105
|
f"axon | --> | {response.headers.get('content-length', -1)} B | {synapse.name} | {synapse.dendrite.hotkey} | {synapse.dendrite.ip}:{synapse.dendrite.port} | {synapse.axon.status_code} | {synapse.axon.status_message}"
|
|
1105
1106
|
)
|
|
1106
1107
|
|
|
@@ -1207,9 +1208,11 @@ class AxonMiddleware(BaseHTTPMiddleware):
|
|
|
1207
1208
|
# We attempt to run the verification function using the synapse instance
|
|
1208
1209
|
# created from the request. If this function runs without throwing an exception,
|
|
1209
1210
|
# it means that the verification was successful.
|
|
1210
|
-
|
|
1211
|
-
verify_fn
|
|
1212
|
-
|
|
1211
|
+
(
|
|
1212
|
+
await verify_fn(synapse)
|
|
1213
|
+
if inspect.iscoroutinefunction(verify_fn)
|
|
1214
|
+
else verify_fn(synapse)
|
|
1215
|
+
)
|
|
1213
1216
|
except Exception as e:
|
|
1214
1217
|
# If there was an exception during the verification process, we log that
|
|
1215
1218
|
# there was a verification exception.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
"""
|
|
1
|
+
""" Standardized logging for Bittensor.
|
|
2
2
|
"""
|
|
3
|
+
|
|
3
4
|
# The MIT License (MIT)
|
|
4
5
|
# Copyright © 2021 Yuma Rao
|
|
5
6
|
|
|
@@ -42,7 +43,7 @@ def _remove_loguru_ansi_directive(text: str) -> str:
|
|
|
42
43
|
|
|
43
44
|
|
|
44
45
|
class logging:
|
|
45
|
-
"""
|
|
46
|
+
"""Standardized logging for Bittensor."""
|
|
46
47
|
|
|
47
48
|
__has_been_inited__: bool = False
|
|
48
49
|
__debug_on__: bool = False
|
|
@@ -58,17 +59,18 @@ class logging:
|
|
|
58
59
|
record_log: bool = None,
|
|
59
60
|
logging_dir: str = None,
|
|
60
61
|
):
|
|
61
|
-
r"""Instantiate
|
|
62
|
+
r"""Instantiate Bittensor logging system backend.
|
|
63
|
+
|
|
62
64
|
Args:
|
|
63
|
-
config (
|
|
65
|
+
config (bittensor.config, optional):
|
|
64
66
|
bittensor.logging.config()
|
|
65
|
-
debug (
|
|
67
|
+
debug (bool, optional):
|
|
66
68
|
Turn on debug.
|
|
67
|
-
trace (
|
|
69
|
+
trace (bool, optional):
|
|
68
70
|
Turn on trace.
|
|
69
|
-
record_log (
|
|
71
|
+
record_log (bool, optional):
|
|
70
72
|
If true, logs are saved to loggind dir.
|
|
71
|
-
logging_dir (
|
|
73
|
+
logging_dir (str, optional):
|
|
72
74
|
Directory where logs are sunk.
|
|
73
75
|
"""
|
|
74
76
|
|
|
@@ -129,8 +131,10 @@ class logging:
|
|
|
129
131
|
|
|
130
132
|
@classmethod
|
|
131
133
|
def config(cls):
|
|
132
|
-
"""Get config from the argument parser
|
|
133
|
-
|
|
134
|
+
"""Get config from the argument parser.
|
|
135
|
+
|
|
136
|
+
Return:
|
|
137
|
+
bittensor.config object
|
|
134
138
|
"""
|
|
135
139
|
parser = argparse.ArgumentParser()
|
|
136
140
|
logging.add_args(parser)
|
|
@@ -203,7 +203,7 @@ class AxonInfo:
|
|
|
203
203
|
return True
|
|
204
204
|
|
|
205
205
|
def ip_str(self) -> str:
|
|
206
|
-
"""Return the whole
|
|
206
|
+
"""Return the whole IP as string"""
|
|
207
207
|
return net.ip__str__(self.ip_type, self.ip, self.port)
|
|
208
208
|
|
|
209
209
|
def __eq__(self, other: "AxonInfo"):
|
|
@@ -341,6 +341,7 @@ class NeuronInfo:
|
|
|
341
341
|
r"""
|
|
342
342
|
Dataclass for neuron metadata.
|
|
343
343
|
"""
|
|
344
|
+
|
|
344
345
|
hotkey: str
|
|
345
346
|
coldkey: str
|
|
346
347
|
uid: int
|
|
@@ -419,7 +420,7 @@ class NeuronInfo:
|
|
|
419
420
|
|
|
420
421
|
@classmethod
|
|
421
422
|
def from_vec_u8(cls, vec_u8: List[int]) -> "NeuronInfo":
|
|
422
|
-
r"""Returns a NeuronInfo object from a vec_u8
|
|
423
|
+
r"""Returns a NeuronInfo object from a ``vec_u8``."""
|
|
423
424
|
if len(vec_u8) == 0:
|
|
424
425
|
return NeuronInfo._null_neuron()
|
|
425
426
|
|
|
@@ -433,7 +434,7 @@ class NeuronInfo:
|
|
|
433
434
|
|
|
434
435
|
@classmethod
|
|
435
436
|
def list_from_vec_u8(cls, vec_u8: List[int]) -> List["NeuronInfo"]:
|
|
436
|
-
r"""Returns a list of NeuronInfo objects from a vec_u8
|
|
437
|
+
r"""Returns a list of NeuronInfo objects from a ``vec_u8``."""
|
|
437
438
|
|
|
438
439
|
decoded_list = from_scale_encoding(
|
|
439
440
|
vec_u8, ChainDataType.NeuronInfo, is_vec=True
|
|
@@ -516,6 +517,7 @@ class NeuronInfoLite:
|
|
|
516
517
|
r"""
|
|
517
518
|
Dataclass for neuron metadata, but without the weights and bonds.
|
|
518
519
|
"""
|
|
520
|
+
|
|
519
521
|
hotkey: str
|
|
520
522
|
coldkey: str
|
|
521
523
|
uid: int
|
|
@@ -589,7 +591,7 @@ class NeuronInfoLite:
|
|
|
589
591
|
|
|
590
592
|
@classmethod
|
|
591
593
|
def from_vec_u8(cls, vec_u8: List[int]) -> "NeuronInfoLite":
|
|
592
|
-
r"""Returns a NeuronInfoLite object from a vec_u8
|
|
594
|
+
r"""Returns a NeuronInfoLite object from a ``vec_u8``."""
|
|
593
595
|
if len(vec_u8) == 0:
|
|
594
596
|
return NeuronInfoLite._null_neuron()
|
|
595
597
|
|
|
@@ -603,7 +605,7 @@ class NeuronInfoLite:
|
|
|
603
605
|
|
|
604
606
|
@classmethod
|
|
605
607
|
def list_from_vec_u8(cls, vec_u8: List[int]) -> List["NeuronInfoLite"]:
|
|
606
|
-
r"""Returns a list of NeuronInfoLite objects from a vec_u8
|
|
608
|
+
r"""Returns a list of NeuronInfoLite objects from a ``vec_u8``."""
|
|
607
609
|
|
|
608
610
|
decoded_list = from_scale_encoding(
|
|
609
611
|
vec_u8, ChainDataType.NeuronInfoLite, is_vec=True
|
|
@@ -673,6 +675,7 @@ class PrometheusInfo:
|
|
|
673
675
|
r"""
|
|
674
676
|
Dataclass for prometheus info.
|
|
675
677
|
"""
|
|
678
|
+
|
|
676
679
|
block: int
|
|
677
680
|
version: int
|
|
678
681
|
ip: str
|
|
@@ -694,6 +697,7 @@ class DelegateInfo:
|
|
|
694
697
|
r"""
|
|
695
698
|
Dataclass for delegate info.
|
|
696
699
|
"""
|
|
700
|
+
|
|
697
701
|
hotkey_ss58: str # Hotkey of delegate
|
|
698
702
|
total_stake: Balance # Total stake of the delegate
|
|
699
703
|
nominators: List[
|
|
@@ -736,7 +740,7 @@ class DelegateInfo:
|
|
|
736
740
|
|
|
737
741
|
@classmethod
|
|
738
742
|
def from_vec_u8(cls, vec_u8: List[int]) -> Optional["DelegateInfo"]:
|
|
739
|
-
r"""Returns a DelegateInfo object from a vec_u8
|
|
743
|
+
r"""Returns a DelegateInfo object from a ``vec_u8``."""
|
|
740
744
|
if len(vec_u8) == 0:
|
|
741
745
|
return None
|
|
742
746
|
|
|
@@ -751,7 +755,7 @@ class DelegateInfo:
|
|
|
751
755
|
|
|
752
756
|
@classmethod
|
|
753
757
|
def list_from_vec_u8(cls, vec_u8: List[int]) -> List["DelegateInfo"]:
|
|
754
|
-
r"""Returns a list of DelegateInfo objects from a vec_u8
|
|
758
|
+
r"""Returns a list of DelegateInfo objects from a ``vec_u8``."""
|
|
755
759
|
decoded = from_scale_encoding(vec_u8, ChainDataType.DelegateInfo, is_vec=True)
|
|
756
760
|
|
|
757
761
|
if decoded is None:
|
|
@@ -765,7 +769,8 @@ class DelegateInfo:
|
|
|
765
769
|
def delegated_list_from_vec_u8(
|
|
766
770
|
cls, vec_u8: List[int]
|
|
767
771
|
) -> List[Tuple["DelegateInfo", Balance]]:
|
|
768
|
-
r"""Returns a list of Tuples of DelegateInfo objects, and Balance, from a vec_u8
|
|
772
|
+
r"""Returns a list of Tuples of DelegateInfo objects, and Balance, from a ``vec_u8``.
|
|
773
|
+
|
|
769
774
|
This is the list of delegates that the user has delegated to, and the amount of stake delegated.
|
|
770
775
|
"""
|
|
771
776
|
decoded = from_scale_encoding(vec_u8, ChainDataType.DelegatedInfo, is_vec=True)
|
|
@@ -786,6 +791,7 @@ class StakeInfo:
|
|
|
786
791
|
r"""
|
|
787
792
|
Dataclass for stake info.
|
|
788
793
|
"""
|
|
794
|
+
|
|
789
795
|
hotkey_ss58: str # Hotkey address
|
|
790
796
|
coldkey_ss58: str # Coldkey address
|
|
791
797
|
stake: Balance # Stake for the hotkey-coldkey pair
|
|
@@ -802,7 +808,7 @@ class StakeInfo:
|
|
|
802
808
|
|
|
803
809
|
@classmethod
|
|
804
810
|
def from_vec_u8(cls, vec_u8: List[int]) -> Optional["StakeInfo"]:
|
|
805
|
-
r"""Returns a StakeInfo object from a vec_u8
|
|
811
|
+
r"""Returns a StakeInfo object from a ``vec_u8``."""
|
|
806
812
|
if len(vec_u8) == 0:
|
|
807
813
|
return None
|
|
808
814
|
|
|
@@ -819,7 +825,7 @@ class StakeInfo:
|
|
|
819
825
|
def list_of_tuple_from_vec_u8(
|
|
820
826
|
cls, vec_u8: List[int]
|
|
821
827
|
) -> Dict[str, List["StakeInfo"]]:
|
|
822
|
-
r"""Returns a list of StakeInfo objects from a vec_u8
|
|
828
|
+
r"""Returns a list of StakeInfo objects from a ``vec_u8``."""
|
|
823
829
|
decoded: Optional[
|
|
824
830
|
List[Tuple(str, List[object])]
|
|
825
831
|
] = from_scale_encoding_using_type_string(
|
|
@@ -840,7 +846,7 @@ class StakeInfo:
|
|
|
840
846
|
|
|
841
847
|
@classmethod
|
|
842
848
|
def list_from_vec_u8(cls, vec_u8: List[int]) -> List["StakeInfo"]:
|
|
843
|
-
r"""Returns a list of StakeInfo objects from a vec_u8
|
|
849
|
+
r"""Returns a list of StakeInfo objects from a ``vec_u8``."""
|
|
844
850
|
decoded = from_scale_encoding(vec_u8, ChainDataType.StakeInfo, is_vec=True)
|
|
845
851
|
|
|
846
852
|
if decoded is None:
|
|
@@ -856,6 +862,7 @@ class SubnetInfo:
|
|
|
856
862
|
r"""
|
|
857
863
|
Dataclass for subnet info.
|
|
858
864
|
"""
|
|
865
|
+
|
|
859
866
|
netuid: int
|
|
860
867
|
rho: int
|
|
861
868
|
kappa: int
|
|
@@ -878,7 +885,7 @@ class SubnetInfo:
|
|
|
878
885
|
|
|
879
886
|
@classmethod
|
|
880
887
|
def from_vec_u8(cls, vec_u8: List[int]) -> Optional["SubnetInfo"]:
|
|
881
|
-
r"""Returns a SubnetInfo object from a vec_u8
|
|
888
|
+
r"""Returns a SubnetInfo object from a ``vec_u8``."""
|
|
882
889
|
if len(vec_u8) == 0:
|
|
883
890
|
return None
|
|
884
891
|
|
|
@@ -891,7 +898,7 @@ class SubnetInfo:
|
|
|
891
898
|
|
|
892
899
|
@classmethod
|
|
893
900
|
def list_from_vec_u8(cls, vec_u8: List[int]) -> List["SubnetInfo"]:
|
|
894
|
-
r"""Returns a list of SubnetInfo objects from a vec_u8
|
|
901
|
+
r"""Returns a list of SubnetInfo objects from a ``vec_u8``."""
|
|
895
902
|
decoded = from_scale_encoding(
|
|
896
903
|
vec_u8, ChainDataType.SubnetInfo, is_vec=True, is_option=True
|
|
897
904
|
)
|
|
@@ -947,6 +954,7 @@ class SubnetHyperparameters:
|
|
|
947
954
|
r"""
|
|
948
955
|
Dataclass for subnet hyperparameters.
|
|
949
956
|
"""
|
|
957
|
+
|
|
950
958
|
rho: int
|
|
951
959
|
kappa: int
|
|
952
960
|
immunity_period: int
|
|
@@ -970,7 +978,7 @@ class SubnetHyperparameters:
|
|
|
970
978
|
|
|
971
979
|
@classmethod
|
|
972
980
|
def from_vec_u8(cls, vec_u8: List[int]) -> Optional["SubnetHyperparameters"]:
|
|
973
|
-
r"""Returns a SubnetHyperparameters object from a vec_u8
|
|
981
|
+
r"""Returns a SubnetHyperparameters object from a ``vec_u8``."""
|
|
974
982
|
if len(vec_u8) == 0:
|
|
975
983
|
return None
|
|
976
984
|
|
|
@@ -983,7 +991,7 @@ class SubnetHyperparameters:
|
|
|
983
991
|
|
|
984
992
|
@classmethod
|
|
985
993
|
def list_from_vec_u8(cls, vec_u8: List[int]) -> List["SubnetHyperparameters"]:
|
|
986
|
-
r"""Returns a list of SubnetHyperparameters objects from a vec_u8
|
|
994
|
+
r"""Returns a list of SubnetHyperparameters objects from a ``vec_u8``."""
|
|
987
995
|
decoded = from_scale_encoding(
|
|
988
996
|
vec_u8, ChainDataType.SubnetHyperparameters, is_vec=True, is_option=True
|
|
989
997
|
)
|
|
@@ -1038,6 +1046,7 @@ class IPInfo:
|
|
|
1038
1046
|
r"""
|
|
1039
1047
|
Dataclass for associated IP Info.
|
|
1040
1048
|
"""
|
|
1049
|
+
|
|
1041
1050
|
ip: str
|
|
1042
1051
|
ip_type: int
|
|
1043
1052
|
protocol: int
|
|
@@ -1053,7 +1062,7 @@ class IPInfo:
|
|
|
1053
1062
|
|
|
1054
1063
|
@classmethod
|
|
1055
1064
|
def from_vec_u8(cls, vec_u8: List[int]) -> Optional["IPInfo"]:
|
|
1056
|
-
r"""Returns a IPInfo object from a vec_u8
|
|
1065
|
+
r"""Returns a IPInfo object from a ``vec_u8``."""
|
|
1057
1066
|
if len(vec_u8) == 0:
|
|
1058
1067
|
return None
|
|
1059
1068
|
|
|
@@ -1066,7 +1075,7 @@ class IPInfo:
|
|
|
1066
1075
|
|
|
1067
1076
|
@classmethod
|
|
1068
1077
|
def list_from_vec_u8(cls, vec_u8: List[int]) -> List["IPInfo"]:
|
|
1069
|
-
r"""Returns a list of IPInfo objects from a vec_u8
|
|
1078
|
+
r"""Returns a list of IPInfo objects from a ``vec_u8``."""
|
|
1070
1079
|
decoded = from_scale_encoding(vec_u8, ChainDataType.IPInfo, is_vec=True)
|
|
1071
1080
|
|
|
1072
1081
|
if decoded is None:
|
|
@@ -845,7 +845,7 @@ class MyDelegatesCommand:
|
|
|
845
845
|
),
|
|
846
846
|
# f'{delegate.take * 100:.1f}%',s
|
|
847
847
|
f"{ delegate[0].total_daily_return.tao * ( 1000 / ( 0.001 + delegate[0].total_stake.tao ) )!s:6.6}",
|
|
848
|
-
str(delegate_description)
|
|
848
|
+
str(delegate_description),
|
|
849
849
|
# f'{delegate_profile.description:140.140}',
|
|
850
850
|
)
|
|
851
851
|
|
|
@@ -124,9 +124,11 @@ class MetagraphCommand:
|
|
|
124
124
|
"*" if metagraph.validator_permit[uid] else "",
|
|
125
125
|
str((metagraph.block.item() - metagraph.last_update[uid].item())),
|
|
126
126
|
str(metagraph.active[uid].item()),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
(
|
|
128
|
+
ep.ip + ":" + str(ep.port)
|
|
129
|
+
if ep.is_serving
|
|
130
|
+
else "[yellow]none[/yellow]"
|
|
131
|
+
),
|
|
130
132
|
ep.hotkey[:10],
|
|
131
133
|
ep.coldkey[:10],
|
|
132
134
|
]
|
|
@@ -271,7 +271,7 @@ class SubnetListCommand:
|
|
|
271
271
|
table.add_column("[overline white]MAX_N", style="white", justify="center")
|
|
272
272
|
table.add_column("[overline white]EMISSION", style="white", justify="center")
|
|
273
273
|
table.add_column("[overline white]TEMPO", style="white", justify="center")
|
|
274
|
-
table.add_column("[overline white]
|
|
274
|
+
table.add_column("[overline white]RECYCLE", style="white", justify="center")
|
|
275
275
|
table.add_column("[overline white]POW", style="white", justify="center")
|
|
276
276
|
table.add_column("[overline white]SUDO", style="white")
|
|
277
277
|
for row in rows:
|
|
@@ -372,11 +372,13 @@ class OverviewCommand:
|
|
|
372
372
|
"{:.5f}".format(validator_trust),
|
|
373
373
|
"*" if validator_permit else "",
|
|
374
374
|
str(last_update),
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
375
|
+
(
|
|
376
|
+
bittensor.utils.networking.int_to_ip(nn.axon_info.ip)
|
|
377
|
+
+ ":"
|
|
378
|
+
+ str(nn.axon_info.port)
|
|
379
|
+
if nn.axon_info.port != 0
|
|
380
|
+
else "[yellow]none[/yellow]"
|
|
381
|
+
),
|
|
380
382
|
nn.hotkey,
|
|
381
383
|
]
|
|
382
384
|
|
|
@@ -38,7 +38,7 @@ class RegisterCommand:
|
|
|
38
38
|
|
|
39
39
|
The registration cost is determined by the current recycle amount for the specified subnet. If the balance is insufficient or the subnet does not exist, the command will exit with an appropriate error message.
|
|
40
40
|
|
|
41
|
-
If the preconditions are met, and the user confirms the transaction (if ``no_prompt`` is not set), the command proceeds to register the neuron by
|
|
41
|
+
If the preconditions are met, and the user confirms the transaction (if ``no_prompt`` is not set), the command proceeds to register the neuron by recycling the required amount of TAO.
|
|
42
42
|
|
|
43
43
|
The command structure includes:
|
|
44
44
|
|
|
@@ -87,7 +87,7 @@ class RegisterCommand:
|
|
|
87
87
|
sys.exit(1)
|
|
88
88
|
|
|
89
89
|
# Check current recycle amount
|
|
90
|
-
current_recycle = subtensor.
|
|
90
|
+
current_recycle = subtensor.recycle(netuid=cli.config.netuid)
|
|
91
91
|
balance = subtensor.get_balance(address=wallet.coldkeypub.ss58_address)
|
|
92
92
|
|
|
93
93
|
# Check balance is sufficient
|
|
@@ -192,9 +192,11 @@ class RootList:
|
|
|
192
192
|
for neuron_data in root_neurons:
|
|
193
193
|
table.add_row(
|
|
194
194
|
str(neuron_data.uid),
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
(
|
|
196
|
+
delegate_info[neuron_data.hotkey].name
|
|
197
|
+
if neuron_data.hotkey in delegate_info
|
|
198
|
+
else ""
|
|
199
|
+
),
|
|
198
200
|
neuron_data.hotkey,
|
|
199
201
|
"{:.5f}".format(
|
|
200
202
|
float(subtensor.get_total_stake_for_hotkey(neuron_data.hotkey))
|
|
@@ -93,9 +93,11 @@ class SenateCommand:
|
|
|
93
93
|
|
|
94
94
|
for ss58_address in senate_members:
|
|
95
95
|
table.add_row(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
(
|
|
97
|
+
delegate_info[ss58_address].name
|
|
98
|
+
if ss58_address in delegate_info
|
|
99
|
+
else ""
|
|
100
|
+
),
|
|
99
101
|
ss58_address,
|
|
100
102
|
)
|
|
101
103
|
|
|
@@ -199,9 +199,9 @@ class RegenColdkeypubCommand:
|
|
|
199
199
|
else:
|
|
200
200
|
config.ss58_address = prompt_answer
|
|
201
201
|
if not bittensor.utils.is_valid_bittensor_address_or_public_key(
|
|
202
|
-
address=
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
address=(
|
|
203
|
+
config.ss58_address if config.ss58_address else config.public_key_hex
|
|
204
|
+
)
|
|
205
205
|
):
|
|
206
206
|
sys.exit(1)
|
|
207
207
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Implementation of the config class, which manages the
|
|
2
|
+
Implementation of the config class, which manages the configuration of different Bittensor modules.
|
|
3
3
|
"""
|
|
4
|
+
|
|
4
5
|
# The MIT License (MIT)
|
|
5
6
|
# Copyright © 2021 Yuma Rao
|
|
6
7
|
# Copyright © 2022 Opentensor Foundation
|
|
@@ -37,21 +38,22 @@ class InvalidConfigFile(Exception):
|
|
|
37
38
|
|
|
38
39
|
class config(DefaultMunch):
|
|
39
40
|
"""
|
|
40
|
-
Implementation of the config class, which manages the
|
|
41
|
+
Implementation of the config class, which manages the configuration of different Bittensor modules.
|
|
41
42
|
"""
|
|
42
43
|
|
|
43
44
|
__is_set: Dict[str, bool]
|
|
44
45
|
|
|
45
46
|
r""" Translates the passed parser into a nested Bittensor config.
|
|
47
|
+
|
|
46
48
|
Args:
|
|
47
49
|
parser (argparse.ArgumentParser):
|
|
48
50
|
Command line parser object.
|
|
49
51
|
strict (bool):
|
|
50
|
-
If true
|
|
52
|
+
If ``true``, the command line arguments are strictly parsed.
|
|
51
53
|
args (list of str):
|
|
52
54
|
Command line arguments.
|
|
53
55
|
default (Optional[Any]):
|
|
54
|
-
Default value for the Config. Defaults to None
|
|
56
|
+
Default value for the Config. Defaults to ``None``.
|
|
55
57
|
This default will be returned for attributes that are undefined.
|
|
56
58
|
Returns:
|
|
57
59
|
config (bittensor.config):
|
|
@@ -98,7 +100,7 @@ class config(DefaultMunch):
|
|
|
98
100
|
parser.add_argument(
|
|
99
101
|
"--no_version_checking",
|
|
100
102
|
action="store_true",
|
|
101
|
-
help="Set true to stop cli version checking.",
|
|
103
|
+
help="Set ``true`` to stop cli version checking.",
|
|
102
104
|
default=False,
|
|
103
105
|
)
|
|
104
106
|
except:
|
|
@@ -110,7 +112,7 @@ class config(DefaultMunch):
|
|
|
110
112
|
"--no_prompt",
|
|
111
113
|
dest="no_prompt",
|
|
112
114
|
action="store_true",
|
|
113
|
-
help="Set true to stop cli from prompting the user.",
|
|
115
|
+
help="Set ``true`` to stop cli from prompting the user.",
|
|
114
116
|
default=False,
|
|
115
117
|
)
|
|
116
118
|
except:
|
|
@@ -246,13 +248,14 @@ class config(DefaultMunch):
|
|
|
246
248
|
args: List[str], parser: argparse.ArgumentParser = None, strict: bool = False
|
|
247
249
|
) -> argparse.Namespace:
|
|
248
250
|
"""Parses the passed args use the passed parser.
|
|
251
|
+
|
|
249
252
|
Args:
|
|
250
253
|
args (List[str]):
|
|
251
254
|
List of arguments to parse.
|
|
252
255
|
parser (argparse.ArgumentParser):
|
|
253
256
|
Command line parser object.
|
|
254
257
|
strict (bool):
|
|
255
|
-
If true
|
|
258
|
+
If ``true``, the command line arguments are strictly parsed.
|
|
256
259
|
Returns:
|
|
257
260
|
Namespace:
|
|
258
261
|
Namespace object created from parser arguments.
|