-
Notifications
You must be signed in to change notification settings - Fork 33
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
fix(levm): resize memory in generic_call
before any validation
#1556
Conversation
5116224
to
0131337
Compare
generic_call
generic_call
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, now I have a doubt if this should also be done in the other call ops
I'm kinda confused about this. It may be accurate behavior but we already do a resizing when we call |
I was thinking the same thing! Let me elaborate |
We check to see if the user has enough funds, and if not we Plus, I think this raises some question regarding Something seems fishy about it. |
Maybe a slight refactor of |
So if the appropriate behavior would be to expand memory before making the necessary validations what would happen if the only change that we made to the code would be to just move the |
That was the "refactor" I had in mind! (You know what they say about great minds ;) ) |
generic_call
generic_call
before any validation
Hi Jere, quick update. I pushed (ce3bf5a) said slight refactor. At least according to the python implementation, all They do so before calling |
Motivation
The
CALLCODE
operand was not resizing the memory with its new size; it was only using the new size to calculate the gas cost. This turned out to be a problem common to all theCALL*
family of operands.Description
Right at the beginning of
generic_call
, we now resize the memory of the current call frame. This is because, the memory should be expanded even if the caller does not have enough funds to proceed with the transaction.This comes from the test
stRandom/randomStatetest248.json
. In this test, the caller is trying to transferU256::MAX
to a different address. In our code, we only expand the memory IF the user has enough funds; but we should expand the memory regardless of funds.