Skip to content

feat(sdk): compatibility validation harness adapter-based integrations + documentations - v1#210

Closed
zama-cremaud wants to merge 70 commits intoprereleasefrom
feat/compatibility-validation-harness-v1
Closed

feat(sdk): compatibility validation harness adapter-based integrations + documentations - v1#210
zama-cremaud wants to merge 70 commits intoprereleasefrom
feat/compatibility-validation-harness-v1

Conversation

@zama-cremaud
Copy link
Copy Markdown
Contributor

@zama-cremaud zama-cremaud commented Apr 7, 2026

Summary

This PR introduces a new compatibility validation harness for Zama SDK integrations, built for real-world wallet/custody architectures (EOA, MPC, API-routed systems, and smart-account-like setups).

What this adds

  • A capability-driven adapter model for integration testing.
  • A structured validation framework with explicit statuses:
    • PASS, FAIL, UNTESTED, UNSUPPORTED, BLOCKED, INCONCLUSIVE.
  • Validation coverage for:
    • identity/address resolution,
    • EIP-712 signing + recoverability,
    • Ethereum execution primitives (when supported),
    • adapter-routed execution/reads,
    • Zama authorization flow,
    • practical Zama write-path probe.
  • Conservative, scoped claim-based final verdicts with rationale.
  • Clear infrastructure/environment diagnostics, separate from compatibility failures.
  • Sectioned human-readable report + optional versioned JSON artifact.
  • Integrator-friendly commands:
    • doctor for preflight checks,
    • validate for CI gating.
  • Example adapters and documentation for Crossmint, Turnkey, and Openfort baseline usage.

Outcome

This introduces a practical, honest compatibility harness that helps partners quickly understand what is validated, what is compatible, what is blocked by infrastructure, and what remains out of scope.

zama-cremaud and others added 10 commits April 7, 2026 09:48
…s (v1)

Standalone Node.js tool for external integrators (Crossmint, Openfort, Turnkey,
etc.) to validate their signing stack against Ethereum EOA, EIP-712, and the
Zama SDK. Integrator plugs their signer into src/signer/index.ts, runs
`npm test`, and gets a structured compatibility report.

Four tests: EIP-712 ecrecover validation, transaction broadcast, Zama SDK
credentials.allow() flow (RelayerNode + Sepolia), and signer type detection.
Token address auto-detected from the on-chain registry — no extra .env config.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the vague "invalid private key" error from viem with a clear
message when the key is missing or still the placeholder value from
.env.example.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…vulnerability

Upgrades @zama-fhe/sdk from 2.3.0-alpha.2 to 2.3.0-alpha.4 (latest published).
Runs npm audit fix to patch Vite ≤7.3.1 path traversal/file read CVEs (GHSA-4w7w-66w2-5vf9,
GHSA-v2wj-q39q-566r, GHSA-p9ff-h696-f583) — Vite bumped from 7.3.0 to 7.3.2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Signer interface: `signTransaction` is now optional; add optional
  `writeContract` for MPC / smart-account wallets
- Signer profile detection runs first (never blocking) and classifies
  wallets as EOA, MPC, Smart Account, or Unknown
- Report is split into two sections (Ethereum Compatibility / Zama SDK
  Compatibility); final verdict is based solely on the Zama section so
  MPC wallets that skip the raw-transaction test still pass
- Transaction test: SKIP gracefully when only `writeContract` is provided
- Add `examples/crossmint/`: full MPC adapter + compatibility report

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…obustness

Env & docs
- .env.example: clarify PRIVATE_KEY is EOA-only; add CROSSMINT_* vars section
  including CROSSMINT_WALLET_ADDRESS (skip API lookup if address is known)
- README: full rewrite — separate EOA / MPC quickstarts, full Signer interface
  docs with async-address pattern, env vars table split by adapter, CI/CD
  GitHub Actions snippet, troubleshooting section for common failure modes
- COMPATIBILITY.md: add CROSSMINT_WALLET_ADDRESS to setup; update key findings

Crossmint adapter fix (race condition)
- Replace fragile "throw then Object.defineProperty" pattern with a proper
  _address variable + exported `ready: Promise<void>`
- Add CROSSMINT_WALLET_ADDRESS env var: if set, address is available
  synchronously from startup with no API call
- If not set, address resolves via GET /wallets/{locator} before tests start

Harness: await `ready` before first test
- signerType.test.ts now imports the signer module and, in beforeAll, awaits
  `signerModule.ready` if it is a Promise — guarantees signer.address is
  available synchronously for the entire test suite
- src/signer/index.ts: document the `ready` export convention for custom
  MPC adapters; add pointer to examples/crossmint/signer.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Instead of copying an adapter file into src/signer/index.ts, integrators
can now point to any signer file without touching the harness source:

  SIGNER_MODULE=./examples/crossmint/signer.ts npm test

vitest.config.ts intercepts imports of src/signer/index.{ts,js} at the
Vite alias level and transparently redirects them to the specified file.
Without SIGNER_MODULE the harness falls back to the built-in EOA signer.

Also adds a convenience npm script:
  npm run test:crossmint  →  SIGNER_MODULE=./examples/crossmint/signer.ts

Docs updated: README quickstart replaces cp step with env var; COMPATIBILITY.md
setup section renumbered and run command updated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ull specifier

Rollup alias with a regex does id.replace(find, replacement) — not a full
substitution. The previous regex /[/\\]signer[/\\]index\.(ts|js)$/ only
matched the suffix, producing paths like ../abs/... instead of the intended
absolute path. Prefixing with ^.* ensures the entire specifier is captured
and replaced.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ndling

Crossmint adapter:
- signTypedData: use a bigIntReplacer in JSON.stringify so that uint256/uint128
  fields in EIP-712 messages (which are BigInt in JS) are serialized as decimal
  strings rather than throwing "Do not know how to serialize a BigInt"
- ready: attach a no-op .catch() to prevent Node.js unhandled rejection warnings
  when the initialisation promise rejects before beforeAll has a chance to await it

signerType.test.ts:
- Wrap `await ready` in try/catch so an init failure does not skip the test suite;
  individual tests will still fail with descriptive errors
- Wrap `signer.address` in recordProfile call in try/catch to handle the case
  where async address resolution failed (falls back to "(unresolved)")

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…roadmap

Covers background, problem statement, architecture, v1 issues/limitations,
v2 requirements, and the end-goal (npx zero-install compatibility check).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…SUMMARY.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cla-bot cla-bot Bot added the cla-signed label Apr 7, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

Public API Changes

✅ No public API changes detected.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 92.59% (🎯 80%) 2988 / 3227
🔵 Statements 92.68% 3066 / 3308
🔵 Functions 92.66% (🎯 80%) 922 / 995
🔵 Branches 85.78% (🎯 80%) 1225 / 1428
File CoverageNo changed files found.
Generated in workflow #1492 for commit 630d18c by the Vitest Coverage Report Action

@zama-cremaud zama-cremaud changed the title Introduce a Zama Compatibility Validation Harness for Adapter-Based Integrations (feat) zama compatibility validation harness for adapter-based integrations - v1 Apr 8, 2026
@zama-cremaud zama-cremaud changed the title (feat) zama compatibility validation harness for adapter-based integrations - v1 feat(compatibility validation harness) adapter-based integrations + documentations - v1 Apr 8, 2026
@zama-cremaud zama-cremaud changed the title feat(compatibility validation harness) adapter-based integrations + documentations - v1 feat(sdk): compatibility validation harness adapter-based integrations + documentations - v1 Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant