Skip to content

Conversation

@x-senpai-x
Copy link
Collaborator

No description provided.

@x-senpai-x x-senpai-x marked this pull request as ready for review February 12, 2026 19:00
Copilot AI review requested due to automatic review settings February 12, 2026 19:00
@x-senpai-x x-senpai-x marked this pull request as draft February 12, 2026 19:01
Copy link
Contributor

Copilot AI left a 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::Prove so prove accepts InputMap, and add prove_with_toml for file-driven proving.
  • Update CLI/FFI/bench callers to use prove_with_toml where TOML inputs are provided.
  • Add playground/passport-input-gen crate 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.

Comment on lines +200 to +204
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();
Copy link

Copilot AI Feb 12, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +206 to +215
// 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 };
}
Copy link

Copilot AI Feb 12, 2026

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.

Copilot uses AI. Check for mistakes.
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.

1 participant