halmos

Write symbolic Foundry tests that verify Solidity properties across all inputs within bounds.

1|1|Updated May 21, 2026
One-click install
npx skills add https://github.com/naruto11eth/cryptoskills --skill halmos-naruto11eth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: halmos
Source: https://github.com/naruto11eth/cryptoskills/tree/main/skills/halmos
Command: npx skills add https://github.com/naruto11eth/cryptoskills --skill halmos-naruto11eth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Fuzz testing only samples random inputs, so it can miss the one value that breaks a smart contract invariant, while full formal verification tools like Certora require learning a new specification language and paid API access. This Skill teaches how to use Halmos to symbolically execute Foundry tests, checking properties against all possible inputs within configurable bounds and producing concrete counter-examples when assertions fail. ## Core Features & Use Cases - Symbolic test authoring: Write check_ prefixed Foundry tests where parameters become symbolic variables, constrain inputs with vm.assume, and verify properties with raw assert(). - Bounded model checking: Configure --loop and --depth bounds, solver timeouts, and storage layouts to balance verification confidence against CI runtime. - Counter-example debugging: Decode Halmos counter-examples, reproduce them as concrete Foundry tests, fix the bug, and re-verify. - Use Case: A DeFi team needs to prove a vault invariant (totalAssets >= totalShares) holds for every deposit and withdrawal. They write check_ tests, run halmos --loop 5 in CI, and get mathematical assurance within bounds without learning Certora's CVL. ## Quick Start Ask the agent to write a Halmos symbolic test that verifies your ERC-20 transfer function preserves total supply for all possible inputs.

Frequently Asked Questions about halmos

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

FAQPage Schema
How do I write a symbolic test with Halmos?

Write a Foundry test function prefixed with check_ instead of test_, and its parameters become symbolic variables covering all possible values. Constrain inputs with vm.assume, verify properties with raw assert(), then run the halmos CLI after forge build.

What is the difference between Halmos and Foundry fuzz testing?

Foundry's fuzzer runs tests with random concrete inputs, giving statistical coverage. Halmos executes tests symbolically, reasoning about all possible inputs simultaneously within loop and depth bounds, and produces concrete counter-examples when assertions fail.

Halmos vs Certora: which should I use for formal verification?

Halmos is a bounded model checker that runs locally with no API key and uses plain Solidity tests, making it suited for quick CI property checks. Certora provides unbounded formal verification but requires learning the CVL specification language and a paid API key.

Why does my Halmos test pass with zero paths?

Zero paths means your vm.assume constraints are contradictory, so no valid inputs exist and the property holds vacuously. Remove assumptions one at a time until the path count increases, keeping only necessary preconditions.

Why does assertEq not fail in Halmos when the property is wrong?

forge-std assertions like assertEq revert on failure, and Halmos treats reverts as valid execution paths rather than property violations. Use raw assert() for symbolic properties so Halmos checks them with the SMT solver.

What are the limitations of Halmos symbolic testing?

Halmos only verifies properties up to the --loop and --depth bounds, so bugs beyond those bounds are missed. It also lacks fork mode, supports only a subset of Foundry cheatcodes, and can hit solver timeouts on complex non-linear arithmetic.