oso icon indicating copy to clipboard operation
oso copied to clipboard

Bytecode parsing to link contract addresses to GitHub repo

Open ryscheng opened this issue 2 years ago • 5 comments

For now we plan to just rely on self-reporting (e.g. via Optimism project registry). But it could be cool to be able to do this automatically e.g. decompile the bytecode to find symbols that we can use to a code search. https://github.com/palkeo/panoramix https://github.com/shazow/whatsabi

ryscheng avatar Jul 31 '23 16:07 ryscheng

Limiting this to ~150 so projects on Optimism for now

ccerv1 avatar Jul 31 '23 22:07 ccerv1

@ryscheng here's what I've done:

  1. Manually linked the Github repos for 177 of the top Optimism projects included in this list -- note, this is the source of the mappings included in this YAML file in our repo
  2. Created Dune queries that show all the contracts deployed by the project addresses above
    • Factory contracts (Dune) and CSV download
    • Standalone contracts (Dune and CSV download
    • There's also a sample of the complete contracts dataset (note: Dune limits CSV download sizes, so this is incomplete)
  3. Combined (1) and (2) into a JSON file we can use for indexing relevant event data. Below is a sample entry.
"0xSplits": {
        "github": "https://github.com/0xSplits",
        "creator_addresses": [
            "0x9ebc8e61f87a301ff25a606d7c06150f856f24e2"
        ],
        "factory_contracts": [
            "0xa6b71e26c5e0845f74c812102ca7114b6a896ab2",
            "0x4df01754ebd055498c8087b1e9a5c7a9ad19b0f6",
            "0x2ed6c4b5da6378c7897ac67ba9e43102feb694ee",
            "0xdecd8b99b7f763e16141450daa5ea414b7994831",
            "0x0a2841630f198745a55c4dab3fe98f77271949e5",
            "0x4e59b44847b379578588920ca78fbf26c0b4956c"
        ],
        "standalone_contracts": [
            "0x2ed6c4b5da6378c7897ac67ba9e43102feb694ee",
            "0x0a2841630f198745a55c4dab3fe98f77271949e5"
        ]
    }

ccerv1 avatar Aug 01 '23 14:08 ccerv1

I'm going to close this out and rename hypercerts-org/oso#78 to refer to the utility script we want to create for the hackathon

ccerv1 avatar Aug 01 '23 21:08 ccerv1

This is great, I'm gonna leave this open for now, there's a few things I wanted to try around bytecode parsing at some point

ryscheng avatar Aug 02 '23 00:08 ryscheng

Another relevant project

https://sourcify.dev/

Which will verify source code matches a contract's bytecode. They have an API for verification

ryscheng avatar Oct 02 '23 23:10 ryscheng