CLI to scaffold Recon fuzzing suite inside Foundry projects
npm install recon-generateCLI to scaffold the Recon fuzzing suite (Chimera/Echidna/Medusa/Halmos targets) inside a Foundry project.
``bash`
npm install -g recon-generateor from this repo
npm install -g .
For local dev:
`bash`
npm install
npm run build
npm link # optional, to use globally
Run from your Foundry project root (where foundry.toml is):
`bash`
recon-generate [options]
Key options:
- --include "A,B:{foo(uint256)|bar(address)},C" — include-only these contracts/functions.--exclude "A:{foo(uint256)},D"
- — exclude these contracts/functions.--admin "A:{fnSig,fnSig}"
- — mark listed functions as admin (asAdmin).--mock "A,B"
- — generate mocks for the listed contracts (compiled ABIs required); mocks go under recon[-name]/mocks and are added to targets.--dynamic-deploy "Foo,Bar"
- — keep dynamic lists for the listed contracts: deploys one instance, tracks addresses in an array, exposes _getRandom and switch helpers to rotate among deployed instances.--coverage
- — emit recon[-name]-coverage.json with source line ranges for included contract functions.--name
- — name the suite; affects folder (recon-), config filenames (echidna-, medusa-, halmos-), and Crytic tester/runner names.--force
- — replace existing generated suite output under --output (does not rebuild .recon/out).--force-build
- — delete .recon/out to force a fresh compile before generation.--list
- — show available contracts/functions after filters, then exit.--debug
- — print filter/matching/debug info.--recon
- — custom recon.json path (defaults to ./recon.json or ./.recon/recon.json).--output
- — base path where the suite folder will be placed; we append /recon or /recon-. Example: --output test → .--foundry-config
- — path to foundry.toml (default ./foundry.toml).
Examples:
`bashDefault scaffolding
recon-generate
After generating a suite you can update Echidna and Medusa configs with detected Foundry libraries:
`bash`
recon-generate link
This runs crytic-compile with --foundry-compile-all to find linked libraries and rewrites:
- Echidna YAML cryticArgs and deployContracts with deterministic placeholder addressescompilation.platformConfig.args
- Medusa to include --compile-libraries`
- If the suite output folder exists and --force is not provided, the command aborts.--force
- replaces the suite output folder; it does not rebuild .recon/out.--force-build
- deletes .recon/out to force a fresh compile before generation.--mock
- When is used, a fresh build is triggered, mocks are generated under recon[-name]/mocks, and a second build picks them up into .recon/out and targets.--dynamic-deploy
- When is used, generated Setup.sol keeps an address[] per listed contract, pushes the first deployment, and emits _getRandom helper plus switch in TargetFunctions.sol to retarget to a previously deployed instance.recon.json
- is regenerated every run from current filters/contracts.Morpho.MarketParams
- Include/exclude/admin matching is tolerant of fully qualified struct names vs short names (e.g., vs MarketParams).actor: admin
- Admin list sets for matched functions; others default to actor.
`bash``
npm install
npm run build
npm link # to test globally