Use Union[None, T] instead of Optional[T] in SSZ datastructures - #5200
Use Union[None, T] instead of Optional[T] in SSZ datastructures#5200ericsson49 wants to merge 1 commit into
Union[None, T] instead of Optional[T] in SSZ datastructures#5200Conversation
|
So SSZ unions are not actually used anywhere in the specs and we were debating whether or not we should remove them (#3906). Also, implementers of this would probably just use non-SSZ types here. Let me look into if switching away from SSZ types here, for this particular field. If it's not trivial, we can merge this PR and deal with it later. |
| payloads: Dict[Root, ExecutionPayloadEnvelope] = field(default_factory=dict) | ||
| # [New in Gloas:EIP7732] | ||
| payload_timeliness_vote: Dict[Root, Vector[Optional[boolean], PTC_SIZE]] = field( | ||
| payload_timeliness_vote: Dict[Root, Vector[Union[None, boolean], PTC_SIZE]] = field( |
There was a problem hiding this comment.
Store is not an SSZ container, what's the problem with optional?
If Optional is problematic, this should be PyUnion, not SSZ Union.
There was a problem hiding this comment.
The problem was that it was used inside Vector which is an SSZ type. We shouldn't have been using Vector here in the first place. I should have caught this earlier. I made #5208 to fix this.
|
Closing this in favor of #5208. |
Recent PR #5180 introduced
Vector[Optional[boolean], PTC_SIZE]]ingloasfork-choice.md.However,
Optionalis not supported as SSZ type, which breaks the generatedgloasspec, e.g.The PR fixes this by using
Vector[Union[None, boolean], PTC_SIZE]instead.Related to #5180