Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We should try and match runtime code to compile artifacts without metadata hash as well #13

Open
cd1m0 opened this issue Apr 18, 2023 · 1 comment
Assignees

Comments

@cd1m0
Copy link
Collaborator

cd1m0 commented Apr 18, 2023

Sometimes we get contracts without compiler metadata hash. In those cases we can still try to match the deployed bytecode to the artifact with the following algorithm:

  1. Select only artifacts with deployed bytecode length equal to the runtime bytecode length
  2. Of those pick the artifact that:
    2.1 Matches the runtime bytecode in the most location
    2.2 Has all 0-s in the mismatching locations

For constructor bytecodes, we can follow the same algorithm, except in step 1 we only pick bytecodes with lengths <= of the runtime bytecode.

@cd1m0 cd1m0 self-assigned this Apr 18, 2023
@cd1m0
Copy link
Collaborator Author

cd1m0 commented Apr 18, 2023

A twist in this is that we need the compiler version for each artifact even before we get to matching runtime bytecode to artifacts. We could try to infer this from the AST trees, with a basic walk if all else fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant