Consensys / mythril

Security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Rootstock, Tron and other EVM-compatible blockchains.
https://mythx.io/
MIT License
3.88k stars 741 forks source link

Feature request: please use https://github.com/vinayps/cs205_project instead of pysha3! #1259

Closed ytrezq closed 2 years ago

ytrezq commented 5 years ago

Not only this would be faster, but this would be the last step to have mythril compatible with pypy because pysha3 is incompatible with pypy.

Both are unmaintained though.

norhh commented 5 years ago

I don’t think pysha3 is extensively being used, it’s better to use hashlib over these

ytrezq commented 5 years ago

@norhh ported Pysha3 to pypy along vectorizing it partially with avx512 support (using the autopar of the compiler so this isn’t clean and real vectorization like with https://github.com/vinayps/cs205_project). And guess what? mythx analysis run 7 to 20 times faster (alas using 25 to 30 times more RAM as it took 24 Gb for the dao). I didn’t perform benchmarks but it was able to complete analysis of the dao in 6 hours whereas it wasn’t finished in a day with the same command using the official Python implementation running on a computer having twice faster single thread performance than the computer running the PyPy implementation.

Though I’m not sure if the accuracy is the same as with CPython.

ytrezq commented 5 years ago

Ok. Whatsover, I used the official latest binary (7.2.0) of PyPy, so the only libraries required are the ones for running the official PyPy binaries. The remaining works standalone.

The target cpu has pretty much all latest avx512 features enabled so this won’t run on older cores.

Just extract this archive to /usr/lib64 (though paths aren’t static) it also contains the patched version of sha3 (the provided binary doesn’t use the patched loop at all). For the purpose of benchmarking, vmprof is also included in the archive. Then run myth using pypy3 where both file are in the /bin directory within the archive.

I suppose it will help you testing.

norhh commented 2 years ago

The current version on Mythril significantly spends time in solver calls(>95%), so this can be closed.