-
Notifications
You must be signed in to change notification settings - Fork 867
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
Update evmtool graalvm build #5639
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0c2f901
Update evmtool graalvm build
shemnon bbea34c
logging fix
shemnon 99d4729
Json and crypto
shemnon bb35788
readma
shemnon dac7d08
license header
shemnon a1bd5c4
license header
shemnon b49a8df
merge
shemnon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
EVM Tool | ||
======== | ||
|
||
EVM Tool is a stand alone EVM executor and test execution tool. The | ||
principal purpose of the tool is for testing and validation of the EVM | ||
and enclosing data structures. | ||
|
||
Using EVM Tool in execution-specification-tests | ||
----------------------------------------------- | ||
|
||
To use EVM Tool in Execution Spec tests it is recommended that you use | ||
the GraalVM build, as the framework incurs significant startup penalties | ||
for each invocation when run via the Java runtime. | ||
|
||
### Building Execution Tests on macOS | ||
|
||
Current as of 24 Jun 2023. | ||
|
||
MacOS users will typically encounter two problems,one relating to the | ||
version of Python used and one relating to zsh. | ||
|
||
Homebrew will only install the most recent version of Python | ||
as `python3`, and that is 3.11. The execution tests require 3.10. The | ||
solution is to use a 3.10 version of python to set up the virtual | ||
environment. | ||
|
||
```zsh | ||
python3.10 -m venv ./venv/ | ||
``` | ||
|
||
Zsh requires braces to be escaped in the command line, so the step to | ||
install python packages needs to escape the brackets | ||
|
||
```zsh | ||
pip install -e .\[docs,lint,test\] | ||
``` | ||
|
||
An all-in-one script, including homebrew, would look like | ||
|
||
```zsh | ||
brew install ethereum solidity | ||
git clone https://github.com/ethereum/execution-spec-tests | ||
cd execution-spec-tests | ||
python3 -m venv ./venv/ | ||
source ./venv/bin/activate | ||
pip install -e .[docs,lint,test] | ||
``` | ||
|
||
### Building EvmTool with GraalVM on macOS | ||
|
||
First you need a GraalVM JDK installed, if not already installed. | ||
|
||
It is recommended you install [SDKMAN](https://sdkman.io/install) to | ||
manage the graalVM install, homebrew has issues with native attributes | ||
and code signing. | ||
|
||
```zsh | ||
sdk install java 22.3.r17-grl | ||
sdk use java 22.3.r17-grl | ||
``` | ||
|
||
You can also manually install GraalVM from | ||
the [GraalVM website](https://www.graalvm.org/downloads).. | ||
|
||
Once GraalVM is installed you use the `nativeCompile` target. | ||
|
||
```zsh | ||
./gradlew nativeCompile | ||
``` | ||
|
||
The resulting binary | ||
is `./ethereum/evmtool/build/native/nativeCompile/evmtool` | ||
|
||
If the testing repository and besu are installed in the same parent | ||
directory, the command to run the execution tests is | ||
|
||
```zsh | ||
fill -v tests --evm-bin ../besu/ethereum/evmtool/build/install/evmtool/bin/evm | ||
``` | ||
|
||
Assuming homebrew and SDKMan are both installed, the complete script is | ||
|
||
```zsh | ||
sdk install java 22.3.r17-grl | ||
sdk use java 22.3.r17-grl | ||
git clone https://github.com/hyperledger/besu | ||
cd besu | ||
./gradlew nativeCompile | ||
cd .. | ||
|
||
brew install ethereum solidity | ||
git clone https://github.com/ethereum/execution-spec-tests | ||
cd execution-spec-tests | ||
python3 -m venv ./venv/ | ||
source ./venv/bin/activate | ||
pip install -e .[docs,lint,test] | ||
|
||
fill -v tests --evm-bin ../besu/ethereum/evmtool/build/install/evmtool/bin/evm | ||
``` | ||
|
||
If you don't want to use the GraalVM tool the binary that is compatible | ||
is generated by the `ethereum:evmtool:installdist` target and is located | ||
at `./ethereum/evmtool/build/install/evmtool/bin/evm` | ||
|
||
Why not GraalVM for everything? | ||
------------------------------- | ||
|
||
Using GraalVM in execution-spec-tests results in over 20x performance | ||
increase in execution. It will be faster to build GraalVM from scratch | ||
and run the execution-spec-tests than to run just the Java version. | ||
|
||
It is demonstrably faster to run the Java version for a node. | ||
All the test execution gains are the result of reduced startup | ||
penalties. Larger benchmarks will show that performance intensive EVM | ||
code will be slower in GraalVM than the Java version due to the adaptive | ||
compiler. | ||
|
||
For contracts that execute 30 million gas in small operations it is | ||
often faster to run the Java EVMTool than the GraalVM EVMTool, including | ||
startup penalty. The execution tests focus on smaller VM tests that | ||
demonstrate specification conformance. | ||
|
||
We would also need to reconsider some library choices. GraalVM does not | ||
work with Log4J, and we would have to ban that library across Besu and | ||
all dependents. Libraries such as Netty also have some problematic entry | ||
points that interact poorly with how SLF4J needs to initialize. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / CodeQL
Use of a potentially broken or risky cryptographic algorithm