How lambdaclass/ethrex works
Main Components
• L1 Execution Client: Represent the core node that handles Ethereum execution, including the RPC endpoints (http and authenticated RPC), P2P networking (discovery, peer handling, and RLPx protocol), database (libmdbx or the in-memory engine), and EVM execution using backend engines (levm or revm).
• L2 Rollup Client: In a separate section or overlay, show the additional “sequencer” component that proposes blocks, the “prover” subsystem (split into an external proverClient and an internal proverServer), and the set of Solidity contracts deployed on L1 for state commitment and verification.
• Shared Subsystems: Include components for blockchain state management (the blockchain crate that includes state diffs, fork-choice, mempool), the VM component (crates/vm for execution, opcode handling, etc.), and common utility libraries for low-level types and serialization (common, rlp, trie).
• Networking & RPC: Illustrate the complete networking layer with its P2P protocols (discovery and sync via the networking crate) and the RPC layer that accepts both regular (eth) and administrative/control commands.
• Development & Testing Tools: Although not part of the runtime, include an auxiliary block (e.g., “Hive” and “ef_tests”) to indicate how end-to-end and spec compliance testing integrate with the system.
Component Relationships and Data Flows
• Interaction between the client and storage, how genesis and network parameters are loaded (from test_data and genesis files), and how configuration plays across several components.
Architectural Patterns and Design Principles
• Vertical Integration: Show that the client (both L1 and L2 variants) is vertically integrated with its own metrics, error handling, and configuration—these can be noted in sub-blocks or annotations.
• Dual-mode Operation: Clearly separate or annotate differences between the L1 and L2 modes. For example, note that the L2 mode includes extra modules (proposer, proverClient, proverServer, and smart contracts) compared to the L1 mode.
Relevant Technologies and Frameworks
• Rust and Cargo are the primary language/tools.
• The database subsystem uses libmdbx (or an in-memory variant).
• P2P networking (using protocols such as DISCv4, RLPx, and Kademlia) and RPC based on Ethereum’s specifications.
• Docker and Kurtosis are used for containerization and local testing; mention these as deployment tools if setting up environments.
• ZK-Rollup components (RISC-V zkVM integration for the L2 mode) should be highlighted.