bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 23쪽 중 11쪽
adapt reth to the pipelined block proposal process of the Gravity SDK. It enables the execution layer to continuously consume a stream of proposed blocks, functioning as a reactor that processes blocks asynchronously. The BSR establishes a dynamic feedback loop with the consensus engine, incorporating proper backpressure signals. These signals adjust the pace of block proposals and state commitments in real-time based on the execution layer's throughput and latency. If the execution layer lags due to complex transactions or resource constraints, the backpressure mechanism throttles the block proposal rate, ensuring system stability.
* **Decoupling State Commitment from Transaction Execution**: The second optimization involves separating the computation of state commitments from transaction execution. By decoupling these processes, we enable asynchronous state commitment computation, allowing the execution of subsequent blocks to proceed without waiting for the finalization of the current block's state commitment. We changed the definition of `blockhash` to remove the dependency on the `stateRoot` field of the block header, ensuring that state root computation do not block further block generation.
* **Optimization of the Storage Layer**: Efficient caching and persistence of multi-version state values and state commitments is critical in a pipelined architecture. The third optimization focuses on enhancing the storage layer to handle these requirements without introducing bottlenecks. By fine-tuning the storage mechanisms, we ensure that state data can be written rapidly and retrieved highly concurrently. This involves building a multi-version storage engine and support asynchronous I/O from the database to storage API.
* **Parallel EVM**: The final optimization involves parallelizing the execution of transactions within the EVM. We have developed Grevm, a parallel EVM runtime that significantly accelerates transaction processing by executing transactions concurrently. . Grevm leverages data dependency hints derived from transaction simulations to optimize parallel execution, minimizing transaction re-executions and enhancing throughput.

### Grevm (Gravity EVM) - Parallel EVM Execution
> Grevm is open-sourced on GitHub (If not, soon it will be). Please read its [README](https://github.com/Galxe/grevm/blob/main/README.md) for more details.
[Grevm (Gravity EVM)](https://github.com/Galxe/grevm) is an open-source, parallel EVM runtime based on [revm](https://github.com/bluealloy/revm). Grevm's algorithm is inspired by [BlockSTM](https://arxiv.org/abs/2203.06871), with enhancement of incorporating a transaction data dependency graph derived from simulation results. This mechanism enables more effective scheduling for parallel execution, minimizing transaction re-executions.
In our benchmark, Grevm stands as the **fastest** open-source parallel EVM implementation to date. For conflict-free transactions, Grevm is **4.13×** faster than sequential execution, running at **26.50 gigagas/s.** If we simulate real-world I/O latency of **100 μs**, it is **50.84×** faster than sequential execution, with **6.80 gigagas/s** throughput. This leap in performance is attributed to both the parallelized execution and the integration of asynchronous I/O operations—enabled by the parallelism—which further amplifies the speedup by efficiently overlapping I/O operations.
The seminal idea behind Grevm is to leverage the data dependency between transactions, using speculated transactions read/write set, to optimize parallel execution. While not all hints are perfectly precise, these simulation-based hints are generally accurate enough for practical purposes. For instance, on the Ethereum mainnet, by **historical gas usages**, approximately 30% of transactions are simple Ether transfers, and another 25%-30% are ERC20 token transfers, which typically involve reading and writing to a limited number of accounts and storage slots. In such transactions, simulation results are consistently accurate.
Building upon these insights, we have developed a **three-phase parallel execution framework** for **Grevm**, a follow-up work of **Block-STM** model by incorporating data dependency hints from transaction simulations:
* **Phase 1**: **Hint Generation & State Preloading**—Simulate transactions to gather dependency hints and warm-up memory cache. This phase can be performed at various points in time, depending on the design of the blockchain. For example, when new transactions arrive in the mempool, simulations can be run immediately to prepare dependency hints in advance.
* **Phase 2**: **Dependency Analysis**—Transform the dependency hints gathered during the simulation phase into a DAG that models the dependencies between transactions. This DAG serves as a roadmap for scheduling transactions in the subsequent parallel execution.
* **Phase 3**: **Concurrent Execution with Conflict Resolution**—Execute transactions in parallel using a modified BlockSTM algorithm that leverages the dependency DAG generated in Phase 2. Instead of the scheduler selecting transactions strictly based on their sequence numbers in the block (e.g., 1, 2, 3, ..., n), it now prioritizes transactions according to the DAG to minimize conflicts and reduce the need for re-executions.

### Asynchronous Batched State Commitment
The generation of state commitments remains a critical bottleneck in the blockchain pipeline, stemming from the inherently sequential nature of merklization. Each sub-tree computation must complete before the final state commitment can be produced, creating significant delays. While existing solutions, such as [reth's account-level parallelization](https://www.paradigm.xyz/2024/04/reth-perf), have introduced some degree of parallelism, there is ample room for further optimization. This is particularly relevant in the context of Gravity reth, a Block Stream Reactor (BSR) execution layer, where state commitment consensus is decoupled from transaction execution, where deferred and batched state commitment computation can be performed asynchronously without blocking execution.
To address these challenges, the proposed framework introduces the following key innovations:
**Asynchronous Batched Hash Computation**: Leveraging the decoupling of state commitment consensus from transaction execution, the framework enables asynchronous computation of state commitments. State root updates are batched—e.g., computed every 10 blocks—to reduce the frequency of state root calculations. This batching approach minimizes the overhead of frequent updates and reduces overall computational costs by aggregating shared dirty nodes for efficient hash computation. For small blocks, batching can significantly increase its parallelism, and for large blocks, it can reduce the overall computational cost.
**Full Parallelization**: The framework extends parallelization beyond individual account trees the whole state tree. For nodes marked as "dirty," the framework employs a Parallel State Calculation algorithm, which partitions the tree into independent subtrees. These subtrees are processed concurrently. The results are aggregated at the top level to compute the final root efficiently. This approach ensures that large blocks, with numerous transactions and state changes, can fully utilize multi-threading, maximizing throughput.
**Alternative Fast State Root**: To accommodate Ethereum's block header and `BLOCKHASH` opcode, which require access to the last 256 block state roots, we redefined the state root. Instead of relying on finalized state commitments—which are unavailable during transaction execution—we calculate the state root as the hash of the block's change sets combined with the previous state root. This approach enables faster state root computation without waiting for full state commitment finalization.

### Gravity Store
High-performance blockchains require a more efficient storage layer to manage the vast amount of data generated by transaction execution and state commitment. The Gravity Store, a fine-tuned multi-version storage layer, builds on the foundation provided by reth, which already separates the state commitment store from the state storage store to mitigate state bloating and lower read/write amplification. However, additional demands arise to support parallel execution and asynchronous state commitment in the Gravity reth execution layer.

To address these requirements, the Gravity Store introduces a highly efficient multi-version tree to facilitate the unique needs of our BSR architecture. It is used to manage state updates across multiple versions. Instead of recalculating hashes immediately after modifications, altered nodes are marked as dirty, allowing for deferred and batched hash computation against specific tree versions. This structure supports efficient operations like creating new versions, querying values from specific versions, and deleting versions below a certain height, thereby offering significant performance benefits for managing blockchain state.
We are also exploring developing our own storage engine, Gravity DB, which is designed to optimize the storage layer for blockchain use cases, and support fully asynchronous I/O operations. The design will be similar as [LETUS](https://dl.acm.org/doi/abs/10.1145/3626246.3653390), a log-structured Efficient Trusted Universal BlockChain Storage high-performance database engine for blockchain. We will publish more details in our upcoming blog post.
## Conclusion
Gravity Chain is a high-performance EVM-compatible layer-1 blockchain designed to meet the scalability and performance demands of modern web3 applications. By combining the Gravity SDK, a pipelined AptosBFT PoS consensus engine, and Gravity reth, a Block Stream Reactor execution layer powered by Grevm, Gravity offers 1 gigagas per second throughput, sub-second finality, and restaking-powered PoS security. These components are designed to empower web3 applications to launch their own alternative L1s and faster-finality L2s, specifically optimized for EVM chains.
# Gravity Reth
Gravity Reth is the fastest open-source EVM execution client, a performance-engineered fork of Reth.
### Abstract
We introduce [Gravity Reth](https://github.com/Galxe/gravity-reth/tree/main), an open-source, performance-engineered fork of Reth, designed to push the upper bounds of EVM execution speed. Through a suite of architectural innovations—including Grevm, a DAG-based optimistic parallel EVM; a **fully parallelized merklization** framework, a **high-performance caching** layer, an **optimized mempool,** and **a pipelined execution architecture**—Gravity Reth achieves state-of-the-art performance. In a benchmark involving ERC20 transfers across 100,000 accounts, Gravity Reth sustains \~**41,000 transactions per second (TPS)**, equivalent to \~**1.5 Gigagas/s**. This represents a greater than **4x performance boost** over the baseline Reth 1.4.8 client. We present the design and evaluation of Gravity Reth and our broader goal of contributing these optimizations to the open-source community to advance the performance of the EVM ecosystem.
## Introduction
For EVM-based ecosystems, the execution client is a critical component of the system stack, often representing a significant performance bottleneck that limits on-chain throughput and raises transaction costs. While modern clients like Reth have made substantial strides in performance, their architectures are not primarily optimized for high-performance Layer 1s and Layer 2 roll-ups, which target sub-second finality and massive scalability, require a fundamental rethinking of client design to overcome bottlenecks in transaction execution, state commitment, and expensive I/O.
This paper introduces Gravity Reth, a fork of the Reth execution client engineered for maximum throughput with reasonable CPU/RAM resources. We systematically re-architected some critical components to unleash the full potential of Reth. Our primary contributions are:
1. **Grevm 2.1:** A hybrid parallel EVM that integrates a Data Dependency Directed Acyclic Graph (DAG) with Block-STM-style optimistic execution. This design minimizes redundant computations in high-contention workloads and achieves near-optimal parallelism in low-contention scenarios.
2. **Parallel Merklization:** A complete redesign of the state root calculation process. We replace Reth's sequential, bottom-up MPT generation with a 16-way, top-down parallel framework that delivers a 3-10x performance increase.
3. **Gravity Cache:** A concurrent, LRU-based caching layer built with `DashMap` that provides an efficient "latest view" of the state, drastically reducing I/O pressure and resolving performance degradation associated with managing numerous in-memory blocks in high-frequency environments.
4. **Optimized Memory Pool:** A two-tier data structure and batch processing mechanism for highly concurrent transaction insertion and management.
5. **Pipeline Architecture:** A five-stage asynchronous pipeline (Execution, Merklization, Verification, Commit) that decouples execution stages, allowing Gravity Reth to effectively overlap computation and I/O and fully leverage multi-core processors to service rapid block production from high-throughput consensus engines.
Our evaluation demonstrates that Gravity Reth achieves \~41,000 TPS in a standard ERC20 transfer benchmark, compared to `Reth 1.4.8`'s 9,800 TPS on identical hardware. We believe Gravity Reth represents the fastest open-source EVM execution client to date and offer our architecture and results as a blueprint for future high-performance blockchain systems.
## Architectural Innovations
Gravity Reth's performance gains stem from a holistic redesign of the core components of an EVM client. We detail each major innovation below.
### Grevm: Fastest Parallel EVM
Optimistic parallel execution in blockchain, as popularized by Block-STM, offers significant speedups for low-contention workloads but suffers performance degradation in scenarios with highly dependent transactions due to frequent aborts and re-executions. To address this, we developed [**Grevm**](https://github.com/galxe/grevm), a parallel execution engine that intelligently combines optimistic execution with dependency-based scheduling.
Grevm first asynchronously performs a parallel simulation of a block's transactions based on most recent state, to construct a Data Dependency Directed Acyclic Graph (DAG). Based on this graph, it dynamically schedules non-dependent transactions for parallel execution while grouping strongly-conflicting transactions into **Task Groups**. Transactions in a group are executed sequentially within a single thread, preserving the benefits of parallelism for independent work while minimizing the overhead of re-execution for contentious operations. Furthermore, we developed **Lock-Free DAG** implementation, replaces global locking with fine-grained, node-level synchronization, reducing DAG scheduling overhead by 60% and improving overall throughput by over 30%, with nearly a **2x** gain in workloads dominated by fast-executing transactions (e.g., ERC20 and raw transfers).
This hybrid approach yields significant performance benefits across a wide spectrum of workloads. Key achievements of Grevm 2.1 include:
* **Robustness in High-Contention Scenarios:** In workloads with high dependency, Grevm avoids the 20-30% performance penalty observed in pure optimistic models, maintaining performance near that of sequential execution while using up to **95% less** CPU.
* **Superior Hybrid Workload Throughput:** For mixed workloads with a 30% contention ratio, Grevm delivers a **5.5x** throughput increase over its predecessor, achieving 2.96 Gigagas/s by minimizing re-executions.
A comprehensive analysis of the Grevm 2.1 architecture, including its lock-free DAG design and implementation, parallel state store, and detailed benchmark comparisons, is available in our previous [research report](https://docs.gravity.xyz/research/grevm2).
### Fully Parallel Merklization
Our analysis identified the state root calculation (Merklization) as a primary performance bottleneck in the native Reth. For a block with `6,000` transactions and a state of `100,000` accounts, this process alone could take `380ms`, imposing a theoretical ceiling of `~16,000 TPS` on the entire system, even in an ideal pipeline model. This limitation stems from several core design choices in Reth's Merkle Patricia Trie (MPT) implementation.
Reth’s MPT implementation is designed for storage compactness. It only persists Branch Nodes, dynamically reconstructing Extension Nodes from raw data when needed. While this saves disk space, it incurs significant computational overhead during state access. The primary bottlenecks are:
* **Bottom-up, Cursor-Dependent Construction:** Reth builds the trie from the bottom up, starting from leaf nodes and moving towards the root. This process fundamentally relies on ordered database access via a `cursor` interface. This dependency makes it difficult to leverage simple, high-performance Key-Value (KV) caches, as they cannot guarantee the ordered iteration required by the algorithm.
* **Redundant Node Processing:** The bottom-up traversal often results in accessing and processing numerous unmodified intermediate nodes simply to reconstruct the path to a modified leaf.
* **Limited Parallelism:** While Reth can parallelize Merklization *between* different storage tries, it lacks the ability to do so *within* a single trie. The main Account Trie and the storage trie of a single "hot" contract, which may be the target of thousands of transactions in a block, are both processed serially. This severely limits performance in common, high-contention scenarios.
To overcome these limitations, we re-engineered a new Merklization framework, inspired by the design of Geth.

Our approach systematically addresses each bottleneck:
1. **Top-Down, KV-Based Traversal:** We abandoned the bottom-up approach in favor of a **top-down** search. Our trie structure persists both Branch and Extension nodes, allowing for direct, fast access using a standard KV interface. This eliminates the dependency on slow database cursors and makes the entire process extremely cache-friendly.
2. **Elimination of Redundant Work:** We introduced a logical nested tree structure with a `dirty` flag for each node and cached node hashes. This ensures that only modified nodes and their direct ancestors are ever re-calculated, completely avoiding redundant hashing of unmodified parts of the trie.
3. **Comprehensive Intra-Trie Parallelism:** The most critical innovation is our **16-way parallel strategy**, which unlo프로젝트로 돌아가기