Skip to content

Commit b561af6

Browse files
authored
Merge pull request #1149 from gurukamath/t8n-fixes
T8N fixes
2 parents 51f2d6a + 4509c1d commit b561af6

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/ethereum_spec_tools/evm_tools/statetest/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def run_test_case(
135135
"stdin",
136136
"--state.fork",
137137
f"{test_case.fork_name}",
138+
"--state-test",
138139
]
139140

140141
if t8n_extra is not None:

src/ethereum_spec_tools/evm_tools/t8n/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def __init__(
109109
trace_memory=trace_memory,
110110
trace_stack=trace_stack,
111111
trace_return_data=trace_return_data,
112+
output_basedir=self.options.output_basedir,
112113
)
113114
self.logger = get_stream_logger("T8N")
114115

src/ethereum_spec_tools/evm_tools/t8n/evm_trace.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
)
3333

3434
EXCLUDE_FROM_OUTPUT = ["gasCostTraced", "errorTraced", "precompile"]
35-
OUTPUT_DIR = "."
3635

3736

3837
@dataclass
@@ -141,6 +140,7 @@ def evm_trace(
141140
trace_memory: bool = False,
142141
trace_stack: bool = True,
143142
trace_return_data: bool = False,
143+
output_basedir: str | TextIO = ".",
144144
) -> None:
145145
"""
146146
Create a trace of the event.
@@ -189,6 +189,7 @@ def evm_trace(
189189
traces,
190190
evm.message.tx_env.index_in_block,
191191
evm.message.tx_env.tx_hash,
192+
output_basedir,
192193
)
193194
elif isinstance(event, PrecompileStart):
194195
new_trace = Trace(
@@ -349,22 +350,23 @@ def output_traces(
349350
traces: List[Union[Trace, FinalTrace]],
350351
index_in_block: int,
351352
tx_hash: bytes,
353+
output_basedir: str | TextIO,
352354
) -> None:
353355
"""
354356
Output the traces to a json file.
355357
"""
356358
with ExitStack() as stack:
357359
json_file: TextIO
358360

359-
if isinstance(OUTPUT_DIR, str):
361+
if isinstance(output_basedir, str):
360362
tx_hash_str = "0x" + tx_hash.hex()
361363
output_path = os.path.join(
362-
OUTPUT_DIR, f"trace-{index_in_block}-{tx_hash_str}.jsonl"
364+
output_basedir, f"trace-{index_in_block}-{tx_hash_str}.jsonl"
363365
)
364366
json_file = open(output_path, "w")
365367
stack.push(json_file)
366368
else:
367-
json_file = OUTPUT_DIR
369+
json_file = output_basedir
368370

369371
for trace in traces:
370372
if getattr(trace, "precompile", False):

tests/conftest.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,13 @@ def pytest_configure(config: Config) -> None:
4747
ethereum_optimized.monkey_patch(None)
4848

4949
if config.getoption("evm_trace"):
50-
path = config.getoption("evm_trace")
5150
import ethereum.trace
52-
import ethereum_spec_tools.evm_tools.t8n.evm_trace as evm_trace_module
5351
from ethereum_spec_tools.evm_tools.t8n.evm_trace import (
5452
evm_trace as new_trace_function,
5553
)
5654

5755
# Replace the function in the module
5856
ethereum.trace.evm_trace = new_trace_function
59-
# Set the output directory for traces
60-
evm_trace_module.OUTPUT_DIR = path
6157

6258

6359
def download_fixtures(url: str, location: str) -> None:

0 commit comments

Comments
 (0)