Use with your AI agent
- Install — run
npx skills add Kali-Decoder/Midnight-skills --skill midnight-testing-checklistfor this skill, ornpx skills add Kali-Decoder/Midnight-skillsfor all - Prompt — copy the example prompt and paste it into Cursor, Claude Code, or Codex
- Build — the agent loads this skill and scaffolds your Midnight work
Testing Checklist
Agent picks this when: Decide what to test and find gaps before a release
What tested means for a Midnight dApp: contract logic, negative and privacy tests, local-devnet end-to-end tests, frontend and ZK-artifact checks, and CI.
Good for
- Checklist across --skip-zk logic tests, negative/privacy tests, devnet E2E with testkit-js, frontend, and CI.
- Names the missing tests and links to the skills that show how to write them.
Preview in agent
Suggested promptsDecide what to test and find gaps before a release. Use the "midnight-testing-checklist" skill from MIDSKILLS. Follow Compact smart-contract best practices, wire wallet flows where needed, and explain each step as you implement. Target Midnight Preprod unless I specify otherwise.
Loaded skill midnight-testing-checklist
What the skill guides the agent to do:
- Checklist across --skip-zk logic tests, negative/privacy tests, devnet E2E with testkit-js, frontend, and CI.
- Names the missing tests and links to the skills that show how to write them.
Illustrative — based on the skill's description, not recorded agent output.
Try it without installing: npx skills use Kali-Decoder/Midnight-skills@midnight-testing-checklist
What changed in v1.0.16
All registry changesNew skill — first published in v1.0.16 (not in v1.0.14).
On this page · 7 sections
Midnight Testing Checklist
What "tested" means for a Midnight dApp, as boxes to tick. For how to write each kind of test, follow the linked skills.
What this skill produces: a filled checklist, the missing tests named one per line, and the commands that run the suite.
Workflow
- Run
midnight-doctorfirst. A version FAIL makes every test result meaningless. - Find the existing suites (
vitest.config.*,**/*.test.ts, CI workflows) and run them once to get a baseline. - Walk sections A–E. For each missing item, name the test to add (file + what it asserts).
- Write or extend tests starting with section B: negative tests catch the bugs that matter on a privacy chain.
- Report what passes, what is missing, and the exact commands.
A. Contract logic (fast loop, no proofs) — see testing/ §3
- The contract compiles with the pinned toolchain; during iteration use
compact compile --skip-zkto skip proving-key generation. - Every exported circuit has at least one happy-path test that checks the resulting ledger state, not only that the call returned.
- Constructor arguments and initial ledger state are asserted.
- Boundary values are tested for every
Uint<N>(0, max, max+1 at the TypeScript boundary) and everyCounternear zero. - State-machine contracts are tested in every state, including calls in the wrong state.
B. Negative and privacy tests — see midnight-security-checklist
- Every
asserthas a test that makes it fail and checks the message. - Every privileged circuit is called by a non-authorized identity and rejected.
- Every one-shot action is replayed and rejected (nullifier / round).
- Every witness is replaced with a dishonest implementation (wrong secret, out-of-range value) and the circuit rejects it.
- For each value meant to stay private: read the public ledger (and emitted events) after the call and assert the value does not appear.
- Two actions by the same user cannot be linked from public state when unlinkability is a requirement.
C. End-to-end on a local devnet — see hello-world/, example-counter/
- A local devnet (node, indexer, proof server at the pinned images) starts from a committed compose file and is healthy before tests run.
- Tests deploy the contract, call each circuit through Midnight.js with real proofs, and read the result back from the indexer.
- Wallet setup uses testkit-js and funds/registers DUST inside the test setup, not by hand.
- Suites that share one devnet wallet run sequentially (parallel spends of the same UTXOs conflict).
- At least one test reconnects to an already deployed contract by address and reads its state.
D. Frontend and artifacts — see 1am-wallet/, midnight-common-errors
- The ZK asset sync copies
compiler/,keys/, andzkir/from the current build; a check fails CI if they are stale. -
next build(or the bundler's production build) passes: wallet/SDK modules load client-side only. - Wallet detection is tested with no extension, one extension, and several extensions.
- Rejected wallet prompts and failed transactions show an error instead of hanging.
-
npm ls @midnight-ntwrk/compact-runtimeshows a single version.
E. CI and release
- CI installs with
npm ciagainst a lockfile with exact pins. - CI runs section A on every PR and section C at least before every release.
- CI runs
midnight-doctor --json(or an equivalent version check) and fails on any FAIL. - The network and versions each release was tested on are recorded (e.g. "preprod, Ledger 9.1 set").
Related skills
| Task | Skill |
|---|---|
Compiler errors, the --skip-zk loop, version management | testing/ |
| Full devnet test setup with vitest and testkit-js | hello-world/ |
| Security properties to prove | midnight-security-checklist/ |
| Version gate | midnight-doctor/ |
Related skills
Midnight Environment Setup
Automatically prepare a Midnight dev environment — Compact, PATH, Docker, proof server, and VS Code extension. Run before building or deploying.
Why Midnight
What Midnight is, why it exists, and how it works — public/private state, selective disclosure, and ZK proofs.
ZK vs FHE vs MPC
Compare ZK, FHE, and MPC for privacy-focused DApps — tradeoffs, platforms, and why Midnight uses zk-SNARKs.
Compact
The Compact smart contract language for Midnight Network. TypeScript-like DSL that compiles to ZK circuits.