Skip to content

fix(shielded-pq): re-pin drifted PQ-v2 regression guards (PQV2-08) - #24

Merged
cloudzombie merged 1 commit into
mainfrom
fix/pqv2-08-regression-guards
Jul 28, 2026
Merged

fix(shielded-pq): re-pin drifted PQ-v2 regression guards (PQV2-08)#24
cloudzombie merged 1 commit into
mainfrom
fix/pqv2-08-regression-guards

Conversation

@cloudzombie

Copy link
Copy Markdown
Owner

Closes audit Medium PQV2-08 — "security/performance regression checks have drifted" — on the DORMANT PQ shielded pool v2 (chain/crates/shielded-pq, BIP-9 bit 2, unarmed).

Fixes the guards, not the code they guard: no consensus behavior, gas, digest, or activation-state change; unsafe stays forbidden; bit 2 remains UNARMED.

Drift found + fixed (each measured, not guessed)

  1. Mislabeled security report (security_level.rs) — line said 42 queries, blowup 8, quadratic while the code measured the shipped proof_options() (64/16/cubic). Measured conjectured 128 / proven(ldr) 128 is the cubic/16/64 row (quadratic/8/42 = 127/75). Relabeled.
  2. No floor pin on the security level — the reporting test asserted nothing; a silent revert to the old set drops proven security 128->75 with every test green. Added >= 128 floor on conjectured AND proven(ldr) bits (measured 128/128). A floor only catches a regression, never blesses a change.
  3. Params not build-time-guarded (prover.rs) — extracted FRI_NUM_QUERIES/BLOWUP/GRINDING/EXTENSION_DEGREE consts with const _: () = assert!(..) guards, so a silent edit fails the BUILD (verified: 42 -> evaluation panicked: FRI query count moved off 64). Same discipline as the PQV2-03 anchor-ring floor.
  4. Claimed-but-absent proof-size pinverify_cost.rs said the size was "pinned by the KAT suite"; no such pin existed. Added kat_proof_size_pinned = 98494 bytes (deterministic STARK proof). Corrected the stale prover.rs doc figure 94.3 KB -> 96.2 KB.
  5. No byte-KAT on the carrier network binding (carrier.rs, PQV2-06) — carrier tests were mutually self-consistent, blind to a silent preimage/scheme/domain change. Added carrier_sighash_byte_kat_pinned + SCHEME_DOMAIN_SIGNER_NONCE == 2 pin.

No KAT/security constant re-blessed to force green: only the corrected report label changed; every added pin is a freshly measured deterministic value.

Coordination

Comment churn in security_level.rs / decode_hardening.rs kept minimal to merge cleanly with the concurrent PQV2-05 (claims-accuracy) PR — this touches values/assertions, not classical-vs-PQ wording.

Verification (real output)

  • cargo fmt --check — clean
  • cargo build --workspace — clean
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo test -p sov-shielded-pq -p sov-runtime — sov-runtime 97/0, shielded-pq lib 71/0 (+1 justified ignore), kat 24/0, decode_hardening 18/0 (+1 justified ignore), security_level 2/0, verify_cost 2/0

The two #[ignore]d tests are a ~2-min full-tree capacity soak and a fuzz-corpus generator — neither a regression check; both correctly gated.

🤖 Generated with Claude Code

The pool-v2 security/performance regression checks had drifted off the
parameters actually shipped, and several security-critical surfaces had no
regression pin at all — a silent parameter change could regress proven
security (128 -> 75 bits) or the proof size / weight derivation with no
failing test while the pool is dormant. Guards only; no consensus behavior,
gas, digest, or activation-state change. Bit 2 stays UNARMED.

- security_level.rs: relabel the security report from the stale "42 queries,
  blowup 8, quadratic" to the shipped 64/16/cubic set (the code measured the
  new set under the old label); add a >=128 FLOOR assertion on conjectured
  AND proven(ldr) bits (the test previously asserted nothing).
- prover.rs: extract FRI_NUM_QUERIES/BLOWUP/GRINDING/EXTENSION_DEGREE consts
  with `const _: () = assert!(..)` build-time guards, so a silent param edit
  fails the BUILD (proven: flipping to 42 -> "FRI query count moved off 64").
  Correct the stale 94.3 KB doc figure to the real 96.2 KB / 98494 B.
- kat.rs: add kat_proof_size_pinned (98494 bytes) — verify_cost.rs claimed the
  size was "pinned by the KAT suite" but no such pin existed.
- carrier.rs: add carrier_sighash_byte_kat_pinned + scheme-byte pin (PQV2-06);
  the existing carrier tests were mutually self-consistent and could not catch
  a silent preimage/scheme/domain change.
- notes: PQV2-08 resolution appended.
@cloudzombie
cloudzombie force-pushed the fix/pqv2-08-regression-guards branch from 192e9d8 to 009aac8 Compare July 28, 2026 20:26
@cloudzombie
cloudzombie merged commit 7bd727f into main Jul 28, 2026
36 checks passed
@cloudzombie
cloudzombie deleted the fix/pqv2-08-regression-guards branch July 28, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant