-
Notifications
You must be signed in to change notification settings - Fork 31
New and Modified passport-input-gen library #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the Provekit proving API to support in-memory inputs (via InputMap) while preserving TOML-based proving, and adds a new passport-input-gen workspace crate that can generate Noir-compatible passport circuit inputs (TBS-720 and TBS-1300) including Poseidon2/partial-SHA256 commitment chains and a unified CLI.
Changes:
- Refactor
provekit_prover::ProvesoproveacceptsInputMap, and addprove_with_tomlfor file-driven proving. - Update CLI/FFI/bench callers to use
prove_with_tomlwhere TOML inputs are provided. - Add
playground/passport-input-gencrate with Poseidon2 + partial SHA256 utilities, commitment computation, input struct generation, TOML writers, and a new interactive CLI.
Reviewed changes
Copilot reviewed 13 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tooling/provekit-ffi/src/ffi.rs | Switch FFI proving to prove_with_toml for TOML input paths. |
| tooling/provekit-bench/tests/compiler.rs | Update bench test to prove from TOML via prove_with_toml. |
| tooling/provekit-bench/benches/bench.rs | Update benchmarks to use TOML proving helper. |
| tooling/cli/src/cmd/prove.rs | CLI prove now uses prove_with_toml for TOML inputs. |
| provekit/prover/src/lib.rs | Change prove to accept InputMap; add prove_with_toml. |
| playground/passport-input-gen/src/poseidon2.rs | Add Noir-compatible Poseidon2 implementation + tests. |
| playground/passport-input-gen/src/partial_sha256.rs | Add partial SHA256 state computation matching Noir. |
| playground/passport-input-gen/src/parser/types.rs | Split TBS sizing constants for 720 vs 1300 and add Merkle constants. |
| playground/passport-input-gen/src/mock_generator.rs | Add padded-TBS mock SOD generator and update tests to new APIs. |
| playground/passport-input-gen/src/lib.rs | Major refactor: new configs, circuit input structs, commitment chaining, TOML output, and tests. |
| playground/passport-input-gen/src/commitment.rs | Add Noir-compatible commitment/packing utilities + tests. |
| playground/passport-input-gen/src/bin/passport_cli/span_stats.rs | Add tracing span-based perf/memory stats layer. |
| playground/passport-input-gen/src/bin/passport_cli/profiling_alloc.rs | Add global allocator tracking for CLI profiling. |
| playground/passport-input-gen/src/bin/passport_cli/main.rs | Add unified interactive CLI for generating inputs and proofs. |
| playground/passport-input-gen/Cargo.toml | Wire new dependencies and use workspace edition. |
| Cargo.toml | Include playground/passport-input-gen in workspace members. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pub fn poseidon2_permutation(state: &mut [Fr; 4]) { | ||
| let rc_full1 = load_rc_full1(); | ||
| let rc_full2 = load_rc_full2(); | ||
| let rc_partial = load_rc_partial(); | ||
| let diag = load_diag(); |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
poseidon2_permutation reloads all round constants and the diagonal (including repeated hex decoding) on every permutation call. This is extremely expensive and will dominate runtime for any non-trivial use of Poseidon2. Consider hoisting these constants into static/LazyLock values (or representing them as pre-parsed limb arrays) so they are initialized once and reused across calls.
| // Build padded TBS: DSC pubkey DER + incrementing non-zero pattern | ||
| let dsc_pub_der = dsc_pub.to_pkcs1_der().expect("pkcs1 der").to_vec(); | ||
| let mut tbs_bytes = dsc_pub_der.clone(); | ||
|
|
||
| // Fill remaining bytes up to tbs_actual_len with non-zero pattern | ||
| let mut next_byte = (tbs_bytes.len() as u8).wrapping_add(1); | ||
| while tbs_bytes.len() < tbs_actual_len { | ||
| tbs_bytes.push(next_byte); | ||
| next_byte = if next_byte == 253 { 1 } else { next_byte + 1 }; | ||
| } |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generate_fake_sod_with_padded_tbs pads by appending bytes until tbs_bytes.len() >= tbs_actual_len. If tbs_actual_len is smaller than the DSC pubkey DER length, the function silently returns a longer TBS (no truncation), and it also doesn’t enforce that the requested length is within the circuit bounds (e.g., >720 for the 1300 path and <=1300). Add explicit validation of tbs_actual_len against the minimum DER size and the intended min/max sizes, or adjust the API/docs to match the actual behavior.
No description provided.