Skip to content

Commit

Permalink
refactor(plugins/forks): Validity markers as classes
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Jan 16, 2025
1 parent 270870b commit 0cf221b
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 160 deletions.
2 changes: 1 addition & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Release tarball changes:
- 🐞 fix(consume): allow absolute paths with `--evm-bin` ([#1052](https://github.com/ethereum/execution-spec-tests/pull/1052)).
- ✨ Disable EIP-7742 framework changes for Prague ([#1023](https://github.com/ethereum/execution-spec-tests/pull/1023)).
- ✨ Allow verification of the transaction receipt on executed test transactions ([#1068](https://github.com/ethereum/execution-spec-tests/pull/1068)).
-Add the `fork_transition_test` marker to fill a test using multiple transition forks ([#1081](https://github.com/ethereum/execution-spec-tests/pull/1081)).
-Modify `valid_at_transition_to` marker to add keyword arguments `subsequent_transitions` and `until` to fill a test using multiple transition forks ([#1081](https://github.com/ethereum/execution-spec-tests/pull/1081)).

### 🔧 EVM Tools

Expand Down
14 changes: 10 additions & 4 deletions docs/writing_tests/test_markers.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,23 @@ This marker is used to specify that a test is only meant to be filled at the tra

The test usually starts at the fork prior to the specified fork at genesis and at block 5 (for pre-merge forks) or at timestamp 15,000 (for post-merge forks) the fork transition occurs.

### `@pytest.mark.fork_transition_test()`
This marker also accepts the following keyword arguments:

This marker is used to signal (in combination with `valid_from` and/or `valid_until`) that a test must be filled starting from the transition fork that transitions to the `valid_from` fork and every transition fork until the last fork specified.
- `subsequent_transitions`: Force the test to also fill for subsequent fork transitions.
- `until`: Implies `subsequent_transitions` and puts a limit on which transition fork will the test filling will be limited to.

```python
@pytest.mark.fork_transition_test
@pytest.mark.valid_from("Cancun")
@pytest.mark.valid_at_transition_to("Cancun", subsequent_transitions=True)
```

produces tests on `ShanghaiToCancunAtTime15k` and `CancunToPragueAtTime15k`, and any transition for after that.

```python
@pytest.mark.valid_at_transition_to("Cancun", subsequent_transitions=True, until="Prague")
```

produces tests on `ShanghaiToCancunAtTime15k` and `CancunToPragueAtTime15k`, but no forks after Prague.

## Fork Covariant Markers

These markers are used in conjunction with the fork validity markers to automatically parameterize tests with values that are valid for the fork being tested.
Expand Down
Loading

0 comments on commit 0cf221b

Please sign in to comment.