Skip to content

docs(security): correct stealth scheme, NUMS, UltraHonk, constraint counts (audit 3/4) - #109

Merged
rz1989s merged 1 commit into
mainfrom
fix/docs-security-crypto
Jun 6, 2026
Merged

docs(security): correct stealth scheme, NUMS, UltraHonk, constraint counts (audit 3/4)#109
rz1989s merged 1 commit into
mainfrom
fix/docs-security-crypto

Conversation

@rz1989s

@rz1989s rz1989s commented Jun 6, 2026

Copy link
Copy Markdown
Member

Summary

Part 3 of 4 of the June 2026 docs audit (#96) — security/spec crypto accuracy + a design-doc banner. These pages feed the upcoming external audit, so accuracy matters most here.

⚠️ Stacked on #108 (PR2) → #107 (PR1). Merge order: #107#108 → this.

Headline: the stealth-address scheme was documented backwards

crypto-assumptions.md and audit-checklist.md described the stealth scheme with the spending and viewing key roles swapped relative to the implementation. Verified against packages/sdk/src/stealth/secp256k1.ts, the real scheme is:

  • S = r·K_spend — ECDH uses the spending key (doc said r·K_view)
  • P = K_view + H(S)·G — address built on the viewing key (doc said K_spend + s·G)
  • p = k_view + H(S) — stealth private key (doc said k_spend + …)

This now matches both the code and security-properties.md (A = Q + H(r·P)·G, Q = viewing, P = spending).

⚑ Note for the auditor / team: SIP's key-role assignment differs from canonical EIP-5564 (which bases the stealth address on the spending key). Deriving the stealth private key here requires both recipient private keys. I've documented what the code actually does and flagged the divergence — no code change in this PR; please confirm it's intentional before the audit.

Other fixes (7 files)

  • NUMS H generatorsha256("SIP_PEDERSEN_H_GENERATOR_V1") + hashToCurve → try-and-increment over "SIP-PEDERSEN-GENERATOR-H-v1:<counter>" (matches commitment.ts).
  • Proof systemUltraPlonkUltraHonk (crypto-assumptions + zk-architecture; removed the spurious Groth16 backend node).
  • Constraint counts — proof-spec badges + the crypto-assumptions table corrected from "~20/50/80/150/200 constraints" to the real ACIR opcodes (funding 972, validity 1,113, fulfillment 1,691; 3,776 total) with an ACIR-vs-Barretenberg-gate-count clarification; fixed the bogus "64 bytes (mock)" proof-size claims.
  • near-integration-design — added a "design proposal — not the shipped API" banner (it documents a proposed SIPClient/.swap() API that doesn't exist; the real client is SIP with getQuotes()/execute()).

Verification

  • astro build green — 1277 pages.
  • Stealth-scheme correction cross-checked against stealth/secp256k1.ts (generation + recovery) and security-properties.md.

Series

PR1 (#107) · PR2 (#108) · PR3 (this) · PR4 sipher SENTINEL → closes #96.

Refs #96

…ounts

June 2026 docs audit, part 3/4 (#96). Fixes crypto/spec inaccuracies in the
security and spec docs (audit-prep critical) + a design-doc banner.

- crypto-assumptions + audit-checklist: the stealth-address scheme had the
  spending/viewing key roles SWAPPED vs the implementation. Corrected to match
  stealth/secp256k1.ts: S = r*K_spend (ECDH on spending key), P = K_view + H(S)*G,
  p = k_view + H(S). Now consistent with security-properties.md (A = Q + H(r*P)*G).
- NUMS H generator: sha256("SIP_PEDERSEN_H_GENERATOR_V1") + hashToCurve ->
  try-and-increment over "SIP-PEDERSEN-GENERATOR-H-v1:<counter>" (matches commitment.ts).
- Proof system: UltraPlonk -> UltraHonk (crypto-assumptions, zk-architecture;
  dropped the spurious Groth16 backend node).
- Constraint counts: proof-spec badges + crypto-assumptions table corrected from
  "~20/50/80/150/200" to real ACIR opcodes (funding 972 / validity 1,113 /
  fulfillment 1,691; 3,776 total) with an ACIR-vs-gate-count clarification; fixed
  the bogus "64 bytes (mock)" proof-size claims.
- near-integration-design: added "design proposal - not the shipped API" banner.

astro build green (1277 pages). Stacked on the PR2 staleness branch.
@vercel

vercel Bot commented Jun 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sip-docs Ready Ready Preview, Comment Jun 6, 2026 10:16am

@rz1989s
rz1989s changed the base branch from fix/docs-staleness to main June 6, 2026 11:23
@rz1989s
rz1989s merged commit 946db43 into main Jun 6, 2026
2 checks passed
@rz1989s
rz1989s deleted the fix/docs-security-crypto branch June 6, 2026 11:26
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.

Monthly Docs Audit - June 2026

1 participant