Private LOS circuit benchmark

This additive canister measures the static private_los_2d circuits for public maps with exactly 0, 4, 16 and 64 segments. Eight-bit equality and an arbitrary 256:1 selector use the same generic runtime as comparisons. The selector has 255 ANDs and 510 XORs; its staged 256-bit Alice input is synthetic data. It never constructs or receives a LOS visibility mask. Preprocessing is unmeasured.

The existing 91-case GC benchmark is unchanged. These fixtures are transient and disappear on restoration. The canister has ordinary SDK typed-root startup and private root/memory/v1.rs and driver/memory/v1.rs owners; no game application or secret-storage contract is introduced.

From the newstack root, the build owner uses an exclusive Cargo target and the pinned environment. The package is cdk-rsx-crypto-private-los-bench. Generate the native reference with portable AES, preserving compiler, source, lockfile and binary identities:

source tools/env.sh
export CARGO_TARGET_DIR=/absolute/exclusive/los-target
export RUSTFLAGS='--cfg aes_force_soft'
mkdir /absolute/fresh/los-run
cargo build --release --locked --offline --manifest-path benches/crypto/Cargo.toml \
  -p cdk-rsx-crypto-private-los-bench --bin los-reference
"$CARGO_TARGET_DIR/$ICRUSTMEM_HOST_TARGET/release/los-reference" 1 1,10,100 \
  > /absolute/fresh/los-run/native-reference.json
python3 benches/crypto/native-reference-receipt.py --suite private-los \
  --binary "$CARGO_TARGET_DIR/$ICRUSTMEM_HOST_TARGET/release/los-reference" \
  --reference /absolute/fresh/los-run/native-reference.json \
  --out /absolute/fresh/los-run/native-reference-receipt.json

Generate the receipt immediately after the build in the same environment. It records the binary, reference, compiler, lockfile and current local source hashes; it does not retrospectively attest a different binary or source checkout. The host requires portable AES and checks the reference hash. Use the SDK canonical builder and preserve its complete output directory and absolute-path receipts:

python3 cdk-rsx/tools/build-app.py \
  --manifest-path benches/crypto/Cargo.toml \
  --package cdk-rsx-crypto-private-los-bench --name private-los-bench \
  --features aes-narrow,prg-xof4,prg-query-batch \
  --out-dir /absolute/fresh/los-run/artifact --debug-artifacts --archive-sources --offline --locked
node benches/crypto/private-los/run.mjs \
  --artifact /absolute/fresh/los-run/artifact \
  --reference /absolute/fresh/los-run/native-reference.json \
  --reference-receipt /absolute/fresh/los-run/native-reference-receipt.json \
  --out /absolute/fresh/los-run/results --pocket-ic /absolute/qualified/pocket-ic

The runner verifies the canonical Wasm, archived sources and generated codec through the factory artifact helper. Both GC and LOS use the same shared, result-local codec bootstrap. It uses the same frozen normal13 PocketIC identity and owned-session lifecycle; no new PocketIC client is implemented.

The shared fixture now has 135 default populations: the six LOS/comparison programs plus three proximity radii, five stages and actual N1/10/100. Use the primary proximity entry for R1/R2/R4 and Equality8 at actual N1/100; it selects 40 populations. Use --cases los64.garble,equality8.garble, --samples 1|2|3 and --batches 1,10,100 to select work. Explicit N1000 is optional and requires a reference generated with that actual batch. Every setup, trap, instruction-limit or method-limit failure remains a failed row. The conservative transient staging cap is 256 MiB per cohort; it is an admission estimate, not a peak heap claim. No row is extrapolated. Inspect the matrix without a server:

node benches/crypto/private-los/run.mjs --dry-run
node --test benches/crypto/private-los/matrix.test.mjs

Five independent body intervals measure:

  • Per-query private PRG construction/fill into staged randomness buffers.
  • Garbling from previously filled material, including runtime scratch wiping.
  • Evaluation from staged garblings and locally selected fixture labels.
  • Serialization of the actual request and output frames, including both headers.
  • Borrowed parsing and exact route/length checks for both frames.

Each fixture stages one Alice workspace and one Bob workspace, reused and cleared for its sequential queries. Every query retains its own inputs, fresh material, private output map, request, output and frame buffers. All allocations, input preparation and cached AES/session preparation precede the body timer. Each fixture runs once and then rejects reuse. Deterministic public fixture domains are independently reconstructed for matched samples; this is reproducible benchmark material, not entropy for real private inputs. Local Bob-label selection is explicitly fixture-only and occurs outside timed work. It does not implement OT.

The raw body retains its loop, input/output barriers, output writes and page faults. Completion, FNV checksums, independent ordinary i64 segment intersection, parsed-frame reevaluation, complete returned-label verification and Alice's decode occur after the timer. Prelude and postcheck instructions are separate. Each stage has a separately staged empty harness; its subtraction is diagnostic. The checked whole-message trace and page fees remain authoritative and include all wrappers, preparation inside the endpoint, postchecks and reply serialization.

The catalog records actual compiled gates, depth, declared and live inputs. Logical OT is live_bob_bits * N; the empty map may have no live Bob inputs. The request payload is the actual live Alice labels, half-gate tables and live constant label. The output payload is 16 bytes. Each encoded frame uses the existing exact 84-byte header. Rows retain payload and framing bytes separately, plus exact benchmark endpoint Wire request/reply bytes. These are constructed circuit frames, without party transport. Sent/received network bytes, actual OT cost, generated/check/base OT counts, rounds and full-protocol costs are null. Explicit BLOCKED rows preserve that unavailable scope.

Each frame's suite ID is a separate BLAKE3 application descriptor over the primitive suite, exact positional contract, program name, public walls, input liveness and generated circuit. Distinct maps cannot share a framing identity. Descriptor hashing occurs outside body timers. Same-runtime Equality8 is the phase comparator: the older specialized Equality8 garbling measurement also included per-query randomness and has a different scope. Component body costs are never added into a claimed measured composition total or page charge.

Before cost capture, 96 target probes compare every request/reply frame and chosen Bob-label byte with the portable native output: the original 48 LOS/control probes plus 48 proximity boundary probes. LOS answers also use an independent ordinary geometry implementation on the host. This shared-source GC differential does not replace the algorithm crate's exhaustive 65,536-pair circuit/oracle tests. Build a separate artifact with --features aes-narrow,prg-xof4,prg-query-batch,instrumentation and run with --correctness-only --instrumented to require exactly four Alice hashes and two Bob hashes per AND, and the compiled AND/XOR counts. Instrumented images cannot supply performance rows. Probe bytes and their complete traces are preserved.

results.json, rows.jsonl, results.csv, setup captures, full compressed execution traces, installation hashes, canonical artifact and host receipts, catalog, out-of-window page views, byte probes and no-op controls are retained. Committed heap/page capacity is not peak live heap. Wall-time median/p95 are unmeasured; traced host invocation duration is only a diagnostic.

The dated qualification records the selected shared-workspace run and its initial per-query-workspace baseline. Native tests/reference generation, canonical builds and the host runner were executed as separate component commands. These instructions do not claim a newly executed end-to-end packaging script. The current README wording postdates the measured host-source snapshot; frozen snapshots retain their original bytes.

The maintained report tool validates rows, audits, regression controls and OT-reference receipts before rendering. To reproduce the selected historical six-program report from the retained complete local raw directories (the recorded run predates the additive proximity circuits):

python3 benches/crypto/private-los/report.py \
  --run playground/private-los-20261031 \
  --primary playground/private-los-20261031/reuse-001/selected-results \
  --counter playground/private-los-20261031/reuse-001/counter-checks \
  --audit playground/private-los-20261031/review/reuse-actual-audit.json \
  --comparison playground/private-los-20261031/selected-results \
  --comparison-audit playground/private-los-20261031/review/actual-audit.json \
  --label 'selected shared sequential workspaces' \
  --out /absolute/fresh/los-report

This is a report-only replay, not a new measurement. The compact committed evidence is a partial reproduction snapshot: it does not contain every raw input needed by this command. --curate and --report publish to explicit fresh destinations; never point them at frozen evidence. Curation also verifies measured host source against the live checkout. Re-curating an old run requires restoring those exact source files in an isolated checkout; the raw run directories alone are not enough after source edits. The archived generator remains unchanged.