Skip to content
NyxFoundationPublic

About

Experimental design for a Lean 4-verified RISC-V consensus-layer STF prototype

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

CL ASM

Lean proofs and RISC-V code for Ethereum consensus-layer operations. The v0 target is weigh_justification_and_finalization: a 175-instruction RV64 routine (700 bytes) whose Lean contract proves the specified state transition, resource preservation, and return within 175 steps. The same bytes run as a ZisK zkVM guest.

The standalone aggregate routine computes the caller's three balances in 78 RV64 instructions (312 bytes), with a proved bound of 52 * N + 24 steps. Its generated ELF is checked against the pinned official reference; its ZisK integration is not yet included.

  • DESIGN.md: scope, ABI, memory layout, trust boundaries.
  • Roadmap: why the consensus layer is being proved, zkVM findings, PoC decisions, and remaining work.
  • Whole-routine contract: preconditions, calling witness, official-reference tests.
  • Balance aggregation: internal ABI, proof, JSON-lines runner, and per-validator step counts.
  • Build and validate: toolchain, commands, test coverage, and the ZisK guest.
  • Benchmarks: host interpreter timing and ZisK results.
lake --no-cache --wfail build
python3 -m venv .venv && .venv/bin/python -m pip install -r tests/requirements.txt
lake env lean scripts/CheckAxioms.lean
.lake/build/bin/cl-asm build && .lake/build/bin/cl-asm-test build
.venv/bin/python -m unittest discover -s tests -v

Requires elan (Lean 4.33.0 is pinned), Python 3.12+, GNU RISC-V binutils, and a clang with the RISC-V target for the ZisK guest.

The Lean proofs cover the modeled instruction sequence. ELF generation, loading, the interpreter conversion, and the ZisK wrapper are checked by tests, not proved.

About

Experimental design for a Lean 4-verified RISC-V consensus-layer STF prototype

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages