halmos

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

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

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. Halmos executes Foundry tests symbolically, reasoning about all possible inputs simultaneously and producing concrete counter-examples when assertions fail. ## Core Features & Use Cases - Symbolic test execution: Write check_ prefixed Foundry tests whose parameters become symbolic variables covering every possible value within configurable loop and depth bounds. - Counter-example generation: When a property fails, Halmos outputs concrete hex-encoded witness values that can be reproduced as standard Foundry tests. - Bounded model checking with CI integration: Configure --loop, --depth, and solver timeouts to balance verification confidence against runtime in GitHub Actions pipelines. - Use Case: Verify that an ERC-20 transfer never changes totalSupply, or that a vault's totalAssets always covers totalShares, for all possible deposit and withdrawal amounts rather than a few hundred random samples. ## Quick Start Write a Foundry test function prefixed with check_ that uses vm.assume and assert, then ask the agent to run halmos against it and interpret any counter-examples.

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. Use vm.assume to constrain inputs and raw assert() for properties, then run the halmos CLI after forge build.

What is the difference between Halmos, Echidna, and Certora?

Halmos is a bounded symbolic executor that checks all inputs within loop bounds using local z3 solving. Echidna is a coverage-guided fuzzer for stateful exploration, while Certora provides unbounded formal verification via its CVL language and paid cloud service.

Does Halmos support all Foundry cheatcodes?

No, Halmos supports a subset including vm.assume, vm.prank, vm.deal, vm.store, vm.load, vm.warp, and vm.roll. Forking cheatcodes like vm.createSelectFork, vm.ffi, file I/O, and snapshots are not supported during symbolic execution.

Why does my Halmos test pass when the property should fail?

Over-constraining with vm.assume can make assumptions contradictory, leaving zero execution paths so the test passes vacuously. Check the path count in the output, and use raw assert() instead of assertEq, which reverts and is treated as a valid path.

How do I fix Halmos solver timeouts on complex math?

Increase the limit with --solver-timeout-assertion, tighten input ranges with vm.assume, and reduce the --loop bound. Breaking complex assertions into smaller sub-properties and avoiding non-linear arithmetic with multiple symbolic variables also helps z3.

What are the limitations of Halmos bounded model checking?

Halmos only verifies properties up to the configured --loop iteration bound, so bugs appearing at higher iterations are missed. It also lacks fork mode, has limited cross-contract symbolic execution, and is pre-1.0 software with breaking changes between releases.