Adversarial & Security Lab

Interactive verification harness testing valid proofs, corrupted pairings, BN254 `n + r` malleability, borrower binding, revoked roots, stale policies, unauthorized markets, replay, exposure caps, and live SAC custody on Stellar Testnet.

1. Valid Proof (Web Worker)Expect: true

Generates a real BN254 Groth16 proof in Web Worker against active Market A policy and verifies on `ZkVerifier`.

2. Corrupted Proof AttackExpect: false

Submits forged G1/G2 pairing coordinates to `ZkVerifier.verify()`, rejecting on-chain with zero state mutation.

3. BN254 `n + r` MalleabilityExpect: false (#6)

Injects `BN254_R + 101` into public signal #7 (`nonce`), proving canonical `< R_BE` enforcement.

4. Wrong Borrower Binding

Simulates `MarketA.borrow()` with proof bound to Market B instead of caller (`Error #5`).

5. Revoked / Inactive Root

Simulates `MarketA.borrow()` against unapproved root on `CredentialRegistry` (`Error #8`).

6. Old / Stale Policy

Valid active Issuer root paired with outdated `policy_hash` triggers `InactivePolicy` (`Error #9`).

7. Unauthorized Market

Queries `CreditController.is_market_enabled()` for unregistered contract (`UnknownMarket #12`).

8. Nullifier Replay Guard

Queries `CreditController.is_nullifier_used()` & verifies consumed replay protection (`Error #10`).

9. Shared Exposure Cap

Checks live shared controller exposure vs allowance & Testnet `#11 AllowanceExceeded` proof.

10. Live SAC Custody & Domain Parity AuditInvariant #8

Verifies `sac.balance(market) >= liquidity + locked_collateral` on Market A & Market B plus `proof_domain` parity.

Verified On-Chain Testnet Security Evidence (`deployments/testnet/demo-evidence.json`)

No demo-evidence.json loaded yet.