Contract safety · Fuzzer trace to PoC
Trace to test converter
Turn a failing fuzzer trace into a Foundry test that reproduces it.
Failing trace
Paste the call sequence the fuzzer printed when it broke a property.
Options
Used for the commented-out import and deployment.
Forge only runs functions whose name starts with test.
Echidna's text output or Medusa's JSON. Both are recognised automatically.
No test yet
Paste a trace and you get a Foundry test that replays the same calls, in the same order, from the same senders.
Supported trace formats
Both are tried in turn: Echidna's line format first, then Medusa's JSON.
function(arg1, arg2) from: 0x... deposit(1000) from: 0x10000 withdraw(500) from: 0x10000
{
"calls": [
{"function": "deposit", "args": ["1000"], "from": "0x..."},
{"function": "withdraw", "args": ["500"], "from": "0x..."}
]
}After generating the test
- Uncomment the contract import and deployment
- Adjust any hardcoded addresses or values
- Add assertions to verify the bug
- Run with
forge test -vvvv
About this tool
When Echidna or Medusa breaks a property, it prints the call sequence that caused it. Paste that trace and this converter writes a Foundry test that replays the same calls, in the same order, from the same senders, plus a step-by-step variant for debugging. Run it with forge test to reproduce the failure every time and to confirm your fix.
Common questions
Which trace formats does it read?
Echidna's text output, where each line looks like name(arg, arg) and can end with the sender, and Medusa's JSON with a calls array. The format is detected automatically.
Why turn a fuzzer trace into a Foundry test?
A unit test reproduces the bug every time, runs in seconds and stays in your suite as a regression test after the fix. Fuzzer runs are random, so the same failure may not show up again.