How risc0/kailua works
Project Type and Purpose
• Kailua is a hybrid on-chain/off-chain rollup fault-proving system that uses RISC-Zero zkVM proofs to finalize or dismiss rollup outputs.
• The on-chain environment lives in crates/contracts/foundry/src and contains the Solidity contracts (the “Dispute Game” factory and game logic) that govern proposer/validator interactions, collateral, and proof verification.
Key On-Chain Components to Model
a. DisputeGameFactory
• Deploys new instances of KailuaGame.
• Holds global configuration (timeouts, collateral parameters).
• Tracks active game instances.
b. KailuaGame (Fault Proof Contract)
• Manages a single dispute:
• Proposer calls propose() to submit a new output.
• Challenger calls challenge() to lock collateral and start a dispute.
• Either party submits a zkVM proof via submitProof() (off-chain computed by RISC-Zero).
• finalize() or dismiss() is called based on proof validity.
• Enforces collateral lockup and slashing rules.
c. ERC-20 Collateral Token (if used; could be ETH/wrapped ETH)
• Abstract as a “Collateral Vault” component.
d. zkVM Verifier Library
• Imported or embedded in the game contract to verify proofs on-chain.
External Systems and Off-Chain Actors
• Proposer Agent (CLI in bin/cli)
• Watches OP Stack devnet.
• Calls factory/game contracts to propose outputs.
• Computes proofs when challenged.
• Validator Agent (CLI in bin/cli or bin/host)
• Detects disputes.
• Calls game contract to challenge and submit proofs.
• RISC-Zero zkVM
• Runs Kona VM execution traces.
• Generates SNARKs or proof artifacts.
• Interacts off-chain with contracts via JSON-RPC.