Skip to content

feat: CLI --backend override and prime-aware witness writing, add Justfile#126

Open
erhant wants to merge 1 commit into
erhant/riwr-attemptsfrom
feat/cli-backend-flag-and-witness-prime
Open

feat: CLI --backend override and prime-aware witness writing, add Justfile#126
erhant wants to merge 1 commit into
erhant/riwr-attemptsfrom
feat/cli-backend-flag-and-witness-prime

Conversation

@erhant

@erhant erhant commented Jun 28, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a CLI-level proving-backend override and makes witness serialization prime-aware (correct n8 for non-bn128 fields), with supporting tests and developer workflow recipes.

Changes:

  • Add --backend to the CLI and plumb an optional backend override through Circomkit::prove.
  • Make .wtns writing depend on the circuit’s prime via prime_field_n8(prime) and add unit tests for roundtrips.
  • Add a Justfile with common workspace tasks (fmt/lint/test variants).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Justfile Adds just recipes for fmt/lint/test and feature-enabled variants.
crates/circomkit/tests/e2e/prove.rs Updates prove calls for new signature and adds an e2e test validating backend override precedence.
crates/circomkit/src/lib.rs Re-exports ProvingBackendKind for downstream/CLI convenience.
crates/circomkit/src/circomkit/prove.rs Adds backend: Option<ProvingBackendKind> override to prove; passes circuit prime into witness writer.
crates/circomkit/src/circomkit/compile.rs Refactors freshness checks to a let-chain style.
crates/circomkit-prove/src/lambdaworks/convert.rs Adjusts proof field access to match expected reference types.
crates/circomkit-core/src/utils/witness.rs Makes witness writing prime-aware (variable n8) and adds unit tests.
crates/circomkit-core/src/utils/primes.rs Introduces prime_field_n8 helper + tests for expected n8 values.
crates/circomkit-core/src/utils/mod.rs Re-exports prime_field_n8.
crates/circomkit-core/src/enums.rs Adds Display/FromStr for ProvingBackendKind (CLI parsing + roundtrip tests).
crates/circomkit-cli/src/main.rs Adds --backend option to prove subcommand and forwards it into Circomkit::prove.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +171 to +172
let dir = std::env::temp_dir().join("circomkit_wtns_n8");
std::fs::create_dir_all(&dir).unwrap();
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.

2 participants