Skip to content
Merged
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
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,30 @@ jobs:
run: |
chmod +x ~/.cargo/bin/enclave

- name: Install Nargo
uses: noir-lang/noirup@v0.1.4
with:
toolchain: ${{ env.NOIR_TOOLCHAIN }}

- name: Cache Barretenberg binary
id: cache-bb
uses: actions/cache@v4
with:
path: /usr/local/bin/bb
key: bb-bin-${{ env.BB_VERSION }}-amd64-linux

- name: Install Barretenberg (bb)
if: steps.cache-bb.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://github.com/gnosisguild/aztec-packages/releases/download/v${{ env.BB_VERSION }}/barretenberg-amd64-linux.tar.gz" -o bb.tar.gz
mkdir -p bb_extract && tar -xzf bb.tar.gz -C bb_extract
BB_BIN=$(find bb_extract -name bb -type f | head -n 1)
sudo mv "$BB_BIN" /usr/local/bin/bb
chmod +x /usr/local/bin/bb

- name: Build enclave circuits
run: pnpm build:circuits --preset insecure-512 --committee micro --skip-if-built

- name: Setup ZK prover
run: |
enclave noir setup
Expand Down Expand Up @@ -1179,6 +1203,30 @@ jobs:
chmod +x ~/.cargo/bin/enclave
chmod +x templates/default/target/debug/e3-support-scripts-dev

- name: Install Nargo
uses: noir-lang/noirup@v0.1.4
with:
toolchain: ${{ env.NOIR_TOOLCHAIN }}

- name: Cache Barretenberg binary
id: cache-bb
uses: actions/cache@v4
with:
path: /usr/local/bin/bb
key: bb-bin-${{ env.BB_VERSION }}-amd64-linux

- name: Install Barretenberg (bb)
if: steps.cache-bb.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://github.com/gnosisguild/aztec-packages/releases/download/v${{ env.BB_VERSION }}/barretenberg-amd64-linux.tar.gz" -o bb.tar.gz
mkdir -p bb_extract && tar -xzf bb.tar.gz -C bb_extract
BB_BIN=$(find bb_extract -name bb -type f | head -n 1)
sudo mv "$BB_BIN" /usr/local/bin/bb
chmod +x /usr/local/bin/bb

- name: Build enclave circuits
run: pnpm build:circuits --preset insecure-512 --committee micro --skip-if-built

- name: Setup ZK prover
run: |
enclave noir setup
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"benchmark_mode": "insecure",
"bfv_preset_subdir": "insecure-512",
"committee": "micro",
"proof_aggregation": true,
"multithread_jobs": 13,
"verbose": true,
"nodes_spawned": 20,
"committee_size_n": 3,
"committee_size_h": 3,
"committee_threshold_t": 1,
"network_model": "in_process_bus",
"testmode_harness": true
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

126 changes: 63 additions & 63 deletions circuits/benchmarks/results_insecure_agg_micro/report.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Enclave ZK Circuit Benchmarks

**Generated:** 2026-05-27 13:55:12 UTC
**Generated:** 2026-06-04 20:35:42 UTC

**Git Branch:** `params/dyn-conf`
**Git Commit:** `e6189e08754c90981a3c359911e081c5f5ff3a90`
**Git Branch:** `compile/all`
**Git Commit:** `5b66ae732e6c8351f58179b73abb25cafa372cec`

**Committee Size:** `H=3`, `N=3`, `T=1`

Expand Down Expand Up @@ -72,39 +72,39 @@ Single-circuit `bb prove` on the benchmark oracle witness (not the integration a

| Circuit | Constraints | Prove (s) | Verify (ms) | Proof (KB) |
| -------------------- | ----------- | --------- | ----------- | ---------- |
| C0 | 6847 | 0.14 | 28.39 | 15.88 |
| C1 | 57818 | 0.36 | 28.35 | 15.88 |
| C2a | 41244 | 0.32 | 27.93 | 15.88 |
| C2b | 79591 | 0.53 | 27.27 | 15.88 |
| C3a | 120114 | 0.60 | 27.47 | 15.88 |
| C3b | 120114 | 0.60 | 27.47 | 15.88 |
| C4a | 67494 | 0.46 | 25.09 | 15.88 |
| C4b | 67494 | 0.46 | 25.09 | 15.88 |
| C5 | 123624 | 0.58 | 35.81 | 15.88 |
| user_data_encryption | 53732 | 0.33 | 26.08 | 15.88 |
| C6 | 86927 | 0.58 | 27.25 | 15.88 |
| C7 | 90841 | 0.52 | 28.18 | 15.88 |
| C0 | 6847 | 0.14 | 31.05 | 15.88 |
| C1 | 57818 | 0.34 | 24.39 | 15.88 |
| C2a | 41244 | 0.38 | 31.88 | 15.88 |
| C2b | 79591 | 0.57 | 28.76 | 15.88 |
| C3a | 120114 | 0.57 | 25.32 | 15.88 |
| C3b | 120114 | 0.57 | 25.32 | 15.88 |
| C4a | 67494 | 0.48 | 26.63 | 15.88 |
| C4b | 67494 | 0.48 | 26.63 | 15.88 |
| C5 | 123624 | 0.55 | 25.38 | 15.88 |
| user_data_encryption | 53732 | 0.34 | 26.58 | 15.88 |
| C6 | 86927 | 0.59 | 25.40 | 15.88 |
| C7 | 90841 | 0.46 | 25.33 | 15.88 |

### Artifacts

| Artifact | Proof size | Public input size | Verify gas | Calldata gas | Total gas |
| -------- | ---------- | ----------------- | ---------- | ------------ | --------- |
| Π_DKG | 10.69 KB | 0.47 KB | 3125379 | 176232 | 3301611 |
| Π_user | 15.88 KB | 0.12 KB | 2972989 | 170272 | 3143261 |
| Π_dec | 10.69 KB | 3.47 KB | 3640997 | 187272 | 3828269 |
| Π_DKG | 10.69 KB | 0.47 KB | 3125331 | 176184 | 3301515 |
| Π_user | 15.88 KB | 0.12 KB | 2973085 | 170236 | 3143321 |
| Π_dec | 10.69 KB | 3.47 KB | 3640972 | 187248 | 3828220 |

### Role / Phase / Activity

| Role | Phase | Activity | Metric | Duration | Proof size | Bandwidth |
| --------------- | ----- | ----------------------------------------- | -------------- | -------- | ---------- | --------- |
| Each ciphernode | P1 | one-time DKG participation (test harness) | wall_clock | 148.93 s | 127.00 KB | 128.19 KB |
| Aggregator | P2 | C5 + Π_DKG fold (aggregator span) | wall_clock | 136.24 s | 10.69 KB | 11.16 KB |
| User | P3 | per user input | isolated_nargo | 0.65 s | 15.88 KB | 16.00 KB |
| Each ciphernode | P4 | per computation output (C6) | isolated_nargo | 0.58 s | 15.88 KB | 16.00 KB |
| Aggregator | P4 | C7 + Π_dec fold (full publish→aggregate) | wall_clock | 55.34 s | 10.69 KB | 14.16 KB |
| Aggregator | P4 | C7 + fold only (pending→plaintext span) | wall_clock | 51.39 s | 10.69 KB | 14.16 KB |

_P2 **tracked_job_wall** sum (ZkDkgAggregation + ZkPkAggregation, parallelizable): **21.30 s** — not
| Each ciphernode | P1 | one-time DKG participation (test harness) | wall_clock | 146.24 s | 127.00 KB | 128.19 KB |
| Aggregator | P2 | C5 + Π_DKG fold (aggregator span) | wall_clock | 133.91 s | 10.69 KB | 11.16 KB |
| User | P3 | per user input | isolated_nargo | 0.67 s | 15.88 KB | 16.00 KB |
| Each ciphernode | P4 | per computation output (C6) | isolated_nargo | 0.59 s | 15.88 KB | 16.00 KB |
| Aggregator | P4 | C7 + Π_dec fold (full publish→aggregate) | wall_clock | 54.40 s | 10.69 KB | 14.16 KB |
| Aggregator | P4 | C7 + fold only (pending→plaintext span) | wall_clock | 50.49 s | 10.69 KB | 14.16 KB |

_P2 **tracked_job_wall** sum (ZkDkgAggregation + ZkPkAggregation, parallelizable): **20.45 s** — not
comparable to P2 wall_clock row above._

## Integration test (`test_trbfv_actor`)
Expand All @@ -114,72 +114,72 @@ comparable to P2 wall_clock row above._
| Phase | Metric | Duration (s) |
| ------------------------------------------------------------------ | ------------ | ------------ |
| Starting trbfv actor test | `wall_clock` | 0.00 |
| Setup completed | `wall_clock` | 2.97 |
| Setup completed | `wall_clock` | 2.96 |
| Committee Setup Completed | `wall_clock` | 20.09 |
| Committee Finalization Complete | `wall_clock` | 0.01 |
| Aggregator P2: PkAggregation pending -> PublicKeyAggregated (wall) | `wall_clock` | 136.24 |
| ThresholdShares -> PublicKeyAggregated | `wall_clock` | 148.93 |
| E3Request -> PublicKeyAggregated | `wall_clock` | 149.43 |
| Aggregator P2: PkAggregation pending -> PublicKeyAggregated (wall) | `wall_clock` | 133.91 |
| ThresholdShares -> PublicKeyAggregated | `wall_clock` | 146.24 |
| E3Request -> PublicKeyAggregated | `wall_clock` | 146.75 |
| Application CT Gen | `wall_clock` | 0.01 |
| Running FHE Application | `wall_clock` | 0.00 |
| Aggregator P4: Aggregation pending -> PlaintextAggregated (wall) | `wall_clock` | 51.39 |
| Ciphertext published -> PlaintextAggregated | `wall_clock` | 55.34 |
| Entire Test | `wall_clock` | 227.84 |
| Aggregator P4: Aggregation pending -> PlaintextAggregated (wall) | `wall_clock` | 50.49 |
| Ciphertext published -> PlaintextAggregated | `wall_clock` | 54.40 |
| Entire Test | `wall_clock` | 224.22 |

### Multithread job timings (`tracked_job_wall`)

| Name | Avg (s) | Runs | Total (s) |
| ----------------------------- | ------- | ---- | --------- |
| CalculateDecryptionKey | 0.00 | 3 | 0.01 |
| CalculateDecryptionShare | 0.02 | 3 | 0.06 |
| CalculateDecryptionShare | 0.02 | 3 | 0.07 |
| CalculateThresholdDecryption | 0.02 | 1 | 0.02 |
| GenEsiSss | 0.01 | 3 | 0.02 |
| GenPkShareAndSkSss | 0.01 | 3 | 0.03 |
| NodeDkgFold/c2ab_fold | 8.42 | 3 | 25.26 |
| NodeDkgFold/c3a_fold | 36.69 | 3 | 110.07 |
| NodeDkgFold/c3ab_fold | 7.68 | 3 | 23.04 |
| NodeDkgFold/c3b_fold | 35.82 | 3 | 107.46 |
| NodeDkgFold/c4ab_fold | 8.05 | 3 | 24.14 |
| NodeDkgFold/node_fold | 19.28 | 3 | 57.84 |
| NodeDkgFold/c2ab_fold | 8.10 | 3 | 24.29 |
| NodeDkgFold/c3a_fold | 35.48 | 3 | 106.45 |
| NodeDkgFold/c3ab_fold | 7.88 | 3 | 23.65 |
| NodeDkgFold/c3b_fold | 35.91 | 3 | 107.72 |
| NodeDkgFold/c4ab_fold | 8.14 | 3 | 24.41 |
| NodeDkgFold/node_fold | 18.72 | 3 | 56.16 |
| ZkDecryptedSharesAggregation | 1.61 | 1 | 1.61 |
| ZkDecryptionAggregation | 49.76 | 1 | 49.76 |
| ZkDkgAggregation | 20.43 | 1 | 20.43 |
| ZkDkgShareDecryption | 1.32 | 6 | 7.91 |
| ZkNodeDkgFold | 115.94 | 3 | 347.81 |
| ZkPkAggregation | 0.86 | 1 | 0.86 |
| ZkPkBfv | 0.23 | 3 | 0.70 |
| ZkPkGeneration | 2.56 | 3 | 7.69 |
| ZkShareComputation | 2.55 | 6 | 15.33 |
| ZkShareEncryption | 4.02 | 24 | 96.43 |
| ZkThresholdShareDecryption | 3.49 | 3 | 10.48 |
| ZkDecryptionAggregation | 48.86 | 1 | 48.86 |
| ZkDkgAggregation | 19.84 | 1 | 19.84 |
| ZkDkgShareDecryption | 1.22 | 6 | 7.35 |
| ZkNodeDkgFold | 114.23 | 3 | 342.68 |
| ZkPkAggregation | 0.62 | 1 | 0.62 |
| ZkPkBfv | 0.23 | 3 | 0.68 |
| ZkPkGeneration | 2.50 | 3 | 7.49 |
| ZkShareComputation | 2.41 | 6 | 14.45 |
| ZkShareEncryption | 3.95 | 24 | 94.82 |
| ZkThresholdShareDecryption | 3.38 | 3 | 10.15 |
| ZkVerifyShareDecryptionProofs | 0.10 | 3 | 0.31 |
| ZkVerifyShareProofs | 0.27 | 5 | 1.35 |
| ZkVerifyShareProofs | 0.28 | 5 | 1.40 |

Sum of tracked job wall time: **908.64 s** — **not** end-to-end latency (jobs run in parallel up to
Sum of tracked job wall time: **893.09 s** — **not** end-to-end latency (jobs run in parallel up to
`BENCHMARK_MULTITHREAD_JOBS`).

### NodeDkgFold sub-steps (`tracked_job_wall`, per fold prove)

| Step | Avg (s) | Runs | Total (s) |
| --------- | ------- | ---- | --------- |
| c2ab_fold | 8.42 | 3 | 25.26 |
| c3a_fold | 36.69 | 3 | 110.07 |
| c3ab_fold | 7.68 | 3 | 23.04 |
| c3b_fold | 35.82 | 3 | 107.46 |
| c4ab_fold | 8.05 | 3 | 24.14 |
| node_fold | 19.28 | 3 | 57.84 |
| c2ab_fold | 8.10 | 3 | 24.29 |
| c3a_fold | 35.48 | 3 | 106.45 |
| c3ab_fold | 7.88 | 3 | 23.65 |
| c3b_fold | 35.91 | 3 | 107.72 |
| c4ab_fold | 8.14 | 3 | 24.41 |
| node_fold | 18.72 | 3 | 56.16 |

### Aggregation jobs (`tracked_job_wall`)

| Operation | Avg (s) | Runs | Total (s) |
| ---------------------------- | ------- | ---- | --------- |
| ZkDecryptedSharesAggregation | 1.61 | 1 | 1.61 |
| ZkDecryptionAggregation | 49.76 | 1 | 49.76 |
| ZkDkgAggregation | 20.43 | 1 | 20.43 |
| ZkNodeDkgFold | 115.94 | 3 | 347.81 |
| ZkPkAggregation | 0.86 | 1 | 0.86 |
| ZkDecryptionAggregation | 48.86 | 1 | 48.86 |
| ZkDkgAggregation | 19.84 | 1 | 19.84 |
| ZkNodeDkgFold | 114.23 | 3 | 342.68 |
| ZkPkAggregation | 0.62 | 1 | 0.62 |

Sum of aggregation job tracked time: **420.48 s** (parallel CPU work; not P1/P2 wall clock).
Sum of aggregation job tracked time: **413.61 s** (parallel CPU work; not P1/P2 wall clock).

### Folded on-chain artifacts (exported for Π_DKG / Π_dec gas)

Expand Down
36 changes: 28 additions & 8 deletions circuits/benchmarks/scripts/check_circuit_preset_artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,44 @@
# Verify dist + circuits/bin artifacts exist for a benchmark preset.
# Exit 0 if ready, 1 if not (prints missing paths on stderr).
#
# Usage: ./check_circuit_preset_artifacts.sh <insecure-512|secure-8192>
# Usage: ./check_circuit_preset_artifacts.sh <insecure-512|secure-8192> [--committee micro|small|medium|large]

set -e

PRESET="${1:-}"
if [ -z "$PRESET" ]; then
echo "Usage: $0 <insecure-512|secure-8192>" >&2
echo "Usage: $0 <insecure-512|secure-8192> [--committee micro|small|medium|large]" >&2
exit 1
fi
if [ "$PRESET" != "insecure-512" ] && [ "$PRESET" != "secure-8192" ]; then
echo "Error: preset must be insecure-512 or secure-8192" >&2
exit 1
fi

shift
COMMITTEE=""
while [[ $# -gt 0 ]]; do
case $1 in
--committee) COMMITTEE="$2"; shift 2 ;;
*) shift ;;
esac
done
Comment thread
0xjei marked this conversation as resolved.

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
DIST="${REPO_ROOT}/dist/circuits/${PRESET}"
BIN="${REPO_ROOT}/circuits/bin"

# Resolve committee from .active-preset.json if not supplied
if [ -z "$COMMITTEE" ]; then
ACTIVE_PRESET="${BIN}/.active-preset.json"
if [ -f "$ACTIVE_PRESET" ]; then
COMMITTEE=$(jq -r '.committee // "micro"' "$ACTIVE_PRESET" 2>/dev/null || echo "micro")
else
COMMITTEE="micro"
fi
fi

DIST="${REPO_ROOT}/dist/circuits/${PRESET}/${COMMITTEE}"
STAMP="${DIST}/.build-stamp.json"

MARKERS=(
Expand All @@ -46,7 +66,7 @@ if [ ! -f "$STAMP" ]; then
missing+=("$STAMP")
elif ! jq -e --arg p "$PRESET" '.preset == $p' "$STAMP" >/dev/null 2>&1; then
echo "Error: ${STAMP} is for a different preset (expected ${PRESET})." >&2
echo " Run: pnpm build:circuits --preset ${PRESET}" >&2
echo " Run: pnpm build:circuits --preset ${PRESET} --committee ${COMMITTEE}" >&2
exit 1
fi

Expand All @@ -55,14 +75,14 @@ if [ ! -f "$ACTIVE" ]; then
elif ! jq -e --arg p "$PRESET" '.preset == $p' "$ACTIVE" >/dev/null 2>&1; then
echo "Error: circuits/bin was last built for a different preset (see ${ACTIVE})." >&2
echo " Fast fix (no full recompile if dist is ready):" >&2
echo " pnpm build:circuits --preset ${PRESET} --skip-if-built --no-clean --no-clean-targets" >&2
echo " pnpm build:circuits --preset ${PRESET} --committee ${COMMITTEE} --skip-if-built --no-clean --no-clean-targets" >&2
exit 1
fi

if [ ${#missing[@]} -gt 0 ]; then
echo "Error: circuit artifacts for preset '${PRESET}' are missing or stale." >&2
echo " circuits/bin/target reflects the last preset built; dist/circuits/<preset>/ must exist for this mode." >&2
echo " Fix: pnpm build:circuits --preset ${PRESET}" >&2
echo "Error: circuit artifacts for preset '${PRESET}/${COMMITTEE}' are missing or stale." >&2
echo " circuits/bin/target reflects the last preset built; dist/circuits/<preset>/<committee>/ must exist for this mode." >&2
echo " Fix: pnpm build:circuits --preset ${PRESET} --committee ${COMMITTEE}" >&2
echo " Or run this script without --skip-build." >&2
echo "Missing:" >&2
printf ' %s\n' "${missing[@]}" >&2
Expand Down
2 changes: 1 addition & 1 deletion circuits/benchmarks/scripts/extract_crisp_verify_gas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ else
fi

require_preset_artifacts() {
if ! "${SCRIPT_DIR}/check_circuit_preset_artifacts.sh" "$PRESET_NAME"; then
if ! "${SCRIPT_DIR}/check_circuit_preset_artifacts.sh" "$PRESET_NAME" --committee "$COMMITTEE"; then
exit 1
fi
}
Expand Down
8 changes: 4 additions & 4 deletions circuits/benchmarks/scripts/run_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ while [[ $# -gt 0 ]]; do
--committee)
COMMITTEE_OVERRIDE="$2"
case "$COMMITTEE_OVERRIDE" in
micro|small|medium) ;;
micro|small|medium|large) ;;
*)
echo "Error: --committee must be micro|small|medium (got: $COMMITTEE_OVERRIDE)"
echo "Error: --committee must be micro|small|medium|large (got: $COMMITTEE_OVERRIDE)"
exit 1
;;
esac
Expand Down Expand Up @@ -83,7 +83,7 @@ while [[ $# -gt 0 ]]; do
;;
*)
echo "Unknown option: $1"
echo "Usage: $0 [--config <config_file>] [--mode insecure|secure] [--committee micro|small|medium] [--circuit <path>] [--skip-compile] [--bench-compile] [--clean] [--verbose] [--proof-aggregation on|off] [--no-proof-aggregation] [--multithread-jobs N]"
echo "Usage: $0 [--config <config_file>] [--mode insecure|secure] [--committee micro|small|medium|large] [--circuit <path>] [--skip-compile] [--bench-compile] [--clean] [--verbose] [--proof-aggregation on|off] [--no-proof-aggregation] [--multithread-jobs N]"
exit 1
;;
esac
Expand Down Expand Up @@ -243,7 +243,7 @@ if [ "$SKIP_COMPILE" = false ]; then
ENSURE_ARGS+=(--verbose)
fi
"${SCRIPT_DIR}/ensure_circuit_preset_built.sh" "${ENSURE_ARGS[@]}"
if "${SCRIPT_DIR}/check_circuit_preset_artifacts.sh" "$PRESET_NAME"; then
if "${SCRIPT_DIR}/check_circuit_preset_artifacts.sh" "$PRESET_NAME" --committee "$OUTPUT_COMMITTEE"; then
PRESET_ARTIFACTS_READY=true
fi
echo "Preflight build complete."
Expand Down
Loading
Loading