Skip to content
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

core/vm: implement metropolis static call opcode #14978

Merged
merged 2 commits into from
Aug 16, 2017

Conversation

karalabe
Copy link
Member

@karalabe karalabe commented Aug 15, 2017

Implements ethereum/EIPs#214

@karalabe karalabe requested a review from holiman August 15, 2017 09:58
@karalabe karalabe added this to the 1.7.0 milestone Aug 15, 2017
 * Fix STATICCALL so it is able to call precompiles too
 * Fix write detection to use the correct value argument of CALL
 * Fix write protection to ignore the value in CALLCODE
}
contract.Gas += returnGas

evm.interpreter.intPool.put(addr, inOffset, inSize, retOffset, retSize)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of allocating a new bigint, and returning e.g. addr to the intpool, you could do

addr.setUint64(0 or 1)
stack.push(addr)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through the other instructions, similar tricks could be done throughout the code. Also there are a lot of stack.pop().Uint64() invocations which don't even return the big int into the pool, just silently discard it.

All in all I think it would be wiser to do a whole refactor for all the opcode and do that in a separate PR where we can review the optimization changes without metro additions in there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I have one such laying around, which also uses peek instead of pop, so you just make sure that the result winds up there and everything is dandy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants