Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a183b12
initial commit with alternate provers (via `circomkit-ffi` repo)
erhant Jun 28, 2026
08f6680
feat: CLI `--backend` override and prime-aware witness writing, add `…
erhant Jun 30, 2026
655a6f9
example: multiplier with e2e test script
erhant Jul 1, 2026
f7f6a29
fix(core): floor PTAU selection at power 8 to match snarkjs domain si…
erhant Jul 1, 2026
1683797
feat(core): fall back to flat inputs/{circuit}.json input layout
erhant Jul 1, 2026
23c2301
feat: add a ligthweight custom circom parser, along with a circom cod…
erhant Jul 13, 2026
d4ac902
feat: witness calculators (c, wasm) and some refactors
erhant Jul 14, 2026
cb8bfa4
fix: lint and tests
erhant Jul 14, 2026
cd7f9df
feat: napi
erhant Jul 14, 2026
db3ead8
feat: `napi` usage with `bun` and circomkit CLI
erhant Jul 14, 2026
b0e24a1
add examples + `doctor` command
erhant Jul 14, 2026
2c5034d
slight refactors
erhant Jul 14, 2026
972299d
feat: initial `book` and `skills`
erhant Jul 14, 2026
6941ab7
fix book, add CIs, refactor `expect_pass`
erhant Jul 17, 2026
6e687cb
small docfix [skip ci]
erhant Jul 17, 2026
a0ee623
refactor: move tests to a sub crate + fmt
erhant Jul 18, 2026
6362992
remove dist, only keep napi and rust
erhant Jul 19, 2026
4f903ee
perf(witness): cache compiled wasm module across witness calculations
erhant Jul 23, 2026
f00667d
fix(examples): correct multiplier test expectations; scope napi backe…
erhant Jul 23, 2026
5b0f013
fix tsconfig
erhant Jul 23, 2026
7316f27
refactor(cli): drop memory and PTAU estimation from doctor
erhant Jul 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 0 additions & 67 deletions .eslintrc.json

This file was deleted.

99 changes: 99 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: CI

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
lint:
name: fmt + clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all --check
- run: cargo clippy --workspace --all-targets -- -D warnings

test:
name: test (${{ matrix.os }}, circom ${{ matrix.circom }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux x86-64 exercises the C witness backend (needs nasm/gmp; circom
# C generator emits x86 assembly). The tags e2e circuit needs circom >= 2.2.0.
- { os: ubuntu-latest, circom: v2.2.3 }
- { os: ubuntu-latest, circom: v2.2.2 }
# macOS is arm64; no prebuilt circom, so build from source. The C
# witness backend is expected to error there (arch-gated test).
- { os: macos-latest, circom: v2.2.3 }
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install snarkjs (latest)
run: npm install -g snarkjs

# circom's C witness generator needs these; Linux x86-64 only.
- name: Install C witness toolchain (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential libgmp-dev nasm nlohmann-json3-dev libsodium-dev

- name: Cache circom binary
id: circom-cache
uses: actions/cache@v4
with:
path: ~/circom-bin
key: circom-${{ runner.os }}-${{ matrix.circom }}

- name: Install circom ${{ matrix.circom }}
if: steps.circom-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ~/circom-bin
if [ "${{ runner.os }}" = "Linux" ]; then
curl -fsSL -o ~/circom-bin/circom \
"https://github.com/iden3/circom/releases/download/${{ matrix.circom }}/circom-linux-amd64"
chmod +x ~/circom-bin/circom
else
# No prebuilt arm64 asset — build from source.
git clone --depth 1 --branch "${{ matrix.circom }}" https://github.com/iden3/circom /tmp/circom
cargo build --release --manifest-path /tmp/circom/Cargo.toml
cp /tmp/circom/target/release/circom ~/circom-bin/circom
fi

- name: Add circom to PATH
run: echo "$HOME/circom-bin" >> "$GITHUB_PATH"

- name: Versions
run: |
circom --version
snarkjs --version || true

# Cache the downloaded test PTAU to avoid flaky network fetches.
- name: Cache test PTAU
uses: actions/cache@v4
with:
path: tests/ptau
key: ptau-${{ runner.os }}-powersOfTau28_hez_final_08

# `cargo test` (default-members) runs the full suite except the napi
# cdylib. On Linux x86-64 the C-witness e2e test builds and runs; on macOS
# arm64 it asserts the clean error path.
- name: Test
run: cargo test
44 changes: 44 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy Book

on:
# Publish the book manually, or automatically when a release is published.
workflow_dispatch:
release:
types: [published]

permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment.
concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: "0.5.4"
steps:
- uses: actions/checkout@v4
- name: Install mdBook
run: |
curl -sSL "https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" \
| tar -xz --directory=/usr/local/bin
- name: Build
run: mdbook build book
- uses: actions/upload-pages-artifact@v3
with:
path: book/book

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
162 changes: 162 additions & 0 deletions .github/workflows/napi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: Publish npm package

# Builds the native addon AND the CLI binary for each desktop target, bundles
# the CLI into the per-platform packages, and publishes `circomkit` to npm.
#
# Runs on a published GitHub release (and manual dispatch). Requires an
# `NPM_TOKEN` repository secret.
#
# NOTE: napi multi-platform publishing is fiddly and cannot be validated in this
# sandbox — verify the `napi` command incantations against `napi --help` and the
# current napi-rs package template on a real run before relying on it.

on:
release:
types: [published]
workflow_dispatch:

env:
# Uses native runners per target — no cross-compilation.
DEBUG: napi:*

defaults:
run:
working-directory: bindings/napi

jobs:
build:
name: build ${{ matrix.target }}
runs-on: ${{ matrix.host }}
strategy:
fail-fast: false
matrix:
include:
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
key: linux-x64-gnu
bin: circomkit
- host: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
key: linux-arm64-gnu
bin: circomkit
- host: macos-13
target: x86_64-apple-darwin
key: darwin-x64
bin: circomkit
- host: macos-latest
target: aarch64-apple-darwin
key: darwin-arm64
bin: circomkit
- host: windows-latest
target: x86_64-pc-windows-msvc
key: win32-x64-msvc
bin: circomkit.exe
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2

- name: Install deps
run: npm install

- name: Build addon
run: npx napi build --release --platform --target ${{ matrix.target }} --js binding.js --dts binding.d.ts

- name: Build CLI binary
working-directory: .
run: cargo build --release -p circomkit-cli --target ${{ matrix.target }}

- name: Upload addon
uses: actions/upload-artifact@v4
with:
name: addon-${{ matrix.key }}
path: bindings/napi/circomkit.*.node
if-no-files-found: error

- name: Upload CLI binary
uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.key }}
path: target/${{ matrix.target }}/release/${{ matrix.bin }}
if-no-files-found: error

publish:
name: publish to npm
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"

- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Install deps
run: npm install

# Generate the platform-agnostic root-package files that live in the main
# `circomkit` package: `binding.js`/`binding.d.ts` (napi loader) and
# `index.js`/`index.d.ts` (compiled TypeScript facade). The .node built
# here is discarded — per-platform .node files come from the build matrix.
- name: Build facade (binding + TS)
run: npm run build

- name: Scaffold platform packages
run: npx napi create-npm-dirs

- name: Download addon artifacts
uses: actions/download-artifact@v4
with:
pattern: addon-*
path: bindings/napi/artifacts
merge-multiple: true

- name: Move addons into platform packages
run: npx napi artifacts

- name: Download CLI binaries
uses: actions/download-artifact@v4
with:
pattern: cli-*
path: bindings/napi/cli-artifacts

- name: Bundle CLI binaries into platform packages
shell: bash
run: |
set -euo pipefail
for key in linux-x64-gnu linux-arm64-gnu darwin-x64 darwin-arm64 win32-x64-msvc; do
bin="cli-artifacts/cli-$key/circomkit"
[ "$key" = "win32-x64-msvc" ] && bin="cli-artifacts/cli-$key/circomkit.exe"
if [ -f "$bin" ]; then
node scripts/bundle-cli.mjs "$key" "$bin"
else
echo "::warning::missing CLI binary for $key ($bin)"
fi
done

- name: List packages
run: ls -R ./npm

- name: Publish
run: |
npm config set provenance true
npx napi prepublish -t npm
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading