-
Notifications
You must be signed in to change notification settings - Fork 416
feat(test): port static context static tests to python #1960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(test): port static context static tests to python #1960
Conversation
26081cb to
d0fab3d
Compare
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #1960 +/- ##
===================================================
+ Coverage 86.07% 86.16% +0.09%
===================================================
Files 599 599
Lines 39527 39527
Branches 3780 3780
===================================================
+ Hits 34021 34059 +38
+ Misses 4872 4847 -25
+ Partials 634 621 -13
Flags with carried forward coverage won't be shown. Click here to find out more. β View full report in Codecov by Sentry. π New features to boost your workflow:
|
LouisTsai-Csie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave some comments! It is really crazy that old test is written in yml format.
* chore(docs): add benchmark marker to test case ref. * chore(docs): update benchmark conftest instead.
- Inspired by comment: ethereum#1960 (comment) - Split the unreadable bytecode test into one where the `evm_bytes`` output is compared to it and asserted (to make the original more readable) and another test from the comment where we can parametrize with all precompiles as well as with call_value = [0, 1] (0 and nonzero).
05fa6e8 to
9d5e0f4
Compare
- Inspired by comment: ethereum#1960 (comment) - Split the unreadable bytecode test into one where the `evm_bytes`` output is compared to it and asserted (to make the original more readable) and another test from the comment where we can parametrize with all precompiles as well as with call_value = [0, 1] (0 and nonzero).
This comment was marked as outdated.
This comment was marked as outdated.
marioevz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small comments that can be applied to all test functions in the PR. Thanks!
| "80818283600160025af15050" | ||
| ) | ||
|
|
||
| target_code = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also use Conditional here to have more readable code, no need to try to match the exact original bytecode IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal here was to preserve the original test and to get it in our API so it is more readable. We then created a version of the test, test_staticcall_reentrant_call_with_value_to_precompile(), that is more readable and does a similar thing while extending coverage.
If we don't care about keeping the exact bytecode that caught a bug once upon a time, then we can keep the variant of the test that is most readable. To be clear, I would prefer to keep the actual bytecode for added safety and for historical reasons. But if we don't want to try to match the original bytecode, I think we can remove this test case entirely.
- Inspired by comment: ethereum#1960 (comment) - Split the unreadable bytecode test into one where the `evm_bytes`` output is compared to it and asserted (to make the original more readable) and another test from the comment where we can parametrize with all precompiles as well as with call_value = [0, 1] (0 and nonzero).
dbad28a to
1b335b2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marioevz I applied all the changes you suggested here. I opted to remove the first test entirely since we don't care about preserving the actual bytecode. We should carefully review to make sure it's covering the same case as the original test if this is the route we want to take.
edit: I had to add an update to the pytest.param() support for valid_from() because docs pulls in all forks and this was erring with the marker for with_all_valid_precompiles in conjunction with valid_from() being in the params. It wouldn't have this fork range updated and some forks don't support precompiles at all. It's a minor change here, but we should make sure it is reviewed appropriately.
| "80818283600160025af15050" | ||
| ) | ||
|
|
||
| target_code = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal here was to preserve the original test and to get it in our API so it is more readable. We then created a version of the test, test_staticcall_reentrant_call_with_value_to_precompile(), that is more readable and does a similar thing while extending coverage.
If we don't care about keeping the exact bytecode that caught a bug once upon a time, then we can keep the variant of the test that is most readable. To be clear, I would prefer to keep the actual bytecode for added safety and for historical reasons. But if we don't want to try to match the original bytecode, I think we can remove this test case entirely.
1b335b2 to
a3ae654
Compare
a3ae654 to
8b9e8b9
Compare
This comment was marked as outdated.
This comment was marked as outdated.
8b9e8b9 to
0ad7061
Compare
Port STATICCALL tests with zero and non-zero value to precompiles
- Inspired by comment: ethereum#1960 (comment) - Split the unreadable bytecode test into one where the `evm_bytes`` output is compared to it and asserted (to make the original more readable) and another test from the comment where we can parametrize with all precompiles as well as with call_value = [0, 1] (0 and nonzero).
0ad7061 to
46de4f2
Compare
46de4f2 to
3c778f0
Compare
|
I also added BAL expectations here since these were of interest to BALs originally, which is why it caught my eye to port them in the first place. More recently (since this PR was opened), geth caught an implementation issue because of these static tests (relevant conversation here). |
3c778f0 to
b2c2f74
Compare
marioevz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I made one last push to change the test types to StateTest while preserving the BAL checks.
Comments have been addressed, and we have a separate newer review.
ποΈ Description
Port STATICCALL tests with zero and non-zero value to precompiles. This has the added bonus of extending the precompiles, parametrized per fork, via
pytest.mark.with_all_precompiles.π Related Issues or PRs
N/A.
β Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx tox -e statictype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_frommarker.Cute Animal Picture