From eee0279cc49e3cb0c6e8313724a1f0c0d1974e0e Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 16 Oct 2024 14:57:50 +0200 Subject: [PATCH 1/4] Expands the type registry to include all the available options. --- bittensor/core/settings.py | 122 ++++++++++++++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 2 deletions(-) diff --git a/bittensor/core/settings.py b/bittensor/core/settings.py index 477d4d955b..c0c94918f4 100644 --- a/bittensor/core/settings.py +++ b/bittensor/core/settings.py @@ -112,11 +112,28 @@ def turn_console_on(): } # --- Type Registry --- -TYPE_REGISTRY: dict = { +TYPE_REGISTRY = { "types": { "Balance": "u64", # Need to override default u128 }, "runtime_api": { + "DelegateInfoRuntimeApi": { + "methods": { + "get_delegated": { + "params": [ + { + "name": "coldkey", + "type": "Vec", + }, + ], + "type": "Vec", + }, + "get_delegates": { + "params": [], + "type": "Vec", + }, + } + }, "NeuronInfoRuntimeApi": { "methods": { "get_neuron_lite": { @@ -141,8 +158,65 @@ def turn_console_on(): ], "type": "Vec", }, + "get_neuron": { + "params": [ + { + "name": "netuid", + "type": "u16", + }, + { + "name": "uid", + "type": "u16", + }, + ], + "type": "Vec", + }, + "get_neurons": { + "params": [ + { + "name": "netuid", + "type": "u16", + }, + ], + "type": "Vec", + }, } }, + "StakeInfoRuntimeApi": { + "methods": { + "get_stake_info_for_coldkey": { + "params": [ + { + "name": "coldkey_account_vec", + "type": "Vec", + }, + ], + "type": "Vec", + }, + "get_stake_info_for_coldkeys": { + "params": [ + { + "name": "coldkey_account_vecs", + "type": "Vec>", + }, + ], + "type": "Vec", + }, + }, + }, + "ValidatorIPRuntimeApi": { + "methods": { + "get_associated_validator_ip_info_for_subnet": { + "params": [ + { + "name": "netuid", + "type": "u16", + }, + ], + "type": "Vec", + }, + }, + }, "SubnetInfoRuntimeApi": { "methods": { "get_subnet_hyperparams": { @@ -153,12 +227,56 @@ def turn_console_on(): }, ], "type": "Vec", - } + }, + "get_subnet_info": { + "params": [ + { + "name": "netuid", + "type": "u16", + }, + ], + "type": "Vec", + }, + "get_subnets_info": { + "params": [], + "type": "Vec", + }, } }, "SubnetRegistrationRuntimeApi": { "methods": {"get_network_registration_cost": {"params": [], "type": "u64"}} }, + "ColdkeySwapRuntimeApi": { + "methods": { + "get_scheduled_coldkey_swap": { + "params": [ + { + "name": "coldkey_account_vec", + "type": "Vec", + }, + ], + "type": "Vec", + }, + "get_remaining_arbitration_period": { + "params": [ + { + "name": "coldkey_account_vec", + "type": "Vec", + }, + ], + "type": "Vec", + }, + "get_coldkey_swap_destinations": { + "params": [ + { + "name": "coldkey_account_vec", + "type": "Vec", + }, + ], + "type": "Vec", + }, + } + }, }, } From 8a75751576b11138204b39b56b3610838365022b Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 16 Oct 2024 16:18:46 +0200 Subject: [PATCH 2/4] Mypy --- bittensor/core/settings.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bittensor/core/settings.py b/bittensor/core/settings.py index 75691a6e9b..8cab8995b3 100644 --- a/bittensor/core/settings.py +++ b/bittensor/core/settings.py @@ -21,6 +21,7 @@ import re import warnings from pathlib import Path +from typing import Union from munch import munchify from rich.console import Console @@ -112,7 +113,16 @@ def turn_console_on(): } # --- Type Registry --- -TYPE_REGISTRY = { +TYPE_REGISTRY: dict[ + str, + dict[ + str, + Union[ + dict[str, str], + dict[str, dict[str, dict[str, Union[list[dict[str, str]], str]]]], + ], + ], +] = { "types": { "Balance": "u64", # Need to override default u128 }, From 32e93b1eb63103b318433bb65233f88d9945fe49 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 16 Oct 2024 16:45:10 +0200 Subject: [PATCH 3/4] Seriously. Mypy again --- bittensor/core/settings.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/bittensor/core/settings.py b/bittensor/core/settings.py index 8cab8995b3..3d2b0894af 100644 --- a/bittensor/core/settings.py +++ b/bittensor/core/settings.py @@ -113,16 +113,7 @@ def turn_console_on(): } # --- Type Registry --- -TYPE_REGISTRY: dict[ - str, - dict[ - str, - Union[ - dict[str, str], - dict[str, dict[str, dict[str, Union[list[dict[str, str]], str]]]], - ], - ], -] = { +TYPE_REGISTRY: dict[str, dict] = { "types": { "Balance": "u64", # Need to override default u128 }, From db8cbca6f141c5e801e8ce510bd0a8851090b37b Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 16 Oct 2024 17:03:06 +0200 Subject: [PATCH 4/4] Flake. --- bittensor/core/settings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bittensor/core/settings.py b/bittensor/core/settings.py index 3d2b0894af..29948b612e 100644 --- a/bittensor/core/settings.py +++ b/bittensor/core/settings.py @@ -21,7 +21,6 @@ import re import warnings from pathlib import Path -from typing import Union from munch import munchify from rich.console import Console