Skip to content

Commit 0bceb2d

Browse files
authored
chore(fill): fix --fork/--from/--until for transition forks (#1311)
1 parent b0c1007 commit 0bceb2d

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

docs/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@ Test fixtures for use by clients are available for each release on the [Github r
1818
- 🐞 Don't parametrize tests for unsupported fixture formats; improve `consume` test collection ([#1315](https://github.com/ethereum/execution-spec-tests/pull/1314)).
1919
- 🐞 Improve index generation of ethereum/tests fixtures: Allow generation at any directory level and include `generatedTestHash` in the index file for the `fixture_hash` ([#1303](https://github.com/ethereum/execution-spec-tests/pull/1303)).
2020

21+
#### `fill`
22+
23+
- 🐞 Fix `--fork/from/until` for transition forks when using `fill` [#1311](https://github.com/ethereum/execution-spec-tests/pull/1311).
24+
2125
### 📋 Misc
2226

23-
- Bump the version of `execution-specs` used by the framework to the package [`ethereum-execution==1.17.0rc6.dev1`](https://pypi.org/project/ethereum-execution/1.17.0rc6.dev1/); bump the version used for test fixture generation for forks < Prague to current `execution-specs` master, [fa847a0](https://github.com/ethereum/execution-specs/commit/fa847a0e48309debee8edc510ceddb2fd5db2f2e) ([#1310](https://github.com/ethereum/execution-spec-tests/pull/1310)).
27+
- 🔀 Bump the version of `execution-specs` used by the framework to the package [`ethereum-execution==1.17.0rc6.dev1`](https://pypi.org/project/ethereum-execution/1.17.0rc6.dev1/); bump the version used for test fixture generation for forks < Prague to current `execution-specs` master, [fa847a0](https://github.com/ethereum/execution-specs/commit/fa847a0e48309debee8edc510ceddb2fd5db2f2e) ([#1310](https://github.com/ethereum/execution-spec-tests/pull/1310)).
2428

2529
### 🧪 Test Cases
2630

src/pytest_plugins/forks/forks.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,14 @@ def get_fork_option(config, option_name: str, parameter_name: str) -> Set[Fork]:
443443
config_str = config.getoption(option_name)
444444
if not config_str:
445445
return set()
446+
446447
forks_str = config_str.split(",")
447-
for i in range(len(forks_str)):
448-
forks_str[i] = forks_str[i].strip().capitalize()
449-
if forks_str[i] == "Merge":
450-
forks_str[i] = "Paris"
448+
forks_str = [s.strip() for s in config_str.split(",")]
449+
# Alias for "Merge"
450+
forks_str = [("Paris" if s.lower() == "merge" else s) for s in forks_str]
451451

452452
resulting_forks = set()
453-
454-
for fork in get_forks():
453+
for fork in config.all_forks_with_transitions:
455454
if fork.name() in forks_str:
456455
resulting_forks.add(fork)
457456

@@ -490,18 +489,16 @@ def get_fork_option(config, option_name: str, parameter_name: str) -> Set[Fork]:
490489
pytest.exit("Invalid command-line options.", returncode=pytest.ExitCode.USAGE_ERROR)
491490

492491
if single_fork:
493-
forks_from = single_fork
494-
forks_until = single_fork
492+
selected_fork_set = single_fork
495493
else:
496494
if not forks_from:
497495
forks_from = get_forks_with_no_parents(forks)
498496
if not forks_until:
499497
forks_until = get_last_descendants(set(get_deployed_forks()), forks_from)
500-
501-
selected_fork_set = get_from_until_fork_set(forks, forks_from, forks_until)
502-
for fork in list(selected_fork_set):
503-
transition_fork_set = transition_fork_to(fork)
504-
selected_fork_set |= transition_fork_set
498+
selected_fork_set = get_from_until_fork_set(forks, forks_from, forks_until)
499+
for fork in list(selected_fork_set):
500+
transition_fork_set = transition_fork_to(fork)
501+
selected_fork_set |= transition_fork_set
505502

506503
config.selected_fork_set = selected_fork_set # type: ignore
507504

src/pytest_plugins/forks/tests/test_markers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ def test_case(state_test):
112112
{"passed": 2, "failed": 0, "skipped": 0, "errors": 0},
113113
id="valid_at_transition_to,subsequent_forks=True,until",
114114
),
115+
pytest.param(
116+
generate_test(
117+
valid_at_transition_to='"Cancun"',
118+
),
119+
["--fork=ShanghaiToCancunAtTime15k"],
120+
{"passed": 1, "failed": 0, "skipped": 0, "errors": 0},
121+
id="valid_at_transition_to,--fork=transition_fork_only",
122+
),
115123
],
116124
)
117125
def test_fork_markers(pytester, test_function: str, outcomes: dict, pytest_args: List[str]):

0 commit comments

Comments
 (0)