Skip to content

feat: link C2 to C3/C4 [skip-line-limit]#1510

Merged
0xjei merged 9 commits into
mainfrom
ref/c2-back-link-c3-c4
Apr 7, 2026
Merged

feat: link C2 to C3/C4 [skip-line-limit]#1510
0xjei merged 9 commits into
mainfrom
ref/c2-back-link-c3-c4

Conversation

@0xjei

@0xjei 0xjei commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

this PR aims to complete the link of C2, C3 and C4 DKG circuits. There are a few things worth mentioning about the changes that have been conducted in this PR

  • replaced the chunked C2 architecture (base + chunk + batch) with the previous, monholithic circuit. We decided to do this since we are going to run with secure parameters with no more than 20 nodes first.
  • C2 now outputs per-party share commitments that C3 consumes as expected_message_commitment and C4 consumes as expected_commitments. This closes the gap where a node could have used different share values across these circuits without detection.

happy to jump into details for any further review!

Summary by CodeRabbit

  • Refactor

    • DKG share-computation split into two inner circuits (C2a/C2b) with an optional wrapper for recursive aggregation; proof generation and verification now distinguish inner vs wrapper proofs.
  • Bug Fixes / Reliability

    • Commitment-consistency checks expanded and made more precise across proof stages; verification picks the correct inner or wrapper verification path.
  • Documentation

    • Circuit docs, READMEs and config tables updated to reflect the C2 split and wrapper layout.
  • Tools / CLI

    • CLI/tooling simplified to target the unified share-computation circuit and updated artifact names/paths.

@vercel

vercel Bot commented Apr 7, 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 Apr 7, 2026 10:14am
enclave-docs Ready Ready Preview, Comment Apr 7, 2026 10:14am

Request Review

@coderabbitai

coderabbitai Bot commented Apr 7, 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: 5fb81386-eaa7-43cd-9372-00e00388ad61

📥 Commits

Reviewing files that changed from the base of the PR and between c71f1f8 and c9c1f1b.

📒 Files selected for processing (3)
  • agent/flow-trace/04_DKG_AND_COMPUTATION.md
  • crates/events/src/enclave_event/proof.rs
  • crates/zk-helpers/src/circuits/output_layout.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • crates/zk-helpers/src/circuits/output_layout.rs
  • crates/events/src/enclave_event/proof.rs

📝 Walkthrough

Walkthrough

Consolidates DKG C2 into two inner recursive circuits (C2a: SK, C2b: ESM) plus an optional recursive wrapper (ShareComputation); removes base/chunk/batch artifacts; introduces unified share-computation logic, updated configs, prover/wrapper verification paths, commitment-link APIs, and documentation/tests updates. (34 words)

Changes

Cohort / File(s) Summary
Docs & Flow
agent/flow-trace/04_DKG_AND_COMPUTATION.md, circuits/README.md, circuits/lib/src/README.md, docs/pages/cryptography.mdx, crates/zk-helpers/README.md
Documented C2 → C2a/C2b split and optional wrapper; clarified verification/commitment semantics and removed chunk/batch references.
Removed circuit packages
circuits/bin/dkg/sk_share_computation_base/*, circuits/bin/dkg/e_sm_share_computation_base/*, circuits/bin/dkg/share_computation_chunk/*, circuits/bin/dkg/share_computation_chunk_batch/*, circuits/bin/dkg/share_computation/*
Deleted manifests, READMEs, and Noir entrypoints for base/chunk/batch/final wrapper pipeline.
Inner circuits added/renamed
circuits/bin/dkg/sk_share_computation/*, circuits/bin/dkg/e_sm_share_computation/*
Added/renamed SK and ESM inner circuits (Nargo.toml, README, main.nr) exposing single-entrypoint inner proofs.
DKG workspace & wrapper
circuits/bin/dkg/Nargo.toml, circuits/bin/recursive_aggregation/wrapper/dkg/share_computation/src/main.nr, circuits/bin/recursive_aggregation/wrapper/README.md
Trimmed workspace to inner circuits; made wrapper N_PUBLIC_INPUTS dynamic and updated wrapper docs.
Core circuit refactor
circuits/lib/src/core/dkg/share_computation.nr (new), deleted .../base.nr, .../chunk.nr, .../mod.nr
Added unified implementations for SecretKeyShareComputation and SmudgingNoiseShareComputation (commitment check, consistency, range, parity, commit helpers); removed base/chunk modules.
Configs
circuits/lib/src/configs/secure/dkg.nr, circuits/lib/src/configs/insecure/dkg.nr
Replaced chunk-specific configs with unified ShareComputationConfigs; added SHARE_COMPUTATION_SK_CONFIGS and SHARE_COMPUTATION_E_SM_CONFIGS; removed chunk/batch sizing and expected-VK-hash globals.
Commitment ordering changes
circuits/lib/src/core/dkg/share_decryption.nr, crates/zk-helpers/src/circuits/dkg/share_decryption/computation.rs
Reversed polynomial coefficient ordering when computing share-encryption commitments to match new inner proof layout.
Events & proof types
crates/events/src/enclave_event/proof.rs, crates/events/src/enclave_event/signed_proof.rs
Replaced base/chunk variants with SkShareComputation/ESmShareComputation; added wrapper_artifact_circuit(); updated ProofType::circuit_names() to include inner + wrapper and adjusted output layout.
Prover orchestration
crates/multithread/src/multithread.rs
Removed chunk/batch pipeline; produce single inner proof then optional wrapper via generate_wrapper_proof; added wrapper-aware verification path (zk_verify_share_proof_bundle) and refined per-job IDs.
zk-prover core
crates/zk-prover/src/circuits/dkg/share_computation.rs, crates/zk-prover/src/circuits/recursive_aggregation/mod.rs, crates/zk-prover/src/circuits/utils.rs, crates/zk-prover/src/prover.rs, crates/zk-prover/src/witness.rs, crates/zk-prover/src/lib.rs
Removed multi-stage proof helpers and non-ZK recursive helper; updated wrapper-proof generation to use inner/wrapper distinction; removed public APIs tied to deleted flows; improved I/O error wrapping.
Commitment-links & checker
crates/zk-prover/src/actors/commitment_links/mod.rs, .../c0_to_c3.rs, .../c1_to_c5.rs, .../c2_to_c3.rs (new), .../c2_to_c4.rs (new), .../c4a_to_c6.rs, .../c4b_to_c6.rs, .../c6_to_c7.rs, crates/zk-prover/src/actors/commitment_consistency_checker.rs, crates/zk-prover/src/actors/mod.rs
Introduced check_signals() API and extended check_consistency signature to accept source/target party IDs; renamed implementations; added C2→C3 and C2→C4 links enforcing per-modulus/per-party matches; find_mismatches now passes party IDs; removed public re-export of CommitmentConsistencyChecker.
zk-helpers: codegen & utils
crates/zk-helpers/src/circuits/dkg/share_computation/{circuit.rs,codegen.rs,computation.rs,mod.rs,utils.rs}
Removed base/chunk codepaths, chunking support and expected-VK-hash resolution; simplified codegen to single ShareComputationCircuit and reduced generated configs.nr.
Commitment helper removal
crates/zk-helpers/src/circuits/commitments.rs
Removed public compute_share_encryption_commitment_from_shares and its unit test (commitment computation moved into inner circuits).
Output layout & constants
crates/zk-helpers/src/circuits/output_layout.rs
Removed SHARE_COMPUTATION_CHUNK_BATCH_OUTPUTS and related fixed-output constants/tests.
CLI & tests
crates/zk-helpers/src/bin/zk_cli.rs, crates/test-helpers/src/lib.rs, crates/tests/tests/integration.rs, crates/zk-prover/tests/local_e2e_tests.rs
CLI consolidated share-computation generation (dropped --chunk_idx); find_bb reads E3_CUSTOM_BB; tests updated to compile/run inner circuits only and write pinned version metadata.

Sequence Diagram(s)

sequenceDiagram
    participant Prover as ZK Prover
    participant Inner as Inner C2 Proof (C2a/C2b)
    participant Wrapper as Wrapper Circuit (ShareComputation)
    participant Verifier as Verifier/Actor

    Prover->>Inner: Generate inner proof (witness, configs)
    Inner->>Inner: Verify commitment, consistency, range, parity
    Inner-->>Prover: Inner proof (signed inner payload)

    alt Wrapper aggregation enabled
        Prover->>Wrapper: generate_wrapper_proof(inner proof)
        Wrapper->>Wrapper: Re-verify inner proof, compress public inputs
        Wrapper-->>Prover: Wrapper proof (ShareComputation)
        Prover->>Verifier: Emit DKGInnerProofReady (inner + wrapper)
    else No wrapper
        Prover->>Verifier: Emit DKGInnerProofReady (inner only)
    end

    Verifier->>Verifier: Select verification path
    alt proof.circuit == ShareComputation (wrapper)
        Verifier->>Verifier: verify_wrapper_proof (wrapper VK)
    else inner circuit
        Verifier->>Verifier: bb verify with inner VK
    end
    Verifier-->>Verifier: Validation result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

ciphernode

Suggested reviewers

  • zahrajavar
  • ctrlc03

Poem

🐰 Two inner circuits hop into place, neat and spry,
No more chunk-chains rolling by.
Wrapper folds proofs with a gentle squeeze,
Commitments matched, no mismatched keys.
Hooray — small hops, a cleaner sky!

🚥 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 PR title 'feat: link C2 to C3/C4' accurately describes the primary change: establishing commitment linkages between the C2 share-computation circuit and both C3 and C4 circuits, which is the main focus of this PR according to the objectives.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ref/c2-back-link-c3-c4

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.

@0xjei 0xjei changed the title feat: link C2 to C3/C4 feat: link C2 to C3/C4 [skip-line-limit] Apr 7, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/zk-helpers/src/circuits/dkg/share_decryption/computation.rs (1)

330-344: ⚠️ Potential issue | 🔴 Critical

Reverse coefficients in test to match implementation's commitment computation.

The Inputs::compute method reverses coefficients before computing expected_commitments (lines 191-198), but this test computes direct_commitment using non-reversed share_coeffs at line 333. The assertion at line 339 will fail because the two commitment values are computed with different coefficient orderings.

Proposed fix
         for (party_idx, party_cts) in sample.honest_ciphertexts.iter().enumerate() {
             for mod_idx in 0..threshold_l {
                 let decrypted_pt = sample.secret_key.try_decrypt(&party_cts[mod_idx]).unwrap();
-                let share_coeffs = decrypted_pt.value.deref().to_vec();
+                let mut share_coeffs = decrypted_pt.value.deref().to_vec();
+                share_coeffs.reverse();
                 let direct_commitment = compute_share_encryption_commitment_from_message(
                     &Polynomial::from_u64_vector(share_coeffs),
                     msg_bit,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/zk-helpers/src/circuits/dkg/share_decryption/computation.rs` around
lines 330 - 344, The test computes direct_commitment from share_coeffs in
sample.honest_ciphertexts but Inputs::compute reverses coefficients before
computing expected_commitments; to fix, reverse the coefficient order the same
way as Inputs::compute before creating the Polynomial used in
compute_share_encryption_commitment_from_message (i.e., take
share_coeffs.deref().to_vec(), reverse it, then call Polynomial::from_u64_vector
on the reversed vector) so the commitment comparison in the loop over
sample.honest_ciphertexts matches the implementation.
🧹 Nitpick comments (6)
crates/zk-helpers/src/circuits/dkg/share_decryption/computation.rs (1)

191-196: Comment references C3 but should reference C2 for consistency with Noir circuit.

The Noir circuit comment (lines 55-56 in share_decryption.nr) correctly states this reversal matches "C2's commit_to_party_shares", but this comment references C3. Since C4 (share_decryption) consumes commitments from C2 per the PR description, the comment should be consistent.

📝 Suggested comment fix
-                // Reverse to match C3's message witness, which is constructed as
-                // `pt.value.reversed()` before committing (share_encryption/computation.rs).
+                // Reverse to match C2's commit_to_party_shares, which stores coefficients
+                // highest-degree-first.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/zk-helpers/src/circuits/dkg/share_decryption/computation.rs` around
lines 191 - 196, The inline comment that says "Reverse to match C3's message
witness..." is incorrect; update it to reference C2 to match the Noir circuit
and PR description. Edit the comment immediately above the reversed_coeffs logic
and the compute_share_encryption_commitment_from_message call so it reads that
the reversal matches C2's commit_to_party_shares (and optionally mention
share_decryption.nr lines 55-56), ensuring the comment consistently references
C2 instead of C3.
circuits/lib/src/core/dkg/share_computation.nr (1)

285-297: Add a regression test for the share-commitment serialization contract.

The new linkage relies on two non-obvious invariants here: outputs are serialized as [party][modulus], and each share polynomial is reversed before committing. A focused cross-circuit test against the C3/C4 commitment path would make this much safer to refactor.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@circuits/lib/src/core/dkg/share_computation.nr` around lines 285 - 297, Add a
regression test that asserts the share-commitment serialization contract:
construct shares the same way as in the loop (build share_coeffs by reversing
y[coeff_idx][mod_idx][party_idx + 1], create Polynomial::new(share_coeffs), and
call compute_share_encryption_commitment_from_message::<N, BIT_SHARE>) and
verify the commitments matrix is serialized as [party][modulus]; compare those
commitments byte-for-byte against the C3/C4 commitment path that builds its
`message` witness via `pt.value.reversed()` to ensure both the reversal and the
[party][modulus] ordering match exactly.
crates/zk-helpers/src/bin/zk_cli.rs (1)

265-271: Redundant condition in show_input_type.

Line 269 checks circuit_name == ShareComputationCircuit::NAME but this is already covered by requires_inputs_arg (set on line 265). The OR clause is always false when requires_inputs_arg is true for ShareComputationCircuit.

Similarly, line 271 duplicates the same check that's already part of requires_inputs_arg.

Simplify the redundant conditions
-    let show_input_type = requires_inputs_arg || circuit_name == ShareComputationCircuit::NAME;
+    let show_input_type = requires_inputs_arg;

-    let dkg_input_type = if circuit_name == ShareComputationCircuit::NAME || requires_inputs_arg {
+    let dkg_input_type = if requires_inputs_arg {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/zk-helpers/src/bin/zk_cli.rs` around lines 265 - 271, The conditions
are redundant: remove the duplicate checks against ShareComputationCircuit::NAME
because requires_inputs_arg already covers them; update the computation of
show_input_type to simply use requires_inputs_arg, and update the dkg_input_type
condition to use only requires_inputs_arg (and any other distinct checks that
remain) so that circuit_name == ShareComputationCircuit::NAME is not repeated;
adjust the expressions referencing requires_inputs_arg, show_input_type, and
dkg_input_type accordingly.
crates/zk-helpers/src/circuits/dkg/share_computation/codegen.rs (1)

43-49: Minor: Explicit closure in error mapping is equivalent but more verbose.

The change from map_err(CircuitsErrors::SerdeJson) to map_err(|e| CircuitsErrors::SerdeJson(e)) is functionally equivalent since CircuitsErrors::SerdeJson is a tuple variant constructor. Both approaches work, but the original was slightly more concise.

♻️ Optional: Revert to concise form
 pub fn generate_toml(witness: &Inputs) -> Result<CodegenToml, CircuitsErrors> {
     let json = witness
         .to_json()
-        .map_err(|e| CircuitsErrors::SerdeJson(e))?;
+        .map_err(CircuitsErrors::SerdeJson)?;
 
     Ok(toml::to_string(&json)?)
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/zk-helpers/src/circuits/dkg/share_computation/codegen.rs` around lines
43 - 49, In generate_toml, revert the verbose closure used in error mapping back
to the concise constructor form: replace map_err(|e|
CircuitsErrors::SerdeJson(e)) with map_err(CircuitsErrors::SerdeJson) so the
CircuitsErrors::SerdeJson tuple-variant is passed directly; this keeps behavior
identical but restores the shorter, idiomatic form.
crates/zk-prover/tests/local_e2e_tests.rs (2)

565-594: Test name may be misleading after simplification.

The test test_share_computation_sk_commitment_consistency now only validates that:

  1. The proof generates successfully
  2. The circuit tag is correct
  3. Public signals are non-empty and not all zeros

It no longer actually verifies "commitment consistency" against an independently computed expected value (as other commitment consistency tests in this file do, e.g., test_pk_generation_commitment_consistency).

Consider either renaming the test to reflect its current scope (e.g., test_share_computation_sk_proof_validity) or adding assertions that compare the public signals against expected commitment values from ShareComputationCircuit::compute().

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/zk-prover/tests/local_e2e_tests.rs` around lines 565 - 594, The test
function test_share_computation_sk_commitment_consistency no longer checks
commitment consistency — either rename it to reflect its current checks (e.g.,
change the function name to test_share_computation_sk_proof_validity and update
any references) or restore the missing assertions by computing the expected
commitment via ShareComputationCircuit::compute() and comparing it to the
produced output: convert proof.public_signals with
public_signals_to_fields(&proof.public_signals) and assert equality/consistency
against the computed expected fields from ShareComputationCircuit::compute() (or
the appropriate method that returns expected commitments), keeping the existing
checks (circuit tag, non-empty/non-zero public signals) intact.

206-207: Consider compiling only the required circuit for this test.

Both sk_share_computation and e_sm_share_computation circuits are compiled here, but since the sample uses DkgInputType::SecretKey, only the SK circuit should be needed for proof generation. The same applies to setup_share_computation_e_sm_test at lines 239-240.

If both are required by the ShareComputationCircuit implementation, a brief comment explaining why would help future maintainers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/zk-prover/tests/local_e2e_tests.rs` around lines 206 - 207, The test
currently compiles both circuits via setup_compiled_circuit(&backend, "dkg",
"sk_share_computation") and setup_compiled_circuit(&backend, "dkg",
"e_sm_share_computation") even though the test uses DkgInputType::SecretKey;
either remove the unnecessary e_sm compilation (leave only the SK compile) or,
if ShareComputationCircuit requires both variants, add a brief clarifying
comment in the test explaining why both sk_share_computation and
e_sm_share_computation are needed for proof generation; update the analogous
setup in setup_share_computation_e_sm_test the same way.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@circuits/bin/recursive_aggregation/wrapper/dkg/share_computation/src/main.nr`:
- Around line 13-17: The comment describing public outputs is stale: update the
comment above the N_PUBLIC_INPUTS declaration to reflect that N_PUBLIC_INPUTS =
(L_THRESHOLD * N_PARTIES) + 1 represents one public batch_key_hash parameter
plus L_THRESHOLD per-party share commitments for each of the N_PARTIES (i.e.,
total commitments = L_THRESHOLD * N_PARTIES, plus the single batch_key_hash),
and remove the obsolete "3 public outputs" / "(key_hash, commitment) return
tuple" wording; reference N_PUBLIC_INPUTS, L_THRESHOLD, and N_PARTIES in the new
comment.

In `@crates/zk-helpers/src/circuits/output_layout.rs`:
- Around line 32-34: The doc comment for CircuitOutputLayout::Dynamic
incorrectly describes the dynamic C2 return shape as `[[Field; L]; N]`; update
the text to reflect that inner circuits now return one commitment vector per
party, i.e. `[[Field; L]; N_PARTIES]`, so the doc comment and signal-layout
contract reference `N_PARTIES` (or the appropriate party-count identifier used
in the file) instead of `N`.

---

Outside diff comments:
In `@crates/zk-helpers/src/circuits/dkg/share_decryption/computation.rs`:
- Around line 330-344: The test computes direct_commitment from share_coeffs in
sample.honest_ciphertexts but Inputs::compute reverses coefficients before
computing expected_commitments; to fix, reverse the coefficient order the same
way as Inputs::compute before creating the Polynomial used in
compute_share_encryption_commitment_from_message (i.e., take
share_coeffs.deref().to_vec(), reverse it, then call Polynomial::from_u64_vector
on the reversed vector) so the commitment comparison in the loop over
sample.honest_ciphertexts matches the implementation.

---

Nitpick comments:
In `@circuits/lib/src/core/dkg/share_computation.nr`:
- Around line 285-297: Add a regression test that asserts the share-commitment
serialization contract: construct shares the same way as in the loop (build
share_coeffs by reversing y[coeff_idx][mod_idx][party_idx + 1], create
Polynomial::new(share_coeffs), and call
compute_share_encryption_commitment_from_message::<N, BIT_SHARE>) and verify the
commitments matrix is serialized as [party][modulus]; compare those commitments
byte-for-byte against the C3/C4 commitment path that builds its `message`
witness via `pt.value.reversed()` to ensure both the reversal and the
[party][modulus] ordering match exactly.

In `@crates/zk-helpers/src/bin/zk_cli.rs`:
- Around line 265-271: The conditions are redundant: remove the duplicate checks
against ShareComputationCircuit::NAME because requires_inputs_arg already covers
them; update the computation of show_input_type to simply use
requires_inputs_arg, and update the dkg_input_type condition to use only
requires_inputs_arg (and any other distinct checks that remain) so that
circuit_name == ShareComputationCircuit::NAME is not repeated; adjust the
expressions referencing requires_inputs_arg, show_input_type, and dkg_input_type
accordingly.

In `@crates/zk-helpers/src/circuits/dkg/share_computation/codegen.rs`:
- Around line 43-49: In generate_toml, revert the verbose closure used in error
mapping back to the concise constructor form: replace map_err(|e|
CircuitsErrors::SerdeJson(e)) with map_err(CircuitsErrors::SerdeJson) so the
CircuitsErrors::SerdeJson tuple-variant is passed directly; this keeps behavior
identical but restores the shorter, idiomatic form.

In `@crates/zk-helpers/src/circuits/dkg/share_decryption/computation.rs`:
- Around line 191-196: The inline comment that says "Reverse to match C3's
message witness..." is incorrect; update it to reference C2 to match the Noir
circuit and PR description. Edit the comment immediately above the
reversed_coeffs logic and the compute_share_encryption_commitment_from_message
call so it reads that the reversal matches C2's commit_to_party_shares (and
optionally mention share_decryption.nr lines 55-56), ensuring the comment
consistently references C2 instead of C3.

In `@crates/zk-prover/tests/local_e2e_tests.rs`:
- Around line 565-594: The test function
test_share_computation_sk_commitment_consistency no longer checks commitment
consistency — either rename it to reflect its current checks (e.g., change the
function name to test_share_computation_sk_proof_validity and update any
references) or restore the missing assertions by computing the expected
commitment via ShareComputationCircuit::compute() and comparing it to the
produced output: convert proof.public_signals with
public_signals_to_fields(&proof.public_signals) and assert equality/consistency
against the computed expected fields from ShareComputationCircuit::compute() (or
the appropriate method that returns expected commitments), keeping the existing
checks (circuit tag, non-empty/non-zero public signals) intact.
- Around line 206-207: The test currently compiles both circuits via
setup_compiled_circuit(&backend, "dkg", "sk_share_computation") and
setup_compiled_circuit(&backend, "dkg", "e_sm_share_computation") even though
the test uses DkgInputType::SecretKey; either remove the unnecessary e_sm
compilation (leave only the SK compile) or, if ShareComputationCircuit requires
both variants, add a brief clarifying comment in the test explaining why both
sk_share_computation and e_sm_share_computation are needed for proof generation;
update the analogous setup in setup_share_computation_e_sm_test the same way.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d689e9da-5399-4fc2-875c-bb3e27f10086

📥 Commits

Reviewing files that changed from the base of the PR and between 279c7a6 and 5b1200b.

📒 Files selected for processing (64)
  • agent/flow-trace/04_DKG_AND_COMPUTATION.md
  • circuits/README.md
  • circuits/bin/dkg/Nargo.toml
  • circuits/bin/dkg/e_sm_share_computation/Nargo.toml
  • circuits/bin/dkg/e_sm_share_computation/README.md
  • circuits/bin/dkg/e_sm_share_computation/src/main.nr
  • circuits/bin/dkg/e_sm_share_computation_base/Nargo.toml
  • circuits/bin/dkg/e_sm_share_computation_base/README.md
  • circuits/bin/dkg/e_sm_share_computation_base/src/main.nr
  • circuits/bin/dkg/share_computation/README.md
  • circuits/bin/dkg/share_computation/src/main.nr
  • circuits/bin/dkg/share_computation_chunk/Nargo.toml
  • circuits/bin/dkg/share_computation_chunk/README.md
  • circuits/bin/dkg/share_computation_chunk/src/main.nr
  • circuits/bin/dkg/share_computation_chunk_batch/README.md
  • circuits/bin/dkg/share_computation_chunk_batch/src/main.nr
  • circuits/bin/dkg/sk_share_computation/Nargo.toml
  • circuits/bin/dkg/sk_share_computation/README.md
  • circuits/bin/dkg/sk_share_computation/src/main.nr
  • circuits/bin/dkg/sk_share_computation_base/Nargo.toml
  • circuits/bin/dkg/sk_share_computation_base/README.md
  • circuits/bin/dkg/sk_share_computation_base/src/main.nr
  • circuits/bin/recursive_aggregation/wrapper/README.md
  • circuits/bin/recursive_aggregation/wrapper/dkg/share_computation/src/main.nr
  • circuits/lib/src/README.md
  • circuits/lib/src/configs/insecure/dkg.nr
  • circuits/lib/src/configs/secure/dkg.nr
  • circuits/lib/src/core/dkg/share_computation.nr
  • circuits/lib/src/core/dkg/share_computation/base.nr
  • circuits/lib/src/core/dkg/share_computation/chunk.nr
  • circuits/lib/src/core/dkg/share_computation/mod.nr
  • circuits/lib/src/core/dkg/share_decryption.nr
  • crates/events/src/enclave_event/proof.rs
  • crates/events/src/enclave_event/signed_proof.rs
  • crates/multithread/src/multithread.rs
  • crates/test-helpers/src/lib.rs
  • crates/tests/tests/integration.rs
  • crates/zk-helpers/README.md
  • crates/zk-helpers/src/bin/zk_cli.rs
  • crates/zk-helpers/src/circuits/commitments.rs
  • crates/zk-helpers/src/circuits/dkg/share_computation/circuit.rs
  • crates/zk-helpers/src/circuits/dkg/share_computation/codegen.rs
  • crates/zk-helpers/src/circuits/dkg/share_computation/computation.rs
  • crates/zk-helpers/src/circuits/dkg/share_computation/mod.rs
  • crates/zk-helpers/src/circuits/dkg/share_computation/utils.rs
  • crates/zk-helpers/src/circuits/dkg/share_decryption/computation.rs
  • crates/zk-helpers/src/circuits/output_layout.rs
  • crates/zk-prover/src/actors/commitment_consistency_checker.rs
  • crates/zk-prover/src/actors/commitment_links/c0_to_c3.rs
  • crates/zk-prover/src/actors/commitment_links/c1_to_c5.rs
  • crates/zk-prover/src/actors/commitment_links/c2_to_c3.rs
  • crates/zk-prover/src/actors/commitment_links/c2_to_c4.rs
  • crates/zk-prover/src/actors/commitment_links/c4a_to_c6.rs
  • crates/zk-prover/src/actors/commitment_links/c4b_to_c6.rs
  • crates/zk-prover/src/actors/commitment_links/c6_to_c7.rs
  • crates/zk-prover/src/actors/commitment_links/mod.rs
  • crates/zk-prover/src/circuits/dkg/share_computation.rs
  • crates/zk-prover/src/circuits/recursive_aggregation/mod.rs
  • crates/zk-prover/src/circuits/utils.rs
  • crates/zk-prover/src/lib.rs
  • crates/zk-prover/src/prover.rs
  • crates/zk-prover/src/witness.rs
  • crates/zk-prover/tests/local_e2e_tests.rs
  • docs/pages/cryptography.mdx
💤 Files with no reviewable changes (20)
  • circuits/bin/dkg/share_computation_chunk_batch/README.md
  • circuits/bin/dkg/sk_share_computation_base/Nargo.toml
  • circuits/bin/dkg/share_computation_chunk/README.md
  • circuits/bin/dkg/sk_share_computation_base/README.md
  • circuits/bin/dkg/share_computation_chunk/Nargo.toml
  • circuits/bin/dkg/e_sm_share_computation_base/README.md
  • circuits/bin/dkg/share_computation/README.md
  • circuits/bin/dkg/e_sm_share_computation_base/Nargo.toml
  • circuits/bin/dkg/share_computation_chunk/src/main.nr
  • crates/zk-prover/src/lib.rs
  • crates/zk-prover/src/circuits/utils.rs
  • circuits/bin/dkg/e_sm_share_computation_base/src/main.nr
  • crates/zk-helpers/src/circuits/commitments.rs
  • circuits/bin/dkg/sk_share_computation_base/src/main.nr
  • circuits/lib/src/core/dkg/share_computation/chunk.nr
  • circuits/bin/dkg/share_computation/src/main.nr
  • circuits/bin/dkg/share_computation_chunk_batch/src/main.nr
  • crates/zk-helpers/src/circuits/dkg/share_computation/circuit.rs
  • circuits/lib/src/core/dkg/share_computation/mod.nr
  • circuits/lib/src/core/dkg/share_computation/base.nr

Comment thread crates/zk-helpers/src/circuits/output_layout.rs
Comment thread crates/zk-helpers/src/circuits/output_layout.rs Outdated
@cedoor cedoor requested a review from zahrajavar April 7, 2026 09:59
Comment thread agent/flow-trace/04_DKG_AND_COMPUTATION.md Outdated
@0xjei

0xjei commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

#1510 (comment) solved via chat

@0xjei 0xjei enabled auto-merge (squash) April 7, 2026 10:21
@0xjei 0xjei merged commit a07fd4d into main Apr 7, 2026
33 checks passed
@github-actions github-actions Bot deleted the ref/c2-back-link-c3-c4 branch April 15, 2026 03:22
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.

Cross-circuit check: C2/C3→C4 — verify C4 expected_commitments match C3 message commitments

2 participants