feat(tests): Additional EIP-7934 test cases#1890
Conversation
6335dc3 to
cd39587
Compare
a2146f9 to
eab5984
Compare
|
Hmm having a difficult time reproducing this CI error locally. I added the concept of a @pytest.fixture
def type_2_default_transaction(sender):
return Transaction(...)Something in the |
marioevz
left a comment
There was a problem hiding this comment.
Awesome! Thanks for implementing this.
I wrote a couple of comments that might be worth considering.
- Move default transaction logic to a ``conftest.py`` setup. - Add ``conftest.py`` files for each fork with the respective transaction pytest fixtures. - Opt for `Type | None` over `Optional[Type]` to avoid an extra import.
- Move default transaction logic to a ``conftest.py`` setup. - Add ``conftest.py`` files for each fork with the respective transaction pytest fixtures. - Opt for `Type | None` over `Optional[Type]` to avoid an extra import.
8451823 to
d26c90b
Compare
|
I'm just missing the documentation here which I can update but we should get consensus on the code first and then I can document the changes appropriately and add the release notes. |
- Move default transaction logic to a ``conftest.py`` setup. - Add ``conftest.py`` files for each fork with the respective transaction pytest fixtures. - Opt for `Type | None` over `Optional[Type]` to avoid an extra import.
d26c90b to
39d2880
Compare
- Move transaction fixtures to a `shared` pytest plugin.
- Opt for `Type | None` over `Optional[Type]` to avoid an extra import.
Bonus:
- Refactor the `indirect` marker logic to be more generic for future use.
If a marker uses `indirect`, it will take the values from the
`fork_attribute_name` and run it through a fixture of name `argnames`
which provides some added logic. In this case it builds default
transactions from the `tx_types` values for each fork.
3fc79fd to
619bbaa
Compare
marioevz
left a comment
There was a problem hiding this comment.
Awesome work, it's a very nice solution and thanks for removing the sender from the tests, it's a nice code reduction in general :)
I pushed a small change to fix the imports in the pytest .ini files, basically, anything that imported pytest_plugins.shared.execute_fill should also have transaction_fixtures.
Will merge after CI passes!
Ah, yeah, thanks for that cleanup! Do you want me to add any documentation around it? It was also missing a release note because we hadn't agreed yet on the path but I can add one before merge, lmk. |
Yeah I guess it would be nice to have some docs in https://github.com/ethereum/execution-spec-tests/blob/main/docs/writing_tests/test_markers.md#pytestmarkwith_all_tx_types, thanks! |
6f13934 to
e276ca6
Compare
- Create global fixtures for default transactions that are covariant with ``fork`` - These should allow overriding particular default transactions by re-defining the fixture for the particular tx type e.g.: ```python @pytest.fixture def type_2_default_transaction(pre): return Transaction(...) ``` - Use these as part of the ``fork`` plugin
- Move transaction fixtures to a `shared` pytest plugin.
- Opt for `Type | None` over `Optional[Type]` to avoid an extra import.
Bonus:
- Refactor the `indirect` marker logic to be more generic for future use.
If a marker uses `indirect`, it will take the values from the
`fork_attribute_name` and run it through a fixture of name `argnames`
which provides some added logic. In this case it builds default
transactions from the `tx_types` values for each fork.
e276ca6 to
5604a7e
Compare
|
Ok ready on my end @marioevz 👍🏼
|
* feat(tests): Add eip7934 test at rlp size with all transaction types * feat(tests): Add eip7934 test at limit with logs * feat(tests,plugins): Add ``with_all_typed_transactions`` support - Create global fixtures for default transactions that are covariant with ``fork`` - These should allow overriding particular default transactions by re-defining the fixture for the particular tx type e.g.: ```python @pytest.fixture def type_2_default_transaction(pre): return Transaction(...) ``` - Use these as part of the ``fork`` plugin * refactor(tests): Use ``with_all_typed_transactions`` for block rlp limit test * refactor(tests) Changes from comments on pr ethereum#1890 and offline: - Move transaction fixtures to a `shared` pytest plugin. - Opt for `Type | None` over `Optional[Type]` to avoid an extra import. Bonus: - Refactor the `indirect` marker logic to be more generic for future use. If a marker uses `indirect`, it will take the values from the `fork_attribute_name` and run it through a fixture of name `argnames` which provides some added logic. In this case it builds default transactions from the `tx_types` values for each fork. * chore: Remove duplicate `sender` fixtures; opting for global `sender` * fix(cli/pytest): Ini files imports * fix(pytest_plugins): Paths and imports * chore(docs): Document `with_all_typed_transactions` marker --------- Co-authored-by: Mario Vega <marioevz@gmail.com>
🗒️ Description
🔗 Related Issues or PRs
Related to ethereum/execution-specs#1562
TODO:
with_all_tx_typesinto something that can be more useful across the board. I'm thinking default transactions that each fork can define if it includes a new tx type and tests can automatically use these transactions, override them as fixtures, or some other more useful flow than re-building every time.with_all_typed_transactionsindirect (new feature) marker✅ Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx --with=tox-uv tox -e lint,typecheck,spellcheck,markdownlinttype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.