crytic / crytic/crytic-compile
Improve metadata handling
- Dominant language
- Python
- Stars
- 197
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
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:
- [`0.5.15`](https://solidity.readthedocs.io/en/v0.5.15/metadata.html#encoding-of-the-metadata-hash-in-the-bytecode)
```
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
```
- [`0.6.1`](https://solidity.readthedocs.io/en/v0.6.1/metadata.html#encoding-of-the-metadata-hash-in-the-bytecode)
```
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.
Contributor guide
Research direction
Start in crytic_compile/crytic_compile.py at lines 942-956 and compare the existing metadata handling with the linked Solidity 0.5.15 and 0.6.1 encoding specifications. Trace the current extraction flow, then verify that the requested newer encodings, metadata key-value parsing, and a public access function are all covered; the issue is done when external tools such as Manticore and evm-cfg-builder can use these capabilities.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, solidity
- Domain
- compilers, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100