A parser that converts echidna call traces into foundry PoC tests
Echidna Trace Parser is a Python script designed to parse Echidna traces and generate corresponding Solidity test functions. This tool simplifies the process of converting Echidna output into usable Solidity tests, making it easier to verify smart contracts.
- Parse Echidna Call Traces: Extracts function calls, parameters, delays, and 'from' addresses from Echidna traces.
- Generate Solidity Test Functions: Automatically creates Solidity test functions based on the parsed data.
- User-Friendly Input: Allows users to paste Echidna traces directly into the terminal.
- Python 3.x
- Basic familiarity with the command line
-
Clone the repository:
git clone https://github.com/yourusername/echidna-trace-parser.git cd echidna-trace-parser
-
Download the Script: Alternatively, download the script file directly and save it in a directory of your choice.
-
Ensure Python is Installed: You can check if Python is installed by running:
python3 --version
If it’s not installed, download and install it from python.org.
To run the Echidna Trace Parser from any directory in your terminal, follow these steps:
If you're using macOS or Linux, you can make the script executable:
- Open your terminal.
- Navigate to the directory where the script is located:
cd /path/to/your/directory
- Run the following command to make the script executable:
chmod +x echidna_parser.py
To run the script from anywhere, you can add its directory to your system's PATH.
- Open your terminal.
- Edit your shell configuration file (like
~/.bashrc
,~/.bash_profile
, or~/.zshrc
) and add the following line, replacing/path/to/your/directory
with the actual path where your script is located:export PATH="$PATH:/path/to/your/directory"
- Save the file and run:
(or the corresponding file for your shell).
source ~/.bashrc
- Search for "Environment Variables" in the Start menu.
- Click on "Edit the system environment variables".
- In the System Properties window, click on "Environment Variables".
- In the "System variables" section, find and select the
Path
variable, then click "Edit". - Click "New" and add the full path to the directory where your script is saved.
- Click OK to save your changes.
-
Open your terminal.
-
Run the script from anywhere:
echidna_parser.py
or if you haven’t made it executable:
python3 echidna_parser.py
-
Input your Echidna call trace:
- Paste your Echidna call trace directly into the terminal.
- Press Enter twice to finish input.
-
View the Generated Solidity Test Function: The tool will output the generated Solidity test function to the terminal.
Paste your Echidna call trace below. Press Enter twice to finish:
Tester.function_name(param1, param2) from: 0x12345 Time delay: 5
*wait* Time delay: 3
Generated Foundry Test Function:
function test_replay() public {
_setUpActor(0x12345);
_delay(5);
Tester.function_name(param1, param2);
_delay(3);
}
Contributions are welcome! If you would like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your branch and submit a pull request.
This project is not open-source.
For any inquiries or feedback, feel free to reach out on the organization's Discord server.