Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6c1fcbe
feat(circuits): prototype chunked C2 circuits
0xjei Aug 5, 2026
97b6e58
feat(circuits): add chunked C2 accumulator
0xjei Aug 5, 2026
d2bd917
feat(zk-prover): add C2 chunk fold orchestration
0xjei Aug 5, 2026
fbadf83
feat(zk-prover): wire chunked C2 into DKG
0xjei Aug 6, 2026
737ab71
fix(zk-prover): bind C2 terminal variants
0xjei Aug 6, 2026
e2dd347
feat(zk-prover): configure C2 chunk size
0xjei Aug 6, 2026
5bde150
test(zk-prover): cover chunked C2 node fold
0xjei Aug 6, 2026
73ea587
update benches to validate full e2e run
0xjei Aug 6, 2026
5067833
feat(zk-prover): batch chunked C2 proofs
0xjei Aug 6, 2026
70fa07e
feat(zk-prover): anchor chunked C2 commitments
0xjei Aug 6, 2026
e9a00b7
benches
0xjei Aug 6, 2026
4a90e71
format & lint
0xjei Aug 6, 2026
3c32122
fix(zk-prover): validate C2 chunk artifact layout
0xjei Aug 6, 2026
49ed9dd
fix: address CodeRabbit review findings
0xjei Aug 6, 2026
7382d30
fix: validate C3 rows against threshold moduli
0xjei Aug 6, 2026
71016bf
fix(zk-helpers): thread chunk-size through DKG circuits and enforce c…
0xjei Aug 7, 2026
3f12553
style: apply rustfmt import ordering
0xjei Aug 7, 2026
3eda06e
fmt and micro benches
0xjei Aug 7, 2026
7376aba
feat(benchmarks): surface chunked share-computation prove sub-steps
0xjei Aug 7, 2026
c9d6c2b
update benches and docs
0xjei Aug 7, 2026
0b6a7a0
lint & format
0xjei Aug 7, 2026
c23a138
perf(zk-prover): parallelize C2 chunk and batch proving; secure micro…
0xjei Aug 8, 2026
373eb2f
chore: raise do_send ratchet baseline 107->108 for chunked C2 sub-ste…
0xjei Aug 8, 2026
1dd45eb
fix(zk-prover): address CodeRabbit findings on length checks and E3Fa…
0xjei Aug 8, 2026
06ef351
chore: remove dead sequential C2 chunk pipeline
0xjei Aug 8, 2026
c1c7d27
fix(zk-prover): bind recursive aggregation VKs
0xjei Aug 8, 2026
4f9809c
style(circuits): format recursive VK binding
0xjei Aug 8, 2026
c217392
fix(zk-prover): harden C2 chunking guards and dkg_aggregator shape ch…
0xjei Aug 9, 2026
92c3922
fix(zk-prover): bind C2/fold VK chains and pin C2 chunk layout
0xjei Aug 9, 2026
5a25c89
dependent smudging from committee
0xjei Aug 9, 2026
9bacabf
removed unsused variables
0xjei Aug 9, 2026
074c562
fix c3
0xjei Aug 9, 2026
afa5de1
update report
0xjei Aug 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ jobs:
- name: Pull circuit artifacts
id: pull
run: |
SOURCE_HASH=$(pnpm tsx scripts/build-circuits.ts hash)
SOURCE_HASH=$(pnpm tsx scripts/build-circuits.ts hash --preset insecure-512 --committee all)
echo "source_hash=$SOURCE_HASH" >> $GITHUB_OUTPUT

if git fetch origin circuit-artifacts 2>/dev/null; then
Expand Down
12 changes: 6 additions & 6 deletions agent/CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ opentelemetry/tracing.

## Circuit map (IDs ↔ `CircuitName` in `crates/events`)

- **DKG** (`circuits/bin/dkg/`): C0 `pk` (PkBfv) · C2a `sk_share_computation` · C2b
`e_sm_share_computation` · C3 `share_encryption` · C4 `share_decryption`
- **DKG** (`circuits/bin/dkg/`): C0 `pk` (PkBfv) · C2a `sk_share_computation_chunk` · C2b
`esm_share_computation_chunk` · C3 `share_encryption` · C4 `share_decryption`
- **Threshold** (`circuits/bin/threshold/`): C1 `pk_generation` · C5 `pk_aggregation` · P3
`user_data_encryption_ct0/ct1` (+ wrapper) · C6 `share_decryption` · C7
`decrypted_shares_aggregation`
- **Recursive aggregation** (`circuits/bin/recursive_aggregation/`): fold kernels (`c2ab_fold`,
`c3_fold`, `c6_fold`, `node_fold`, `nodes_fold`, …) and the top-level `dkg_aggregator` /
`decryption_aggregator`, which produce the on-chain Honk verifiers (committed only for
`(insecure-512, minimum)`).
- **Recursive aggregation** (`circuits/bin/recursive_aggregation/`): fold kernels
(`c2ab_chunk_fold`, `c3_fold`, `c6_fold`, `node_fold`, `nodes_fold`, …) and the top-level
`dkg_aggregator` / `decryption_aggregator`, which produce the on-chain Honk verifiers (committed
only for `(insecure-512, minimum)`).
- `config` circuit validates preset constants (CRT moduli, bounds, parity matrices). Parity matrices
are generated by the Rust `generate_parity_matrices` binary — never hand-edit.
18 changes: 16 additions & 2 deletions agent/INVARIANTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ skip-proof feature containment (`pnpm check:invariants`, baselines in
public-input layout and must be redeployed on committee change.
- Parity matrices (`parity_{insecure,secure}.nr`) are derived artifacts regenerated from preset
`QIS` + committee `(N, T)`; hand-edits are caught by regenerate-and-diff.
- Smudging constants (`smudging.nr`) are derived artifacts regenerated from the BFV preset and
committee size. C1 and C2b use the same generated bit width.

### Noir / Barretenberg compatibility

Expand All @@ -287,8 +289,10 @@ skip-proof feature containment (`pnpm check:invariants`, baselines in
### DKG / threshold structure

- SK splits into N shares; any **M+1** reconstruct/decrypt. — `flow-trace/04`
- `party_id` derives from the finalized committee normalized by ascending address; 1-indexed,
strictly increasing. Active aggregator = lowest non-expelled `party_id`. — `ARCHITECTURE.md`;
- DKG runtime and NodeFold `party_id` derives from the finalized committee normalized by ascending
address; it is zero-indexed and strictly increasing. Active aggregator = lowest non-expelled
`party_id`. Decryption-aggregator Shamir coordinates are a separate 1-indexed circuit format and
translate to zero-indexed registry slots at the wrapper boundary. — `ARCHITECTURE.md`;
`flow-trace/04`
- DKG aggregation receives **exactly H** canonical honest NodeFold proofs (unique in-range party
IDs) and **exactly N** ordered committee addresses; every preset has `H < N` — never assert
Expand Down Expand Up @@ -326,6 +330,16 @@ skip-proof feature containment (`pnpm check:invariants`, baselines in
- **No proof-disabled bypass (C-02):** both final verifier calls are mandatory in production;
`skip_proof_aggregation` works only under the `test-only-skip-proof-aggregation` Cargo feature;
production verifiers reject placeholder C5/C7 proofs. — INDEX concern #32
- **Complete DKG recursive VK binding:** the DKG proof carries the canonical `NodeFold` VK hash and
a recursive VK manifest. The manifest binds the C0/C1, C2 chunk/batch/finalizer/C2AB, C3
leaf/fold/kernel/C3AB, C4 leaf/C4AB, and NodesFold kernel VK hashes. NodesFold and C3Fold bind
both the current accumulator VK and each prior accumulator's expected kernel or fold VK hash, and
every fold step asserts the accumulator's child-VK hash equals the inner proof's VK hash (IF-005);
a substituted inner VK fails witness generation. C2 terminal proofs
(`SkC2ChunkFinalize`/`ESmC2ChunkFinalize`) are bound to the deployment-time chunk-leaf and
`C2ChunkBatch` VK anchors before generic verification (IF-006). `BfvPkVerifier` checks these
values against deployment-time anchors before it calls the Honk verifier. — `dkg_aggregator`,
`BfvPkVerifier`
- Circuit soundness fixes to preserve: `ModU64::div_mod` verifies
`result*divisor == dividend (mod modulus)` (IF-001); C7 compares **every** decoded coefficient,
including zeros, to the claimed message (IF-002).
Expand Down
14 changes: 8 additions & 6 deletions agent/flow-trace/00_INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,14 @@ _Found during source-code cross-referencing of these trace documents._

### Circuit Audit Remediations

| Finding | Status | Implemented behavior |
| ----------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **IF-001 — unconstrained U64 modular division** | Fixed | `ModU64::div_mod` verifies the hinted quotient satisfies `result * divisor == dividend (mod modulus)`; the Noir suite includes a non-invertible-divisor regression test. |
| **IF-002 — conditional C7 decoding equality** | Fixed | C7 compares every decoded coefficient with the claimed message, including zero coefficients; a focused regression test rejects a nonzero decoded value claimed as zero. |
| **IF-003 — decryption proof phase and party binding** | Fixed | `decryption_aggregator` requires 1-indexed, strictly increasing party IDs, while `BfvDecryptionVerifier` checks the surfaced SK/ESM commitments against the E3's registry-backed DKG anchors. |
| **IF-004 — ciphertext commitment binding** | Fixed | The off-chain SAFE commitment is stored at ciphertext publication, propagated as a final decryption-proof public input, and compared on-chain without attempting BFV decoding or Poseidon2 execution in Solidity. |
| Finding | Status | Implemented behavior |
| ----------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **IF-001 — unconstrained U64 modular division** | Fixed | `ModU64::div_mod` verifies the hinted quotient satisfies `result * divisor == dividend (mod modulus)`; the Noir suite includes a non-invertible-divisor regression test. |
| **IF-002 — conditional C7 decoding equality** | Fixed | C7 compares every decoded coefficient with the claimed message, including zero coefficients; a focused regression test rejects a nonzero decoded value claimed as zero. |
| **IF-003 — decryption proof phase and party binding** | Fixed | `decryption_aggregator` requires 1-indexed, strictly increasing party IDs, while `BfvDecryptionVerifier` checks the surfaced SK/ESM commitments against the E3's registry-backed DKG anchors. |
| **IF-004 — ciphertext commitment binding** | Fixed | The off-chain SAFE commitment is stored at ciphertext publication, propagated as a final decryption-proof public input, and compared on-chain without attempting BFV decoding or Poseidon2 execution in Solidity. |
| **IF-005 — fold-step child VK binding** | Fixed | Every `c3_fold`/`nodes_fold` step asserts the accumulator's child-VK hash equals the verifying key hash of the inner proof folded that step. A substituted (even canonical) inner VK now fails witness generation instead of passing silently. Regression-covered by `fold_vk_binding_adversarial_tests`. |
| **IF-006 — C2 terminal VK binding at ingress** | Fixed | Before generic (bb) verification, each `SkC2ChunkFinalize`/`ESmC2ChunkFinalize` proof is checked against the deployment-time anchors: the child field equals the canonical chunk-leaf VK hash for that proof type, the final field equals the canonical `C2ChunkBatch` VK hash, the public-signal length matches the frozen committee and preset, and every field is canonical. A mismatch marks the signed proof invalid. Covered by `validate_c2_terminal_proof`. |

### Protocol Design Concerns

Expand Down
Loading
Loading