EVM2: The Fastest EVM

We've released EVM2 v1.0.0, the fastest EVM. It ships in Foundry 1.10, Reth v2.9.0 and Tempo, and it introduces:

  • Up to 2× faster than revm: on interpreter-bound benchmarks, and Reth executes mainnet blocks about 10% faster.

  • Up to 3.4× faster tests: Morpho Blue's test suite drops from 45.7 seconds to 13.5 with Foundry 1.10.

  • 2.3× more TPS with a JIT: a contract-heavy Tempo workload went from 2,437 to 5,613 TPS.

2× faster than revm.

An interpreter pays a cost on every instruction: decode the opcode, find its handler, charge gas, move values on and off the stack. EVM2 cuts that cost without changing what any instruction does:

Embedded image image1

In Reth v2.9.0, that makes mainnet block execution about 10% faster. Most of a node's time goes to state access and the state root, so the gain is smaller than in the interpreter alone.

Tail calls.

revm runs bytecode the way most interpreters do: one big loop that fetches an opcode, calls its handler and returns to the loop for the next. In EVM2 there is no loop. Each handler does its work and jumps straight into the next one. That change alone cuts 10% to 30% off large transactions:

Embedded image image2

Another big win came from the CPU. In revm, the Rust compiler wrote each 32-byte stack word as four 8-byte stores, and the next instruction read it back with one 32-byte load, which stalls until the stores reach L1 cache. EVM2 stores the word in one go, so the load is forwarded straight from the store buffer, for another 25% to 30%:

Embedded image image3

Up to 3.4× faster tests.

Tests are the inner loop of smart contract development. We ran the test suites of seven real-world projects with Foundry 1.9 and Foundry 1.10:

Embedded image image4

Cheatcodes gain the most. With revm, Foundry paused on every instruction so cheatcodes could watch, whether a test used them or not. EVM2 hooks only the instructions a cheatcode asks for:

Embedded image image5

Up to 11× faster with a JIT.

An interpreter, however fast, still handles one instruction at a time. EVM2 ships a JIT compiler that turns hot contracts into native machine code, under the chain's own opcodes and gas rules. Compute-heavy contracts run up to 11× faster than in the interpreter, and 5× faster for an onchain language model:

Embedded image image6

On a contract-heavy Tempo workload, the same binary with the JIT on went from 2,437 to 5,613 TPS. The JIT is behind a build feature and a flag, and off by default while we test it more widely.

OK, I'm sold! How do I try EVM2?

To build on EVM2, add it to your project:

cargo add evm2

Chains can add their own opcodes, gas rules and precompiles without forking: start from the custom EVM example and the docs.

Or, update Foundry and run your tests:

foundryup

forge test

Foundry 1.10 uses EVM2 by default. A few edge cases behave differently; they’re listed in Foundry’s EVM2 notes. To run a node on EVM2, upgrade to Reth v2.9.0.

Where do we go from here?

Next up are superinstructions, which fuse common opcode sequences into one handler: an early draft already executes mainnet blocks about 10% faster. Then the JIT on by default, in Tempo and in Foundry.

If you're a great engineer looking to work on EVM2 or other bleeding-edge projects at Tempo, please reach out to georgios@paradigm.xyz.

See you on GitHub!

EVM2 is open source under MIT or Apache 2.0 at github.com/alloy-rs/evm2. It was audited by Sigma Prime and Zellic.

Disclaimer: This post is for general information purposes only. It does not constitute investment advice or a recommendation or solicitation to buy or sell any investment and should not be used in the evaluation of the merits of making any investment decision. It should not be relied upon for accounting, legal or tax advice or investment recommendations. This post reflects the current opinions of the authors and is not made on behalf of Paradigm or its affiliates and does not necessarily reflect the opinions of Paradigm, its affiliates or individuals associated with Paradigm. The opinions reflected herein are subject to change without being updated.

en