a16z / halmos

A symbolic testing tool for EVM smart contracts
GNU Affero General Public License v3.0
789 stars 62 forks source link

Portfolio solving with multiple solvers #245

Open karmacoma-eth opened 9 months ago

karmacoma-eth commented 9 months ago

Is your feature request related to a problem? Please describe.

We currently use only z3 to solve both path conditions and assertions. Some solvers like cvc5, bitwuzla or boolector, etc. may give better results on some kinds of tests.

Describe the solution you'd like

Ideally we could validate the concept (do some solvers outperform z3 sometimes? consistently?) without fully productizing it.

We can currently invoke an external solver explicitly with --solver-subprocess --solver-subprocess-command COMMAND, so we could manually test with a few solvers on a few types of problems.

If it looks like that approach may be beneficial, then we can try to make it more automated, for instance like this:

karmacoma-eth commented 7 months ago

started work on this

karmacoma-eth commented 1 month ago

✅ Preliminary work confirmed the intuition, there are indeed solvers like yices and bitwuzla that consistently outperform z3.

✅ We have a Docker image (https://github.com/a16z/halmos/tree/main/packages/solvers) that ships with multiple competitive solvers, ready to be invoked.

Now we need the infrastructure to spawn solver processes, monitor them, kill them and return results to halmos. This way, halmos can remain "single solver", and just invoke the metasolver.

karmacoma-eth commented 1 month ago

https://github.com/agra-uni-bremen/metaSMT is a project that sounds similar to what we need, but seems to take a strange approach by actually building the solvers?

For what we need, we can stay in the Python ecosystem

karmacoma-eth commented 1 month ago

Spec'ing out what we need:

karmacoma-eth commented 1 month ago

more motivation: https://karmacoma.notion.site/halmos-multicore-processing-6b485bf455c9496c93d4c96872950154