From 2a73342e711143a5cd5ee2732142c5a25022baf0 Mon Sep 17 00:00:00 2001 From: rodgerjohnson Date: Fri, 17 May 2024 17:37:00 +0900 Subject: [PATCH] Rename all instances of starkware to starknet (#61) --- README.md | 2 +- src/collectors.py | 4 ++-- src/configuration.py | 2 +- src/registries.py | 4 ++-- src/test_collectors.py | 20 +++++++++---------- src/test_registries.py | 8 ++++---- ...kware.yaml => configuration_starknet.yaml} | 4 ++-- 7 files changed, 22 insertions(+), 22 deletions(-) rename src/tests/fixtures/{configuration_starkware.yaml => configuration_starknet.yaml} (83%) diff --git a/README.md b/README.md index 5ec9c97..f836fa0 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Exporter currently supports all EVM-compatible chains. In addition, there is lim - Bitcoin (https) - Dogecoin (https) - Filecoin (https) -- Starkware (https) +- Starknet (https) ## Available Metrics diff --git a/src/collectors.py b/src/collectors.py index 513cd1b..7562a83 100644 --- a/src/collectors.py +++ b/src/collectors.py @@ -318,8 +318,8 @@ def latency(self): return self.interface.latest_query_latency -class StarkwareCollector(): - """A collector to fetch information about starkware RPC endpoints.""" +class StarknetCollector(): + """A collector to fetch information about starknet RPC endpoints.""" def __init__(self, url, labels, chain_id, **client_parameters): diff --git a/src/configuration.py b/src/configuration.py index fccf818..111f8d7 100644 --- a/src/configuration.py +++ b/src/configuration.py @@ -47,7 +47,7 @@ def endpoints(self): def _load_configuration(self): allowed_providers = self._load_validation_file() supported_collectors = ('evm', 'cardano', 'conflux', 'solana', - 'bitcoin', 'doge', 'filecoin', 'starkware') + 'bitcoin', 'doge', 'filecoin', 'starknet') configuration_schema = Schema({ 'blockchain': diff --git a/src/registries.py b/src/registries.py index 0f20434..726ba38 100644 --- a/src/registries.py +++ b/src/registries.py @@ -79,8 +79,8 @@ def get_collector_registry(self) -> list: collector = collectors.FilecoinCollector case "solana", "solana": collector = collectors.SolanaCollector - case "starkware", "starkware": - collector = collectors.StarkwareCollector + case "starknet", "starknet": + collector = collectors.StarknetCollector case "evm", other: # pylint: disable=unused-variable collector = collectors.EvmCollector if collector is None: diff --git a/src/test_collectors.py b/src/test_collectors.py index 7da7af1..53815df 100644 --- a/src/test_collectors.py +++ b/src/test_collectors.py @@ -591,8 +591,8 @@ def test_latency(self): self.assertEqual(0.123, self.solana_collector.latency()) -class TestStarkwareCollector(TestCase): - """Tests the starkware collector class""" +class TestStarknetCollector(TestCase): + """Tests the starknet collector class""" def setUp(self): self.url = "wss://test.com" @@ -608,45 +608,45 @@ def setUp(self): "id": 1 } with mock.patch('collectors.HttpsInterface') as mocked_connection: - self.starkware_collector = collectors.StarkwareCollector( + self.starknet_collector = collectors.StarknetCollector( self.url, self.labels, self.chain_id, **self.client_params) self.mocked_connection = mocked_connection def test_https_interface_created(self): - """Tests that the starkware collector calls the https interface with the correct args""" + """Tests that the starknet collector calls the https interface with the correct args""" self.mocked_connection.assert_called_once_with( self.url, self.open_timeout, self.ping_timeout) def test_interface_attribute_exists(self): """Tests that the interface attribute exists. May be used by external calls to access objects such as the interface cache""" - self.assertTrue(hasattr(self.starkware_collector, 'interface')) + self.assertTrue(hasattr(self.starknet_collector, 'interface')) def test_alive_call(self): """Tests the alive function uses the correct call and args""" - self.starkware_collector.alive() + self.starknet_collector.alive() self.mocked_connection.return_value.cached_json_rpc_post.assert_called_once_with( self.block_height_payload) def test_alive_false(self): """Tests the alive function returns false when post returns None""" self.mocked_connection.return_value.cached_json_rpc_post.return_value = None - result = self.starkware_collector.alive() + result = self.starknet_collector.alive() self.assertFalse(result) def test_block_height(self): """Tests the block_height function uses the correct call and args to get block height""" - self.starkware_collector.block_height() + self.starknet_collector.block_height() self.mocked_connection.return_value.cached_json_rpc_post.assert_called_once_with( self.block_height_payload) def test_block_height_returns_none(self): """Tests that the block height returns None if json_rpc_post returns None""" self.mocked_connection.return_value.cached_json_rpc_post.return_value = None - result = self.starkware_collector.block_height() + result = self.starknet_collector.block_height() self.assertEqual(None, result) def test_latency(self): """Tests that the latency is obtained from the interface based on latest_query_latency""" self.mocked_connection.return_value.latest_query_latency = 0.123 - self.assertEqual(0.123, self.starkware_collector.latency()) + self.assertEqual(0.123, self.starknet_collector.latency()) diff --git a/src/test_registries.py b/src/test_registries.py index b5b139f..11b5e84 100644 --- a/src/test_registries.py +++ b/src/test_registries.py @@ -120,13 +120,13 @@ def test_get_collector_registry_for_solana(self): helper_test_collector_registry(self, collector) @mock.patch.dict(os.environ, { - "CONFIG_FILE_PATH": "tests/fixtures/configuration_starkware.yaml", + "CONFIG_FILE_PATH": "tests/fixtures/configuration_starknet.yaml", "VALIDATION_FILE_PATH": "tests/fixtures/validation.yaml" }) - def test_get_collector_registry_for_starkware(self): - """Tests that the starkware collector is called with the correct args""" + def test_get_collector_registry_for_starknet(self): + """Tests that the starknet collector is called with the correct args""" self.collector_registry = CollectorRegistry() - with mock.patch('collectors.StarkwareCollector', new=mock.Mock()) as collector: + with mock.patch('collectors.StarknetCollector', new=mock.Mock()) as collector: helper_test_collector_registry(self, collector) @mock.patch.dict(os.environ, { diff --git a/src/tests/fixtures/configuration_starkware.yaml b/src/tests/fixtures/configuration_starknet.yaml similarity index 83% rename from src/tests/fixtures/configuration_starkware.yaml rename to src/tests/fixtures/configuration_starknet.yaml index 3ce32ca..6ac2d45 100644 --- a/src/tests/fixtures/configuration_starkware.yaml +++ b/src/tests/fixtures/configuration_starknet.yaml @@ -1,8 +1,8 @@ -blockchain: "starkware" +blockchain: "starknet" chain_id: 1234 network_name: "TestNetwork" network_type: "Mainnet" -collector: "starkware" +collector: "starknet" endpoints: - url: wss://test1.com provider: TestProvider1