crytic-compile
crytic-compile copied to clipboard
Improve metadata handling
Following the https://github.com/trailofbits/manticore/issues/909 discussion:
We need to improve https://github.com/crytic/crytic-compile/blob/35370b6202ba3cee0f10be7ede8076658fca1b38/crytic_compile/crytic_compile.py#L942-L956
To handle newer versions of the metadata encoding, including:
0xa2
0x65 'b' 'z' 'z' 'r' '1' 0x58 0x20 <32 bytes swarm hash>
0x64 's' 'o' 'l' 'c' 0x43 <3 byte version encoding>
0x00 0x32
0xa2
0x64 'i' 'p' 'f' 's' 0x58 0x22 <34 bytes IPFS hash>
0x64 's' 'o' 'l' 'c' 0x43 <3 byte version encoding>
0x00 0x32
We could also handle the parsing of the metatadata, like doing the key-values extraction.
Additionally, we should add a public function allowing external tools to access these functionalities. This would be useful for, at least, Manticore and evm-cfg-builder.
Fwiw in solc 0.8.18, there will be an option to remove the metadata with "appendCBOR": false https://docs.soliditylang.org/en/develop/using-the-compiler.html#input-description