Skip to content

Commit 5604a7e

Browse files
committed
chore(docs): Document with_all_typed_transactions marker
1 parent 3228bfa commit 5604a7e

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

docs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Users can select any of the artifacts depending on their testing needs for their
114114
- ✨ Opcode classes now validate keyword arguments and raise `ValueError` with clear error messages ([#1739](https://github.com/ethereum/execution-spec-tests/pull/1739), [#1856](https://github.com/ethereum/execution-spec-tests/pull/1856)).
115115
- ✨ All commands (`fill`, `consume`, `execute`) now work without having to clone the repository, e.g. `uv run --with git+https://github.com/ethereum/execution-spec-tests.git consume` now works from any folder ([#1863](https://github.com/ethereum/execution-spec-tests/pull/1863)).
116116
- 🔀 Move Prague to stable and Osaka to develop ([#1573](https://github.com/ethereum/execution-spec-tests/pull/1573)).
117+
- ✨ Add a `pytest.mark.with_all_typed_transactions` marker that creates default typed transactions for each `tx_type` supported by the current `fork` ([#1890](https://github.com/ethereum/execution-spec-tests/pull/1890)).
117118

118119
### 🧪 Test Cases
119120

@@ -128,6 +129,7 @@ Users can select any of the artifacts depending on their testing needs for their
128129
-[EIP-7934](https://eips.ethereum.org/EIPS/eip-7934): Add test cases for the block RLP max limit of 10MiB ([#1730](https://github.com/ethereum/execution-spec-tests/pull/1730)).
129130
-[EIP-7939](https://eips.ethereum.org/EIPS/eip-7939) Add count leading zeros (CLZ) opcode tests for Osaka ([#1733](https://github.com/ethereum/execution-spec-tests/pull/1733)).
130131
-[EIP-7918](https://eips.ethereum.org/EIPS/eip-7918): Blob base fee bounded by execution cost test cases (initial), includes some adjustments to [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) tests ([#1685](https://github.com/ethereum/execution-spec-tests/pull/1685)). Update the blob_base_cost ([#1915](https://github.com/ethereum/EIPs/pull/1915)).
132+
-[EIP-7934](https://eips.ethereum.org/EIPS/eip-7934): Add additional test cases for block RLP max limit with all typed transactions and for a log-creating transactions ([#1890](https://github.com/ethereum/execution-spec-tests/pull/1890)).
131133

132134
## [v4.5.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v4.5.0) - 2025-05-14
133135

docs/writing_tests/test_markers.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,59 @@ This marker is used to automatically parameterize a test with all contract creat
5555

5656
This marker only differs from `pytest.mark.with_all_tx_types` in that it does not include transaction type 3 (Blob Transaction type) on fork Cancun and after.
5757

58+
### `@pytest.mark.with_all_typed_transactions`
59+
60+
This marker is used to automatically parameterize a test with all typed transactions, including `type=0` (legacy transaction), that are valid for the fork being tested.
61+
This marker is an indirect marker that utilizes the `tx_type` values from the `pytest.mark.with_all_tx_types` marker to build default typed transactions for each `tx_type`.
62+
63+
Optional: Default typed transactions used as values for `typed_transaction` exist in `src/pytest_plugins/shared/transaction_fixtures.py` and can be overridden for the scope of
64+
the test by re-defining the appropriate `pytest.fixture` for that transaction type.
65+
66+
```python
67+
import pytest
68+
69+
from ethereum_test_tools import Account, Alloc, StateTestFiller
70+
from ethereum_test_types import Transaction
71+
72+
# Optional override for type 2 transaction
73+
@pytest.fixture
74+
def type_2_default_transaction(sender: Account):
75+
return Transaction(
76+
ty=2,
77+
sender=sender,
78+
max_fee_per_gas=0x1337,
79+
max_priority_fee_per_gas=0x1337,
80+
...
81+
)
82+
83+
# Optional override for type 4 transaction
84+
@pytest.fixture
85+
def type_4_default_transaction(sender: Account, pre: Alloc):
86+
return Transaction(
87+
ty=4,
88+
sender=sender,
89+
...,
90+
authorization_list=[
91+
AuthorizationTuple(
92+
address=Address(1234),
93+
nonce=0,
94+
chain_id=1,
95+
signer=pre.fund_eoa(),
96+
)
97+
]
98+
)
99+
100+
101+
@pytest.mark.with_all_typed_transactions
102+
@pytest.mark.valid_from("Prague")
103+
def test_something_with_all_tx_types(
104+
state_test: StateTestFiller,
105+
pre: Alloc,
106+
typed_transaction: Transaction
107+
):
108+
pass
109+
```
110+
58111
### `@pytest.mark.with_all_precompiles`
59112

60113
This marker is used to automatically parameterize a test with all precompiles that are valid for the fork being tested.

0 commit comments

Comments
 (0)