// the find
foundry-rs/forge-std
A collection of helpful contracts and libraries for use with Forge and Foundry
The standard library for Foundry/Forge, providing test helpers, cheatcode wrappers, assertions, storage manipulation, and scripting utilities for Solidity development. This is essentially a required dependency for anyone doing serious Ethereum contract testing with Foundry — the Solidity equivalent of what jest-extended is to Jest.
- stdStorage is genuinely clever: it uses the record/accesses cheatcodes to find storage slots by function selector rather than requiring you to know the layout, which saves a lot of pain when testing contracts with complex or assembly-based storage.
- The Vm.sol interface file provides typed bindings to all Foundry cheatcodes, so you get compile-time checking on cheatcode calls instead of low-level ABI encoding.
- Assertion library covers the hard cases — assertApproxEqRel and assertApproxEqAbs are useful for fixed-point math testing where exact equality is impractical.
- Actively maintained by the core Foundry team with CI, a clear release checklist, and dependabot — not an abandoned side project.
- StdConfig/StdToml TOML parsing relies on Foundry cheatcodes that only work in a Forge environment, so any config-parsing logic is untestable outside that context and the error messages when the TOML structure doesn't match expectations are opaque.
- stdStorage silently fails or throws vague errors with packed storage slots unless you call enable_packed_slots() first — easy to get wrong and the failure mode isn't obvious to new users.
- The console.sol uint256/int256 decoding bug is a known issue that they've documented but not fixed, instead shipping two separate console implementations (console.sol vs console2.sol) which creates confusion about which one to use.
- Vm.sol is auto-generated from Foundry internals via a Python script, meaning the Solidity types are tightly coupled to the Foundry binary version — version mismatches between forge-std and the installed foundry binary can cause subtle test failures that are annoying to debug.