Skip to content

Conversation

@batmendbar
Copy link
Collaborator

@batmendbar batmendbar commented Oct 29, 2025

Summary

This PR implements SPARK, a proof system used to verify deferred evaluations of R1CS (Rank-1 Constraint System) matrix MLEs (Multilinear Extensions).
SPARK extends the prover and verifier stack to support deferred computation flows in WHIR, improving efficiency while maintaining correctness and soundness guarantees.

Key Changes

  • Added core SPARK module implementing deferred evaluation proofs for R1CS matrices.
  • Added supporting CLI tooling for SPARK proof generation and verification.
  • Added option to the recursive verifier to prove evaluation through SPARK.

Motivation

Deferred evaluation of MLEs improves prover efficiency by allowing WHIR to use lazily computed values which are verified later in the proof flow. SPARK provides a mechanism to prove that these deferred evaluations are consistent and correct, ensuring soundness while maintaining performance.

New end-to-end flow:

noirup --version v1.0.0-beta.11
cd noir-examples/noir-passport-examples/complete_age_check
nargo compile
cargo run --release --bin provekit-cli prepare ./target/complete_age_check.json -p ./noir-provekit-prover.pkp -v ./noir-provekit-verifier.pkv
cargo run --release --bin provekit-cli prove ./noir-provekit-prover.pkp ./Prover.toml -o ./noir-proof.np
cargo run --release --bin provekit-cli verify ./noir-provekit-verifier.pkv ./noir-proof.np
cargo run --release --bin provekit-cli generate-gnark-inputs ./noir-provekit-prover.pkp ./noir-proof.np
cargo run --release --bin spark-cli -- prove --noir-proof-scheme ./noir-provekit-prover.pkp --noir-proof ./noir-proof.np 
cargo run --release --bin spark-cli -- verify --spark-proof spark_proof.json --noir-proof ./noir-proof.np 
cd ../../../recursive-verifier/cmd/cli
go run . --evaluation spark --config ../../../noir-examples/noir-passport-examples/complete_age_check/params_for_recursive_verifier --spark_config ../../../noir-examples/noir-passport-examples/complete_age_check/gnark_spark_proof.json --r1cs ../../../noir-examples/noir-passport-examples/complete_age_check/r1cs.json --saveKeys "./keys" 


@batmendbar batmendbar marked this pull request as ready for review October 30, 2025 09:58
@batmendbar batmendbar requested review from kustosz and recmo October 30, 2025 10:00
@batmendbar batmendbar changed the title Spark Implement SPARK Prover Integration for Deferred R1CS Evaluations Oct 30, 2025
@batmendbar batmendbar changed the title Implement SPARK Prover Integration for Deferred R1CS Evaluations Implement SPARK Integration for Deferred R1CS Evaluations Oct 30, 2025
- name: Build provekit-cli
run: cargo build --release --bin provekit-cli

- name: Build provekit-cli
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Build provekit-cli
- name: Build spark-cli

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: This file should be deleted.


// Compute weights from R1CS instance
let alphas = calculate_external_row_of_r1cs_matrices(alpha, r1cs);
let alphas = calculate_external_row_of_r1cs_matrices(alpha.clone(), r1cs);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Please send a reference to alpha.

num_terms_4batched: num_terms_4batched_config.clone(),
};

let mut io = IOPattern::new("💥");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: this should be a separate function.

transcriptT[i] = uints.NewU8(cfg.Transcript[i])
}

sparkTranscriptT := make([]uints.U8, len(sparkConfig.Transcript))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sparkTranscriptT that T at the end seems like a typo that we had for quite a while, and it got reused here

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.

4 participants