Skip to content

Rebase Vite/Vitest tooling onto prover stack (self-contained IIFE, external bfj)#629

Open
OBrezhniev wants to merge 3 commits into
feature/memory-scopingfrom
feature/esm-tooling
Open

Rebase Vite/Vitest tooling onto prover stack (self-contained IIFE, external bfj)#629
OBrezhniev wants to merge 3 commits into
feature/memory-scopingfrom
feature/esm-tooling

Conversation

@OBrezhniev

Copy link
Copy Markdown
Member

Rebase tooling migration onto our prover stack (Vite + Vitest)

Applies the feat/esm-migration build/test tooling on top of our
feature/memory-scoping prover-optimization work. Target: feat/esm-migration.

Keeps all of our work and behaviour:

  • src unchanged: groth16_prove.js (buildABCStream witness gather,
    msmBatching/msmGlv/msmGls options, --memlog/memoryLogging),
    cli.js (--memlog, msm options), noble-hashes v2 import paths. Only removed
    a redundant /* global window */.
  • Self-contained IIFE preserved. The Vite iife build bundles
    ffjavascript/binfileutils/r1csfile so a bare <script src="snarkjs.min.js">
    still exposes a working window.snarkjs — this branch's iife externalises
    them as globals, which breaks that usage. Node built-ins and the wasm codegen
    toolchain are stubbed via resolve.alias (build-config/), reproducing the
    old rollup virtual stubs; snarkjs.min.js 763 → 569 KB.
  • bfj/ejs kept in dependencies (external + lazily required in the CLI)
    so startup stays fast and JSON/Solidity exports still work. (This branch moved
    bfj to devDeps + bundled it.)
  • exports keeps node import/require + browser + umd (snarkjs.min.js).

Validation: lint clean; 59 node tests (fullprocess/fflonk/keypar/polynomial)

  • 10 browser tests (Playwright/chromium) pass; built CLI prove+verify (OK!)
    with --memlog, and bfj r1cs-json export verified.

Not included: the test/smart_contracts.test.js Hardhat/ethers Solidity-verifier
test — it needs a Solidity build toolchain and is a net-new capability, better
ported on its own. The unminified build/snarkjs.js is dropped (only the
umd-referenced snarkjs.min.js is built).

Rollup -> Vite (build:node/cli/browser/iife), Mocha -> Vitest (node-esm +
browser-chromium via Playwright), flat eslint.config.js, CI workflow. Ports
the tooling from feat/esm-migration onto our prover-optimization branch,
keeping all of our work and behaviour:

- src unchanged: groth16_prove.js (buildABCStream gather, msmBatching/msmGlv/
  msmGls options, --memlog/memoryLogging), cli.js (--memlog, msm options),
  noble-hashes v2 imports. Only removed a redundant /* global window */.
- Self-contained IIFE preserved: the Vite iife build bundles ffjavascript/
  binfileutils/r1csfile (bare <script> still exposes a working window.snarkjs),
  unlike the source branch which externalised them as globals. Node built-ins
  and the wasm codegen toolchain are stubbed via resolve.alias (build-config/),
  reproducing the old rollup virtual stubs; snarkjs.min.js 763 -> 569 KB.
- bfj/ejs kept in dependencies (external + lazily required in the CLI), so
  startup stays fast and JSON/Solidity exports still work.
- exports keep node import/require + browser + umd (snarkjs.min.js).

Validation: lint clean; 59 node tests (fullprocess/fflonk/keypar/polynomial)
+ 10 browser tests pass; built CLI prove+verify (OK!) with --memlog, and bfj
r1cs-json export verified.

Not included: the feat/esm-migration Hardhat/ethers Solidity-verifier test
(test/smart_contracts.test.js) -- it needs a Solidity build toolchain and is a
separate net-new capability, to be ported on its own. The unminified
build/snarkjs.js is dropped (only the umd-referenced snarkjs.min.js is built).
@OBrezhniev

Copy link
Copy Markdown
Member Author

ESM-rebase set — the tooling migration re-applied on top of our optimization stack (rather than replaying the branches), so the MSM/CIOS/memory work is preserved. Review together:

Deviations from feat/esm-migration are called out in each PR body (e.g. binfileutils MAX_BUFFER_SIZE, snarkjs IIFE/bfj, mnt6753 excluded, smart_contracts test deferred). All branches keep git+https commit-ref pins; re-pin if a branch moves.

@OBrezhniev OBrezhniev changed the base branch from feat/esm-migration to feature/memory-scoping July 5, 2026 09:31
@OBrezhniev OBrezhniev requested a review from Kolezhniuk July 5, 2026 09:54
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.

1 participant