This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Build workspace:
just borjust build-native - Lint:
just lorjust lint-native - Format:
just forjust fmt-native-fix - Run all tests:
just torjust tests - Run specific test:
cargo nextest run --package [package-name] --test [test-name] - Run single test:
cargo nextest run --package [package-name] --test [test-name] -- [test_function_name] - Documentation:
just test-docs
- MSRV: 1.88
- Format with nightly rustfmt:
cargo +nightly fmt - Imports: organized by crate, reordered automatically
- Error handling: use proper error types, prefer
Result<T, E>over panics - Naming: follow Rust conventions (snake_case for variables/functions, CamelCase for types)
- Prefer type-safe APIs and strong typing
- Documentation: rustdoc for public APIs, clear comments for complex logic
- Tests: write unit and integration tests for all functionality
- Performance: be mindful of allocations and copying, prefer references where appropriate
- No warnings policy: all clippy warnings are treated as errors (-D warnings)
Kona is a monorepo for OP Stack types, components, and services built in Rust. The repository is organized into several major categories:
client: The fault proof program that executes state transitions on a proverhost: Native program serving as the Preimage Oracle servernode: Rollup Node implementation with flexible chain ID supportsupervisor: Supervisor implementation for interop coordination
derive:no_stdcompatible derivation pipeline implementationprotocol: Core protocol types used across OP Stack rust cratesgenesis: Genesis types for OP Stack chainsinterop: Core functionality for OP Stack Interop featuresregistry: Rust bindings for superchain-registrycomp: Compression types and utilitieshardforks: Consensus layer hardfork types and network upgrade transactions
executor:no_stdstateless block executorproof: High-level OP Stack state transition proof SDKproof-interop: Extension ofkona-proofwith interop supportmpt: Merkle Patricia Trie utilities for client programpreimage: High-level PreimageOracle ABI interfacesstd-fpvm: Platform-specific Fault Proof VM kernel APIsdriver: Stateful derivation pipeline driver
service: OP Stack rollup node service implementationengine: Extensible rollup node engine clientrpc: OP Stack RPC types and extensionsp2p: P2P networking including Gossip and Discoverysources: Data source types and utilities
core: Core supervisor functionalityservice: Supervisor service implementationrpc: Supervisor RPC types and clientstorage: Database storage layertypes: Common types for supervisor components
- Testing: The project uses
nextestfor test execution. Online tests are excluded by default and can be run separately withjust test-online - Cross-compilation: Docker-based builds for
cannon(MIPS) andasterisc(RISC-V) targets - Documentation: Both rustdoc and a separate documentation site at rollup.yoga
- Monorepo Integration: Pins and integrates with the Optimism monorepo for action tests
rust-toolchain.toml: Pins Rust version to 1.88rustfmt.toml: Custom formatting configuration with crate-level import groupingclippy.toml: MSRV configuration for clippydeny.toml: Dependency auditing and license compliancerelease.toml: Configuration forcargo-releasetool
- Native development on standard platforms
- Cross-compilation support for fault proof VMs:
- MIPS64 (cannon target)
- RISC-V (asterisc target)
no_stdcompatibility for proof components
- Heavy use of Alloy ecosystem for Ethereum types
- OP-specific extensions via op-alloy
- Modular feature flags for different compilation targets
- Workspace-level dependency management with version pinning