refactor: rename witness to inputs in zk-helpers#1301
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR systematically refactors the zero-knowledge circuit infrastructure by renaming the "Witness" abstraction to "Inputs" across computation, codegen, and trait layers. The changes include type renames, field updates, method signatures, CLI flags, documentation, and test adjustments. Control flow and logic remain functionally identical. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@crates/zk-helpers/src/circuits/threshold/decrypted_shares_aggregation/computation.rs`:
- Around line 10-11: The module doc comment incorrectly references
Input::standard_form but the struct is named Inputs; update the intra-doc link
to the correct identifier (e.g., Inputs::standard_form) so rustdoc resolves the
link—search for the doc comment at the top of computation.rs and replace
`Input::standard_form` with the exact public item name `Inputs::standard_form`
(or adjust to `crate::...::Inputs::standard_form` if needed) to match the actual
struct/method symbol.
🧹 Nitpick comments (5)
crates/zk-helpers/src/bin/zk_cli.rs (1)
230-230: Minor grammar nit: "a inputs-type" → "an inputs-type".- // DKG circuits have a inputs-type choice (secret-key vs smudging-noise) excluding `pk` or C0 circuit. + // DKG circuits have an inputs-type choice (secret-key vs smudging-noise) excluding `pk` or C0 circuit.crates/zk-prover/tests/local_e2e_tests.rs (1)
230-230: Stale comment: still says "from the witness".- // Recompute commitments from the witness + // Recompute commitments from the inputscrates/zk-helpers/src/circuits/threshold/share_decryption/codegen.rs (1)
39-43: Inconsistent ownership:generate_tomltakesInputsby value here but by reference elsewhere.The DKG share_decryption codegen (
crates/zk-helpers/src/circuits/dkg/share_decryption/codegen.rs, Line 42) and share_encryption codegen both accept&Inputs. This file takesInputsby value. Consider taking&Inputsfor consistency across codegen modules.♻️ Suggested fix
-pub fn generate_toml(inputs: Inputs) -> Result<CodegenToml, CircuitsErrors> { - let json = inputs.to_json().map_err(|e| CircuitsErrors::SerdeJson(e))?; +pub fn generate_toml(inputs: &Inputs) -> Result<CodegenToml, CircuitsErrors> { + let json = inputs.to_json().map_err(|e| CircuitsErrors::SerdeJson(e))?;And at the call site (Line 32):
- let toml = generate_toml(inputs)?; + let toml = generate_toml(&inputs)?;examples/CRISP/crates/zk-inputs/src/lib.rs (1)
122-128: Variable names still reference "witness" despite the rename.
ciphertext_addition_witness_jsonanduser_data_encryption_witness_jsonstill use "witness" terminology. SinceCiphertextAdditionWitnesswasn't renamed in this PR, the first is arguably fine, butuser_data_encryption_witness_json(Line 123) could be updated touser_data_encryption_inputs_jsonto align with the.inputsfield access on Line 124.Same applies to the duplicate in
generate_inputsat Lines 190-192.crates/zk-helpers/src/circuits/threshold/pk_aggregation/computation.rs (1)
46-46: Nit: unnecessary double-reference&input.
inputis already&PkAggregationCircuitInput(from the method signature). Passing&inputcreates&&PkAggregationCircuitInput, which works via auto-deref but is unnecessary and inconsistent with sibling computation modules (e.g.,dkg/pk/computation.rs,share_decryption/computation.rs) which passinputdirectly.Suggested fix
- let inputs = Inputs::compute(preset, &input)?; + let inputs = Inputs::compute(preset, input)?;
Re #1302
Summary by CodeRabbit
Release Notes