Advice on doing research on EVM?


#1

We are planning to do some research on EVM at my company, such as adding new opcodes related to vector computations and deep learning. We have an engineer who just has been assigned to this task and starting to learn.

  1. I wonder whats the best way for someone that does not know all bells and whistles of the current EVM impelementation to learn the basics and start “tweaking it”.

  2. We are looking at at a Python-based EVM implementation. Would py-evm be a good starting point, or there are simpler implementations?

  3. What would a good, time-saving development strategy to run py-evm off-chain and start tweaking it? Are there any tools/scripts/documentation within py-evm that can help?


#2

IMO I’d recommend tracing code on py-evm + comparing with yellow paper.

No such documents for py-evm right now, a good way to start is using eth-tester, you can choose the “backend” between py-evm and pyethereum. :slightly_smiling_face:


#3

Thank you :-))

I also found this talk on plugging in different EVM implementations

It seems a bit strange though that they are using essentially C-headers as a compatibility tool, having the industry trends one would expect more of a microservice API approach in this case …


#4

The best way for me to learn something is to implement it yourself. It helps to understand all caveats and to feel the code better. It’s not required to implement every behaviour but a parts. Also it’s very helpful to read and understand source code. It’s the only way to became a pro in short term.


#5

The problem is how to make it compatible :slight_smile:

EVM probably has zillions of cornercases not included in the yellow paper, so if we have our own thing, what the chance of it being really compatible ?)

On the other hand if we take a production EVM and slowly inject our stuff into it we will be guaranteed to have all the bugs the production EVM has, so we will get really really compatible :rofl::rofl::rofl:

It seems that the EVM has this forks directory, which specifies alternative opcodes, so if we want to introduce an opcode, then we just need to add another fork there …


#6

There’s also K-EVM which is used for verifying the EVM. But the Yellow paper is a good place to start, and Py-EVM is easiest to read and play around with.


#7

I have a list for you https://github.com/pirapira/awesome-ethereum-virtual-machine#specification

py-evm sounds good.


#8

Speaking of vector computations - SIMD opcodes proposal might be of interest to you https://github.com/ethereum/EIPs/issues/616
Also the implmentation in cpp-ethereum’s EVM https://github.com/ethereum/cpp-ethereum/pull/4233


#9

Andrei - thank you, this is interesting.

So we basically apply this patch, recompile it and get the SIMD functionality.

Do you think that the SIMD functionaly has a chance of going into an official release anytime soon?


#10

It’s merged into develop branch of cpp-ethereum, so theoretically to make it work you need only to build with EIP_616 flag enabled. (and cpp-ethereum doesn’t have official releases lately)


#11

@yhirai I put your list in the Wiki.


#12

You can use https://github.com/ethereum/tests.