Skip to content

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

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

ctrlc03 wants to merge 19 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.

Update 2026-11-21: rebased onto main (#2524–#2530) and Fable review fixes

  • 05bf0bf32: blueprint refs moved by the rebase.
  • 1c0cc837a: the two synchronized-selection tests probed decryption_aggregator, which main's feat(circuits): verify synchronized Minimum decryption recursively #2527 made a synchronized definition, so both failed; they now probe the SS-only c6_chonk_root.
  • ce89d83b6: upgrades.md records C6 over Chonk; the README places the C6 Chonk circuits.

@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 21, 2026 3:27pm UTC
interfold-docs Ready Ready Preview Nov 21, 2026 3:27pm 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 59 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 696cacb and ce89d83.

Files selected for processing: 57

  • 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/architecture/upgrades.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/10-contracts.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 736721c76 to ce89d83b6. The page was removed when this pull request closed.

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 11 commits November 21, 2026 14:26
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.
ctrlc03 and others added 8 commits November 21, 2026 14:26
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.
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.
…n tests

The tests asserted that a synchronized build rejects decryption_aggregator, but main's synchronized definition now includes that circuit, so both tests failed. They now probe c6_chonk_root, which only the SS build has, keeping the never-fall-back-to-SS guard.
@ctrlc03

ctrlc03 commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

Folded into #2531 so that each PR in the stack passes CI on its own: main requires template_integration, which cannot pass on a PR that changes circuits without their regenerated outputs. This PR's commits and description are unchanged inside #2531; its review threads stay here.

This branch was successfully deployed

2 active and 1 inactive deployments
github-pages — ce89d83b Deployed Nov 21, 2026 by ctrlc03 via Publish the previews #1343
Preview – interfold-dashboard — ce89d83b Deployed Nov 21, 2026 by vercel[bot]
Preview – interfold-docs — ce89d83b Deployed Nov 21, 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