-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Use evmone for testing. #7010
Use evmone for testing. #7010
Conversation
test/ExecutionFramework.cpp
Outdated
|
||
evmc::result call(const evmc_message& msg) noexcept final | ||
{ | ||
// TODO: Improve C API for result creation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess most of the tests are failing because this is not yet implemented.
39ff71c
to
6b43716
Compare
There was an error when running
Please check that your changes are working as intended. |
There was an error when running
Please check that your changes are working as intended. |
There was an error when running
Please check that your changes are working as intended. |
There was an error when running
Please check that your changes are working as intended. |
There was an error when running
Please check that your changes are working as intended. |
There was an error when running
Please check that your changes are working as intended. |
test/ExecutionFramework.cpp
Outdated
@@ -50,25 55,294 @@ string getIPCSocketPath() | |||
return ipcPath; | |||
} | |||
|
|||
evmc::vm& getVM() | |||
{ | |||
static unique_ptr<evmc::vm> theVM; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just do static evmc::vm theVM = ...
;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but then I cannot try different locations for libevmone.so
The way evmc is included is still not satisfactory for me. Since it is "just a wrapper", I'm thinking of stripping everything that is not needed and just adding the 4 header files and single .c file into the project. |
d8e102b
to
05e68c5
Compare
Test failure count is down to 36. One is a weird failure in the auction registrar. Then we have a bunch of gas cost test failures - those are probably still quite some work. I would suspect this is related to https://github.com/ethereum/solidity/pull/7010/files#diff-e4cd21bbaea28071e286e4adfd6ec79aR97 Finally, we have some failures related to the precompiled contracts. We probably do not want to implement everything, so this boils down to implementing some crude "simulated" version of each precompile and modifying the test expectations, I would assume. Anyone feel free to continue working on this until Monday :) |
Another reason for the gas test failures is that EVMHost maybe has to compute the data gas. @chfast - do you have any insight into this? |
Host is responsible for counting refunds, unfortunately. |
@chfast is there a complete implementation somewhere? |
In Aleth:
In geth:
Yes, we already know this should be handled by the VM, but that requires the ABI break so it will not be changed in EVMC 6. |
2fc4208
to
94c7643
Compare
Phew. Now the only thing left to do is clean everything up and implement the required test vectors for the snark precompiles. |
Selectively disabled failing check for ASan builds. |
Also had a local change in the dockerfile that was not pushed upstream. |
tar -xf /tmp/aleth.tar.gz -C /usr | ||
wget -q -O /tmp/evmone.tar.gz "${EVMONE_URL}"; \ | ||
test "$(shasum /tmp/evmone.tar.gz)" = "$EVMONE_HASH /tmp/evmone.tar.gz"; \ | ||
tar -xf /tmp/evmone.tar.gz -C /usr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment: Later in the dockerfile, a static build of evmone is installed at the same destination /usr
from source. The subsequent overwriting should not be a problem since the tarball is presumably packed with the shared library version which the static build does not install.
.circleci/soltest.sh
Outdated
( | ||
cd /usr/ | ||
wget -q https://github.com/ethereum/evmone/releases/download/v0.1.0/evmone-0.1.0-linux-x86_64.tar.gz -O - | tar xz | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed since the docker image should contain evmone now.
CMakeLists.txt
Outdated
@@ -13,6 13,7 @@ eth_policy() | |||
set(PROJECT_VERSION "0.5.11") | |||
project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX) | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline can be removed?
f0e26ef
to
44ff050
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked everything in every detail, but generally this looks good - mainly some minor comments!
The precompile stuff I haven't checked at all, though.
|
||
To run a basic set of tests that require neither ``aleth`` nor ``libz3``, run | ||
``./scripts/soltest.sh --no-ipc --no-smt``. | ||
Some tests require the ``libevmone.so`` library, others require ``libz3``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really related to this PR, but "others require libz3
" doesn't really feel correct here... first of all it's not enough to have libz3
at runtime as for libevmone
, but it must have been present at build time already, secondly it must be a correct version of z3
and thirdly it could also be cvc4
... But we can change this separately, no need to let this block this PR.
`Github <https://github.com/ethereum/evmone/releases/download/v0.1.0/evmone-0.1.0-linux-x86_64.tar.gz>`_ | ||
and either place it in the project root path or inside the ``deps`` folder. | ||
|
||
If you do not have libz3 installed on your system, you should disable the SMT tests: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More like "If you did not build against libz3 or cvc4" actually, but yeah, as above.
result.create_address = message.destination; | ||
destination.code = bytes(result.output_data, result.output_data result.output_size); | ||
destination.codeHash = convertToEVMC(keccak256(destination.code)); | ||
result.gas_left -= eth::GasCosts::createDataGas * result.output_size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... this logic now probably results in parts of our gas tests basically being tested against our own gas calculation, right? But ok, it's probably fine...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, no way around this, unfortunately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand: Most of the gas calculation is done by evmone itself, we mainly only do storage gas and data cas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I mentioned it here: this is going to be changed and EVM will calculate these, but we need to break EVMC ABI first.
// we disable it if we are compiling an ASan test binary. The | ||
// DISABLE_CHECK_FOR_ASAN_BUILD macro is defined if | ||
// -DSANITIZE=address is passed as a compile time cmake option. | ||
#ifndef DISABLE_CHECK_FOR_ASAN_BUILD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might have gone with just calling this ASAN_BUILD
... and we still want to run the test, even though it takes a long time? We could also move the #ifndef
around the whole test to avoid having to wait for it for 60 seconds...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to define own macro. There is a way to check if you are building with ASan: https://clang.llvm.org/docs/AddressSanitizer.html#conditional-compilation-with-has-feature-address-sanitizer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bshastry noted that this is not cross-compiler. Does asan exist on non-llvm compilers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will work for cross-compilation - the code will be instrumented for the target architecture (if that's a concern).
ASan is also supported with GCC. The same basic flags are used, but the runtime library is different I believe. In case of GCC the __SANITIZE_ADDRESS__
macro is defined: https://gcc.gnu.org/onlinedocs/gcc-4.8.0/cpp/Common-Predefined-Macros.html.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to use the compiler-internal check for now. It's fine for the test to fail on gcc.
…_early_exit unit test for address sanitizer builds.
The tests are not run properly, because the docker image currently only contains libevmone.a and not libevmone.so. |
The above is fixed by #7203 |
No description provided.