Overview
Jolt’s R1CS (Rank-1 Constraint System) encodes the zkVM’s correctness conditions as a set of uniform equality-conditional constraints. Unlike traditional zkVMs that use constraint-per-step layouts, Jolt’s uniform structure applies the same constraints to every execution step, dramatically simplifying the constraint system.Role in the Proving System
The R1CS constraint system is proved via Spartan, a sumcheck-based SNARK:- Input: Execution trace converted to witness polynomials (instruction flags, register values, etc.)
- Constraints: Uniform R1CS rows encoding instruction semantics and state transitions
- Proving: Spartan IOP reduces R1CS satisfaction to polynomial evaluations via sumcheck
- Output: Opening claims verified via batched polynomial commitments
Uniform Equality-Conditional Constraints
Structure
Each constraint has the form:Az,Bzare multilinear polynomials over witness/public inputsxindexes into execution steps- No
Czterm needed (all constraints are equality checks)
Uniformity
The same set of constraints applies to every step:- Dramatically smaller constraint system than per-step approaches
- Enables efficient batching via sumcheck protocol
- Leverages instruction flags for conditional activation
Constraint Organization
Linear Combinations
Constraints are built from linear combinations (LC) of terms:
- Instruction flags (circuit flags for each instruction type)
- Register values (
rs1,rs2,rd) - Memory addresses and values
- Lookup outputs (via virtual polynomials)
Univariate-Skip Split
Constraints are divided into two groups for the univariate-skip optimization: First Group (R1CS_CONSTRAINTS_FIRST_GROUP):
- Constraints with boolean guards and small (~64-bit) magnitudes
- Optimized for efficient univariate-skip first round
- Size:
OUTER_UNIVARIATE_SKIP_DOMAIN_SIZE(typically 64)
R1CS_CONSTRAINTS_SECOND_GROUP):
- Constraints with wider arithmetic (e.g., multiplication bounds)
- Processed in subsequent sumcheck rounds
- Complement of first group
Example Constraints
Instruction Consistency
flag_add is true (encoding the ADD instruction).
Memory Access
Lookup Correctness
R1CS Inputs
Virtual Polynomials
Jolt uses virtual polynomials (not explicitly committed) derived from committed witness:InstructionFlags: One-hot encoding of instruction typeRegisterValues: Contents of registersrs1,rs2,rdRamAddress,RamValue: Memory access address and valuePC: Program counter
Public Inputs
Public inputs embedded in constraints:- Instruction immediates (from bytecode)
- Memory layout parameters
- Program I/O bounds
Constraint Generation
Compile-Time Definition
Constraints are statically defined at compile time:Runtime Evaluation
During proving, constraints are evaluated over the execution trace:- Bind to step: Evaluate Az(x), Bz(x) at specific execution step x
- Check satisfaction: Verify Az(x) · Bz(x) = 0
- Sumcheck reduction: Aggregate all steps via sumcheck protocol
Key Type: UniformSpartanKey
UniformSpartanKey stores:
- Constraint structure (Az, Bz polynomials)
- Padding parameters
- Univariate-skip split metadata
Product Virtualization
Some R1CS constraints reference virtual products from outer sumcheck:Integration with Spartan
The R1CS constraints are proved via the Spartan IOP:- Outer sumcheck: Reduces R1CS satisfaction to Az, Bz evaluations
- Product virtual sumcheck: Handles deferred products
- Opening proofs: Verifies polynomial evaluations via commitment scheme
Performance Characteristics
- Constraint count: ~50-100 uniform constraints (independent of trace length)
- Prover time: Dominated by sumcheck polynomial bindings
- Verifier time: O(num_constraints · log(trace_length))
- Proof size: Logarithmic in trace length (via Spartan)
Key Files
jolt-core/src/zkvm/r1cs/constraints.rs: Constraint definitionsjolt-core/src/zkvm/r1cs/evaluation.rs: Runtime constraint evaluationjolt-core/src/zkvm/r1cs/key.rs: UniformSpartanKey structurejolt-core/src/zkvm/r1cs/inputs.rs: R1CS input polynomial mapping
Next Steps
- Spartan IOP: How R1CS constraints are proved
- Witness Generation: Creating witness polynomials from traces
- Instruction Execution: Lookup-based instruction verification