diff --git a/compute_horde/compute_horde/fv_protocol/validator_requests.py b/compute_horde/compute_horde/fv_protocol/validator_requests.py index e5258497c..04b83f3cb 100644 --- a/compute_horde/compute_horde/fv_protocol/validator_requests.py +++ b/compute_horde/compute_horde/fv_protocol/validator_requests.py @@ -26,7 +26,7 @@ def from_keypair(cls, keypair: bittensor.Keypair) -> Self: def verify_signature(self) -> bool: public_key_bytes = bytes.fromhex(self.public_key) - keypair = bittensor.Keypair(public_key=public_key_bytes, ss58_format=42) + keypair = bittensor.Keypair(public_key=self.public_key, ss58_format=42) # make mypy happy valid: bool = keypair.verify(public_key_bytes, self.signature) return valid @@ -34,9 +34,7 @@ def verify_signature(self) -> bool: @property def ss58_address(self) -> str: # make mypy happy - address: str = bittensor.Keypair( - public_key=bytes.fromhex(self.public_key), ss58_format=42 - ).ss58_address + address: str = bittensor.Keypair(public_key=self.public_key, ss58_format=42).ss58_address return address diff --git a/compute_horde/tests/test_signature.py b/compute_horde/tests/test_signature.py index 58faab21b..416425319 100644 --- a/compute_horde/tests/test_signature.py +++ b/compute_horde/tests/test_signature.py @@ -13,6 +13,7 @@ V2JobRequest, to_json_array, ) +from compute_horde.fv_protocol.validator_requests import V0AuthenticationRequest from compute_horde.signature import ( SIGNERS_REGISTRY, VERIFIERS_REGISTRY, @@ -200,3 +201,9 @@ def test_signed_fields__volumes_uploads(): output_upload=uploads[0], ) assert v2_job_request.get_signed_fields() == facilitator_signed_fields + + +def test_authentication_request(keypair): + authentication_request = V0AuthenticationRequest.from_keypair(keypair) + assert authentication_request.verify_signature() + assert authentication_request.ss58_address == keypair.ss58_address