-
Notifications
You must be signed in to change notification settings - Fork 99
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
new(tests): EOF - EIP-7069: Call Gas Testing for EXT*CALL #713
Conversation
Test call gas for EXT*CALL, using a legacy harness. Signed-off-by: Danno Ferrin <[email protected]>
Signed-off-by: Danno Ferrin <[email protected]>
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.
I was opposed at first, but this looks very practical. Any ideas how to resolve the complaints I had?
- philosophically against the grain of removing gas introspection (not so important)
- ignores EOF-only EVMs, should such exist
- ignores post-legacy-EVM-ban worlds
- OOG testing - I suppose with some complication of your harness this could be done: if the harness stored the setup/teardown gas usage, added cold/warm gas to it and subtracted 1, or sth along these lines? For a healthy test though, this should probably be generated as a separate
state_test
, so 1gas_test
=> 2state_tests
, is that even possible?
Are you proposing this more as a long-term or short-term approach?
What I had in mind to not require gas introspection is to use a single contract, pre-calculate the gas and use that as the gas limit value of the transaction (plus the 21,000). With that in mind, cold and warm could be two separate tests, and in the warm test, the subject code becomes the same code twice and the calculated gas is cold+warm. |
How do we assert the gas within the test and durring a fill? If all we want is observed gas then we can get the same effect by filling the desired behavior and having the fixtures pass/fail based on total consumed gas. What I want is a test that will fail only because of gas calculations so an implementor can look at the test and know it's a gas problem. We need to detect and fail on both overcharging and undercharging. A test with a strict gas limit only gets us overcharging. |
The approach from MCOPY mem expansion test correct? I initially preferred that to using GAS, but this PR here makes a strong case for using GAS. I actually only now realized it solves the problem of dynamic gas allowances of EXT*CALL I think we'd run into with the "MCOPY approach" |
Yes I think this approach is really nice too, I think we could plan on doing a decorator around this, even if it uses I have a branch with a decorator for the |
@marioevz are we maybe closer to a decision whether we'll adopt this or #719 moving forward (or both?). Also, I'm wondering which approach would lend itself better to the EOF marker? (for an example MCOPY gas test using the EOF marker, without the decoration, is in #754). Another question still up is the OOG testing part (see previous comment) - is such an extension to the harness here feasible? @shemnon Re:
In #719 both strict gas limit and strict gas limit - 1 are tested, former expected to work, latter expected to OOG, so undercharging is also covered. |
I'm taking a look at
|
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.
Looks good! We could move gas_test
to src/ethereum_test_tools/code/generators.py
and export it to use it anywhere, although I'm thinking of any other cases (other than *CALL opcode testing) where the cold-warm dynamic would come into play.
Signed-off-by: Danno Ferrin <[email protected]>
I'm going to punt on moving it. Mostly because of the storage slot allocation needed to store data( |
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, thanks!
Pushed a commit to make tox happy, I'll merge in a bit. |
ποΈ Description
Test call gas for EXT*CALL, using a legacy harness.
Signed-off-by: Danno Ferrin [email protected]
π Related Issues
β Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.