Skip to content

fix: harden batch chonk verifier.#23484

Merged
ludamad merged 1 commit into
nextfrom
cb/07fa8374405a
Jun 5, 2026
Merged

fix: harden batch chonk verifier.#23484
ludamad merged 1 commit into
nextfrom
cb/07fa8374405a

Conversation

@AztecBot

@AztecBot AztecBot commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Main changes:

  • Bind prover-supplied IPA G_0 values in IPA::batch_reduce_verify with an independent batched SRS MSM check.
  • Harden ChonkBatchVerifier lifecycle, queue validation, duplicate request IDs, queue bounds, invalid VK/proof-size handling, callback exceptions, and shutdown cleanup.
  • Harden bbapi batch verifier FIFO result delivery and startup cleanup, including FIFO path validation, terminal FIFO failure handling, and pending request failure results for malformed proof fields.
  • Make BatchChonkVerifier reject pending TS promises on FIFO/decode failures, wait briefly for native stop to flush FIFO result frames, and clean up temp FIFO directories reliably.
  • Make Chonk verifier API wrong-VK byte lengths return valid=false before deserialization, including in wasm builds where catch blocks are compiled away.
  • Keep the pinned bb.js Chonk test from re-reading bounded wasm inputs after the native backend case has run.

@AztecBot AztecBot added the claudebox Owned by claudebox. it can push to this PR. label May 21, 2026
@ludamad ludamad marked this pull request as ready for review May 21, 2026 23:59
@AztecBot AztecBot force-pushed the cb/07fa8374405a branch 7 times, most recently from 277cd63 to 235d46b Compare May 27, 2026 19:41
@ludamad ludamad added this pull request to the merge queue May 29, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 29, 2026
@ludamad ludamad enabled auto-merge June 2, 2026 21:16
@ludamad ludamad added this pull request to the merge queue Jun 2, 2026
@ludamad ludamad removed this pull request from the merge queue due to a manual request Jun 2, 2026
@ludamad ludamad enabled auto-merge June 3, 2026 00:14
@ludamad ludamad added this pull request to the merge queue Jun 3, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 3, 2026
@iakovenkos iakovenkos enabled auto-merge June 3, 2026 10:36
@iakovenkos iakovenkos added this pull request to the merge queue Jun 3, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 3, 2026
@AztecBot AztecBot added the ci-draft Run CI on draft PRs. label Jun 5, 2026
@ludamad ludamad added the ci-full Run all master checks. label Jun 5, 2026
@ludamad ludamad enabled auto-merge June 5, 2026 02:55
@ludamad ludamad changed the title fix: harden batch chonk verifier fix: harden batch chonk verifier. Jun 5, 2026
Main changes:

- Bind prover-supplied IPA `G_0` values in `IPA::batch_reduce_verify` with an independent batched SRS MSM check.
- Harden `ChonkBatchVerifier` lifecycle, queue validation, duplicate request IDs, queue bounds, invalid VK/proof-size handling, callback exceptions, and shutdown cleanup.
- Harden bbapi batch verifier FIFO result delivery and startup cleanup, including FIFO path validation, terminal FIFO failure handling, and pending request failure results for malformed proof fields.
- Make `BatchChonkVerifier` reject pending TS promises on FIFO/decode failures, wait briefly for native stop to flush FIFO result frames, and clean up temp FIFO directories reliably.
- Make Chonk verifier API wrong-VK byte lengths return `valid=false` before deserialization, including in wasm builds where catch blocks are compiled away.
- Keep the pinned bb.js Chonk test from re-reading bounded wasm inputs after the native backend case has run.
@ludamad ludamad added this pull request to the merge queue Jun 5, 2026
Merged via the queue into next with commit 91df1ab Jun 5, 2026
19 checks passed
@ludamad ludamad deleted the cb/07fa8374405a branch June 5, 2026 04:29
AztecBot added a commit that referenced this pull request Jun 8, 2026
… --ci-refresh-chonk

## What

Refreshes the pinned Chonk IVC inputs (`barretenberg/cpp/scripts/chonk-inputs.hash`) so the **Nightly Debug Build** goes green again.

This PR carries the `ci-refresh-chonk` label **and** a `--ci-refresh-chonk` head-commit marker. PR CI's post-action (`ci_update_chonk_inputs.sh`) regenerates the pinned inputs, uploads the new tarball to S3, verifies the smallest flow through `ChonkPinnedIvcInputsTest.AllPinnedFlows`, and pushes a follow-up commit replacing the placeholder hash in this PR with the freshly-pinned value. **Do not merge until that follow-up commit lands** — the hash here is a `0000…` placeholder until then.

Supersedes the earlier closed-unmerged refresh attempt #23744; the pin is still at the 2026-05-21 value (`209dde8e69a27c9f`), so the nightly has stayed red.

## Root cause

Nightly debug build run [27085031299](https://github.com/AztecProtocol/aztec-packages/actions/runs/27085031299) failed in:

```
FAILED: barretenberg/cpp/scripts/run_test.sh bbapi_tests ChonkPinnedIvcInputsTest.AllPinnedFlows (code: 1)
```

The failure is on circuit 10/10 (`hiding_kernel`) of the `deploy_ecdsar1+sponsored_fpc` pinned flow:

```
Pub inputs offset mismatch: 669 vs 673
Commitment mismatch: Q_M, Q_C, Q_L, Q_R, Q_O, Q_4, Q_5, Q_ARITH, Q_SORT, ...
C++ exception: Assertion failed: (kernel_return_data_match)
  Reason: kernel_return_data mismatch: proof contains
          { 0x183227397098d014..., 0x0 } but kernel_calldata commitment is { 0x..01, 0x..02 }
```

The `hiding_kernel` circuit's public-input layout changed (offset 669 → 673, plus selector-commitment changes), so the **precomputed VK and proof baked into the pinned `ivc-inputs.msgpack` are stale**. The reconstructed `kernel_return_data` from the stale public inputs reads a sentinel `{1, 2}` (the BN254 generator, i.e. an empty databus column) instead of the real return-data commitment, tripping the consistency check.

That check is `BB_ASSERT_DEBUG(kernel_return_data_match, ...)` at `barretenberg/cpp/src/barretenberg/chonk/chonk.cpp:169` — a **debug-only** assertion compiled out of release/PR CI. Only the nightly *debug* build exercises it, which is why the stale pin slips past merge-queue CI.

The pin was last bumped 2026-05-21. Circuit-affecting barretenberg changes have since landed on `next` without `ci-refresh-chonk`, most notably:

- #23484 *fix: harden batch chonk verifier* — adds an independent batched-SRS MSM check in `IPA::batch_reduce_verify` (`commitment_schemes/ipa/ipa.hpp`); the IPA verifier lives inside the hiding kernel, which accounts for the new public inputs and changed selector commitments.
- #23615 *feat: optimize sumcheck in ECCVM and Translator*.

## Fix

Regenerate and re-pin the Chonk inputs via the standard `ci-refresh-chonk` flow (this PR). No source changes are needed — the pinned fixtures just need to track the current circuits.

## Follow-up (separate)

Because the assertion is debug-only, circuit changes can stale the pin with no PR-CI signal, and refresh PRs have repeatedly been opened and closed without landing. Worth deciding whether `chonk_inputs.sh check` should exercise the pinned-flow IVC with debug asserts at PR time (or whether the nightly should hard-block), so this is caught before it reaches the nightly. Tracking separately.

---
*Created by [claudebox](https://claudebox.work/v2/sessions/1bec730eb3623e82) · group: `slackbot`*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-full Run all master checks. claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants