What are Forge, Cast, Anvil and Chisel?
| Tool | What it does |
|---|---|
| Forge | Builds, tests, deploys and verifies contracts |
| Cast | Calls contracts, sends transactions and reads chain data from the command line |
| Anvil | Runs a local Ethereum node that can fork a live network |
| Chisel | A Solidity REPL for trying out snippets |
The descriptions come from the Foundry README and the Foundry docs.
What does a Foundry test look like?
Foundry tests are Solidity contracts in which setUp() runs before each test and test functions are prefixed with test (Foundry), and a test that takes parameters becomes a fuzz test.
A contract, a unit test and a fuzz test, with no imports (illustrative, not audited code) CounterTest.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
contract Counter {
uint256 public count;
function increment() external {
count += 1;
}
}
contract CounterTest {
Counter internal counter;
function setUp() public {
counter = new Counter();
}
function test_incrementAddsOne() public {
counter.increment();
assert(counter.count() == 1);
}
function testFuzz_incrementTimes(uint8 times) public {
for (uint256 i = 0; i < times; i++) counter.increment();
assert(counter.count() == times);
}
}
Real projects inherit from the forge-std Test contract, which adds assertions and cheatcodes that change msg.sender, balances, block time and storage inside a test (Foundry).
Why do security reviewers use Foundry?
The attack and the test are in the same language. A reviewer can write a proof of concept exploit as a test, run it on a fork of mainnet with forge test --fork-url (Foundry), and turn a property into an invariant test without leaving Solidity. QuillShield supports Solidity in Foundry projects today, and run your first audit shows the steps.
Sources
- Foundry README, foundry-rs (GitHub) checked 3 December 2026
- Introducing the Foundry Ethereum development toolbox, Paradigm checked 3 December 2026
- Foundry overview, Foundry docs checked 3 December 2026
- Testing, Foundry docs checked 3 December 2026
- Cheatcodes overview, Foundry docs checked 3 December 2026
- Fork testing, Foundry docs checked 3 December 2026