-
Notifications
You must be signed in to change notification settings - Fork 62
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(tests): callcode gas test when call stipend is applied to gas limit #371
Conversation
This new test covers a bug that was identified in the EthereumJS EVM implementation that was recently fixed by @jochem-brouwer in our code. I'm not 100% sure where to place this test in the broader test suite so have opened this PR to get conversation started and will work through the checklist over the next day or two. |
ec61253
to
6d5e28b
Compare
Thanks for the contribution :) I've added a refactor in a PR to your branch here: acolytec3#1 Currently test placement is allocated based on when the feature/EIP was introduced. |
Thanks! I wasn't sure where to put it but have merged your PR. Anything else you need from me on it? |
Great! A commit squash would be ideal so everything is in 1 commit |
eac929f
to
2cfd3a6
Compare
Done. Looks like I mucked up something in the changelog when I squashed things 🤔 Any ideas here? |
6707aad
to
afe3c03
Compare
All good! 💯 |
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.
This is looking very good! I just proposed a small change in acolytec3#2 for readability, but it's not essential.
One thing that would be helpful would be a comment on the gas values used, see comment below.
I added a PR re. the recent comments: acolytec3#3, but after looking over this again, I get a mismatch for the CALL opcode when filling with geth. That is when using the values specified in:
What values do you guys get in the dynamic gas formulas?
|
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 renaming made in acolytec3#3 got me thinking (as gets trickier to give a good name to tests targeting multiple opcodes!).
Does it make sense to expand this test to all execution opcodes, i.e., DELEGATECALL
and STATICCALL
while we're at it?
This test is specific for the call stipend which we erroneously added to the current gas limit. This only applies to CALL opcodes which allow endowment (sending value) so the other candidate besides CALLCODE is CALL. 😊 |
I wanted to resolve the merge conflict but for some reason the PR does not show up right. Could you cherry-pick acolytec3@76ed643 in here? EDIT: that diff looks also weird 🤔 Not sure whats going on here |
e3881bf
to
ff21894
Compare
Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com> Co-authored-by: Jochem Brouwer <jochembrouwer96@gmail.com> Co-authored-by: danceratopz <danceratopz@gmail.com> feat(tests): fix state test error.
ff21894
to
db20cac
Compare
Looks great! Thanks a lot for the gas calculation explanations / sufficient/insufficient gas improvements! |
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!
🗒️ Description
Correctly evaluate CALLCODE gas usage when a call stipend is applied to gas limit
Adds a new test to cover a bug that was discovered in the EthereumJS EVM implementation of the
CALLCODE
opcode where we were incorrectly applying the call stipend to the gas limit applied to the new call frame before evaluating the gas consumed by the call frame so would incorrectly continue execution of the CALLCODE call frame instead of going OOG.🔗 Related Issues
Covers the scenario described in this issue.
✅ Checklist
mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.