diff --git a/pyteal/ast/abi/address.py b/pyteal/ast/abi/address.py index 10a8ac6bc..1e8da1f0f 100644 --- a/pyteal/ast/abi/address.py +++ b/pyteal/ast/abi/address.py @@ -22,7 +22,7 @@ class AddressLength(IntEnum): class AddressTypeSpec(StaticArrayTypeSpec): def __init__(self) -> None: - super().__init__(ByteTypeSpec(), int(AddressLength.Bytes)) + super().__init__(ByteTypeSpec(), AddressLength.Bytes) def new_instance(self) -> "Address": return Address() @@ -67,7 +67,7 @@ def set( case ComputedValue(): pts = value.produced_type_spec() if pts == AddressTypeSpec() or pts == StaticArrayTypeSpec( - ByteTypeSpec(), int(AddressLength.Bytes) + ByteTypeSpec(), AddressLength.Bytes ): return value.store_into(self) @@ -78,7 +78,7 @@ def set( if ( value.type_spec() == AddressTypeSpec() or value.type_spec() - == StaticArrayTypeSpec(ByteTypeSpec(), int(AddressLength.Bytes)) + == StaticArrayTypeSpec(ByteTypeSpec(), AddressLength.Bytes) ): return self.stored_value.store(value.stored_value.load()) diff --git a/pyteal/ast/abi/array_static.py b/pyteal/ast/abi/array_static.py index 0b26a0db0..b829237b7 100644 --- a/pyteal/ast/abi/array_static.py +++ b/pyteal/ast/abi/array_static.py @@ -18,7 +18,9 @@ def __init__(self, value_type_spec: TypeSpec, array_length: int) -> None: super().__init__(value_type_spec) if not isinstance(array_length, int) or array_length < 0: raise TypeError(f"Unsupported StaticArray length: {array_length}") - self.array_length: Final = array_length + + # Casts to `int` to handle downstream usage where value is a subclass of int like `IntEnum`. + self.array_length: Final = int(array_length) def new_instance(self) -> "StaticArray[T, N]": return StaticArray(self)