What problem does it solve?
This skill helps developers write deterministic, comprehensive tests for code that interacts directly with the Midnight ledger libraries by removing flaky test patterns and enforcing correct lifecycle transitions, fixture validity, and time control.
Core Features & Use Cases
- Proof staging validation: Verify transactions progress through unproven → proved → bound → proof-erased stages and assert stage-specific behaviors and type-enforced transitions.
- Ledger state and time control: Test ZswapLocalState and DustLocalState immutability, mutation return values, replayEvents, TTL expiry behavior with fixed dates, and watchFor/clearPending semantics.
- Crypto fixtures, cost model, and serialization: Use deterministic sample functions for hex-typed fixtures, assert deterministic coinCommitment and coinNullifier properties, validate cost model dimensions and fee calculations, perform encode/decode and serialize/deserialize round-trip checks.
Use case: Build unit and integration tests that validate transaction construction, fee estimation, well-formedness rejection cases, and on-chain LedgerState.apply effects.
Quick Start
Create a deterministic test that builds an unproven transaction from an intent, advances it through prove and bind, asserts CostModel dimensions and well-formedness, and verifies serialize/deserialize at a fixed date.