From 1addd3a3955b41724b669c9f9cb502b7818b2d2e Mon Sep 17 00:00:00 2001 From: El De-dog-lo <3859395+fubuloubu@users.noreply.github.com> Date: Fri, 4 Oct 2024 11:29:19 -0400 Subject: [PATCH] fix(cluster): owner has wrong type `AddressType` (#128) --- silverback/cluster/types.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/silverback/cluster/types.py b/silverback/cluster/types.py index 3e31a029..d674b767 100644 --- a/silverback/cluster/types.py +++ b/silverback/cluster/types.py @@ -4,10 +4,9 @@ from datetime import datetime from typing import Annotated, Any -from ape.types import AddressType +from ape.types import AddressType, HexBytes from cryptography.exceptions import InvalidSignature from cryptography.hazmat.primitives.hmac import HMAC, hashes -from eth_pydantic_types import Address, HexBytes from eth_utils import to_bytes, to_int from pydantic import BaseModel, Field, computed_field, field_validator @@ -171,7 +170,7 @@ def encode(self) -> int: + self._encode_byte(self.duration, 7) ) - def get_product_code(self, owner: Address, cluster_id: uuid.UUID) -> HexBytes: + def get_product_code(self, owner: AddressType, cluster_id: uuid.UUID) -> HexBytes: # returns bytes32 product code `(sig || config)` config = normalize_bytes(to_bytes(self.encode())) @@ -189,7 +188,7 @@ def get_product_code(self, owner: Address, cluster_id: uuid.UUID) -> HexBytes: return HexBytes(config + sig) def validate_product_code( - self, owner: Address, signature: bytes, cluster_id: uuid.UUID + self, owner: AddressType, signature: bytes, cluster_id: uuid.UUID ) -> bool: # NOTE: Put `cluster_id` last so it's easy to use with `functools.partial` config = normalize_bytes(to_bytes(self.encode()))