Skip to content

Conversation

@ch4r10t33r
Copy link
Collaborator

Summary

This PR transforms leanpoint into a production-ready checkpoint sync provider with:

  • SSZ Binary Format Support: Properly deserialize finalized state from Lean Ethereum nodes
  • Monorepo Architecture: Complete React web UI for real-time monitoring
  • v0 API Endpoints: Updated to use /lean/v0/* and /v0/health endpoints
  • Improved Error Handling: Better diagnostics for unreachable services and API failures
  • Docker with UI: Complete web interface bundled in Docker image

Key Features

Backend Enhancements:

  • Parse SSZ-encoded finalized state to extract slot data (bytes 8-15 as u64 little-endian)
  • Support for /lean/v0/states/finalized and /lean/v0/checkpoints/justified endpoints
  • New /api/upstreams endpoint exposing detailed upstream health and consensus data
  • Static file serving for web UI
  • Thread-safe upstream state access with mutex
  • Comprehensive error reporting for connection failures, timeouts, and API errors

Frontend (New):

  • React + TypeScript + Vite web UI
  • Real-time checkpoint status monitoring
  • Per-upstream health tracking table
  • Consensus visualization
  • Auto-refresh every 5 seconds
  • Responsive design inspired by checkpointz

Build System:

  • Unified Makefile for backend + frontend builds
  • Docker image includes complete web UI (~8MB binary + 155KB frontend)
  • Development workflow with hot reload (make dev)

Refactoring:

  • Renamed all Beam* types to Lean* for consistency
  • Updated terminology from "beacon nodes" to "lean nodes"
  • Consolidated documentation into single README.md

CI/CD:

  • Fixed Zig 0.14.1 compatibility
  • Comprehensive CI workflow from zeam
  • Auto-release workflow

Test Plan

  • Build backend successfully with zig build
  • Build frontend successfully with make build-web
  • Test SSZ deserialization with local zeam nodes
  • Verify v0 endpoints work with zeam, ream, lantern
  • Test consensus algorithm with multiple upstreams
  • Verify Docker image includes web UI
  • Test /api/upstreams endpoint returns correct data
  • Confirm static file serving works
  • Validate frontend loads and displays real-time data
  • Test with both local devnet and remote nodes

Breaking Changes

  • Default health endpoint path changed from /health to /v0/health
  • Finalized endpoint changed from /lean/states/finalized to /lean/v0/states/finalized
  • Configuration files need to be regenerated with new endpoint paths

Related Issues

Implements checkpoint sync monitoring for Lean Ethereum ecosystem.

Update lean_api.zig to parse SSZ-encoded state data from
/lean/states/finalized endpoint. The slot is extracted from
the first 8 bytes (little-endian u64) of the SSZ-encoded
BeaconState structure.

Since /lean/states/justified returns 404, use finalized slot
for both justified and finalized until correct endpoint is found.
Changes:
- Add ssz.zig library dependency from blockblaz/ssz.zig
- Update lean_api.zig to parse SSZ-encoded BeamState from /lean/states/finalized
- Extract slot directly from bytes 8-15 (second field in BeamState after genesis_time)
- Remove fallback to JSON parsing (endpoint returns pure SSZ binary)
- Add upstreams-zeam-only.json for testing with zeam client only

Note: Currently only zeam client implements /lean/states/finalized endpoint correctly.
Other clients (ream, qlean, lantern, etc.) return metrics or error messages instead.
Replace BeamState with LeanState and BeamBlockHeader with LeanBlockHeader
to align with Lean Ethereum naming conventions.
Changes:
- Update /health to /v0/health
- Update /lean/states/finalized to /lean/v0/states/finalized
- Update /lean/states/justified to /lean/v0/states/justified

These endpoints will work once remote lean node images are updated.
Adds a complete web interface inspired by checkpointz for monitoring
leanpoint checkpoint sync status and upstream lean nodes.

Backend changes:
- Add /api/upstreams endpoint to expose detailed upstream status
- Add static file serving for web-dist/ frontend assets
- Add UpstreamsData structures for API serialization
- Add mutex to UpstreamManager for thread-safe access
- Update AppState to reference UpstreamManager

Frontend additions:
- React + TypeScript + Vite setup in web/ directory
- StatusCard component for overall checkpoint status
- UpstreamsTable component for per-upstream monitoring
- CSS theming matching checkpointz aesthetic
- API client for backend communication

Build system:
- Add Makefile with unified build targets
- Support for development workflow (make dev)
- Clean separation of backend/frontend builds

Documentation:
- Add MONOREPO_GUIDE.md with comprehensive usage guide
- Add web/README.md for frontend development
- Update .gitignore for frontend artifacts
Updates Dockerfile to build and ship the React web UI alongside the
Zig backend. The Docker image now includes a complete monorepo deployment.

Changes:
- Add Node.js to build stage for frontend compilation
- Build web UI during Docker image creation
- Copy web-dist/ to /usr/share/leanpoint/web/ in runtime image
- Update default CMD to serve web UI automatically
- Update MONOREPO_GUIDE.md with corrected Docker instructions

The Docker image now provides a complete web interface out of the box.
Access the UI at http://localhost:5555 when running the container.
Merges all monorepo documentation into the main README for a single
source of truth. The README now covers both backend and frontend with
updated quick start, development workflow, and deployment instructions.
Runs zig fmt on all source files to fix formatting issues.
Adds .eslintrc.cjs for frontend linting with TypeScript and React rules.
Removes upstreams-*.json files from git tracking, keeping only
upstreams.example.json as a template. User-specific configs should
be generated locally and are now properly ignored.

Updates .gitignore to exclude all upstreams-*.json except the example.
@ch4r10t33r ch4r10t33r merged commit 9a2e216 into main Jan 26, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants