-
Notifications
You must be signed in to change notification settings - Fork 21
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
[Testing] Integrate testing with evm
in go-ethereum
#27
Comments
This comment has been minimized.
This comment has been minimized.
This is the dispatcher for 1 argument, 1 return value function:
Binary:
|
Here is the example we perform 2 arguments 1 output function dispatching:
Binary:
|
Spent a bit of time refining a third party assembler: crytic/pyevmasm#36 We will use this little tool to inject a simple function dispatcher in our tests. |
Another way to do this completely in Python is to use py-evm. Investigating the possibilities. |
Closing this function now since we now have a testing utility framework built. We will continue to improve the framework. |
go-ethereum
provides a decent interface for executing EVM code. We could use it for our use of testing.We will start with non-blockchain interacting correctness checking. In such cases, we compile a single function and feed it into
evm
and execute.The compiled function takes a certain amount of arguments as input, plus the return address at the bottom of the stack. When function finishes executing, the last instruction will jump to the return address.
So to test the result and make sure the function returns correctly, we should push a return address onto stack before anything else. But that would alter the relocation offset.
One way to do this is to add an option to specify an offset to the relocation offset. Let’s say when we are fixing up a jump destination, and we have determined location at 0xabcd, and if we have specified
-debug-offset-offset=2
, then the 0xabcd will become0xabcd + 2 = 0xabcf
. By doing this we can acknowledge the prefix offsets added to test cases.The text was updated successfully, but these errors were encountered: