Skip to content

Commit dacb1b7

Browse files
refactor: update serialization schema
1 parent 626f82a commit dacb1b7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ethereum_test_vm/bytecode.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from pydantic import GetCoreSchemaHandler
66
from pydantic_core.core_schema import (
77
PlainValidatorFunctionSchema,
8-
format_ser_schema,
98
no_info_plain_validator_function,
9+
plain_serializer_function_ser_schema,
1010
)
1111

1212
from ethereum_test_base_types import Bytes, Hash
@@ -232,5 +232,8 @@ def __get_pydantic_core_schema__(
232232
"""Provide Pydantic core schema for Bytecode serialization and validation."""
233233
return no_info_plain_validator_function(
234234
cls,
235-
serialization=format_ser_schema("0x{}"),
235+
serialization=plain_serializer_function_ser_schema(
236+
lambda bytecode: "0x" + bytecode.hex(),
237+
info_arg=False,
238+
),
236239
)

0 commit comments

Comments
 (0)