Skip to content

Blob interface can be simpler and consistent between inherited classes #137

Description

@CiottiGiorgio
class StateBlob(ABC):
    def __init__(self, num_keys: int):
        self.num_keys = num_keys

while

class AccountStateBlob(StateBlob):
    def __init__(self, keys: Optional[int | list[int]] = None):

and

class ApplicationStateBlob(StateBlob):
    def __init__(self, keys: Optional[int | list[int]] = None):

makes it hard to use StateBlob in an abstract way and then substitute with whatever implementation (signature on the abstract should match signatures on the concrete).

Furthermore, I think

class Blob(ABC):
    def __init__(self, key_limit: int, /, *, keys: Optional[int | list[int]] = None):

could be much simpler. Maybe always accepting just a int | Tuple[int, int] is enough?
I'm thinking of the case where a single global/local space could be storing multiple blobs so it makes sense to either specify the size or a range of slots.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions