← Lab /Software

Mewt uncovers missing authorization tests in DAML contracts

Mewt can identify gaps in DAML test suites, including missing checks on authorization primitives, by generating and evaluating mutants.

Software Trail of Bits 8 Jul 2026 Tooling Real-world evidence

Published as “Mutation testing comes to DAML”

Why it matters

Identifying surviving mutants helps developers write missing tests, improving the reliability and security of DAML smart contracts.

Summary

The authors extended their open-source mutation-testing engine Mewt to parse DAML code and added two DAML-specific mutations that target controller clauses. Running Mewt on a sample DAML project produced seven mutants, of which four survived the existing test suite, revealing missing test cases around party authorization. On the OpenZeppelin canton-stablecoin reference implementation, hundreds of mutants were generated and seven survived, four of which represented genuine gaps. The evidence is based on concrete runs on real DAML codebases, though the authors note that some survivors are equivalent mutants and that campaigns can be time-consuming.

What they found 2

  1. On a sample project, Mewt generated seven mutants; three were killed and four survived

    “Run Mewt on the project and it generates seven mutants. The test suite catches three of them. Four survive.”

  2. On the OpenZeppelin canton-stablecoin reference, hundreds of mutants were generated; seven survived, four of which were genuine missing test cases

    “Mewt generated hundreds of mutants for it. We ran the highest-priority ones through the existing test suite, and seven of those survived. Three were equivalent mutants or sat behind a guard that no path reaches, and the other four were genuine missing test cases.”

Caveats 7

  • Not every surviving mutant represents a real test gap; some are equivalent mutants.
  • Running a mutation campaign can be time-consuming, requiring minutes to hours of test execution and manual triage.
  • Mewt relies on a reused Haskell grammar, which parses DAML constructs as error-recovered subtrees.
  • Equivalent mutants may survive and need manual dismissal.
  • Campaigns cost time: wall-clock time scales with number of mutants and test suite duration.
  • Manual review of survivors is required to determine genuine gaps.
  • No maintained tree-sitter grammar for DAML; Mewt reuses the Haskell grammar with error recovery.

What’s new here 4

  • Support for parsing DAML using a reused tree-sitter-haskell grammar
  • Two DAML-specific mutations: controller party swap and controller party removal
  • Integration with existing DAML test commands via a simple mewt.toml configuration
  • Open-source release of the extended Mewt engine