Skip to content

Commit

Permalink
fix(cluster): owner has wrong type AddressType (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu authored Oct 4, 2024
1 parent 832fabe commit 1addd3a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions silverback/cluster/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()))

Expand All @@ -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()))
Expand Down

0 comments on commit 1addd3a

Please sign in to comment.