Disassemble EVM bytecode
Lightweight library with the sole purpose of decoding evm bytecode into individual Opcodes and formatting them in a human readable way
Inspiration
This library was inspired by the pyevmasm. When formatting the decoded operations using the inbuilt function the output should be equivalent to that of pyevasm
, which is tested on the bytecode of several large evm contracts.
Installation
cargo add evm-disassembler
Documentation
See the API reference here.
Example
use ;
Tests
You can run the tests as usual with cargo test
.
The main tests compare the output of this library when decoding contract bytecode against the output from pyevasm
. The input and reference files for these tests are saved in testdata
.
To generate new testdata for these tests you can run the generate_testdata.sh
script with an array of ethereum mainnet addresses. (Requires prior installation of foundry
and pyevasm
).