crytic / medusa

Parallelized, coverage-guided, mutational Solidity smart contract fuzzing, powered by go-ethereum
https://secure-contracts.com/program-analysis/medusa/docs/src/
GNU Affero General Public License v3.0
301 stars 40 forks source link

assertion mode: fail and save reproducer if custom error is returned #460

Open bsamuels453 opened 2 months ago

bsamuels453 commented 2 months ago

Right now we allow the user to configure what kinds of reverts will make Medusa identify a counterexample.

We should have support for custom errors as well, especially for when debugging reversion statistics.

0xalpharush commented 2 months ago

We need to update the assertion test config to allow users to supply error selectors and check for them in the assertion test case provider here

https://github.com/crytic/medusa/blob/3beda5cc80b2b79ceeeafe2583899fa2d72a6613/fuzzing/executiontracer/execution_trace.go#L231-L232

https://github.com/crytic/medusa/blob/3beda5cc80b2b79ceeeafe2583899fa2d72a6613/fuzzing/test_case_assertion_provider.go#L60-L71

Until it is implemented, one can write a try-catch on the error selector and assert false