Skip to content

refactor(crypto): generate Solidity and Noir protocol constants - #2344

Merged
ctrlc03 merged 4 commits into
refactor/2197-stack-typescriptfrom
refactor/2197-stack-protocol-bindings
Oct 26, 2026
Merged

ctrlc03 merged 4 commits into
refactor/2197-stack-typescriptfrom
refactor/2197-stack-protocol-bindings

Conversation

@neogiacomo

@neogiacomo neogiacomo commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Part 4/6 of #2197's BFV configuration stack, based on #2343. Review and merge predecessors first; review follow-ups are kept in #2353.

Generate Solidity/Noir constants and committee facts from their Rust owners. Keep ActiveCryptoConfig.sol as maintained admission policy over generated data; remove its obsolete implementation template, retain current aliases, and preserve independent historical/upgrade vectors.

Normalize selector-import ordering in source identities using Noir's actual formatter; masking preset names alone was insufficient. The six-pair projection regression does not sort recursive dependencies or proofs. The newly added formatter action now uses main's v0.1.5 SHA.

Current baseline and verification

Restacked on main ea058724ef630d864614ddcd1887033e2793fdc4, including #2349's coordinated Noir rc.3 / BB 6.0.0 upgrade. Protocol 9, generation 2, and BFV domain v5 are inherited; this layer adds no counter change. Published #2341 was already on this baseline and its tip is preserved.

Whole-stack current evidence is recorded in #2353, not in architecture documentation. It includes frozen identity/metadata/source checks, 300 independently rederived latest VKs and 12 Solidity verifiers, a fresh default-source build matching all 102 published key/hash/anchor files, 853 prepared contract tests, seven SDK WASM proof tests, and nine native leaf plus three fold/node proof tests against latest. Do not treat historical beta.26/BB5.2 results as current qualification.

Matching CI run 40320746575 passed for ab043272ae86. All seven matching stack CI runs are green, and #2353 is ready for review. Rewritten branches were published using recorded exact leases and ordinary hooks. These cumulative whole-stack results do not claim every follow-up fix already exists in this individual layer.

Compatibility and limits

Relative to current main, the read-only review found no further parameter/configuration-ID/domain, committee order, T+1/H, proof multiplicity, public-input layout, production ABI/storage/events, durable-schema, or wire-format change. Frozen vectors remain independent; current slot-0/slot-2 admission and explicit historical handling remain intact. Human protocol review is still required.

Review references: artifact boundaries, proof statements, threshold decryption, protocol history, and upgrades.

#2346 explicitly reconciles 18/42 catalogue expectations with main's already-breaking toolchain cutover. Main's matching rc.3/BB6 verifier/artifact combination remains supported; protocol-8/beta.26/BB5.2 compatibility is not promised. Source stamps are preserved, not relabelled. Old-data replay and mixed-peer formats are unchanged, but no new live mixed-fleet/replay qualification is claimed. Rollback stays within the matching protocol-9 baseline and never decreases counters.

Fresh all-pair source-bound release qualification, historical #2195 replay/recurring-file measurement, exhaustive live-fleet/release qualification, and matching immutable public pins/public-release E2E for CRISP draft #6 remain separate. CRISP stays release-blocked. No migration, governance action, merge, tag, release, deployment, or artifact publication is performed or authorized.

Stack: #2341 → #2342 → #2343 → #2344 → #2345 → #2346 → #2353.

Summary by CodeRabbit

  • New Features
    • Added commands to synchronize generated protocol settings or check that they’re up to date across the circuit and contract configurations.
    • Centralized shared BFV protocol settings so related components use consistent values.
  • Bug Fixes
    • Updated configuration checks to compare the current protocol settings, helping detect mismatches between circuit and contract configurations.
  • Documentation
    • Updated circuit artifact and configuration command documentation to reflect the current protocol settings and checks.

@vercel

vercel Bot commented Oct 22, 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 Oct 26, 2026 12:15pm UTC
interfold-docs Ready Ready Preview Oct 26, 2026 12:15pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 23699ce and ab04327.

Files selected for processing: 26
  • .github/workflows/ci.yml
  • circuits/lib/src/configs/committee/micro/mod.nr
  • circuits/lib/src/configs/committee/minimum/mod.nr
  • circuits/lib/src/configs/committee/small/mod.nr
  • circuits/lib/src/configs/default/mod.nr
  • circuits/lib/src/configs/mod.nr
  • circuits/lib/src/configs/protocol.nr
  • crates/zk/build/src/bindings.rs
  • crates/zk/build/src/configuration.rs
  • crates/zk/build/src/identity.rs
  • crates/zk/build/src/lib.rs
  • crates/zk/build/src/main.rs
  • crates/zk/build/src/tests.rs
  • crates/zk/build/templates/active_crypto_config.sol.in
  • docs/architecture/circuit-artifacts.md
  • packages/interfold-contracts/contracts/lib/ActiveCryptoConfig.sol
  • packages/interfold-contracts/contracts/lib/BfvProtocol.sol
  • packages/interfold-contracts/contracts/test/BfvProtocolHarness.sol
  • packages/interfold-contracts/contracts/test/MockE3Program.sol
  • packages/interfold-contracts/contracts/test/MockE3ProgramHarness.sol
  • packages/interfold-contracts/contracts/verifiers/bfv/BfvDecryptionVerifier.sol
  • packages/interfold-contracts/test/BfvProtocol.spec.ts
  • scripts/checks/committee.sh
  • scripts/circuits/README.md
  • scripts/circuits/bfv-bindings.test.ts
  • scripts/circuits/crypto-config.mjs
Files with no reviewable changes: 1
  • crates/zk/build/templates/active_crypto_config.sol.in

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Rust build tooling now generates shared BFV protocol constants for Noir and Solidity. Solidity consumers, configuration checks, and CI workflows use the generated bindings. The CLI supports binding synchronization and check operations.

Changes: BFV protocol bindings

Layer / File(s) Summary
Generate protocol bindings
crates/zk/build/src/bindings.rs, circuits/lib/src/configs/*
The build crate generates and synchronizes Solidity and Noir protocol and committee configurations. Generated Noir files define protocol dimensions and committee parameters.
Wire generation into Rust build tooling
crates/zk/build/src/configuration.rs, crates/zk/build/src/identity.rs, crates/zk/build/src/lib.rs, crates/zk/build/src/main.rs, crates/zk/build/src/tests.rs, crates/zk/build/templates/active_crypto_config.sol.in
Configuration generation stages the new bindings, and the CLI adds sync-bindings and check-bindings. Source identity hashing includes the protocol source and projected updates. The former Solidity template is removed.
Use and test Solidity protocol constants
packages/interfold-contracts/contracts/lib/BfvProtocol.sol, packages/interfold-contracts/contracts/lib/ActiveCryptoConfig.sol, packages/interfold-contracts/contracts/test/*, packages/interfold-contracts/contracts/verifiers/bfv/BfvDecryptionVerifier.sol, packages/interfold-contracts/test/BfvProtocol.spec.ts
Solidity consumers read protocol and committee values from BfvProtocol. A test harness exposes identities, committee values, and dimensions for comparison with shared configuration.
Update drift checks and generation workflows
.github/workflows/ci.yml, scripts/checks/committee.sh, scripts/circuits/*, docs/architecture/circuit-artifacts.md
CI and committee checks use BfvProtocol.sol. The crypto configuration script runs binding check or sync mode, and the documentation names the updated generated artifact.

Priority: Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant e3_zk_build
  participant bindings_sync
  participant BfvProtocol_sol
  participant Noir_config_files
  e3_zk_build->>bindings_sync: Run sync-bindings or check-bindings
  bindings_sync->>BfvProtocol_sol: Generate and compare expected Solidity contents
  bindings_sync->>Noir_config_files: Generate and compare expected Noir contents
Loading

Possibly related issues

  • theinterfold/interfold#2319: This PR generates BFV configuration constants from Rust-owned definitions and adds source-identity checks, which overlaps with the issue’s stated configuration identity consolidation.
  • theinterfold/CRISP#2: This PR generates shared Solidity and Noir protocol facts and checks source identities. It does not implement repository extraction.

Suggested reviewers: ctrlc03

Merge Risk: Minimal · up to ab043

No actionable compatibility or runtime issue is established for this change; it is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 13.04% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 10 files. (15 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: generating Solidity and Noir protocol constants.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 13.04% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 10 files. (15 skipped: 15 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

@neogiacomo

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Render shared identities, committee declarations, and circuit dimensions from their Rust owners. Keep ActiveCryptoConfig as stable admission policy, route consumers through generated bindings, and include the Noir protocol module in staged source identity and read-only freshness checks.

Preserve existing Solidity ABI/bytecode and the checked Noir ACIR/ABI outputs. Full proof-matrix qualification remains outstanding. Related to #2197.
Keep source identities independent of Noir's lexical import placement when the shared protocol binding is introduced. A six-pair regression checks that the read-only hash command agrees with the formatted build projection. Carry this fix in the protocol-binding layer so intermediate stacked PRs remain correct.
The real six-pair source-hash regression invokes nargo fmt, so provision the pinned compiler in library-test jobs instead of skipping or mocking that regression. The failed GitHub runs reported nargo --version ENOENT; the regression passes with the required tool installed.

This branch was successfully deployed

2 active deployments
Preview – interfold-dashboard — ab043272 Deployed Oct 26, 2026 by vercel[bot]
Preview – interfold-docs — ab043272 Deployed Oct 26, 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