Skip to content

core/vm/runtime: added simple execution runtime#1964

Merged
obscuren merged 1 commit intoethereum:developfrom
obscuren:evm-runtime
Nov 18, 2015
Merged

core/vm/runtime: added simple execution runtime#1964
obscuren merged 1 commit intoethereum:developfrom
obscuren:evm-runtime

Conversation

@obscuren
Copy link
Copy Markdown
Contributor

@obscuren obscuren commented Nov 4, 2015

The runtime environment can be used for simple basic execution of
contract code without the requirement of setting up a full stack and
operates fully in memory.

@frozeman required some benchmarking of the EVM and execution of many calls. I recall @karalabe requesting a simple execution model for the execution of EVM byte code and hence I've created a PR for such cases.

@robotally
Copy link
Copy Markdown

Vote Count Reviewers
👍 1 @fjl
👎 0

Updated: Wed Nov 18 13:38:06 UTC 2015

@karalabe
Copy link
Copy Markdown
Member

karalabe commented Nov 4, 2015

Yeah, but couldn't wait for one so I've implemented my own :)) Will look though this one though :)

Comment thread core/vm/runtime/doc.go
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nitpicking, but you might want to bump the year.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

                                                                                  build/update-license.go will fix it when we run it.

@codecov-io
Copy link
Copy Markdown

Current coverage is 46.70%

Merging #1964 into develop will increase coverage by +0.10% as of 4ec5d50

Powered by Codecov. Updated on successful CI builds.

@karalabe
Copy link
Copy Markdown
Member

karalabe commented Nov 4, 2015

This is what I've used when I played with the EVM: https://gist.github.com/karalabe/6c200d783586a6c6b29c Feel free to cherry pick anything you like.

Comment thread core/vm/runtime/env.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You didn't initialize the remainder of the big.Ints, which will crash the first time accessed. (e.g. Try running "D" ;) )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right. I must have overlooked this. I'll add some tests to test these fields thru the EVM calling the specific opcodes.

@obscuren
Copy link
Copy Markdown
Contributor Author

obscuren commented Nov 5, 2015

@karalabe PTAL

@karalabe
Copy link
Copy Markdown
Member

karalabe commented Nov 5, 2015

I think it would be valuable to return the generated logs too, beside the result of the execution (i.e. like this https://gist.github.com/karalabe/6c200d783586a6c6b29c#file-evm-go-L15). This would be very useful in scenarios where the code generates actual logs and you would like to inspect them / check that they are indeed correct, etc.

@obscuren
Copy link
Copy Markdown
Contributor Author

obscuren commented Nov 5, 2015

@karalabe i'm not sure about that. That's what the Debug flag is for; in case you need inspecting. If the need arises to change the behaviour I'll reconsider.

@fjl
Copy link
Copy Markdown
Contributor

fjl commented Nov 18, 2015

👍

@karalabe
Copy link
Copy Markdown
Member

Debug is ok for manually inspecting the execution logs, but what I was really looking for is a way to programatically inspect the contract's generated events/logs. Specifically so that I can unit test that a compiled code indeed fires the events it's supposed to.

@obscuren
Copy link
Copy Markdown
Contributor Author

@karalabe sure. I'll make it return the stateDB which contain the logs, that makes sense. But the event/logs aren't the structured logs. The StructLog are used to create debug output and are not be confused with the vm.Logs which are used for LOG*.

@karalabe
Copy link
Copy Markdown
Member

Aaaahh, gotcha. Confused the two things apparently. Dunno what the best way
would be then to access the logs, but you get the rational why I'd like to
inspect them. Returning the state db or something similar would also come
in handy for unit testing the contract storage.

On Wed, Nov 18, 2015 at 3:30 PM, Jeffrey Wilcke notifications@github.com
wrote:

@karalabe https://github.com/karalabe sure. I'll make it return the
stateDB which contain the logs, that makes sense. But the event/logs
aren't the structured logs. The StructLog are used to create debug output
and are not be confused with the vm.Logs which are used for LOG*.


Reply to this email directly or view it on GitHub
#1964 (comment)
.

@obscuren
Copy link
Copy Markdown
Contributor Author

@karalabe addressed it. PTAL :-)

Comment thread core/vm/runtime/runtime.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe rename to GasPrice? To keep it consistent with the yellow paper and the rest of the code base?

The runtime environment can be used for simple basic execution of
contract code without the requirement of setting up a full stack and
operates fully in memory.
obscuren added a commit that referenced this pull request Nov 18, 2015
core/vm/runtime: added simple execution runtime
@obscuren obscuren merged commit 23f42d9 into ethereum:develop Nov 18, 2015
@obscuren obscuren removed the review label Nov 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants