Enclave ready EVM (eEVM) is an open-source, standalone, embeddable, C++ implementation of the Ethereum Virtual Machine.
Перейти к файлу
Eddy Ashton 05efed8658
Add `workflow_dispatch` Actions trigger (#78)
2023-07-10 14:19:39 +01:00
.github/workflows Add `workflow_dispatch` Actions trigger (#78) 2023-07-10 14:19:39 +01:00
3rdparty Upgrade doctest to 2.4.9 (#72) 2022-06-22 18:13:16 +01:00
include/eEVM Strict RLP decoding (#68) 2020-02-19 09:15:20 +00:00
samples Validate sample execution in CI (#59) 2019-11-19 11:38:07 +00:00
src Update opcodes and add documentation (#65) 2020-02-07 10:06:29 +00:00
tests Strict RLP decoding (#68) 2020-02-19 09:15:20 +00:00
.clang-format Seed commit 2018-10-26 11:38:32 +01:00
.gitignore Add RLP support for generic vectors and arrays (#35) 2019-08-05 09:33:57 +01:00
CMakeLists.txt Replace Boost with intx (#55) 2019-10-10 17:05:08 +01:00
LICENSE Initial commit 2018-10-25 15:03:14 -07:00
README.md Remove unused CircleCI (#76) 2023-01-11 15:45:19 +00:00
SECURITY.md Microsoft mandatory file (#73) 2022-08-22 16:20:40 +01:00
THIRD_PARTY_NOTICES.txt Add libfmt license notice 2019-08-20 10:04:58 +01:00
azure-pipelines.yml Validate sample execution in CI (#59) 2019-11-19 11:38:07 +00:00

README.md

Enclave EVM

Enclave EVM (eEVM) is an open-source, standalone, embeddable, C++ implementation of the Ethereum Virtual Machine. It was originally built to run within a TEE (ie, SGX enclave) on top of the Open Enclave SDK, for use with Microsoft's Confidential Consortium Framework.

eEVM GitHub Actions CI

Description

The main entry point is eevm::Processor::run(). You will need to provide eevm::Processor with an implementation of eevm::GlobalState to handle all interactions with permanent state. The source includes eevm::SimpleGlobalState as an example backed by std::map, but other instances will likely want an implementation which provides permanent storage - perhaps a wrapper to read/write data from the Ethereum blockchain.

eEVM supports all opcodes from Ethereum's Homestead release, as listed in opcode.h. Note that this does not include more recent opcodes such as RETURNDATACOPY or RETURNDATASIZE from EIP #211.

The implementation ignores all gas costs - gas is not spent, tracked, or updated during execution, and execution will never throw an outofgas exception. However, it may still be necessary to pass a sensible initial gas value to eevm::Processor::run() in case the bytecode calculates or verifies gas budgets itself. It also does not provide the precompiled contracts at addresses 1 to 8.

So far, the code is not particularly optimized in any dimension. In fact, it is in experimental state.

Dependencies

  • CMake. Minimum version 3.10.

Build and Test

We build and test eEVM on Linux and Windows on x86-64, but it should be functional cross-platform.

Linux

Build the static library and tests.

mkdir build
cd build
cmake ..
make

It is also possible to build with Ninja or another generator of choice, and the code will compile with either GCC or Clang (other compilers are untested).

Run the tests.

cd build
ctest -VV

Windows / Visual Studio 2017

Open the Visual Studio 2017 developer command prompt. Create .sln and .vcxproj files and build the static library and tests as follows.

mkdir build
cd build
cmake ..
msbuild ALL_BUILD.vcxproj

Run the tests.

cd build
ctest -C debug

More on tests

To run the tests outside of CTest you will need to provide the path to the test cases as an environment variable.

cd build
export TEST_DIR=../3rdparty/test_cases/
./eevm_tests

The full test suite contains some longer performance tests which are skipped by default. For full coverage, these can be run by passing the no-skip option to the test app - these should complete in minutes, while the default tests should complete in under a second.

cd build

time TEST_DIR=../3rdparty/test_cases/ ./eevm_tests
...
real    0m0.424s

time TEST_DIR=../3rdparty/test_cases/ ./eevm_tests -ns
...
real    2m11.306s

Note that the test harness skips several test cases. Some of these test features which are not supported (gas exhaustion, huge address space), while others appear malformed (do not match the documented test format).

Third-party components

We rely on several open source third-party components, attributed under THIRD_PARTY_NOTICES.

Keccak

The Keccak sources were created from the reference KeccakCodePackage by running make FIPS202-opt64.pack. Unfortunately, we cannot use the probably more optimized ASM versions for now, because they are neither PIC nor Visual Studio compatible.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.