Skip to content

Commit a94000f

Browse files
spencer-tbjsign
authored andcommitted
fix(fw): witness in fixtures from t8n output result.
1 parent af96fb7 commit a94000f

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

src/ethereum_test_fixtures/blockchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ def from_witness(cls, w: Witness) -> "FixtureWitness":
423423
"""
424424
Returns a FixtureWitness from a Witness.
425425
"""
426-
return cls(**w.model_dump(exclude_none=False))
426+
return cls(**w.model_dump())
427427

428428

429429
class FixtureBlockBase(CamelModel):

src/ethereum_test_types/verkle/types.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
Useful Verkle types for generating Ethereum tests.
33
"""
44

5-
from typing import Dict, List
5+
from typing import Any, Dict, List
66

77
from pydantic import Field, RootModel, field_validator
8+
from pydantic.functional_serializers import model_serializer
89

910
from ethereum_test_base_types import CamelModel, HexNumber, PaddedFixedSizeBytes
1011

@@ -74,8 +75,20 @@ class SuffixStateDiff(CamelModel):
7475
"""
7576

7677
suffix: int
77-
current_value: Hash | None = Field(default_factory=None)
78-
new_value: Hash | None = Field(default_factory=None)
78+
current_value: Hash | None
79+
new_value: Hash | None
80+
81+
@model_serializer(mode="wrap")
82+
def custom_serializer(self, handler) -> Dict[str, Any]:
83+
"""
84+
Custom serializer to include None (null) values for current/new value.
85+
"""
86+
output = handler(self)
87+
if self.current_value is None:
88+
output["currentValue"] = None
89+
if self.new_value is None:
90+
output["newValue"] = None
91+
return output
7992

8093

8194
class StemStateDiff(CamelModel):
@@ -86,7 +99,7 @@ class StemStateDiff(CamelModel):
8699
Includes a list of differences for its suffixes.
87100
"""
88101

89-
stem: Hash
102+
stem: Stem
90103
suffix_diffs: List[SuffixStateDiff]
91104

92105

src/evm_transition_tool/transition_tool.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ def _evaluate_filesystem(
320320
args.extend(
321321
["--output.vkt", output_paths["vkt"], "--output.witness", output_paths["witness"]]
322322
)
323-
print(output_paths)
324323
if t8n_data.vkt is not None:
325324
args.extend(["--input.vkt", input_paths["vkt"]])
326325

@@ -379,7 +378,6 @@ def _evaluate_filesystem(
379378
with open(file_path, "r+") as file:
380379
output_contents[key] = json.load(file)
381380
output = TransitionToolOutput(**output_contents)
382-
print(output)
383381
if self.trace:
384382
self.collect_traces(output.result.receipts, temp_dir, debug_output_path)
385383

0 commit comments

Comments
 (0)