Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Networking codec test fixture for wire-format conformance testing."""

from collections.abc import Callable
from typing import Annotated, ClassVar, Final, Literal, Union
from typing import Annotated, ClassVar, Final, Literal

from pydantic import Field

Expand Down Expand Up @@ -699,20 +699,18 @@ def attempt_decode(self) -> Exception | None:


NetworkingCodec = Annotated[
Union[
VarintRoundtrip,
GossipTopicRoundtrip,
GossipMessageIdentifier,
GossipsubRpcRoundtrip,
ReqRespRequestRoundtrip,
ReqRespResponseRoundtrip,
ReqRespResponseStream,
EnrRoundtrip,
PeerIdentifierDerivation,
SnappyBlockRoundtrip,
SnappyFrameRoundtrip,
DecodeFailure,
],
VarintRoundtrip
| GossipTopicRoundtrip
| GossipMessageIdentifier
| GossipsubRpcRoundtrip
| ReqRespRequestRoundtrip
| ReqRespResponseRoundtrip
| ReqRespResponseStream
| EnrRoundtrip
| PeerIdentifierDerivation
| SnappyBlockRoundtrip
| SnappyFrameRoundtrip
| DecodeFailure,
Field(discriminator="kind"),
]
"""Discriminated union of every networking codec case under test."""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Slot clock test fixture for timing conformance testing."""

from typing import Annotated, ClassVar, Literal, Union
from typing import Annotated, ClassVar, Literal

from pydantic import Field

Expand Down Expand Up @@ -146,7 +146,7 @@ def run(self) -> TotalIntervalsOutput:


SlotClockOperation = Annotated[
Union[FromUnixTime, FromSlot, CurrentSlot, CurrentInterval, TotalIntervals],
FromUnixTime | FromSlot | CurrentSlot | CurrentInterval | TotalIntervals,
Field(discriminator="kind"),
]
"""Discriminated union of every slot clock conversion under test."""
Expand Down
14 changes: 6 additions & 8 deletions packages/testing/src/consensus_testing/test_types/step_types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Step types for fork choice tests: author-facing inputs and emitted results."""

from typing import Annotated, Any, Literal, Union
from typing import Annotated, Any, Literal

from pydantic import Field, field_serializer, model_validator

Expand Down Expand Up @@ -173,7 +173,7 @@ class GossipAggregatedAttestationStep(BaseForkChoiceStep):

# Discriminated union type for all fork choice steps
ForkChoiceStep = Annotated[
Union[TickStep, BlockStep, AttestationStep, GossipAggregatedAttestationStep],
TickStep | BlockStep | AttestationStep | GossipAggregatedAttestationStep,
Field(discriminator="step_type"),
]

Expand Down Expand Up @@ -281,11 +281,9 @@ class FilledGossipAggregatedAttestationStep(BaseFilledStep):

# Discriminated union type for all emitted fork choice steps
FilledForkChoiceStep = Annotated[
Union[
FilledTickStep,
FilledBlockStep,
FilledAttestationStep,
FilledGossipAggregatedAttestationStep,
],
FilledTickStep
| FilledBlockStep
| FilledAttestationStep
| FilledGossipAggregatedAttestationStep,
Field(discriminator="step_type"),
]
Loading