Skip to content

Audit: Gravity Testnet v1.0.0 — Full diff vs reth v1.8.3#258

Draft
Richard1048576 wants to merge 216 commits intoaudit/base-reth-v1.8.3from
audit/gravity-testnet-v1.0.0
Draft

Audit: Gravity Testnet v1.0.0 — Full diff vs reth v1.8.3#258
Richard1048576 wants to merge 216 commits intoaudit/base-reth-v1.8.3from
audit/gravity-testnet-v1.0.0

Conversation

@Richard1048576
Copy link
Collaborator

Overview

This PR captures the complete set of Gravity-specific changes on top of upstream reth v1.8.3 for external security audit purposes.

  • Release tag: gravity-testnet-v1.0.0
  • Upstream base: paradigmxyz/reth v1.8.3
  • Gravity-only commits: 216
  • Files changed: 254
  • Lines: +28,172 / −2,104

⚠️ This PR is read-only for audit review — it is NOT intended to be merged.

Scope

New Gravity-Specific Crates (highest priority)

Crate Path LOC Description
gravity-primitives crates/gravity-primitives/ ~67 Global config (OnceLock), Gravity CLI flags
gravity-storage crates/gravity-storage/ ~243 GravityStorage trait, ParallelDatabase, BlockViewStorage
pipe-exec (execute) crates/pipe-exec-layer-ext-v2/execute/ ~2,400 Core execution pipeline: OrderedBlock → EVM → ExecutionResult, on-chain config, BLS/Mint precompiles
pipe-exec (event-bus) crates/pipe-exec-layer-ext-v2/event-bus/ ~85 Static event dispatcher (MakeCanonicalEvent, WaitForPersistenceEvent)
pipe-exec (relayer) crates/pipe-exec-layer-ext-v2/relayer/ ~1,400 Oracle/bridge cross-chain data relayer
RocksDB backend crates/storage/db/src/implementation/rocksdb/ ~1,744 3-CF sharded RocksDB (state, account_trie, storage_trie)

Modified Upstream Crates

Area Key Paths Changes Description
Engine Tree crates/engine/tree/ ~925 LOC Recovery, persistence, RocksDB integration
EVM Execution crates/ethereum/evm/, crates/evm/evm/ ~700 LOC Grevm parallel execution (parallel_execute.rs, debug_ext.rs)
Node/CLI crates/node/builder/, crates/node/core/ ~350 LOC Gravity CLI args, database config
Storage DB crates/storage/db/ ~1,000 LOC DB abstraction, parallel MDBX tx, RocksDB feature gate
Trie crates/trie/ ~500 LOC Parallel state root, nested hash

Custom External Dependencies

Dependency Repository Description
grevm v2.2.4 Galxe/grevm@26b586c Parallel EVM (DAG + Block-STM), ~2,998 LOC
gravity-api-types Galxe/gravity-aptos@c9ae04b Consensus-execution interface types, ~1,485 LOC
revm v29.0.1-gravity Galxe/revm Custom revm fork
alloy-evm v0.21.3-gravity Galxe/alloy Custom alloy fork

Pipeline Architecture

OrderedBlock (from consensus)
    │
    ▼
┌──────────────┐    ┌──────────────────┐    ┌──────────────┐    ┌────────┐
│  Execution   │ →  │  Merklization    │ →  │ Verification │ →  │ Commit │
│  (Grevm)     │    │  (16-way parallel│    │              │    │(RocksDB│
│              │    │   state root)    │    │              │    │  3-CF) │
└──────────────┘    └──────────────────┘    └──────────────┘    └────────┘

Related Resources

nekomoto911 and others added 30 commits November 26, 2024 22:25
feat(grevm): introduce grevm to reth

feat(grevm): implement grevm batch executor (#3)

* support GrevmBatchExecutor

* implement post execution for grevm executor

chore(grevm): support some debug extension for block execution (#5)

chore(grevm): update grevm dependency (#6)
* fix missed pre-execution in `EthBlockExecutor` and rewrite state in grevm executor

* add debug ext EVM_COMPARE_WITH_REVM_EXECUTOR

* fix pre-execution in `GrevmBlockExecutor`
* implement pipe-exec-layer-ext-v2

* introduce gravity storage in pipe-exec-layer-ext-v2
* implement pipe barrier in PipeExecService

* adapt gravity storage interface
Co-authored-by: kk-x <exmple@example.com>
- fix `state_root_with_updates` and narrow down the critical area of the lock in `BlockViewStorage`
- implement `state_root_with_updates_v2` for `LatestStateProviderRef`
- skip `try_recv_engine_message` if enable `PIPE_EXEC_LAYER_EXT_V2`
- fix cancun fields
- fix range in BlockViewStorage::get_state_view
- block waiting for make canonical to complete
- implement missing state_root_with_updates_v2 function for structs which implement StateRootProvider trait
- use std::mpsc channel as event channel, because the receiver side is not in tokio task and we need recv_timeout function.
* implement ParallelStateProvider

* implement functions that support build parallel state provider
* implement `block_hash` for `ParallelStateProvider`

* support get latest state provider in `Stage::execute`

* support parallel state provider for latest block

* use `ParallelStateProvider` in `ExecutionStage`
If there are no concurrent requests, process the requests in place to eliminate synchronization overhead.
Benchmark for block 17034870 to 17134870 using grevm 1.0:
- LatestStateProvider (no parallel): 403.92 Mgas/second
- ParallelStateProvider before opt. (parallel = 8): 331.64 Mgas/second
- ParallelStateProvider after opt. (parallel = 8): 544.19 Mgas/second
AshinGau and others added 26 commits December 31, 2025 10:34
Keep the block header timestamp in seconds, while using microseconds for ordered blocks to pass to metadata transactions.
#225)

use sharding rocksdb instances to optimize persist stage
* feat(trie): support eth_getProof for nested hash, step 1
Support hive in Greth
Add blockNumber field to JWK oracle commitMessageSent ABIs
Extract and carry source block number from MessageSent events
Add OracleStateFetcher to fetch latest DataRecord from NativeOracle
Add persistence module for tracking processed state across restarts
Remove auto-discovery from BlockchainEventSource, use explicit cursor
Update gravity-api-types dependency to latest revision
This enables the relayer to track the source block number for each oracle
event and fetch consistent oracle state from the chain, improving state
reconciliation across restarts.
 ignore and skip unsupported actions
* fix header timestamp in epoch change block

* debug assertions for block execution validation

* fix gravity pipe test
Co-authored-by: Snezhkko <snezhkodaria38@gmail.com>
* support custom precompiles for ParallelExecutor

* support bls verify precompile

* apply custom precompiles
@github-actions
Copy link
Contributor

Your PR title doesn't follow the Conventional Commit guidelines.

Example of valid titles:

  • feat: add new user login
  • fix: correct button size
  • docs: update README

Usage:

  • feat: Introduces a new feature
  • fix: Patches a bug
  • chore: General maintenance tasks or updates
  • test: Adding new tests or modifying existing tests
  • bench: Adding new benchmarks or modifying existing benchmarks
  • perf: Performance improvements
  • refactor: Changes to improve code structure
  • docs: Documentation updates
  • ci: Changes to CI/CD configurations
  • revert: Reverts a previously merged PR
  • deps: Updates dependencies

Breaking Changes

Breaking changes are noted by using an exclamation mark. For example:

  • feat!: changed the API
  • chore(node)!: Removed unused public function

Help

For more information, follow the guidelines here: https://www.conventionalcommits.org/en/v1.0.0/

@nekomoto911 nekomoto911 marked this pull request as draft February 28, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants