eth-sri / ilf

AI based fuzzer based on imitation learning
Apache License 2.0
149 stars 32 forks source link

Incorrect calculation of swarm hash #11

Closed AnonymousMonkey2021 closed 3 years ago

AnonymousMonkey2021 commented 3 years ago

https://github.com/eth-sri/ilf/blob/9d2ae9b2360d9533ed30e3b59ebd212ab085cc30/execution/contract.go#L16 https://github.com/eth-sri/ilf/blob/9d2ae9b2360d9533ed30e3b59ebd212ab085cc30/execution/contract.go#L89

https://docs.soliditylang.org/en/v0.5.3/metadata.html#encoding-of-the-metadata-hash-in-the-bytecode

According to the solidity doc, the swarm hash is padded like this 0xa1 0x65 'b' 'z' 'z' 'r' '0' 0x58 0x20 <32 bytes swarm hash> 0x00 0x29.

This would mean that your swarm hash is 2 bytes off.

LostBenjamin commented 3 years ago

Fixed in this commit. Thanks for reporting the issue.