From df6d1b3d5016a45bf094254aa1b97b79dfa88e4c Mon Sep 17 00:00:00 2001 From: Felix H Date: Thu, 20 Nov 2025 14:20:11 +0000 Subject: [PATCH 1/2] fix: log Transaction fields like 'from' as human-readable hex string instead of raw bytes --- .../src/execution_testing/test_types/transaction_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/testing/src/execution_testing/test_types/transaction_types.py b/packages/testing/src/execution_testing/test_types/transaction_types.py index 77a0ba03bd..ec9e7f4146 100644 --- a/packages/testing/src/execution_testing/test_types/transaction_types.py +++ b/packages/testing/src/execution_testing/test_types/transaction_types.py @@ -32,10 +32,10 @@ TestAddress, TestPrivateKey, ) +from execution_testing.exceptions import TransactionException from execution_testing.logging import ( get_logger, ) -from execution_testing.exceptions import TransactionException from .account_types import EOA from .blob_types import Blob From 824cc66e0e3da07ac91788fcd1fc49645e03ce7c Mon Sep 17 00:00:00 2001 From: Felix H Date: Thu, 20 Nov 2025 14:38:24 +0000 Subject: [PATCH 2/2] fix: transaction logging --- .../test_types/transaction_types.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/packages/testing/src/execution_testing/test_types/transaction_types.py b/packages/testing/src/execution_testing/test_types/transaction_types.py index ec9e7f4146..af387fa601 100644 --- a/packages/testing/src/execution_testing/test_types/transaction_types.py +++ b/packages/testing/src/execution_testing/test_types/transaction_types.py @@ -725,6 +725,42 @@ def metadata_string(self) -> str | None: return None return self.metadata.to_json() + def _format_field_value(self, field_name: str, value: Any) -> str: + """ + Format a field value for string representation. + + Special handling for to, data, and sender fields to show hex encoding. + """ + if field_name in ("to", "data", "sender"): + if value is None: + return "None" + elif hasattr(value, "hex"): + return value.hex() + else: + return repr(value) + else: + return repr(value) + + def __repr__(self) -> str: + """ + Return string representation with hex-encoded values for to, data, and + sender fields. + """ + field_strs = [] + for field_name in self.model_fields: + value = getattr(self, field_name) + formatted_value = self._format_field_value(field_name, value) + field_strs.append(f"{field_name}={formatted_value}") + + return " ".join(field_strs) + + def __str__(self) -> str: + """ + Return string representation with hex-encoded values for to, data, and + sender fields. + """ + return self.__repr__() + @cached_property def hash(self) -> Hash: """Returns hash of the transaction."""