Skip to content

refactor(circuits)!: aggregate C6 proofs over Chonk - #2532

Open
ctrlc03 wants to merge 16 commits into
large/nodes-fold-threefrom
large/c6-chonk
Open

ctrlc03 wants to merge 16 commits into
large/nodes-fold-threefrom
large/c6-chonk

Conversation

@ctrlc03

@ctrlc03 ctrlc03 commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

Split from #2398 (Zara's work). Stacked on #2531 (large/nodes-fold-three); review that one first.

A decryption aggregated its T + 1 C6 proofs (one per selected member) with a sequential fold: one
recursive proof per leaf. This aggregates them with Chonk instead, in one stack.

  • c6_chonk_app verifies all T + 1 C6 proofs, checks they share the first leaf's domain, and places
    their sk, esm, ct and d commitments by slot (lib::math::c6_chonk_rows), then the init, tail and
    hiding kernels close the stack. T + 1 must stay within the stack's ECCVM bound (24 C3-sized
    proofs). Slot indices are private witnesses; two leaves cannot share a slot, and every slot must
    be written, so the ciphertext commitment is bound in all of them.
  • c6_chonk_tube verifies the stack's Chonk proof as a rollup proof, and c6_chonk_root closes its
    IPA claim. A root rollup closes exactly two claims, so the root takes the tube twice under the
    tube key and states only the first; the final IPA check fails unless both are valid. The root
    exposes the hash of the tube's seven key hashes (its own, the tube, the hiding kernel, C6, app,
    init, tail) before the data.
  • decryption_aggregator verifies c6_chonk_root and requires c6_fold_key_hash to equal
    hash(root key, key-list hash). The C6 VK tree is hash(c6_chonk_root, hash(tube, tube, hiding kernel, C6, app, init, tail)).
  • The C6 tree anchor keeps the retired c6_fold artifact path and the c6_fold_key_hash input
    name, so the contracts' deploy scripts and BfvDecryptionVerifier still read the same file.
  • The Chonk stack infrastructure (chonk_stack.rs, run_bb, the builder's chonk group with
    bb_poseidon2_hash VK hashes) is the one from the C3 PR; C6 only adds its circuits, the
    c6_chonk prover module and its rows library.
  • c6_fold, c6_fold_kernel and the Rust c6_accumulator are removed. With them the Rust
    sequential_fold driver and the Noir sequential_fold_vk_hash lose their last callers and are
    removed too.
  • The build test that counts the manifest seeds 27 anchor keys (45 files): six C6 keys replace
    c6_fold and c6_fold_kernel.

Verification

Only static checks ran in this branch; CI runs the tests.

  • nargo compile of bin/chonk, c6_chonk_tube, c6_chonk_root and decryption_aggregator;
    scripts/circuits/lint.sh; nargo fmt --check clean.
  • cargo check -p e3-zk-prover -p e3-zk-config -p e3-zk-build -p e3-events -p e3-aggregator -p e3-tests --all-targets; cargo clippy on the three zk crates reports nothing in the changed
    files; cargo fmt --all --check; prettier on the changed markdown and JSON.
  • node scripts/blueprint/check.mjs (no --fix): relative to main, no reference is newly moved or
    broken.
  • Tests added or rewritten, to be run by CI: fold_accumulators_e2e_tests has three C6 tests: the
    root proves and binds the decryption aggregator; a corrupted leaf or a substituted key is
    rejected next to an honest twin; the app rejects a shared slot, an out-of-range slot and a
    foreign domain. circuit_identity, e3-zk-build VK-tree and VK_PATHS tests, and the
    lib::math::c6_chonk_rows tests in circuits/lib are updated.

Compatibility

Breaking within the unreleased protocol-9 cutover (no separate counter change): drain-and-resync.

  • The decryption aggregator, the C6 VK tree and every deployed decryption verifier's
    expectedC6FoldKeyHash change, so verifiers and artifacts from before this change do not accept
    the new proofs. Partly aggregated C6 work from an E3 in flight cannot be continued: drain first.
    Rollback: drain, then restore the previous binary and artifacts.
  • Storage schema and gossip/sync majors are unchanged. CircuitName::C6Fold and C6FoldKernel stay
    in place, documented as retired, so stored encodings keep their indices; the six C6 Chonk circuits
    are appended. C6 Chonk proofs are never persisted or gossiped.
  • The VK catalogue (circuits/vk-commitments.json), the Solidity verifiers, the BFV VK-binding
    fixture and the layout-lock fixtures are regenerated once, from one matrix build, in chore(circuits): regenerate the circuit outputs of the large stack #2541 (large/circuit-outputs), near the top of
    the stack. Until then this PR's circuit, verifier and layout-lock checks
    fail by design.

@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
interfold-dashboard Ready Ready Preview Nov 20, 2026 9:49am UTC
interfold-docs Ready Ready Preview Nov 20, 2026 9:49am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 445953b and d0177de.

Files selected for processing: 55

  • circuits/README.md
  • circuits/bin/chonk/Nargo.toml
  • circuits/bin/chonk/c6_chonk_app/Nargo.toml
  • circuits/bin/chonk/c6_chonk_app/src/main.nr
  • circuits/bin/chonk/c6_chonk_hiding_kernel/Nargo.toml
  • circuits/bin/chonk/c6_chonk_hiding_kernel/src/main.nr
  • circuits/bin/chonk/c6_chonk_init_kernel/Nargo.toml
  • circuits/bin/chonk/c6_chonk_init_kernel/src/main.nr
  • circuits/bin/chonk/c6_chonk_tail_kernel/Nargo.toml
  • circuits/bin/chonk/c6_chonk_tail_kernel/src/main.nr
  • circuits/bin/recursive_aggregation/c6_chonk_root/Nargo.toml
  • circuits/bin/recursive_aggregation/c6_chonk_root/src/main.nr
  • circuits/bin/recursive_aggregation/c6_chonk_tube/Nargo.toml
  • circuits/bin/recursive_aggregation/c6_chonk_tube/src/main.nr
  • circuits/bin/recursive_aggregation/c6_fold/src/main.nr
  • circuits/bin/recursive_aggregation/c6_fold_kernel/src/main.nr
  • circuits/bin/recursive_aggregation/decryption_aggregator/src/main.nr
  • circuits/lib/src/core/threshold/share_decryption.nr
  • circuits/lib/src/math/c6_chonk_rows.nr
  • circuits/lib/src/math/chonk.nr
  • circuits/lib/src/math/mod.nr
  • circuits/lib/src/math/recursive_vk.nr
  • crates/events/src/interfold_event/compute_request/zk.rs
  • crates/orchestration/aggregator/src/plaintext_aggregation/effects/prove_plaintext.rs
  • crates/zk/build/src/artifacts.rs
  • crates/zk/build/src/tests.rs
  • crates/zk/build/src/vk_tree.rs
  • crates/zk/config/src/circuit.rs
  • crates/zk/config/tests/circuit_identity.rs
  • crates/zk/prover/README.md
  • crates/zk/prover/required-artifacts.json
  • crates/zk/prover/src/circuits/aggregation/c6_accumulator.rs
  • crates/zk/prover/src/circuits/aggregation/c6_chonk.rs
  • crates/zk/prover/src/circuits/aggregation/helpers.rs
  • crates/zk/prover/src/circuits/aggregation/mod.rs
  • crates/zk/prover/src/circuits/aggregation/node_dkg_fold.rs
  • crates/zk/prover/src/lib.rs
  • crates/zk/prover/src/prover.rs
  • crates/zk/prover/src/test_utils.rs
  • crates/zk/prover/tests/common/helpers.rs
  • crates/zk/prover/tests/fold_accumulators_e2e_tests.rs
  • docs/architecture/circuit-artifacts.md
  • docs/architecture/proof-statements.md
  • docs/architecture/threshold-decryption.md
  • docs/pages/build/noir-circuits.mdx
  • docs/pages/internals/dkg.mdx
  • docs/pages/learn/cryptography.mdx
  • packages/interfold-contracts/contracts/interfaces/IDecryptionVerifier.sol
  • packages/interfold-contracts/contracts/verifiers/bfv/BfvDecryptionVerifier.sol
  • packages/interfold-contracts/test/BfvVkBindingIntegration.spec.ts
  • scripts/blueprint/curated.mjs
  • scripts/blueprint/facts/05-zk.json
  • scripts/blueprint/facts/11-circuits.json
  • scripts/blueprint/refs/D-circuits.json
  • scripts/circuits/lint.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Architecture change

From 7a4f381ad to d0177dec8. Open this change in the blueprint: green is new, red is removed and yellow is changed, and a number on a box counts the changes inside it.

Experimental. The page goes away when the pull request closes. scripts/blueprint/diff/README.md says how to turn it off or remove it.

zahrajavar and others added 15 commits November 19, 2026 23:27
A decryption's T + 1 C6 proofs now run in one Chonk stack instead of a
sequential c6_fold chain. c6_chonk_app verifies every C6 proof, checks
they share the first leaf's domain and places their sk, esm, ct and d
commitments by slot; c6_chonk_tube verifies the stack as a rollup proof
and c6_chonk_root closes its IPA claim. A root rollup closes exactly two
claims, so the root takes the tube twice under the tube key.

decryption_aggregator verifies c6_chonk_root and binds the anchored C6
tree hash to hash(root key, key-list hash). The C6 tree is now
hash(c6_chonk_root, c6 chain); its anchor keeps the retired c6_fold
artifact path. CircuitName gains six C6 Chonk variants; C6Fold and
C6FoldKernel stay as retired variants so stored encodings keep their
indices.

Split from #2398.
The C6 chain and the nodes fold no longer fold one leaf per step, so
the Rust sequential_fold driver and the Noir sequential_fold_vk_hash have
no callers.
C6 over Chonk replaces two anchor keys (c6_fold, c6_fold_kernel) with
six (the tube, the root and four stack keys), so the build test seeds 27
keys and the manifest holds 45 files.
The retired c6_fold circuit no longer builds, so the immediate-key check read a file that does not exist. Also drop the C6 fold wording from the BfvDecryptionVerifier docs.
The C6 tree anchor keeps the `c6_fold` path, but `c6_fold` holds no circuit now, so
`discover` no longer lists it. `hydrate` and `stage_bin` placed anchors with the circuits
they walk, so `--hydrate-bin-only` and `--skip-if-built` left `circuits/bin` without
`c6_fold.vk_tree_hash` (or with a stale one), and a staged pair had none.

- Place both anchors by name in `refresh_anchors`, `hydrate`, `stage_bin` and `bin_markers`.
- Cover the C6 anchor in the staging test.
C6 no longer folds sequentially: its Chonk stages append key hashes and `c6_chonk_root`
hashes the list.
Prettier wraps prose at the column the previous commit missed.
@ctrlc03
ctrlc03 added this pull request to stack #2543 November 20, 2026 09:22
The C6 anchor equality with the key-list hash fails as an unsolvable program, because the failing opcode carries no assertion payload; the other rejection cases fail as a failed assertion. Both mean that the witness breaks a circuit constraint.

This branch was successfully deployed

3 active deployments
github-pages — d0177dec Deployed Nov 20, 2026 by ctrlc03 via Publish the previews #1293
Preview – interfold-dashboard — d0177dec Deployed Nov 20, 2026 by vercel[bot]
Preview – interfold-docs — d0177dec Deployed Nov 20, 2026 by vercel[bot]
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