acuarica / evm

A Symbolic Ethereum Virtual Machine (EVM) bytecode interpreter, parser and decompiler, along with several other utils for programmatically extracting information from EVM bytecode.
https://acuarica.github.io/evm/
MIT License
46 stars 5 forks source link

Add support to decompile to Huff #52

Closed acuarica closed 6 months ago

acuarica commented 8 months ago

Huff[1] is a low-level programming language designed for developing highly optimized smart contracts that run on the Ethereum Virtual Machine (EVM). Huff does not hide the inner workings of the EVM. Instead, Huff exposes its programming stack to the developer for manual manipulation.

Huff can be useful to debug EVM.js as an intermediate representation of EVM bytecode. Given that function selectors[2] are part of the contract ABI, Huff decompilation needs to include these function selectors[3]. Moreover, it can be useful to use the Huff compiler[4] in tests since the generated bytecode can be easily compared to Huff decompiled output.

Other decompilation targets are tracked here https://github.com/acuarica/evm/issues/34


[1] https://github.com/huff-language/huff-rs [2] https://docs.soliditylang.org/en/latest/abi-spec.html#function-selector [3] https://docs.huff.sh/tutorial/function-dispatching/#what-is-the-problem [4] https://github.com/huff-language/huff-rs/tree/main/huff_js