@@ -59,25 +59,11 @@ def create_new_miner(uid: int):
5959 )
6060
6161 @classmethod
62- def from_dict (cls , data : Dict [str , Any ]) -> "Miner" :
63- return cls (
64- uid = int (data .get ("uid" , - 1 )),
65- country = data .get ("country" , None ),
66- version = data .get ("version" , "0.0.0" ),
67- verified = bool (int (data .get ("verified" , 0 ))),
68- score = float (data .get ("score" , 0 )),
69- availability_score = float (data .get ("availability_score" , 0 )),
70- latency_score = float (data .get ("latency_score" , 0 )),
71- reliability_score = float (data .get ("reliability_score" , 0 )),
72- distribution_score = float (data .get ("distribution_score" , 0 )),
73- challenge_successes = int (data .get ("challenge_successes" , 0 )),
74- challenge_attempts = int (data .get ("challenge_attempts" , 0 )),
75- process_time = float (data .get ("process_time" , 0 )),
76- )
77-
78- def to_redis_mapping (self ) -> Dict [str , str ]:
62+ def to_dict (self ) -> Dict [str , str ]:
7963 return {
8064 "uid" : self .uid ,
65+ "hotkey" : self .hotkey ,
66+ "ip" : self .ip or "0.0.0.0" ,
8167 "country" : self .country or "" ,
8268 "version" : self .version ,
8369 "verified" : int (self .verified ),
@@ -91,10 +77,12 @@ def to_redis_mapping(self) -> Dict[str, str]:
9177 "process_time" : self .process_time ,
9278 }
9379
94- @classmethod
95- def from_redis_mapping ( cls , data : Dict [str , str ]) -> "Miner" :
96- return cls (
80+ @staticmethod
81+ def from_dict ( data : Dict [str , str ]) -> "Miner" :
82+ return Miner (
9783 uid = int (data .get ("uid" , - 1 )),
84+ hotkey = data .get ("hotkey" , None ),
85+ ip = data .get ("ip" , "0.0.0.0" ),
9886 country = data .get ("country" , None ),
9987 version = data .get ("version" , "0.0.0" ),
10088 verified = bool (int (data .get ("verified" , 0 ))),
0 commit comments