Skip to content

Commit

Permalink
Fix Profile should not inherit from StableContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
etan-status committed May 23, 2024
1 parent ff2b81d commit 12ed198
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions remerkleable/stable_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def __class_getitem__(cls, b) -> Type["Profile"]:
if not issubclass(b, StableContainer) and not issubclass(b, Container):
raise Exception(f"invalid Profile base: {b}")

class ProfileView(Profile, b):
class ProfileView(Profile):
B = b

ProfileView.__name__ = ProfileView.type_repr()
Expand Down Expand Up @@ -567,8 +567,13 @@ def key_to_static_gindex(cls, key: Any) -> Gindex:
if key == '__active_fields__':
return RIGHT_GINDEX
(_, _) = cls.fields()[key]
(findex, _, _) = cls.B._field_indices[key]
return 2**get_depth(cls.N) * 2 + findex
if issubclass(cls.B, StableContainer):
(findex, _, _) = cls.B._field_indices[key]
return 2**get_depth(cls.B.N) * 2 + findex
else:
findex = cls.B._field_indices[key]
n = len(cls.B.fields())
return 2**get_depth(n) + findex


class OneOf(ComplexView):
Expand Down

0 comments on commit 12ed198

Please sign in to comment.