Skip to content

Commit cbae7d8

Browse files
committed
ifeat(trace): improve misleading comments
1 parent 14641da commit cbae7d8

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

tests/infra/trace/README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ SSZ artifacts (hash-addressed to avoid duplication).
1515

1616
## Usage and example test
1717

18+
You can find this example in `tests/infra/trace/test_example_slots_2.py`:
19+
20+
1821
```python
1922
from tests.infra.trace.decorator import spec_trace
2023

@@ -29,11 +32,10 @@ def test_linear_sanity_slots_222(
2932
spec.process_slot(state)
3033
```
3134

32-
This can, for example, be put into e.g.
33-
`tests/core/pyspec/eth2spec/test/gloas/sanity/test_slots_2.py` and then can be
34-
run with something like
35+
Example of using example test with reftests:
3536

3637
```bash
38+
cp -v tests/infra/trace/test_example_slots_2.py tests/core/pyspec/eth2spec/test/gloas/sanity/test_slots_2.py
3739
make reftests fork=gloas runner=sanity k=linear_sanity_slots_222 verbose=true
3840
```
3941

@@ -93,8 +95,8 @@ results. A decorator is used to set things up. Some simple pydantic models are
9395
used for the trace file structure and some sanitation/formatting.
9496

9597
From a consumer standpoint (i.e. test runner) new tests using this decorator
96-
behave differently and are being detected by a new data type yielded (a
97-
pydantic model instance). Some logic was added to `execute_test` in
98+
behave differently and are being detected by a new data type yielded (a pydantic
99+
model instance). Some logic was added to `execute_test` in
98100
`tests/core/pyspec/eth2spec/gen_helpers/gen_base/gen_runner.py` to catch that
99101
new case and apply new serialization method.
100102

@@ -118,6 +120,9 @@ Some cleanup and polishing is still required.
118120

119121
Typing could be improved.
120122

123+
More example tests showcasing new features (or potentially some actually
124+
needed tests that were waiting for this) could be added.
125+
121126
## Credits
122127

123128
Thanks to Leo for the initial idea and guidance, and to all the reviewers who

tests/infra/trace/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def simple_sanitize_data(value: SERIALIZED_ARGS) -> SERIALIZED_ARGS:
2020
return f"0x{value.hex()}"
2121
# recursively clean lists
2222
if isinstance(value, list):
23-
# typing hint: nesting never added
2423
return [simple_sanitize_data(x) for x in value]
2524
return value
2625

@@ -101,6 +100,7 @@ class TraceConfig(BaseModel):
101100
The root schema for the trace file.
102101
Contains metadata, context, and the execution trace.
103102
"""
103+
104104
model_config = ConfigDict(extra="forbid")
105105

106106
default_fork: str = Field(default="")

tests/infra/trace/test_traced_spec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ def test_empty_trace(recording_spec):
330330
proxy = recording_spec
331331

332332
# try to save a state that's not a state
333+
# this is intentionally testing internal behavior
333334
proxy._capture_pre_state(None)
334335
proxy._capture_post_state(None)
335336
# try to finalize without a single state being captured

0 commit comments

Comments
 (0)