Seamless integration of Foundry, Medusa, and Echidna for smart contract testing
Features • Installation • Getting Started • Usage • Configuration • Troubleshooting • License
The Recon extension is a VS Code extension that streamlines smart contract testing by providing:
- One-click setup: Automatically install and configure Chimera templates
- Integrated fuzzing: Run Echidna and Medusa directly from VS Code
- Contract explorer: Browse and select target contracts and functions
- Fuzzer integration: Quick access to fuzzing tools directly through the extension
- Coverage visualization: View and analyze code coverage from fuzzers
- Test generation: Generate Foundry unit tests from call sequences that break properties found by the fuzzer
- Mock/TargetFunctions generation: Easily create mock contracts and target functions for testing
- CodeLens integration: Run tests and modify function behaviors directly in the editor
- Visual Studio Code 1.88.0 or higher
- Foundry toolchain (forge, cast, anvil)
- Echidna (optional)
- Medusa (optional)
Official Link: https://marketplace.visualstudio.com/items?itemName=Recon-Fuzz.recon
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "Recon"
- Click "Install"
- Download the
.vsix
file from the latest release - In VS Code, go to Extensions
- Click the "..." menu and select "Install from VSIX..."
- Select the downloaded file
- Open a Foundry project in VS Code
- Click on the Recon icon in the activity bar
- In the Cockpit view, click "Scaffold" to set up a project using the create-chimera-app template
- Select target contracts and functions in the Contracts view
- Run Echidna or Medusa from the status bar or Cockpit view
The "Scaffold" button in the Recon Cockpit view will:
- Install Chimera as a Foundry submodule dependency
- Update
remappings.txt
with the necessary dependency remappings - Create template files in the test/recon directory
- Configure your project for fuzzing
In the Contracts view you can:
- Enable the contracts you want to test
- For each contract, select the functions to include in the generated
TargetFunctions
contract - Configure function properties:
- Actor: Regular user or admin
- Mode: Normal execution, expected failure, or catch exceptions
- Use the status bar buttons for quick access to Echidna and Medusa
- Set the default fuzzer and configuration in the Cockpit view
- View live fuzzing progress in the output panel
After running a fuzzer with coverage enabled:
- Go to the Coverage Reports view
- Select a coverage report to view
- Click the external icon to open the report in a browser view
- Use the "Clean up Coverage Report" command for better readability
Right-click on a contract's JSON artifact (located in the out/
directory by default) or Solidity file and select "Generate Solidity Mock" to create a mock implementation of the contract.
Recon can be configured through VS Code settings:
recon.defaultFuzzer
: Choose between Echidna and Medusarecon.showAllFiles
: Show or hide test and library files in the Contracts viewrecon.foundryConfigPath
: Path to foundry.toml (relative to workspace root)
recon.echidna.mode
: Configure testing mode (assertion, property, etc.)recon.echidna.testLimit
: Maximum number of test cases to runrecon.echidna.workers
: Number of parallel workers
recon.medusa.testLimit
: Maximum number of test cases to runrecon.medusa.workers
: Number of parallel workers
recon.forge.buildArgs
: Additional arguments for forge buildrecon.forge.testVerbosity
: Verbosity level for forge test output
- Fuzzer not found: Ensure Echidna/Medusa are installed and in your PATH
- Compilation errors: Run
forge build
manually to identify issues - No contracts showing: Check if
out/
directory exists with compiled contracts