How lita-xyz/reva works
Main Components
• Host Application: Represented by the “bin/host” directory. Its core responsibility is to fetch blockchain data via RPC calls (using provided block number and chain ID), process that data, and serialize it into an input file (e.g., bin/host/input/<chain_id>/<block_no>.bin).
• Client Applications: There are at least two clients – “client-eth” (for Ethereum) and “client-op” (for the OP Stack) found under “bin/client-eth” and “bin/client-op” respectively. Their role is to consume the input generated by the host and run or prove the computation inside the Valida VM.
• Executor Logic and Libraries: This includes several reusable crates in the “crates” directory (such as executor, mpt, primitives, storage). These libraries encapsulate core logic such as:
• Executor: Split into host and client parts (e.g., crates/executor/host and crates/executor/client) managing simulation and execution flows.
• MPT: Likely used for Merkle-Patricia Tree operations which are central to Ethereum state management.
• Primitives: Common data structures and definitions (like chain specifications and account proofs).
• Storage: Separate sub-crates (rpc-db and witness-db) that provide interfaces for storing the serialized input and proof data.
• External Tools & Environment:
• The repository requires the Valida tools (a custom runtime and Rust compiler) for building and running the binaries.
• Build systems (Cargo, Justfile, and scripts) and GitHub workflows for continuous integration, versioning, and deployment automation.
Relationships and Interactions
• Data Flow:
• External Input: The system starts with an external blockchain RPC call (using a provided RPC URL) initiated by the host application.
• Host Processing: The host application fetches block data, processes it using the shared libraries (executor, primitives, storage, etc.), and outputs a serialized binary file.
• Client Execution: The client applications (client-eth or client-op) then take the binary file as input to run the zero-knowledge proof generation or verification routines.
• Dependency & Layered Architecture:
• The host and client binaries both depend on the lower-level crates for domain logic (e.g., executor, mpt) and data structures (primitives).
• The architecture shows a clear separation of concerns: data gathering (host), data processing (shared libraries), and proof generation/execution (client).
Architectural Patterns and Technologies
• Separation of Concerns: Clear division between host (data preparation) and clients (execution/proving).
• Modular Design: Usage of Cargo workspaces (with multiple Cargo.toml files in subdirectories) to keep libraries and binaries decoupled yet interoperable.
• Targeted Compilation: The system uses custom compilation targets (e.g., "valida-unknown-baremetal-gnu") to aggregate code for the Valida VM environment.
• Continuous Integration & Tooling: GitHub workflows are set up (check “.github/workflows”) ensuring build automation and integration testing.
• Key Technologies:
• Rust (primary language)
• Valida VM and its custom toolchain (via cargo +valida)
• Zero-knowledge proofs technology, as inferred from the README description
• Reth framework functionalities (for interacting with the Ethereum network)
Final Advice for the Principal Software Engineer
• Component is clearly labeled with its directory or service name (for example, “Host (bin/host)”, “Client – Ethereum (bin/client-eth)”, “Client – OP (bin/client-op)”, “Executor Libraries (crates/executor)”, etc.).
• Remember to add notes or legends capturing the custom build targets (“valida-unknown-baremetal-gnu”) and the use of the Valida toolchain.