$ show ipsilon/evmone
evmone is a high-performance Ethereum Virtual Machine (EVM) implementation written in C++20, designed as a plugin for Ethereum clients via the EVMC interface. It provides two execution engines: a baseline interpreter using computed goto dispatch for simplicity and speed, and an advanced interpreter using indirect call threading with precomputed basic block analysis for further optimization. The implementation supports all EVM revisions from Frontier through the upcoming Amsterdam, including precompiled contracts for cryptographic operations such as SHA-256, RIPEMD-160, BLAKE2b, BN254 pairings, BLS12-381, KZG point evaluation, and secp256r1 verification. The codebase is structured as a shared library (libevmone) with a CLI tool (evmone) for running bytecode and executing state transitions (t8n), along with extensive benchmarking and testing infrastructure. The architecture is modular: core EVM logic resides in lib/evmone/, precompiled contracts in lib/evmone_precompiles/, and test utilities in test/. The project uses CMake with Hunter for dependency management and includes a self-contained CMake bootstrap library (Cable) for build configuration. It features a comprehensive test suite including unit tests (Google Test), state transition tests, blockchain tests, fuzzing, and integration tests against Ethereum execution-spec-tests. The code demonstrates strong engineering practices with heavy use of templates, constexpr, and platform-specific optimizations (e.g., SHA-NI, BMI) while maintaining portability across x86, ARM, and RISC-V. Notable reusable components include a generic LRU cache, Montgomery modular arithmetic for arbitrary precision, a bytecode construction DSL for testing, a generic elliptic curve library, and a modular exponentiation implementation with CIOS multiplication. The project is actively maintained with frequent releases tracking Ethereum protocol upgrades, and its design emphasizes performance without sacrificing correctness, as evidenced by rigorous testing and fuzzing.
The LLM identified 5 files worth highlighting for reuse:
A generic LRU cache implementation with O(1) get and put operations. Uses a node-based map (std::unordered_map) storing list iterators for stable references, and a std::list for LRU ordering with splice-based promotion. The cache is fully templated on key and value types, supports capacity-based eviction, and is self-contained with no internal dependencies beyond standard library. This pattern is reusable in any C++ project requiring a bounded, fast cache.
A generic elliptic curve arithmetic library providing field elements, affine and projective point representations, point addition/doubling, scalar multiplication (including windowed and GLV decomposition), and multi-scalar multiplication. The implementation is templated on field parameters and curve constants, making it reusable for any elliptic curve (e.g., BN254, secp256k1). It demonstrates advanced C++ template metaprogramming and mathematical optimization.
A domain-specific language (DSL) for constructing EVM bytecode in C++ tests. Provides operator overloading and helper functions (e.g., push, sstore, call) that generate raw bytecode vectors. The DSL is self-contained, header-only, and can be reused in any EVM testing project to write concise and readable bytecode sequences without manual hex encoding.
An optimized modular exponentiation implementation for Ethereum's MODEXP precompile. Uses Coarsely Integrated Operand Scanning (CIOS) Montgomery multiplication, Chinese Remainder Theorem for even moduli, and specialized paths for power-of-two moduli. Includes a bump allocator for working memory and fallback heap allocation. The algorithm is self-contained and can be extracted as a standalone cryptographic primitive for large-integer modular arithmetic.
A self-contained CMake bootstrap library that provides build type configuration, compiler settings, toolchain management, and package packaging. It includes HunterGate for dependency management and generates build info (version, git hash). The entire Cable system is a single cmake/ directory that can be vendored into any C++ project to standardize build infrastructure without external dependencies.