Skip to content

feat(fnd): real-kernel Chonk flow with an in-app UltraHonk verifier - #25420

Open
iAmMichaelConnor wants to merge 1 commit into
nextfrom
mc/chonk-flows-real-kernel-uh-verifier
Open

feat(fnd): real-kernel Chonk flow with an in-app UltraHonk verifier#25420
iAmMichaelConnor wants to merge 1 commit into
nextfrom
mc/chonk-flows-real-kernel-uh-verifier

Conversation

@iAmMichaelConnor

@iAmMichaelConnor iAmMichaelConnor commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds noir-projects/fnd/noir-protocol-circuits/integration-tests/verify-uh-proof-within-smart-contract: a Chonk (ClientIVC) flow over the real private kernels whose app verifies an UltraHonk proof, the way a smart contract does when it verifies a Noir proof in a private function. It is generated entirely from code in this repository (no captured fixtures, no aztec-nr, no PXE), so proving-system regressions in a real kernel stack are caught here without a round trip through the labs repository.

The flow is app_uh_verifier -> private_kernel_init -> private_kernel_reset_tail -> hiding_kernel_to_rollup. The app is a private function as the kernels see one: it emits PrivateCircuitPublicInputs on the return data bus and, on the way, recursively verifies an UltraHonk ZK proof through bb_proof_verification::verify_honk_proof. Until now this path had no proving coverage anywhere: bb's DSL test only checks the circuit and its VK, the stdlib test proves a standalone Mega circuit, acir_tests proves the verifier programs under UltraHonk, and none of the pinned Chonk flows contains an app that verifies a proof.

This also introduces noir-protocol-circuits/integration-tests/ as the home for tests that prove the real protocol circuits end to end with bb, alongside the existing nargo test unit tests and nargo execute fixture runs. See its README.

How it works

  • flow-inputs-builder is an unconstrained Noir program that derives every kernel input from the circuits' real verification keys: the VK tree with the kernels at their protocol indices, the app's function tree and contract address, the public data tree non-membership proof for class updates, and the no-op reset hints. It reuses protocol_test_utils::FixtureBuilder and is never proven. The kernel library itself is untouched; the reset hints are built from std::mem::zeroed() plus the documented inactive sentinels, set through the hint structs' public fields.
  • prove_uh_verifier_app_with_real_kernels.py (stdlib Python) proves inner_circuit with bb, runs the builder, chains each circuit's return data into the next one's call data with noir-execute, assembles ivc-inputs.msgpack, and runs bb prove and bb verify --scheme chonk. --flow-dir also writes the stack in the chonk-pinned-flows layout, which the existing C++ and bb.js pinned-flow tests accept as-is.
  • The test's crates are members of the protocol-circuits workspace (listed in Nargo.template.toml) because nargo always resolves the topmost Nargo.toml. build_integration_tests in the protocol-circuits bootstrap.sh compiles them and moves their artifacts into the test's own target/, so they never reach the protocol artifacts, benches, or pins. The build loop's member grep is tightened to top-level crates/ so it ignores them.
  • integration_test_cmds emits two test commands under the existing noir-protocol-circuits-tests target, hashed over the circuits, bb, and the Noir verifier library: the flow must prove and verify, and with --corrupt-inner-proof (one element of the inner proof flipped; ACVM does not check proofs during witness generation) bb must reject it.

Test plan

  • noir-projects/fnd/noir-protocol-circuits/bootstrap.sh build_integration_tests, then integration-tests/verify-uh-proof-within-smart-contract/prove_uh_verifier_app_with_real_kernels.py --skip-compile: bb accumulates the four real circuits and the Chonk proof verifies.
  • The same with --corrupt-inner-proof: bb fails while building the app circuit, reported as a pass.
  • bootstrap.sh test_cmds lists both commands; nargo fmt --check and nargo check are clean; the protocol target/ holds no test circuits after the build.

Not covered yet, as sibling tests to add: multi-call transactions (private_kernel_inner), intermediate resets, and the to-public tail.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Dct8Fqzq1WFqckm9vCEbMS

@iAmMichaelConnor iAmMichaelConnor added the claudebox Owned by claudebox. it can push to this PR. label Sep 7, 2026
Adds noir-protocol-circuits/integration-tests, the home for tests that
prove the real protocol circuits end to end with bb, with its first test,
verify-uh-proof-within-smart-contract: an app circuit that recursively
verifies an UltraHonk ZK proof through bb_proof_verification (no
aztec-nr), folded by private_kernel_init, private_kernel_reset_tail and
hiding_kernel_to_rollup. An unconstrained Noir builder derives every
kernel input from the circuits' real VKs: the VK tree, the app's function
tree and contract address, the public data tree non-membership proof and
the no-op reset hints. A Python driver chains each circuit's return data
into the next one's call data with noir-execute, assembles
ivc-inputs.msgpack and runs bb prove/verify --scheme chonk. A second test
command corrupts the inner proof and requires the flow to be rejected.

The test's crates are members of the protocol-circuits workspace, since
nargo always resolves the topmost Nargo.toml; build_integration_tests
compiles them and moves the artifacts into the test's own target/ so they
never reach the protocol artifacts, and integration_test_cmds emits the
commands under the existing noir-protocol-circuits-tests target. The
kernel library itself is untouched.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dct8Fqzq1WFqckm9vCEbMS
@iAmMichaelConnor
iAmMichaelConnor force-pushed the mc/chonk-flows-real-kernel-uh-verifier branch from fa73b7c to 7b81ec8 Compare September 7, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant