Skip to content

refactor: consolidate Chonk VK generation and clarify polynomial consumption - #25653

Merged
fcarreiro merged 3 commits into
nextfrom
si/chonk-memory-followup
Oct 14, 2026
Merged

fcarreiro merged 3 commits into
nextfrom
si/chonk-memory-followup

Conversation

@iakovenkos

@iakovenkos iakovenkos commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

The memory PR #25638 changed prove --write_vk to reuse the input VK instead of deriving it from the circuit. We remove this redundant option and keep write_vk as the single way to generate Chonk VKs.

Re the question on #25638: it is moot. Every Chonk verifier uses the hiding-kernel VK from the protocol VK tree. The node takes it from the protocol circuit artifacts, and the rollup checks the VK against the tree at the expected leaf index. Those VKs come from bb write_vk --scheme chonk, which derives them from bytecode. A VK written by prove --write_vk was never used anywhere, so we remove the option rather than fix it. The pinned-flow test now derives the hiding-kernel VK from bytecode, checks it against the input VK, and verifies the proof with the derived one.

We also remove the unused prove_and_verify method, its PrivateExecutionSteps helper, and an unnecessary constraint-system copy during VK generation.

For HyperNova, we keep the move and document that both accumulation methods consume the instance’s polynomials. The batches overlap, so an assertion checks that the first unshifted polynomial—the one consumed—is absent from the second batch. This makes the contract explicit and guards the layout assumption; no peak-memory improvement was measured for this move.

Validation: 16 HyperNova tests and all 11 pinned flows passed; CLI and test targets rebuilt.

Remove Chonk prove --write_vk, whose retained-key export diverged from standalone bytecode-derived VK generation. Keep write_vk as the derivation path and verify pinned proofs against independently derived hiding keys.

Remove the unused bulk proving API and its parsed-step container, and avoid copying the constraint system during VK derivation.
Keep the polynomial move, document consumption on both public accumulation methods, and assert that the first unshifted entity is absent from the to-be-shifted batch.

Correct the batching comment: the batches overlap, but only the first entity is consumed by each in-place batch.
@iakovenkos iakovenkos added the ci-barretenberg Run all barretenberg/cpp checks. label Oct 14, 2026
@iakovenkos
iakovenkos marked this pull request as ready for review October 14, 2026 20:03
@iakovenkos
iakovenkos requested a review from fcarreiro October 14, 2026 20:05
@iakovenkos
iakovenkos changed the base branch from merge-train/barretenberg to next October 14, 2026 20:06
@iakovenkos iakovenkos self-assigned this Oct 14, 2026
@iakovenkos iakovenkos added port-to-v6 and removed ci-barretenberg Run all barretenberg/cpp checks. labels Oct 14, 2026
@fcarreiro
fcarreiro enabled auto-merge (squash) October 14, 2026 22:51
@fcarreiro
fcarreiro merged commit d1db3d1 into next Oct 14, 2026
19 of 22 checks passed
@fcarreiro
fcarreiro deleted the si/chonk-memory-followup branch October 14, 2026 22:53
AztecBot pushed a commit that referenced this pull request Oct 14, 2026
…umption (#25653)

The [memory PR
#25638](#25638)
changed `prove --write_vk` to reuse the input VK instead of deriving it
from the circuit. We remove this redundant option and keep `write_vk` as
the single way to generate Chonk VKs.

Re the question on #25638: it is moot. Every Chonk verifier uses the
hiding-kernel VK from the protocol VK tree. The node takes it from the
protocol circuit artifacts, and the rollup checks the VK against the
tree at the expected leaf index. Those VKs come from `bb write_vk
--scheme chonk`, which derives them from bytecode. A VK written by
`prove --write_vk` was never used anywhere, so we remove the option
rather than fix it. The pinned-flow test now derives the hiding-kernel
VK from bytecode, checks it against the input VK, and verifies the proof
with the derived one.

We also remove the unused `prove_and_verify` method, its
`PrivateExecutionSteps` helper, and an unnecessary constraint-system
copy during VK generation.

For HyperNova, we keep the move and document that both accumulation
methods consume the instance’s polynomials. The batches overlap, so an
assertion checks that the first unshifted polynomial—the one consumed—is
absent from the second batch. This makes the contract explicit and
guards the layout assumption; no peak-memory improvement was measured
for this move.

Validation: 16 HyperNova tests and all 11 pinned flows passed; CLI and
test targets rebuilt.

(cherry picked from commit d1db3d1)
@AztecBot AztecBot mentioned this pull request Oct 14, 2026
3 tasks done
IlyasRidhuan pushed a commit that referenced this pull request Oct 15, 2026
Rolling port of `port-to-v6`-labelled PRs from `next` onto `v6`. Each
source PR lands as its cherry-pick commit; conflicted picks are a raw
pick (conflict markers as git produced them) followed by a `fix(port):`
commit with the resolution.

## Ported

- [x]
[#25631](#25631)
feat(kvdb): expose read-only lmdb transactions — **conflicted**. The fix
commit maps the change onto v6's pre-split layout: the native code goes
into `barretenberg/cpp/src/barretenberg/nodejs_module/lmdb_store` +
`lmdblib` (v6's `SERIALIZATION_FIELDS`, `bb::nodejs` namespace,
`barretenberg/` includes, unqualified `format`), the Makefile keeps v6's
targets, and `native-packages/kvdb/*` is dropped (no kvdb package on
v6). It also decides one behavioural point: barretenberg's msgpack-c
fork rejects a missing map key where the upstream msgpack-c used by kvdb
on `next` treats it as unset, and v6 clients never send `txId`. Requests
carrying an optional `txId` therefore get a `convert` adaptor that reads
a missing `txId` as nil. Without it every node fails to start with
`Missing field txId`. The source PR's `read_tx.test.mjs` suite passes
8/8 against the v6 addon locally (6/8 fail without the adaptor). The
lmdblib gtests pass.
- [x]
[#25638](#25638)
chore: chonk memory improvements — clean pick.
- [x]
[#25653](#25653)
refactor: consolidate Chonk VK generation and clarify polynomial
consumption — clean pick.

---
*Created by
[claudebox](https://claudebox.work/v2/sessions/c367595c72de79d5/jobs/1)
· group: `slackbot` · [Slack
thread](https://aztecprotocol.slack.com/archives/C0AGN2WT3CP/p1791993763598479?thread_ts=1791993763.598479&cid=C0AGN2WT3CP)*

---------

Co-authored-by: Santiago Palladino <santiago@aztec-labs.com>
Co-authored-by: sergei iakovenko <105737703+iakovenkos@users.noreply.github.com>
Co-authored-by: Oleh Misarosh <olehmisar@gmail.com>
Co-authored-by: Facundo <facundo@aztec-labs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants