Skip to content

Commit 7c9de1d

Browse files
raxhvlmarioevz
andauthored
🐞 fix(types): Add missing yParity in Authorization tuple (#1398)
* 🐞 fix: Add missing yParity in Authorization tuple * fix(fixtures): Tox --------- Co-authored-by: raxhvl <[email protected]> Co-authored-by: Mario Vega <[email protected]>
1 parent a695b00 commit 7c9de1d

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/ethereum_test_fixtures/common.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import Dict
44

5-
from pydantic import AliasChoices, Field, model_serializer
5+
from pydantic import AliasChoices, Field
66

77
from ethereum_test_base_types import (
88
BlobSchedule,
@@ -57,18 +57,6 @@ def from_authorization_tuple(
5757
"""Return FixtureAuthorizationTuple from an AuthorizationTuple."""
5858
return cls(**auth_tuple.model_dump())
5959

60-
@model_serializer(mode="wrap", when_used="json-unless-none")
61-
def duplicate_v_as_y_parity(self, serializer):
62-
"""
63-
Add a duplicate 'yParity' field (same as `v`) in JSON fixtures.
64-
65-
Background: https://github.com/erigontech/erigon/issues/14073
66-
"""
67-
data = serializer(self)
68-
if "v" in data and data["v"] is not None:
69-
data["yParity"] = data["v"]
70-
return data
71-
7260
def sign(self):
7361
"""Sign the current object for further serialization."""
7462
# No-op, as the object is always already signed

src/ethereum_test_types/types.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,18 @@ def get_rlp_signing_prefix(self) -> bytes:
461461
"""
462462
return self.magic.to_bytes(1, byteorder="big")
463463

464+
@model_serializer(mode="wrap", when_used="json-unless-none")
465+
def duplicate_v_as_y_parity(self, serializer):
466+
"""
467+
Add a duplicate 'yParity' field (same as `v`) in JSON fixtures.
468+
469+
Background: https://github.com/erigontech/erigon/issues/14073
470+
"""
471+
data = serializer(self)
472+
if "v" in data and data["v"] is not None:
473+
data["yParity"] = data["v"]
474+
return data
475+
464476

465477
class AuthorizationTuple(AuthorizationTupleGeneric[HexNumber]):
466478
"""Authorization tuple for transactions."""

0 commit comments

Comments
 (0)