# public-verify-bench — result ## Scope This item builds **one independently runnable component**: a repeatable CPU benchmark for **secp256k1 ECDSA public signature verification** using known-answer vectors. It is self-contained and has no role in key recovery; it reports throughput in **verifications per second**. All changes are confined to `public-verify-bench/**`. ## Files created (all under `public-verify-bench/`) | Path | What it is | |------|------------| | `public-verify-bench/secp256k1_verify.py` | Pure standard-library secp256k1 group ops + ECDSA verify (the measured op). Includes an RFC 6979 deterministic signer used **offline only** to generate fixtures. Imports only `hashlib`, `hmac`. | | `public-verify-bench/gen_fixtures.py` | Deterministically generates the synthetic KAT fixtures. | | `public-verify-bench/fixtures/vectors.json` | 128 generated KAT vectors (**SYNTHETIC**, labeled). | | `public-verify-bench/fixtures/LICENSE` | CC0-1.0 public-domain dedication for the fixture data. | | `public-verify-bench/benchmark.py` | Correctness gate (valid accepted / corrupted rejected) then timed throughput + memory/metadata recording. | | `public-verify-bench/test_verify.py` | 10 deterministic unit tests. | | `public-verify-bench/README.md` | Prerequisites, exact commands, expected output, provenance/license. | No files outside `public-verify-bench/**` were modified. `foundry.toml`, `remappings.txt`, `lib/`, `.github/` and other configuration were not touched. No dependency, `package.json` or lockfile was added. No git submodule created. ## Data provenance and license Fixtures are **SYNTHETIC and independently generated** by `gen_fixtures.py`: private keys are `SHA-256` of a fixed public seed string (`public-verify-bench/secp256k1/synthetic-kat/v1`), and signatures use **RFC 6979** (HMAC-SHA256) deterministic nonces, so regeneration is byte-identical and the `(r, s)` pair is itself the known answer. The secp256k1 domain parameters are the public standard constants (**SEC 2 v2, §2.4.1**, Certicom Research, 2010), not generated here. Fixture data is dedicated to the public domain under **CC0-1.0** (`fixtures/LICENSE`). No downloaded/third-party dependency is used at runtime — Python standard library only. ## Commands actually run and what they reported 1. `python3 gen_fixtures.py --count 128 --out fixtures/vectors.json` → `wrote 128 synthetic KAT vectors to .../fixtures/vectors.json` 2. `python3 -m unittest -v` → `Ran 10 tests in 1.592s` / `OK`. Tests cover: generator on curve; `N·G == ∞`; compressed-key decompression round-trip; sign→verify; RFC 6979 determinism (identical signature on repeat); rejection of corrupted `s`, wrong message, and out-of-range `r`/`s`; low-s canonical form; and that every shipped fixture verifies. 3. `python3 benchmark.py --repeat 5` (full default workload) → correctness gate `passed: true` with `total_valid_vectors=128, valid_accepted=128, corrupted_rejected=128`; `workload_vectors=128`, `repeat_count=5`, `total_verifications=640`, `wall_time_s≈52.88`, `verifications_per_second≈12.10`, `peak_python_alloc_bytes=1308` (`≈1.3 KiB`, tracemalloc, timed phase), `process_peak_rss_kib=21328` (`resource.ru_maxrss`, KiB on Linux), `backend="pure-python-stdlib (int arithmetic, SHA-256/HMAC via hashlib)"`, `hardware_metadata={source: none, device_details: unknown}` (no `$PVB_TASK_DESCRIPTOR` was supplied, so device details are left unknown rather than probed). 4. `python3 benchmark.py --limit 16 --repeat 2` (fast smoke) → `gate True | workload 16 | total 32 | wall_s 2.73 | vps 11.7 | rss_kib 21280`. 5. Determinism check: regenerated `vectors.json` and `diff` against a saved copy → `DETERMINISTIC: identical`. 6. `git status --short` → only `public-verify-bench/` appears as an untracked addition (other entries are pre-existing device-node dotfiles, not changed by this item). ## Recorded benchmark metrics (observed on build machine) - Backend: pure-python-stdlib (int arithmetic; `hashlib`/`hmac`). - Workload size: 128 KAT vectors; repeat count: 5; total verifications: 640. - Wall time: ≈52.88 s; throughput: ≈12.10 verifications/second. - Per-run peak memory: `tracemalloc` peak ≈1.3 KiB during the timed phase; process peak RSS 21328 KiB (`ru_maxrss`, KiB, Linux). - Correctness gate: 128/128 valid accepted, 128/128 corrupted rejected. - Platform: CPython 3.14.4, Linux. CPU model/core count not probed and left `unknown` (no platform task descriptor present). Figures are machine- and load-dependent; the pure-stdlib backend is dependency-free and therefore slow by design. ## How it was checked Determinism and correctness are enforced in-tool: the benchmark refuses to time anything unless the correctness gate (valid-accept + corrupted-reject across the whole workload) passes, and the unit suite independently checks curve identities, RFC 6979 determinism, and signature rejection cases. Fixture regeneration was confirmed byte-identical. The verifier was cross-checked against its own RFC 6979 signer and against standard curve invariants (`N·G = ∞`, points on curve). ## Blockers None for this item. The component builds and runs with the Python standard library alone. (The surrounding goal's key-recovery objective is out of scope for this item and was not attempted here.)