a16z / halmos

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

Improve testing of EVM correctness #127

Open karmacoma-eth opened 1 year ago

karmacoma-eth commented 1 year ago

Problem

Halmos is essentially a light EVM interpreter (without gas), and because we're in the business of looking for corner cases of EVM bytecode, it is actually mission critical for our modeling to be as correct and complete as possible. However, we're not doing a ton to ensure that we're actually conforming to the spec.

Solution

The most complete thing we could do is make sure that we have good coverage of the EVM state transition tests, which is something github.com/ethereum/execution-specs/ does (as well as KEVM from what I've heard)

However this is going to be difficult in practice because:

So on the spectrum from very-lightweight to fully-compliant testing, we are currently too close to very-lightweight and would like to move meaningfully towards fully-compliant, while remaining pragmatic.

Alternatives

Maybe we can get away with unit testing for specific corner cases at the instruction level, e.g.:

Extra context

This is actually a massive task, but marked good first issue because there is a well defined spec out there and it is possible to make incremental progress while keeping halmos basically a black box.

0xalpharush commented 6 months ago

I had seen this approach for testing the fidelity of HEVM a while ago https://github.com/ethereum/hevm/pull/202. Not sure how applicable it is to Halmos