Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

kernel-gate-counts

БесплатноБез исполняемых скриптовНе проверен

Compile noir-protocol-circuits (kernels, rollup, etc.) and compute their gate counts with `bb gates`, for both the chonk (client IVC) and ultra_honk schemes…

AztecProtocolот AztecProtocol★ 458 звёзд на GitHub

Об этом скилле

Protocol-Circuit Gate Counts & Variant Regeneration

When to Use

Use this skill when asked to:

  • Compile protocol circuits (private kernels, rollup circuits, etc.) with nargo
  • Regenerate circuit variants (e.g. after adding init-N / inner-N / reset crates)
  • Measure gate counts / circuit sizes with bb gates, for either:
    • --scheme chonk — client-IVC circuits (private kernels)
    • --scheme ultra_honk — standalone UltraHonk circuits (rollup circuits)

Key Paths

All paths relative to the git root.

  • Protocol circuits workspace: noir-projects/fnd/noir-protocol-circuits/
  • Circuit crates: noir-projects/fnd/noir-protocol-circuits/crates/<crate-name>/
  • Variant generator: noir-projects/fnd/noir-protocol-circuits/scripts/generate_variants.js
  • Workspace manifest (generated): noir-projects/fnd/noir-protocol-circuits/Nargo.toml
  • Workspace template (source of truth): noir-projects/fnd/noir-protocol-circuits/Nargo.template.toml
  • nargo binary: noir/noir-repo/target/release/nargo — do NOT use a globally installed nargo; version mismatches produce opaque bytecode failures.
  • bb binary: barretenberg/cpp/build/bin/bb
  • bb-avm binary: barretenberg/cpp/build/bin/bb-avm — required for circuits that recurse the AVM (see Gotchas).
  • Compiled artifacts: noir-projects/fnd/noir-protocol-circuits/target/<package_name>.json

Step 1 — Regenerate Variants (only when crates were added/removed)

generate_variants.js regenerates the reset-circuit variants under crates/autogenerated/ AND rewrites the workspace Nargo.toml from Nargo.template.toml. Run it after adding or removing crates so the new crates are actually included in the workspace — otherwise nargo won't see them.

cd noir-projects/fnd/noir-protocol-circuits
node scripts/generate_variants.js

Verify the crates you expect are now listed, e.g.:

grep -nE "inner|init" Nargo.toml

Note: numbered kernel variants (init-N / inner-N) are hand-written crates committed under crates/, not auto-generated. The generator only (re)writes Nargo.toml and the crates/autogenerated/ reset variants. Running node before compiling newly-added crates is needed purely to refresh Nargo.toml from the template. If no crates changed, you can skip this step.

Step 2 — Compile

Package names use underscores, not dashes. A directory like crates/private-kernel-inner-N has package name private_kernel_inner_N (check the name = field in <crate>/Nargo.toml). Passing the dashed form to --package fails with "invalid character '-' in package name".

cd noir-projects/fnd/noir-protocol-circuits
NARGO=../../noir/noir-repo/target/release/nargo
$NARGO compile --package <package_name> --silence-warnings

Discover package names for a family of crates automatically:

for d in crates/private-kernel-init crates/private-kernel-init-* \
         crates/private-kernel-inner crates/private-kernel-inner-*; do
  [ -d "$d" ] && grep -h '^name' "$d/Nargo.toml"
done

The *_simulated crates are unconstrained witness-generation variants, NOT proving circuits — exclude them from gate counting unless explicitly asked.

Step 3 — Gate Counts

Pass the compiled .json artifact as the bytecode path:

bb gates --scheme <chonk|ultra_honk> -b target/<package_name>.json

Reading the result (works for both schemes): bb gates prints a JSON object to stdout with the gate count in functions[].circuit_size (acir_opcodes is the ACIR opcode count):

{"functions": [
  {
        "acir_opcodes": 8653,
        "circuit_size": 32209
  }
]}

Extract it robustly with jq (ignores any warnings on stderr):

bb gates --scheme chonk -b target/private_kernel_init.json 2>/dev/null \
  | jq '.functions[].circuit_size'

The chonk scheme additionally prints a human-readable line to stderr (capture with 2>&1, not 2>/dev/null):

ChonkStats - circuit: ivc_circuit, acir_opcodes: 8653, circuit_size: 32209 (mem: 30.22 MiB)

Example A — chonk circuit: private kernel init

cd noir-projects/fnd/noir-protocol-circuits
NARGO=../../noir/noir-repo/target/release/nargo
BB=../../barretenberg/cpp/build/bin/bb

$NARGO compile --package private_kernel_init --silence-warnings
$BB gates --scheme chonk -b target/private_kernel_init.json 2>/dev/null \
  | jq '.functions[].circuit_size'

Example B — ultra_honk circuit: private base rollup

Rollup circuits recursively verify proofs that carry IPA (the rollup uses IPA for the inner proofs), so you must pass --verifier_target noir-rollup. Without it the construction aborts with IPA proofs present when not expected.

cd noir-projects/fnd/noir-protocol-circuits
NARGO=../../noir/noir-repo/target/release/nargo
BB=../../barretenberg/cpp/build/bin/bb

$NARGO compile --package rollup_tx_base_private --silence-warnings
$BB gates --scheme ultra_honk -t noir-rollup -b target/rollup_tx_base_private.json 2>/de
Полный SKILL.md на GitHub

Установить kernel-gate-counts в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл kernel-gate-counts?

Compile noir-protocol-circuits (kernels, rollup, etc.) and compute their gate counts with `bb gates`, for both the chonk (client IVC) and ultra_honk schemes. Use when asked to regenerate circuit variants, compile protocol circuits, or measure gate/circuit sizes.

Как установить скилл kernel-gate-counts?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл kernel-gate-counts запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить kernel-gate-counts с