Skip to content

refactor: drop pk1 from c1 circuit#1486

Merged
ctrlc03 merged 3 commits into
mainfrom
refactor/remove-c1-pk1
Mar 26, 2026
Merged

refactor: drop pk1 from c1 circuit#1486
ctrlc03 merged 3 commits into
mainfrom
refactor/remove-c1-pk1

Conversation

@cedoor

@cedoor cedoor commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor
    • Simplified threshold public key generation circuit by removing a redundant input parameter.
    • The second component of the threshold public key is now implicitly derived from the system's common reference string, streamlining the input requirements.

@cedoor cedoor requested review from 0xjei and ctrlc03 March 26, 2026 14:53
@coderabbitai

coderabbitai Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3b915410-3f18-4e83-bf21-452bfb09c843

📥 Commits

Reviewing files that changed from the base of the PR and between 73b8ab0 and 7f786b3.

📒 Files selected for processing (7)
  • circuits/bin/threshold/pk_generation/src/main.nr
  • circuits/lib/src/core/threshold/pk_generation.nr
  • crates/zk-helpers/src/circuits/threshold/pk_generation/codegen.rs
  • crates/zk-helpers/src/circuits/threshold/pk_generation/computation.rs
  • crates/zk-helpers/src/circuits/threshold/pk_generation/mod.rs
  • crates/zk-helpers/src/circuits/threshold/pk_generation/sample.rs
  • crates/zk-prover/tests/local_e2e_tests.rs
💤 Files with no reviewable changes (1)
  • crates/zk-helpers/src/circuits/threshold/pk_generation/sample.rs

📝 Walkthrough

Walkthrough

This PR removes the explicit pk1 witness component from the threshold public key generation circuit. The second public key component is now derived from the hardcoded CRS polynomial a instead of being provided as a separate witness parameter, simplifying the circuit interface and inputs structure.

Changes

Cohort / File(s) Summary
Noir Circuit Definition
circuits/bin/threshold/pk_generation/src/main.nr, circuits/lib/src/core/threshold/pk_generation.nr
Removed pk1is parameter from the main entrypoint and PkGeneration struct. Updated constructor and public key commitment computation to use the CRS polynomial a instead of a separate pk1 witness.
Computation and Code Generation
crates/zk-helpers/src/circuits/threshold/pk_generation/computation.rs, crates/zk-helpers/src/circuits/threshold/pk_generation/codegen.rs
Removed pk1is field from the Inputs struct and eliminated associated assertions/extraction logic. Updated parallel computation to exclude the a-derived pk1is limb aggregation.
Documentation and Tests
crates/zk-helpers/src/circuits/threshold/pk_generation/mod.rs, crates/zk-helpers/src/circuits/threshold/pk_generation/sample.rs, crates/zk-prover/tests/local_e2e_tests.rs
Updated module documentation to reflect that pk1 is implicitly the CRS polynomial a. Removed assertion validating pk1is.limbs.len() from sample generation test. Modified end-to-end test to compute and use derived polynomial a for commitment consistency verification.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • gnosisguild/enclave#1268 — Earlier PR that added pk1/pk1is support to pk_generation circuit; this PR reverses that direction by removing pk1is and using CRS a instead.
  • gnosisguild/enclave#1281 — Modifies threshold PK generation circuit wiring and witness handling; may require updates to align with removal of pk1is witness.
  • gnosisguild/enclave#1306 — Touches the same pk_generation code files in crates/lib and crates/zk-helpers, affecting related configuration and input handling.

Suggested labels

noir

Suggested reviewers

  • 0xjei
  • ctrlc03

Poem

🐰 A witness removed, the CRS stays true,
No extra component to shuffle through,
Just pk0 and the hardcoded a,
Simpler circuits lead the way! ✨

🚥 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 accurately describes the main change: removing the pk1 parameter from the public key generation circuit (c1), which is the primary objective across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/remove-c1-pk1

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.

@cedoor cedoor linked an issue Mar 26, 2026 that may be closed by this pull request
@vercel

vercel Bot commented Mar 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
crisp Ready Ready Preview, Comment Mar 26, 2026 2:54pm
enclave-docs Ready Ready Preview, Comment Mar 26, 2026 2:54pm

Request Review

@cedoor cedoor changed the title refactor: drop pk1 from c1 circuit refactor: drop pk1 from c1 circuit Mar 26, 2026

@ctrlc03 ctrlc03 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

utACK

@ctrlc03 ctrlc03 enabled auto-merge (squash) March 26, 2026 15:03
@ctrlc03 ctrlc03 merged commit 1f806c9 into main Mar 26, 2026
33 of 35 checks passed
@ctrlc03 ctrlc03 deleted the refactor/remove-c1-pk1 branch March 26, 2026 15:41
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.

Drop redundant pk1 witness from C1

2 participants