From bfca4f12b093fe3f3816d4487cf97d18cdb46e5a Mon Sep 17 00:00:00 2001 From: p-ferreira <38992619+p-ferreira@users.noreply.github.com> Date: Mon, 12 Jun 2023 15:00:59 -0400 Subject: [PATCH] simplifies logic of metagraph axon_info verification --- openvalidators/utils.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/openvalidators/utils.py b/openvalidators/utils.py index cc71649..4899916 100644 --- a/openvalidators/utils.py +++ b/openvalidators/utils.py @@ -91,13 +91,10 @@ def resync_metagraph(self): # Sync the metagraph. self.metagraph.sync() - # Creates a dictionary of uids and hotkeys from the previous metagraph state. - uids_hotkeys_state_dict = dict(zip(previous_metagraph.uids.tolist(), previous_metagraph.hotkeys)) - - # Creates a dictionary of latest uids and hotkeys of the metagraph. - latest_uids_hotkeys_state_dict = dict(zip(self.metagraph.uids.tolist(), self.metagraph.hotkeys)) + # Check if the metagraph axon info has changed. + metagraph_axon_info_updated = previous_metagraph.axons != self.metagraph.axons - if uids_hotkeys_state_dict != latest_uids_hotkeys_state_dict: + if metagraph_axon_info_updated: bt.logging.info("Metagraph updated, re-syncing hotkeys, dendrite pool and moving averages") # Reconstruct the dendrite pool with the new endpoints. self.dendrite_pool.resync(self.metagraph)