Skip to content

feat: Refactor#153

Merged
shreyas-londhe merged 8 commits intomainfrom
px/refactor
Aug 29, 2025
Merged

feat: Refactor#153
shreyas-londhe merged 8 commits intomainfrom
px/refactor

Conversation

@Bisht13
Copy link
Copy Markdown
Collaborator

@Bisht13 Bisht13 commented Aug 27, 2025

🏗️ Major Repository Refactoring: Modular Architecture & Clean Separation of Concerns

Overview

This PR introduces a comprehensive architectural refactoring of the ProveKit repository, transforming a monolithic structure into a clean, modular design that separates concerns and improves maintainability.

🏗️ New Architecture

Core ProveKit Modules:

  • provekit/common/ - Shared utilities and core types
  • provekit/r1cs-compiler/ - R1CS compilation logic
  • provekit/prover/ - Proving functionality
  • provekit/verifier/ - Verification functionality
  • provekit/tests/ - Integration tests and benchmarks

Tooling & Infrastructure:

  • tooling/cli/ - Command-line interface for prove/verify operations
  • tooling/provekit-bench/ - Dedicated benchmarking infrastructure
  • tooling/provekit-gnark/ - Gnark integration utilities

Research & Experiments:

  • playground/cm31_ntt/ - NTT experiments (moved from root)
  • playground/sage/ - Mathematical research & prototypes

🔧 Key Improvements

Clean Module Separation

  • provekit-common: Core types, utilities, and shared abstractions
  • provekit-r1cs-compiler: Pure compilation logic separated from proving
  • provekit-prover: Focused proving functionality with witness generation
  • provekit-verifier: Standalone verification capabilities

Better Organization

  • Extracted witness generation logic into dedicated modules
  • Moved CLI tools to dedicated tooling/cli crate
  • Separated experimental code from production codebase
  • Clear interfaces between components

🚀 Benefits

  • Faster compilation: Modular crates enable targeted builds
  • Better code reuse: Common functionality centralized
  • Easier testing: Isolated modules enable better unit testing
  • Cleaner dependencies: Each module has focused, minimal dependencies
  • Plugin architecture: New proving backends can easily integrate

🔄 Backward Compatibility

This refactoring maintains API compatibility:

  • External CLI interface unchanged
  • Core proving/verification APIs preserved
  • Existing test programs continue to work
  • All tests pass with new structure

This refactoring establishes a solid foundation for future development while maintaining the high-performance characteristics that make ProveKit suitable for mobile zero-knowledge applications.

@Bisht13 Bisht13 marked this pull request as draft August 27, 2025 17:00
@worldfnd worldfnd deleted a comment from codspeed-hq Bot Aug 28, 2025
@worldfnd worldfnd deleted a comment from codspeed-hq Bot Aug 29, 2025
@Bisht13 Bisht13 marked this pull request as ready for review August 29, 2025 00:57
@Bisht13 Bisht13 requested a review from Copilot August 29, 2025 00:58
Copy link
Copy Markdown
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 introduces a comprehensive architectural refactoring that transforms the ProveKit repository from a monolithic structure into a clean, modular design. It separates concerns by extracting core functionality into focused modules under the provekit/ directory and reorganizes tooling under tooling/.

  • Creates modular ProveKit crates: provekit-common, provekit-r1cs-compiler, provekit-prover, and provekit-verifier
  • Extracts CLI tools into dedicated tooling/cli and benchmarking infrastructure into tooling/provekit-bench
  • Moves experimental code to playground/ and maintains backward compatibility

Reviewed Changes

Copilot reviewed 95 out of 161 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tooling/provekit-gnark/src/lib.rs New lib entry point for Gnark integration utilities
tooling/provekit-gnark/src/gnark_config.rs Refactors imports to use modular provekit-common
tooling/provekit-gnark/Cargo.toml Package rename and dependency restructuring
tooling/provekit-bench/tests/compiler.rs Test suite for compilation with updated imports
tooling/provekit-bench/benches/bench.rs Benchmarking suite with modular imports
tooling/cli/src/cmd/*.rs CLI command implementations using separated modules
provekit/verifier/src/whir_r1cs.rs New verification functionality for WHIR R1CS
provekit/verifier/src/noir_proof_scheme.rs Verification trait implementation
provekit/prover/src/whir_r1cs.rs Proving functionality extracted and modularized
provekit/common/src/lib.rs Core types and utilities shared across modules
skyscraper/*/Cargo.toml Workspace metadata updates for consistency
Comments suppressed due to low confidence (1)

provekit/prover/src/whir_r1cs.rs:1

  • [nitpick] Commented-out code should be removed unless there's a specific reason to keep it. If it's needed for reference, add a comment explaining why it's preserved.
use {

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread provekit/common/src/utils/mod.rs
Comment thread tooling/provekit-bench/benches/bench.rs
Comment thread tooling/provekit-bench/tests/compiler.rs
Comment thread provekit/verifier/src/whir_r1cs.rs
@worldfnd worldfnd deleted a comment from codspeed-hq Bot Aug 29, 2025
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Aug 29, 2025

CodSpeed WallTime Performance Report

Merging #153 will degrade performances by 28.91%

Comparing px/refactor (537d1f3) with main (d91b2f2)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

❌ 4 regressions
✅ 27 untouched benchmarks
🆕 4 new benchmarks
⁉️ 4 dropped benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
⁉️ prove_poseidon_1000 15.8 s N/A N/A
⁉️ prove_poseidon_1000_with_io 17.4 s N/A N/A
⁉️ read_poseidon_1000 1.6 s N/A N/A
⁉️ verify_poseidon_1000 2.3 ms N/A N/A
montgomery_interleaved_3 113 ns 128 ns -11.72%
scalar_mul 95 ns 128 ns -25.78%
simd_mul 112 ns 147 ns -23.81%
block_sqr 91 ns 128 ns -28.91%
🆕 prove_poseidon_1000 N/A 15.5 s N/A
🆕 prove_poseidon_1000_with_io N/A 17.3 s N/A
🆕 read_poseidon_1000 N/A 1.6 s N/A
🆕 verify_poseidon_1000 N/A 1.8 ms N/A

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.

3 participants