From 6fba4c7e2a10013da7dbc798b1800f9b503f0564 Mon Sep 17 00:00:00 2001 From: fselmo Date: Fri, 5 Dec 2025 11:45:45 -0700 Subject: [PATCH 1/3] fix(test-cli-fill): Use default evm-dump-dir for traces; gitignore it --- .gitignore | 3 +++ docs/filling_tests/debugging_t8n_tools.md | 3 ++- .../cli/pytest_commands/plugins/filler/filler.py | 7 +++++++ .../src/execution_testing/client_clis/file_utils.py | 13 ++++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 5829ce2876..689305cfb6 100644 --- a/.gitignore +++ b/.gitignore @@ -76,6 +76,9 @@ tests/t8n_testdata fixtures/ +# Trace output (generated by --traces flag) +/traces/ + logs/ *.log diff --git a/docs/filling_tests/debugging_t8n_tools.md b/docs/filling_tests/debugging_t8n_tools.md index 21b57d3735..76960b4590 100644 --- a/docs/filling_tests/debugging_t8n_tools.md +++ b/docs/filling_tests/debugging_t8n_tools.md @@ -8,7 +8,8 @@ There are two flags that can help debugging `t8n` tools or the execution-spec-te ## EVM Dump Directory -The `--evm-dump-dir` flag tells the framework to write the inputs and outputs of every call made to the `t8n` command to the specified output directory. The aim is to help debugging or simply understand how a test is interacting with the EVM. Debug output is only generated when this flag is explicitly specified. +The `--evm-dump-dir` flag tells the framework to write the inputs and outputs of every call made to the `t8n` command to the specified output directory. The aim is to help debugging or simply understand how a test is interacting with the EVM. +When `--traces` is specified without an explicit `--evm-dump-dir`, a default directory of `traces/` is used. Each test case receives its own sub-directory under the `--evm-dump-dir` that contains these files which can be easily accessed from the HTML test report generated by `fill` (located by default in the root of the `--output` directory). diff --git a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/filler.py b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/filler.py index 7119f3e29b..150f956291 100644 --- a/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/filler.py +++ b/packages/testing/src/execution_testing/cli/pytest_commands/plugins/filler/filler.py @@ -723,6 +723,13 @@ def pytest_configure(config: pytest.Config) -> None: or config.getoption("optimize_gas", False) ) + # set default for --evm-dump-dir + if ( + config.collect_traces # type: ignore[attr-defined] + and config.getoption("base_dump_dir") + ) is None: + config.option.base_dump_dir = "traces" + # Instantiate the transition tool here to check that the binary path/trace # option is valid. This ensures we only raise an error once, if # appropriate, instead of for every test. diff --git a/packages/testing/src/execution_testing/client_clis/file_utils.py b/packages/testing/src/execution_testing/client_clis/file_utils.py index 579a9a6dd0..a6a937e65c 100644 --- a/packages/testing/src/execution_testing/client_clis/file_utils.py +++ b/packages/testing/src/execution_testing/client_clis/file_utils.py @@ -7,6 +7,8 @@ from pydantic import BaseModel, RootModel +from execution_testing.client_clis.cli_types import LazyAlloc + def dump_files_to_directory(output_path: str, files: Dict[str, Any]) -> None: """Dump the files to the given directory.""" @@ -22,7 +24,16 @@ def dump_files_to_directory(output_path: str, files: Dict[str, Any]) -> None: os.makedirs(os.path.join(output_path, rel_path), exist_ok=True) file_path = os.path.join(output_path, file_rel_path) with open(file_path, "w") as f: - if isinstance(file_contents, BaseModel) or isinstance( + if isinstance(file_contents, LazyAlloc): + # Validate and serialize the lazy alloc + f.write( + file_contents.get().model_dump_json( + indent=4, + exclude_none=True, + by_alias=True, + ) + ) + elif isinstance(file_contents, BaseModel) or isinstance( file_contents, RootModel ): f.write( From 70ab208d73c2910a077c3ad1501ed4049026a2a2 Mon Sep 17 00:00:00 2001 From: fselmo Date: Mon, 8 Dec 2025 10:21:21 -0700 Subject: [PATCH 2/3] enhance: optimization from comment on PR #1852 --- .../execution_testing/client_clis/file_utils.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/testing/src/execution_testing/client_clis/file_utils.py b/packages/testing/src/execution_testing/client_clis/file_utils.py index a6a937e65c..796e58ed55 100644 --- a/packages/testing/src/execution_testing/client_clis/file_utils.py +++ b/packages/testing/src/execution_testing/client_clis/file_utils.py @@ -7,7 +7,7 @@ from pydantic import BaseModel, RootModel -from execution_testing.client_clis.cli_types import LazyAlloc +from execution_testing.client_clis.cli_types import LazyAllocJson, LazyAllocStr def dump_files_to_directory(output_path: str, files: Dict[str, Any]) -> None: @@ -24,15 +24,12 @@ def dump_files_to_directory(output_path: str, files: Dict[str, Any]) -> None: os.makedirs(os.path.join(output_path, rel_path), exist_ok=True) file_path = os.path.join(output_path, file_rel_path) with open(file_path, "w") as f: - if isinstance(file_contents, LazyAlloc): - # Validate and serialize the lazy alloc - f.write( - file_contents.get().model_dump_json( - indent=4, - exclude_none=True, - by_alias=True, - ) - ) + if isinstance(file_contents, (LazyAllocStr, LazyAllocJson)): + if isinstance(file_contents, LazyAllocJson): + dump(file_contents.raw, f, ensure_ascii=True, indent=4) + else: + f.write(file_contents.raw) + elif isinstance(file_contents, BaseModel) or isinstance( file_contents, RootModel ): From 5f21c425140184d24a0fd33a146717e6b7190ce2 Mon Sep 17 00:00:00 2001 From: Mario Vega Date: Mon, 8 Dec 2025 19:17:40 +0000 Subject: [PATCH 3/3] fix: issue when filling with geth's evm --- .../src/execution_testing/client_clis/file_utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/testing/src/execution_testing/client_clis/file_utils.py b/packages/testing/src/execution_testing/client_clis/file_utils.py index 796e58ed55..8e53f1729e 100644 --- a/packages/testing/src/execution_testing/client_clis/file_utils.py +++ b/packages/testing/src/execution_testing/client_clis/file_utils.py @@ -7,7 +7,11 @@ from pydantic import BaseModel, RootModel -from execution_testing.client_clis.cli_types import LazyAllocJson, LazyAllocStr +from execution_testing.client_clis.cli_types import ( + LazyAllocJson, + LazyAllocStr, + TransitionToolInput, +) def dump_files_to_directory(output_path: str, files: Dict[str, Any]) -> None: @@ -30,8 +34,8 @@ def dump_files_to_directory(output_path: str, files: Dict[str, Any]) -> None: else: f.write(file_contents.raw) - elif isinstance(file_contents, BaseModel) or isinstance( - file_contents, RootModel + elif isinstance( + file_contents, (BaseModel, RootModel, TransitionToolInput) ): f.write( file_contents.model_dump_json(