midnight-cq:compact-testing

Run deterministic Compact contract unit tests with the OpenZeppelin-compact contracts-simulator.

37|9|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/devrelaicom/midnight-expert --skill midnight-cq-compact-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: midnight-cq:compact-testing
Source: https://github.com/devrelaicom/midnight-expert/tree/main/plugins/midnight-cq/skills/compact-testing
Command: npx skills add https://github.com/devrelaicom/midnight-expert --skill midnight-cq-compact-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill enables deterministic, reproducible unit testing for Compact contracts by providing a structured testing framework and guidance for mock patterns, witnesses, and simulator-driven workflows.

Core Features & Use Cases

  • Structured test layout: Guides 4-layer test structure (production source, witnesses, mocks, simulators) for reliable contract testing.
  • Mock pattern guidance: Details standard mock patterns to enable deployable wrappers around modules under test.
  • Witness management: Explains how to override and manage witnesses to simulate different private states and scenarios.
  • Simulator-centric testing: Demonstrates how to use the OpenZeppelin-compact contracts-simulator to drive pure/impure circuits with automatic ledger/context handling.

Quick Start

Install the simulator-based testing framework and bootstrap a basic Ownable test to verify initialization and access control.

Frequently Asked Questions about midnight-cq:compact-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I unit test Compact contracts deterministically?

To unit test Compact contracts deterministically, structure tests across four layers—production source, witnesses, mocks, and simulators—using Vitest and the OpenZeppelin-compact contracts-simulator for automatic ledger and context handling.

What is the standard mock pattern for Compact contract testing?

The standard mock pattern for Compact contract testing involves configuring contractFactory, private state, and ledger access to create deployable wrappers around the modules under test within the simulator framework.

How do I manage witnesses when testing Compact contracts?

You manage witnesses in Compact contract testing by overriding them within the simulator workflow to simulate different private states and scenarios, ensuring deterministic and reproducible test outcomes across layers.

Does the OpenZeppelin-compact contracts-simulator work with Vitest?

Yes, the OpenZeppelin-compact contracts-simulator integrates with Vitest to drive pure and impure circuits, automatically handling ledger and context management for deterministic Compact contract testing.

What's the best way to structure tests for Compact contracts?

The best way to structure Compact contract tests is a 4-layer layout: production source, witnesses, mocks, and simulators, which isolates modules under test and guarantees deterministic reproducible behavior.

Why are my Compact contract unit tests not reproducible?

Compact contract tests lack reproducibility when witness states and ledger contexts are not properly mocked or overridden, which this simulator-driven framework resolves by enforcing a standard mock pattern and deterministic workflow.