Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ contracts/broadcast/
*.log
.env
.env.*

.idea
81 changes: 37 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "MIT"
publish = false

[workspace.dependencies]
# noir-zk 0.3.3 (crates.io): layered registries, the generic pipeline kernels, Chonk via bb's FFI.
# noir-zk 0.3.3 (crates.io, patched below): layered registries, the generic pipeline kernels, Chonk via bb's FFI.
# Every layer below is bound with the same release.
noir-zk-core = "=0.3.3"
noir-zk-backend = { version = "=0.3.3", features = ["packs", "http"] }
Expand All @@ -35,3 +35,14 @@ toml = "0.9"
# Witness solving and proving are unusably slow unoptimised (noir-zk's note).
[profile.dev]
opt-level = 3

# noir-zk on bb 7.0.0-nightly.20261110 / Noir 1.0.0-rc.5 (zk-experiments/noir-zk#11) and the
# emit-protocol built on it, until both are released: one noir-zk for every layer.
[patch.crates-io]
noir-zk-core = { git = "https://github.com/zk-experiments/noir-zk", rev = "0d022abf80cec1f2e28a7bc2008d0579af4ae141" }
noir-zk-kernels = { git = "https://github.com/zk-experiments/noir-zk", rev = "0d022abf80cec1f2e28a7bc2008d0579af4ae141" }
noir-zk-backend = { git = "https://github.com/zk-experiments/noir-zk", rev = "0d022abf80cec1f2e28a7bc2008d0579af4ae141" }
noir-zk-codegen = { git = "https://github.com/zk-experiments/noir-zk", rev = "0d022abf80cec1f2e28a7bc2008d0579af4ae141" }
emit-protocol = { git = "https://github.com/zk-experiments/emit-protocol", rev = "fcf30900219ca0382450fa6e6035bed944f0224a" }
emit-protocol-abi = { git = "https://github.com/zk-experiments/emit-protocol", rev = "fcf30900219ca0382450fa6e6035bed944f0224a" }
emit-circuits = { git = "https://github.com/zk-experiments/emit-protocol", rev = "fcf30900219ca0382450fa6e6035bed944f0224a" }
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ emit-circuits' `pins.toml` is compiled into the node and the wallet and checked

| what | version / pin | from | checked |
|---|---|---|---|
| noir-zk (core, backend, codegen, kernels) | `=0.3.3` | crates.io | kernels family root `0x297133fa…ae43` and version |
| noir-zk (core, backend, codegen, kernels) | `=0.3.3`, patched to noir-zk#11 (`0d022abf`) | git | kernels family root `0x094a0086…5701` and version |
| the protocol's layers (emit: transfer_holder, dg1_envelope, escrow_resolve; identity_cache: register, member) | `emit-protocol@0.1.0`, family roots `transfer_holder` `0x18ee3ff5…efc7`, `dg1_envelope` `0x0b7d4c28…3119`, `escrow_resolve` `0x04c880b8…2757`, `register` `0x1d0042a0…c1eb`, `member` `0x00f3d510…0a75` | emit-protocol (`noir/`, frozen into `emit-circuits` with `noir-zk freeze`, bytecode bundled) | library and every family root; bytecode against its pin when loaded |
| channel layer | `zk-encryption-circuits` 0.1.5 from crates.io (library `zk-encryption@0.1.3`, on noir-zk 0.3.3) | bytecode bundled in `zk-encryption-circuits`; catalog `https://circuits.zk-experiments.dev/zk-encryption/0.1.5/catalog.json` | catalog SHA-256 `b797c5ed…bb81`; its families' roots equal the compiled-in ones |
| identity layer | `eid-circuits` 0.8.3 from crates.io (frozen library `eid-circuits@0.8.2`), `eid-prover` by git tag `v0.8.3` | DSC, SOD and document steps: packs on `https://circuits.zk-eid.dev`, catalog `catalog@0.8.2.json` (0.8.3 didn't refreeze: the same pinned bytecode) | catalog SHA-256 `4de0e4f0…53eb`, its version and its DSC/SOD/document labels in eid's registry; each pack's SHA-256 against the catalog; every unpacked `.b64` / `.vk` against eid's registry pins |
| CSCA registry | tag `registry-20260928-1039`, root `0x27bef40a…02a2` | `https://registry.zk-eid.dev/<tag>/registry.json` | file SHA-256 `17a21c0f…4444` and `commitment.root` |
| deployment | root `0x02d515b4…a88a`; `identity_register` `0x0a2bcc6a…55cf` (4); `member_transfer` `0x0185c63e…ee6c` (5); `member_resolve` `0x23173a42…6853` (2) | computed by emit-circuits' codegen | equal to the generated constants |
| deployment | root `0x2beb20f9…1baf`; `identity_register` `0x069782dc…1a0e` (4); `member_transfer` `0x22f795d8…6596` (5); `member_resolve` `0x285c421a…1af2` (2) | computed by emit-circuits' codegen | equal to the generated constants |
| pool contract | `EmitV2Pool` from emit-protocol (solc 0.8.30) | `emit-protocol-abi`'s artifact (ABI and bytecode); `zkpool deploy` deploys it | emit-protocol's CI checks the artifact against `forge build` |
| toolchain | bb 7.0.0-nightly.20260927 (via `barretenberg-rs`), reth v2.6.0 | crates.io, git tag | the Noir and Solidity toolchains are emit-protocol's |
| toolchain | bb 7.0.0-nightly.20261110 (via `barretenberg-rs`), reth v2.6.0 | crates.io, git tag | the Noir and Solidity toolchains are emit-protocol's |

Caches: `~/.cache/emit-protocol` (`$EMIT_PROTOCOL_CACHE`): the pinned files, eid's unpacked packs (the demo needs common, rsa4096, rsa2048, bp384, bp256: about 300 MB). The prover reads bb's CRS from `~/.bb-crs` (`$BB_CRS_PATH`), checked against noir-zk's pinned hashes; `scripts/srs.sh` provisions it.

Expand Down Expand Up @@ -183,10 +183,10 @@ Starts `emit-node node --dev` on `genesis.json` (datadir `.devnet/chain`, http 8

```
pins: ok emit-protocol layers emit-protocol@0.1.0 family roots (transfer_holder, dg1_envelope, escrow_resolve, register, member)
pins: ok deployment root 0x02d515b4c11b8b715af4d6fa14644a3e7e8dcc52dd9923f3424f1304561da88a
pins: ok pipeline identity_register root 0x0a2bcc6a85b08c9ee3046ec9387b53a583e188447c51ce7a45cc989702e855cf length 4
pins: ok pipeline member_transfer root 0x0185c63e50408ddc230b73c27e117be74fe278a964be0e45def5cdc527a8ee6c length 5
pins: ok pipeline member_resolve root 0x23173a425869da40ad85bb78639280b69ccc656121c183cfba1e6e575bcd6853 length 2
pins: ok deployment root 0x2beb20f9f1597700f9338a78c3e70967f2f9b10a91341faa9c6a8c89c84e1baf
pins: ok pipeline identity_register root 0x069782dc3636269cc75fd9feafabb5cae7f4df81e7b11c90248b379b36b41a0e length 4
pins: ok pipeline member_transfer root 0x22f795d8c0f659fccc7ef8fce423d7f95dcf81faa7b918a54bfac39470d16596 length 5
pins: ok pipeline member_resolve root 0x285c421af2895cd9adaeff4ed5a3aa2baa7f9fc701f579fa2bbfd3f53cf71af2 length 2
…
precompiles: ZK_VERIFY at 0x0000000000000000000000000000000000000100 (1200000 gas + 3/word), POSEIDON2 at 0x0000000000000000000000000000000000000101 (60 + 360/permutation)
node pid …, rpc http://127.0.0.1:8545, EmitV2Pool 0x5FbDB2315678afecb367f032d93F642f64180aa3
Expand Down
6 changes: 6 additions & 0 deletions bench/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fixtures/
wasm/node_modules/
.Cargo.lock.bak
.cache/
artifacts/
web-dist/
29 changes: 29 additions & 0 deletions bench/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Circuit benchmarks (WASM)

Proving time, memory, verify time, proof and circuit size of each proving pipeline, with bb in
WASM (bb.js) and ACVM in WASM (acvm_js), as a stand-in for on-device proving (iPhone 17).

```sh
# 1. Fold each pipeline natively once and dump its circuits + inputs (needs a noir-zk checkout
# with NOIR_ZK_BENCH_DUMP; NOIR_ZK=path, default ../noir-zk).
./bench/fixtures.sh
# 2. Run (Node >= 22, macOS for /usr/bin/time -l).
cd bench/wasm && npm install && node bench.mjs run --samples 5 --threads 1,6
```

Results: `bench/results/<date>/{report.md,timings.csv,metadata.json}`.

## Matched registration and age comparison

See [`compare/README.md`](compare/README.md) for the local cross-implementation experiment:
the PR's exact German BP384/BP256 and US RSA4096/RSA2048 registration relations,
plus a shared age-verification circuit instead of member/payment operations.
It compares Chonk, Arkworks Groth16 and ProveKit WHIR, with the same summary layout,
1/6-thread WASM samples, process footprint, and warm full-host WASM/native verification.

The existing Chonk runner and historical PR results above are preserved.
The new entry points are `node bench/compare/fixtures.mjs`,
`node bench/compare/prepare.mjs`, and `cd bench/wasm && npm run compare`.
The browser demo is built with `npm run build:web` and served with `npm run serve`.
Use `npm run compare -- --runtime native` for the same fixtures on native executables.
Native and WASM host reports are stored separately and linked separately from the demo.
Loading