core/vm: track 63/64 call gas off stack#15563
Merged
Merged
Conversation
Gas calculations in gasCall* relayed the available gas for calls by replacing it on the stack. This lead to inconsistent traces, which we papered over by copying the pre-execution stack in trace mode. This change relays available gas using a temporary variable, off the stack, and allows removing the weird copy.
c85114e to
c11a92a
Compare
karalabe
approved these changes
Nov 28, 2017
Member
karalabe
left a comment
There was a problem hiding this comment.
Two nitpicks, LGTM otherwise.
| stack.pop() | ||
| gas := evm.callGasTemp | ||
| // Pop other call parameters. | ||
| to, inOffset, inSize, retOffset, retSize := stack.pop(), stack.pop(), stack.pop(), stack.pop(), stack.pop() |
Member
There was a problem hiding this comment.
Perhaps rename to to addr so it's consistent with all the other call* changes?
| // callGasTemp holds the gas available for the current call. This is needed because the | ||
| // available gas is calculated in gasCall* according to the 63/64 rule and later | ||
| // applied in opCall*. | ||
| callGasTemp uint64 |
Member
There was a problem hiding this comment.
Perhaps callGasReal (as in the real value, not the requested amount?). Temp seems a bit strange.
Contributor
Author
There was a problem hiding this comment.
I chose "temp" because the field holds the gas value temporarily, in-between calls to gasCall* and opCall*.
Contributor
Author
|
@karalabe PTAL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gas calculations in gasCall* relayed the available gas for calls by
replacing it on the stack. This lead to inconsistent traces, which we papered
over by copying the pre-execution stack in trace mode.
This change relays available gas using a temporary variable, off the
stack, and allows removing the weird copy.