Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Common Development Commands

### Building
- **Release build**: `make build`
- **Debug build**: `make build-dev`
- **Build all workspace members**: `make build-all`

### Testing
- **Run all tests**: `make test`
- **Run tests with output**: `make test-verbose`
- **Unit tests only**: `make test-unit`
- **Integration tests**: `make test-integration`
- **Test specific crate**: `make test-node`, `make test-rollkit`, `make test-common`

### Code Quality
- **Format code**: `make fmt`
- **Check formatting**: `make fmt-check`
- **Run linter**: `make lint`
- **Run all checks**: `make check-all`

### Running the Node
- **Run with defaults**: `make run`
- **Run with debug logs**: `make run-dev`
- **Direct execution**: `./target/release/lumen node --chain <CHAIN_SPEC> --datadir <DATA_DIR> --http --ws`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Makefile defines several useful Docker-related commands (docker-build, docker-build-push, etc.). It would be valuable to document these under a new ### Docker subsection within the "Common Development Commands" section.

Suggested change
- **Direct execution**: `./target/release/lumen node --chain <CHAIN_SPEC> --datadir <DATA_DIR> --http --ws`
### Running the Node
- **Run with defaults**: `make run`
- **Run with debug logs**: `make run-dev`
- **Direct execution**: `./target/release/lumen node --chain <CHAIN_SPEC> --datadir <DATA_DIR> --http --ws`
### Docker
- **Build Docker image**: `make docker-build`
- **Build and push Docker image**: `make docker-build-push`
- **Build and push Docker image as latest**: `make docker-build-push-latest`


## High-Level Architecture

Lumen is a specialized Ethereum execution client built on Reth that integrates with Rollkit. The key architectural innovation is accepting transactions directly through the Engine API instead of the traditional mempool.

### Core Components

1. **RollkitPayloadBuilder** (`crates/node/src/builder.rs`)
- Accepts transactions from Engine API payload attributes
- Executes transactions and builds blocks
- Manages state transitions

2. **RollkitEngineTypes** (`bin/lumen/src/main.rs`)
- Custom Engine API types supporting transaction submission
- Handles payload attribute validation and processing

3. **RollkitEngineValidator** (`bin/lumen/src/main.rs`)
- Modified validator that bypasses certain checks for Rollkit compatibility
- Maintains security while allowing flexible block production

### Transaction Flow
1. Rollkit submits transactions via `engine_forkchoiceUpdatedV3` with transactions in payload attributes
2. Transactions are decoded from RLP format and validated
3. Payload builder executes transactions against current state
4. Block is constructed and returned via Engine API

### Key Design Decisions
- Transactions bypass the mempool entirely, submitted directly via Engine API
- Block validation is relaxed for Rollkit-produced blocks (hash validation bypassed)
- Custom gas limits can be specified per payload
- Modular workspace structure separates concerns between general node logic and Rollkit-specific features

### Testing Strategy
- Unit tests for individual components
- Integration tests in `crates/tests/` covering:
- Engine API interactions
- Payload building with transactions
- State execution validation
- Rollkit-specific scenarios

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It's a good practice to end files with a newline character. This can prevent issues with file concatenation and diffs.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Lumen follows a modular architecture similar to Odyssey, with clear separation o
- **`crates/common`**: Shared utilities and constants used across all crates
- **`crates/node`**: Core node implementation including the payload builder
- **`crates/rollkit`**: Rollkit-specific types and integration logic
- **`crates/e2e-tests`**: Comprehensive end-to-end tests
- **`crates/tests`**: Comprehensive test suite including unit and integration tests

This modular design allows for:
- Better code organization and maintainability
Expand Down Expand Up @@ -182,7 +182,7 @@ lumen/
│ │ └── src/
│ │ ├── lib.rs
│ │ └── types.rs # Rollkit payload attributes
│ └── e2e-tests/ # End-to-end tests
│ └── tests/ # Comprehensive test suite
│ ├── Cargo.toml
│ └── src/
│ ├── lib.rs
Expand Down
Loading