diff --git a/bittensor/core/settings.py b/bittensor/core/settings.py index 98d47104a..262bc710a 100644 --- a/bittensor/core/settings.py +++ b/bittensor/core/settings.py @@ -36,7 +36,7 @@ MINERS_DIR.mkdir(parents=True, exist_ok=True) # Bittensor networks name -NETWORKS = ["finney", "test", "archive", "local"] +NETWORKS = ["finney", "test", "archive", "local", "subvortex"] DEFAULT_ENDPOINT = "wss://entrypoint-finney.opentensor.ai:443" DEFAULT_NETWORK = NETWORKS[0] @@ -46,19 +46,14 @@ FINNEY_TEST_ENTRYPOINT = "wss://test.finney.opentensor.ai:443/" ARCHIVE_ENTRYPOINT = "wss://archive.chain.opentensor.ai:443/" LOCAL_ENTRYPOINT = os.getenv("BT_SUBTENSOR_CHAIN_ENDPOINT") or "ws://127.0.0.1:9944" +SUBVORTEX_ENTRYPOINT = "ws://subvortex.info:9944" NETWORK_MAP = { NETWORKS[0]: FINNEY_ENTRYPOINT, NETWORKS[1]: FINNEY_TEST_ENTRYPOINT, NETWORKS[2]: ARCHIVE_ENTRYPOINT, NETWORKS[3]: LOCAL_ENTRYPOINT, -} - -NETWORK_MAP = { - NETWORKS[0]: FINNEY_ENTRYPOINT, - NETWORKS[1]: FINNEY_TEST_ENTRYPOINT, - NETWORKS[2]: ARCHIVE_ENTRYPOINT, - NETWORKS[3]: LOCAL_ENTRYPOINT, + NETWORKS[4]: SUBVORTEX_ENTRYPOINT, } # Currency Symbols Bittensor diff --git a/bittensor/core/subtensor.py b/bittensor/core/subtensor.py index a11aa192b..252414362 100644 --- a/bittensor/core/subtensor.py +++ b/bittensor/core/subtensor.py @@ -685,16 +685,8 @@ def determine_chain_endpoint_and_network( if network is None: return None, None - if network in ["finney", "local", "test", "archive"]: - if network == "finney": - # Kiru Finney staging network. - return network, settings.FINNEY_ENTRYPOINT - elif network == "local": - return network, settings.LOCAL_ENTRYPOINT - elif network == "test": - return network, settings.FINNEY_TEST_ENTRYPOINT - elif network == "archive": - return network, settings.ARCHIVE_ENTRYPOINT + if network in settings.NETWORKS: + return network, settings.NETWORK_MAP[network] else: if ( network == settings.FINNEY_ENTRYPOINT @@ -715,7 +707,6 @@ def determine_chain_endpoint_and_network( return "local", network else: return "unknown", network - return None, None def get_netuids_for_hotkey( self, hotkey_ss58: str, block: Optional[int] = None diff --git a/tests/unit_tests/test_subtensor.py b/tests/unit_tests/test_subtensor.py index 201acae38..e3f573c67 100644 --- a/tests/unit_tests/test_subtensor.py +++ b/tests/unit_tests/test_subtensor.py @@ -2110,3 +2110,16 @@ def test_get_delegate_take_none(subtensor, mocker): subtensor_module.u16_normalized_float.assert_not_called() assert result is None + + +def test_networks_during_connection(mocker): + """Test networks during_connection.""" + # Preps + subtensor_module.SubstrateInterface = mocker.Mock() + # Call + for network in list(settings.NETWORK_MAP.keys()) + ["undefined"]: + sub = Subtensor(network) + + # Assertions + sub.network = network + sub.chain_endpoint = settings.NETWORK_MAP.get(network)