Fukuii Repository Structure¶
This document provides an overview of the Fukuii repository organization to help contributors and users understand the layout of the codebase.
Repository Organization¶
fukuii/
├── src/ # Main application source code
├── bytes/ # Vendored: Bytes manipulation library
├── crypto/ # Vendored: Cryptographic utilities
├── rlp/ # Vendored: RLP encoding/decoding
├── scalanet/ # Vendored: Networking library (from IOHK)
├── docker/ # Docker configurations and compose files
├── docs/ # Documentation (ADRs, runbooks, guides)
├── ets/ # Ethereum Test Suite configuration
├── ops/ # Operations configs (Grafana dashboards)
├── tls/ # TLS certificates for testing
├── project/ # SBT build configuration
├── build.sbt # Main SBT build definition
└── [config files] # .scalafmt.conf, .scalafix.conf, etc.
Directory Details¶
Application Source Code¶
src/¶
The main Fukuii application source code, following standard SBT/Scala conventions:
src/main/- Production codescala/com/chipprbots/ethereum/- Main application packageresources/- Configuration files, genesis blocks, etc.-
protobuf/&protobuf_override/- Protocol buffer definitions for external VM interface -
src/test/- Unit tests src/it/- Integration testssrc/rpcTest/- RPC API-specific testssrc/evmTest/- EVM execution testssrc/benchmark/- Performance benchmarkssrc/universal/- Distribution filesbin/- Launcher scriptsconf/- Configuration templates
Vendored Libraries¶
These libraries were vendored (copied into the repository) to provide better control over dependencies and ensure Scala 3 compatibility:
bytes/¶
Simple bytes manipulation utilities. A foundational library used throughout the codebase.
crypto/¶
Cryptographic utilities for Ethereum operations (hashing, signing, key derivation).
rlp/¶
Recursive Length Prefix (RLP) encoding and decoding, the serialization format used in Ethereum.
scalanet/¶
Network layer implementation originally from IOHK. Provides peer-to-peer networking functionality.
Note: These libraries are defined as SBT subprojects in build.sbt and maintain their own src/main/ and src/test/ structure.
Testing & Integration¶
ets/¶
Ethereum Test Suite (ETS) integration:
- ets/tests/ - Git submodule pointing to official Ethereum consensus tests
- ets/config/fukuii/ - Retesteth configuration for Fukuii
- ets/retesteth - Wrapper script for running tests
- test-ets.sh - CI script for running the full test suite
See the Testing Documentation for details on running tests.
tls/¶
TLS certificates and scripts for secure RPC testing: - Self-signed certificates for development/testing - Certificate generation scripts
Operations & Deployment¶
docker/¶
Docker and Docker Compose configurations:
- docker/fukuii/ - Fukuii-specific Docker Compose setup with Prometheus/Grafana
- docker/besu/ - Besu client setup (for comparison testing)
- docker/geth/ - Geth client setup (for comparison testing)
- ops/barad-dur/ - Barad-dûr (Kong) API gateway integration
- docker/scripts/ - Helper scripts
- Dockerfile* - Various Dockerfile variants (prod, dev, distroless, etc.)
See Docker Documentation for comprehensive Docker documentation.
ops/¶
Operational configurations for production deployments:
- ops/barad-dur/ - Barad-dûr (Kong API Gateway) - Production API gateway stack
- ops/cirith-ungol/ - Cirith Ungol - ETC mainnet testing environment
- ops/gorgoroth/ - Gorgoroth - Internal private test network
- ops/grafana/ - Pre-configured Grafana dashboards for monitoring Fukuii nodes
- ops/prometheus/ - Prometheus configuration templates
See ops/README.md and Metrics and Monitoring for details.
docs/¶
Comprehensive documentation:
- docs/adr/ - Architecture Decision Records (ADRs), organized by category (infrastructure, vm, consensus, testing, operations)
- docs/runbooks/ - Operational runbooks for production
- docs/operations/ - Metrics, monitoring, and operational guides
- docs/images/ - Logo and other images
Key documents: - ../adr/README.md - Index of architecture decisions - ../runbooks/README.md - Index of operational runbooks - architecture-overview.md - System architecture
Build System¶
project/¶
SBT build configuration:
- project/build.properties - SBT version
- project/plugins.sbt - SBT plugins
- project/Dependencies.scala - Dependency management
Root Build Files¶
build.sbt- Main build definition with subproject configuration.jvmopts- JVM options for SBT.scalafmt.conf- Code formatting rules (Scalafmt).scalafix.conf- Linting and refactoring rules (Scalafix)version.sbt- Project version
Configuration Files¶
.gitignore- Git ignore patterns.gitmodules- Git submodules (ETS tests).dockerignore- Docker ignore patterns.devcontainer/- VS Code Dev Container / GitHub Codespaces configuration
Build System Architecture¶
Fukuii uses a multi-module SBT build with the following structure:
- Core Application (
nodeproject in root) - Depends on: bytes, crypto, rlp, scalanet, scalanetDiscovery
-
Configurations: compile, test, it, evm, rpcTest, benchmark
-
Vendored Libraries (independent SBT subprojects)
- Each has its own
src/main/andsrc/test/structure - Published as separate artifacts (though currently disabled)
- Can be built/tested independently
Conventions and Standards¶
Code Organization¶
- Package structure:
com.chipprbots.ethereum.* - Scala version: 3.3.4 (LTS)
- JDK version: 21 (LTS)
Testing Conventions¶
- Unit tests:
src/test/scala/ - Integration tests:
src/it/scala/ - Test configurations: Use ScalaTest framework
- Ethereum tests: ETS submodule with retesteth
Documentation Conventions¶
- Architecture decisions: ADRs in
docs/adr/ - Operational guides: Runbooks in
docs/runbooks/ - API documentation: ScalaDoc in source code
- External docs: Markdown in
docs/
Development Workflow¶
Quick Start¶
# Clone with submodules
git clone --recursive https://github.com/chippr-robotics/fukuii.git
cd fukuii
# Build
sbt compile
# Run tests
sbt test
# Format and check code
sbt pp # "prepare PR" - formats, checks, and tests
# Build distribution
sbt dist
Testing¶
# Unit tests
sbt test
# Integration tests
sbt IntegrationTest/test
# RPC tests
sbt RpcTest/test
# EVM tests
sbt Evm/test
# Ethereum Test Suite
./test-ets.sh
Code Quality¶
# Format all code
sbt formatAll
# Check formatting
sbt formatCheck
# Run static analysis
sbt runScapegoat
# Coverage report
sbt testCoverage
Historical Context¶
This repository is a continuation of the Mantis Ethereum Classic client originally developed by Input Output (HK). Key changes:
- Rebranding (2024): Mantis → Fukuii
- Package:
io.iohk.ethereum→com.chipprbots.ethereum -
Binary:
mantis→fukuii -
Scala 3 Migration (October 2024)
- Scala 2.13 → Scala 3.3.4 (LTS)
- Akka → Apache Pekko
- Monix → Cats Effect 3
-
Vendored Dependencies
- scalanet: Networking library (needed for Scala 3 compatibility)
- bytes, crypto, rlp: Core utilities extracted as modules
Related Documentation¶
- Getting Started - Getting started and features
- Contributing Guide - Contribution guidelines
- Architecture Diagrams - C4 architecture diagrams
- Vendored Modules Plan - Plan for integrating vendored modules
Questions?¶
For questions about the repository structure or where to add new code:
- Check existing code for similar functionality
- Follow the package structure in
src/main/scala/ - Refer to Contributing Guide
- Ask in GitHub Discussions or open an issue