Skip to content

chore: port to v6 - #25651

Merged
IlyasRidhuan merged 4 commits into
v6from
cb/port-to-v6
Oct 15, 2026
Merged

IlyasRidhuan merged 4 commits into
v6from
cb/port-to-v6

Conversation

@AztecBot

@AztecBot AztecBot commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • #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.
  • #25638 chore: chonk memory improvements — clean pick.
  • #25653 refactor: consolidate Chonk VK generation and clarify polynomial consumption — clean pick.

Created by claudebox · group: slackbot · Slack thread

Raw cherry-pick of aca4d3e onto v6 with
conflict markers as git produced them. Resolution is in the following
fix(port) commit.

Conflicted paths:
- Makefile
- barretenberg/cpp/src/barretenberg/nodejs_module/lmdb_store/lmdb_store_message.hpp
- barretenberg/cpp/src/barretenberg/nodejs_module/lmdb_store/lmdb_store_wrapper.hpp
- native-packages/kvdb/.rebuild_patterns
- native-packages/kvdb/bootstrap.sh
- native-packages/kvdb/ts/package.json
- native-packages/kvdb/yarn.lock
@AztecBot AztecBot added ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR. labels Oct 14, 2026
AztecBot and others added 2 commits October 14, 2026 20:06
Resolve the v6 pick against the pre-split layout: the native code lives in
barretenberg's nodejs_module and lmdblib.

- lmdb_store_message.hpp / lmdb_store_wrapper.hpp: take the new txId fields,
  StartReadTx/CloseReadTx messages and read-tx registry, using v6's
  SERIALIZATION_FIELDS, bb::nodejs namespaces and barretenberg/ include paths.
- lmdb_store_message.hpp: barretenberg's msgpack-c fork rejects any missing map
  key, while the upstream msgpack-c used by kvdb on next reads it as unset. v6
  clients omit txId, so requests carrying an optional txId get a convert
  adaptor that reads a missing txId as nil.
- lmdb_store_wrapper.cpp: use v6's unqualified format().
- Makefile: keep v6 (no native-packages build targets).
- Drop native-packages/kvdb/*: that package does not exist on v6, so its
  node:test suite (read_tx.test.mjs) and harness wiring have no home.
Frees prover memory as soon as it is no longer needed. Six commits are
cherry-picked unchanged from #25635 (author @olehmisar); the last commit
is a small cleanup. Proofs and VKs are unchanged.

## Changes

- Free each step's ACIR program once its circuit is built.
- Move the batched HyperNova polynomial out instead of copying it.
- Free the translator circuit builder once its proving key is built, and
the final accumulator's polynomials after the decider proof.
- Free the circuit builder's construction data (witness, copy cycles,
lookup tables, memory records) once the prover instance is built.
- `bb prove --scheme chonk`: move each step's bytecode, VK and witness
into the bbapi requests instead of copying them. `--write_vk` now writes
the hiding-kernel VK held by the IVC, since the bytecode has been moved
out.
- `bb prove --scheme chonk`: decompress each step just before it is
loaded instead of all up front.

The two `bb prove` changes affect only the native CLI; bb.js calls bbapi
directly.

## Memory

Native `bb prove --scheme chonk`, 8 threads, glibc malloc, interleaved
base/PR runs. Peak RSS is the median of 3 runs; peak live heap is from
an `LD_PRELOAD` allocation tracker, median of 2.

| Flow | Peak RSS base | Peak RSS PR | Δ | Peak live heap base | Peak
live heap PR | Δ |
|---|---|---|---|---|---|---|
| `ecdsar1+transfer_0_recursions+sponsored_fpc` | 285 MiB | 241 MiB |
−45 (−16%) | 261 MiB | 217 MiB | −44 (−17%) |
| `ecdsar1+transfer_1_recursions+private_fpc` | 335 MiB | 251 MiB | −84
(−25%) | 304 MiB | 224 MiB | −79 (−26%) |
| `ecdsar1+amm_add_liquidity_1_recursions+sponsored_fpc` | 344 MiB | 249
MiB | −95 (−28%) | 314 MiB | 225 MiB | −90 (−29%) |
| `ecdsar1+storage_proof_7_layers+sponsored_fpc` | 867 MiB | 689 MiB |
−177 (−20%) | 796 MiB | 642 MiB | −153 (−19%) |

Wall time was not resolvable on the shared benchmark host. WASM was not
measured.

## Testing

- `chonk_tests`, `hypernova_tests`, `bbapi_tests` (including
`ChonkPinnedIvcInputsTest.AllPinnedFlows`), `sumcheck_tests`,
`translator_vm_tests`, `ultra_honk_tests`, in Release and RelWithAssert
builds.
- All 11 pinned Chonk flows: base and PR proofs verify with each other's
verifier, the hiding-kernel VK is byte-equal, `bb check` passes, and
single-threaded proofs with a fixed RNG are byte-identical to base.

---------

Co-authored-by: Oleh Misarosh <olehmisar@gmail.com>
Co-authored-by: Facundo <facundo@aztec-labs.com>
(cherry picked from commit b69af48)
…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

Copy link
Copy Markdown
Collaborator Author

Flakey Tests

🤖 says: This CI run detected 1 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/f8b22963fd95640e�f8b22963fd95640e8;;�): cd labs && export root= ci3= &&  yarn-project/end-to-end/scripts/run_test.sh simple src/multi-node/slashing/inactivity_slash_with_consecutive_epochs.test.ts (413s) (code: 0) group:e2e-p2p-epoch-flakes

@IlyasRidhuan
IlyasRidhuan marked this pull request as ready for review October 15, 2026 10:08
@IlyasRidhuan
IlyasRidhuan removed the request for review from ludamad October 15, 2026 10:08
@IlyasRidhuan
IlyasRidhuan merged commit 9a642fc into v6 Oct 15, 2026
13 checks passed
@IlyasRidhuan
IlyasRidhuan deleted the cb/port-to-v6 branch October 15, 2026 10:11
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-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants