Skip to content

refactor: update pk bfv computation & polynomial utilities#1254

Merged
cedoor merged 4 commits into
mainfrom
refactor/pk-bfv-computation
Feb 3, 2026
Merged

refactor: update pk bfv computation & polynomial utilities#1254
cedoor merged 4 commits into
mainfrom
refactor/pk-bfv-computation

Conversation

@cedoor

@cedoor cedoor commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • Refactor

    • Simplified polynomial utility functions; removed deprecated reduction and centering helpers
    • Streamlined circuit computation APIs for improved usability
    • Restructured witness representation for better data organization
  • Bug Fixes

    • Enhanced error handling for polynomial operations with improved error propagation

@cedoor cedoor requested a review from 0xjei February 2, 2026 16:39
@vercel

vercel Bot commented Feb 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
crisp Skipped Skipped Feb 3, 2026 1:00pm
enclave-docs Skipped Skipped Feb 3, 2026 1:00pm

Request Review

@coderabbitai

coderabbitai Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • templates/default/Cargo.lock is excluded by !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

This PR refactors polynomial reduction and centering utilities by removing higher-level wrapper functions and replacing them with direct primitive operations. It updates ZK-helpers circuit types from Vec<Vec> to CrtPolynomial, migrates CircuitComputation implementations to Computation trait, and updates JSON mapping utilities accordingly.

Changes

Cohort / File(s) Summary
Polynomial Utilities
crates/polynomial/benches/polynomial.rs, crates/polynomial/src/utils.rs
Removed wrapper functions for reduce_and_center, center_coefficients_mut, reduce_in_ring, reduce_coefficients, and related variants. Updated benchmarks to use individual reduce and center calls instead of combined operations.
ZK-Helpers Trait and Error Handling
crates/zk-helpers/src/circuits/computation.rs, crates/zk-helpers/src/circuits/errors.rs
Changed CircuitComputation trait compute method from instance method to associated function (removed &self). Added CrtPolynomialError variant to CircuitsErrors enum with automatic conversion support.
ZK-Helpers PK-BFV Circuit
crates/zk-helpers/src/circuits/pk_bfv/computation.rs, crates/zk-helpers/src/circuits/pk_bfv/codegen.rs, crates/zk-helpers/src/circuits/pk_bfv/circuit.rs
Changed Witness fields pk0is and pk1is from Vec<Vec> to CrtPolynomial. Migrated PkBfvCircuit implementation from CircuitComputation to Computation. Removed ReduceToZkpModulus trait usage and updated witness computation pipeline.
ZK-Helpers Configuration and Utilities
crates/zk-helpers/Cargo.toml, crates/zk-helpers/src/utils.rs
Enabled serde feature for e3-polynomial dependency. Renamed and refactored map_witness_2d_vector_to_json to crt_polynomial_to_toml_json with CrtPolynomial parameter instead of Vec<Vec>.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

noir

Suggested reviewers

  • 0xjei

Poem

🐰 The wrapper functions hop away today,
As primitives emerge to play and sway,
CrtPolynomials dance where vectors did dwell,
Traits transform their shapes—a refactoring spell!
Cleaner pipelines bloom, more direct and bright,
One trait now governs the compute in flight! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor: update pk bfv computation & polynomial utilities' accurately summarizes the main changes: refactoring of PkBfv computation logic and polynomial utility functions across multiple files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/pk-bfv-computation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel vercel Bot temporarily deployed to Preview – crisp February 3, 2026 13:00 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs February 3, 2026 13:00 Inactive

@0xjei 0xjei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tACK

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