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
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: ci
on:
push:
pull_request:
jobs:
lean:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install elan
run: |
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain none
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"
- name: Fetch Mathlib cache
run: lake exe cache get
- name: Build
run: lake build
- name: Build tests
run: lake build RandTest
- name: Axiom audit
run: scripts/audit.sh
generated:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust 1.98.1
run: rustup toolchain install 1.98.1 --profile minimal
- name: Cache exporter build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
exporter/target
key: exporter-${{ runner.os }}-${{ hashFiles('exporter/Cargo.lock', 'exporter/Cargo.toml', 'SOURCES.toml') }}
- name: Regenerate and diff Rand/Generated
run: scripts/check-generated.sh
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.lake/
build/
third_party/
exporter/target/
31 changes: 31 additions & 0 deletions ASSUMPTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Assumptions

Every assumption below matches a named Lean hypothesis (a `structure` field or
a theorem argument, never an `axiom`). The list is the initial one and grows
with the proofs.

- **Known gap: the Poseidon2 round constants are a development seed
(`research/src/poseidon2_constants.rs`, listed in `research/AGENTS.md`), not
the published constants. Replacing them changes every chain hash and needs a
chain cut, which is outside this project; publication does not wait on it.**
- STARK/FRI soundness with the deployed parameters (RV32: blowup 3, 80
queries, 20 PoW bits; rVM: blowup 4 per rate ¼, 92 queries, 24 PoW bits),
and LogUp/permutation bus soundness ⇒ multiset equality.
- Poseidon2, BLAKE3, Keccak-f, SHA-256 behave as their bus contracts say.
- Dilithium2 EUF-CMA; validator signatures unforgeable.
- The Rust compiler, Plonky3 prover/verifier code, the RV32 guest toolchain,
and the RV32→rVM constraint emitter are trusted.
- Honest replicas persist safety state before voting; < 1/3 Byzantine stake
per epoch; epoch hand-off.
- The RV32 lookup contracts (`Rand.rv32Contract`: RANGE8, POW2, AND4, OR4,
XOR4) are justified by the fixed tables' contents plus bus soundness: the
exporter prints the range and nibble chips' `preprocessed_trace`s into
`Rand/Generated/RV32/Tables.lean`, and `RandTest/Contracts.lean` checks each
contract against those rows by `decide`. The table chips' own AIRs (that the
provided multiplicities are the only entries on those buses) are not yet
proved; M2 proves them.
- The exporter (`exporter/`, `air2lean`) is trusted to translate Plonky3's
symbolic constraint DAG faithfully. It fails on any leaf, bus or interaction
kind it does not translate; `scripts/check-generated.sh` (CI job
`generated`) regenerates `Rand/Generated/` from the pinned circuits commit
and fails on any difference.
28 changes: 28 additions & 0 deletions Audit.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Lean
import Rand

/-!
# Axiom audit

Every theorem in `published` may depend only on `propext`, `Classical.choice`
and `Quot.sound`. `scripts/audit.sh` runs this file and fails on any other axiom
(which also catches `native_decide`, via `Lean.ofReduceBool`).
-/

open Lean Elab Command

/-- The published theorems (listed in `PROVEN.md`). Empty until Task 5 onward. -/
def published : List Name := []

def allowedAxioms : List Name := [`propext, `Classical.choice, `Quot.sound]

run_cmd do
let mut bad := false
for n in published do
let axs ← liftCoreM <| collectAxioms n
let extra := axs.filter (fun a => !allowedAxioms.contains a)
logInfo m!"{n}: {axs.toList}"
if !extra.isEmpty then
bad := true
logError m!"{n} depends on disallowed axioms: {extra.toList}"
if !bad then logInfo m!"audit ok: {published.length} theorem(s)"
Loading
Loading